From bcc97d1aa7252a3af92032e8aaeed6aca595667b Mon Sep 17 00:00:00 2001 From: jludden Date: Sat, 29 Sep 2018 15:13:15 +0800 Subject: [PATCH 1/2] Adding switch view button to downloads activity Can now switch between linear and grid layouts in the downloads activity --- .../giga/ui/fragment/MissionsFragment.java | 14 ++++++++++---- app/src/main/res/menu/download_menu.xml | 3 +++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/us/shandian/giga/ui/fragment/MissionsFragment.java b/app/src/main/java/us/shandian/giga/ui/fragment/MissionsFragment.java index 7b42f90c9..5241415b2 100644 --- a/app/src/main/java/us/shandian/giga/ui/fragment/MissionsFragment.java +++ b/app/src/main/java/us/shandian/giga/ui/fragment/MissionsFragment.java @@ -16,6 +16,8 @@ import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; @@ -144,17 +146,21 @@ public abstract class MissionsFragment extends Fragment { } @Override - public boolean onOptionsItemSelected(MenuItem item) { - return super.onOptionsItemSelected(item); + public void onPrepareOptionsMenu(Menu menu) { + 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: mLinear = !mLinear; updateList(); return true; default: return super.onOptionsItemSelected(item); - }*/ + } } public void notifyChange() { diff --git a/app/src/main/res/menu/download_menu.xml b/app/src/main/res/menu/download_menu.xml index 4cbb845ea..e71eaf152 100644 --- a/app/src/main/res/menu/download_menu.xml +++ b/app/src/main/res/menu/download_menu.xml @@ -5,4 +5,7 @@ + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0dc837ae8..04a0be64f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -517,5 +517,6 @@ None Minimize to background player Minimize to popup player + Switch View From 4bcb2a5c9da98ddfedf2faafd8065b8126e37076 Mon Sep 17 00:00:00 2001 From: jludden Date: Sun, 30 Sep 2018 07:42:02 +0800 Subject: [PATCH 2/2] update linear layout re-arrange elements and allow the video title to display over multiple lines --- .../main/res/layout/mission_item_linear.xml | 69 +++++++++---------- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/app/src/main/res/layout/mission_item_linear.xml b/app/src/main/res/layout/mission_item_linear.xml index 21f637839..0133d0c3f 100644 --- a/app/src/main/res/layout/mission_item_linear.xml +++ b/app/src/main/res/layout/mission_item_linear.xml @@ -9,7 +9,7 @@ android:layout_width="match_parent" android:layout_margin="2dp" android:background="@color/bluegray"> - + - - + android:ellipsize="end" + android:padding="6dp" + android:text="XXX.xx" + android:textColor="@color/white" + android:textSize="16sp" + android:textStyle="bold" /> - - - - - - + + android:textColor="@color/white" + android:textSize="12sp" />