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 2a93d20f4..69c8e8f50 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 @@ -7,7 +7,6 @@ import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.content.SharedPreferences; -import android.content.res.Configuration; import android.os.Bundle; import android.os.IBinder; import android.preference.PreferenceManager; @@ -171,15 +170,6 @@ public class MissionsFragment extends Fragment { if (mAdapter != null) setAdapterButtons(); - int max = getMaxActionButtons() - 1 /* grid button */; - if (max >= 2) { - // show start/pause downloads buttons in pair to avoid confusions - mStart.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); - mPause.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); - - if (max > 3) mClear.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); - } - super.onPrepareOptionsMenu(menu); } @@ -260,23 +250,6 @@ public class MissionsFragment extends Fragment { ); } - public int getMaxActionButtons() { - Configuration configuration = mContext.getResources().getConfiguration(); - int widthDp = configuration.screenWidthDp; - int heightDp = configuration.screenHeightDp; - int smallest = configuration.smallestScreenWidthDp; - - if (smallest > 600 || widthDp > 600) { - return 5; - } else if (widthDp >= 500 || widthDp > 480 && heightDp > 640) { - return 4; - } else if (widthDp >= 360) { - return 3; - } else { - return 2; - } - } - @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); diff --git a/app/src/main/res/menu/download_menu.xml b/app/src/main/res/menu/download_menu.xml index 935399169..6285352da 100644 --- a/app/src/main/res/menu/download_menu.xml +++ b/app/src/main/res/menu/download_menu.xml @@ -7,7 +7,7 @@ android:icon="?attr/ic_grid" android:title="@string/grid" tools:ignore="AlwaysShowAction" - app:showAsAction="always" /> + app:showAsAction="ifRoom" />