Adding switch view button to downloads activity
Can now switch between linear and grid layouts in the downloads activity
This commit is contained in:
parent
49f9d36718
commit
bcc97d1aa7
3 changed files with 14 additions and 4 deletions
|
@ -16,6 +16,8 @@ import android.support.v7.widget.GridLayoutManager;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -144,17 +146,21 @@ public abstract class MissionsFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public void onPrepareOptionsMenu(Menu menu) {
|
||||||
return super.onOptionsItemSelected(item);
|
mSwitch = menu.findItem(R.id.switch_mode);
|
||||||
|
super.onPrepareOptionsMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
/*switch (item.getItemId()) {
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
case R.id.switch_mode:
|
case R.id.switch_mode:
|
||||||
mLinear = !mLinear;
|
mLinear = !mLinear;
|
||||||
updateList();
|
updateList();
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyChange() {
|
public void notifyChange() {
|
||||||
|
|
|
@ -5,4 +5,7 @@
|
||||||
<item android:id="@+id/action_settings"
|
<item android:id="@+id/action_settings"
|
||||||
app:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/settings"/>
|
android:title="@string/settings"/>
|
||||||
|
<item android:id="@+id/switch_mode"
|
||||||
|
app:showAsAction="ifRoom"
|
||||||
|
android:title="@string/switch_view"/>
|
||||||
</menu>
|
</menu>
|
|
@ -517,5 +517,6 @@
|
||||||
<string name="minimize_on_exit_none_description">None</string>
|
<string name="minimize_on_exit_none_description">None</string>
|
||||||
<string name="minimize_on_exit_background_description">Minimize to background player</string>
|
<string name="minimize_on_exit_background_description">Minimize to background player</string>
|
||||||
<string name="minimize_on_exit_popup_description">Minimize to popup player</string>
|
<string name="minimize_on_exit_popup_description">Minimize to popup player</string>
|
||||||
|
<string name="switch_view">Switch View</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue