Merge pull request #2487 from kapodamy/buttons-hiding-fix-on-screen-off
fixup for #2149 (missing buttons)
This commit is contained in:
commit
5883f6e763
|
@ -61,6 +61,7 @@ public class DownloadActivity extends AppCompatActivity {
|
|||
.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
|
@ -86,9 +87,4 @@ public class DownloadActivity extends AppCompatActivity {
|
|||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestoreInstanceState(Bundle inState){
|
||||
super.onRestoreInstanceState(inState);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -666,9 +666,9 @@ public class DownloadManager {
|
|||
continue;
|
||||
|
||||
if (mission.running)
|
||||
paused = true;
|
||||
else
|
||||
running = true;
|
||||
else
|
||||
paused = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,14 +122,8 @@ public class MissionAdapter extends Adapter<ViewHolder> {
|
|||
break;
|
||||
}
|
||||
|
||||
if (mStartButton != null && mPauseButton != null) switch (msg.what) {
|
||||
case DownloadManagerService.MESSAGE_DELETED:
|
||||
case DownloadManagerService.MESSAGE_ERROR:
|
||||
case DownloadManagerService.MESSAGE_FINISHED:
|
||||
case DownloadManagerService.MESSAGE_PAUSED:
|
||||
if (mStartButton != null && mPauseButton != null)
|
||||
checkMasterButtonsVisibility();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -163,8 +157,7 @@ public class MissionAdapter extends Adapter<ViewHolder> {
|
|||
mPendingDownloadsItems.remove(h);
|
||||
if (mPendingDownloadsItems.size() < 1) {
|
||||
setAutoRefresh(false);
|
||||
if (mStartButton != null) mStartButton.setVisible(false);
|
||||
if (mPauseButton != null) mPauseButton.setVisible(false);
|
||||
checkMasterButtonsVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -664,11 +657,11 @@ public class MissionAdapter extends Adapter<ViewHolder> {
|
|||
if (mEmptyMessage.getVisibility() != flag) mEmptyMessage.setVisibility(flag);
|
||||
}
|
||||
|
||||
private void checkMasterButtonsVisibility() {
|
||||
public void checkMasterButtonsVisibility() {
|
||||
boolean[] state = mIterator.hasValidPendingMissions();
|
||||
|
||||
mStartButton.setVisible(state[0]);
|
||||
mPauseButton.setVisible(state[1]);
|
||||
mPauseButton.setVisible(state[0]);
|
||||
mStartButton.setVisible(state[1]);
|
||||
}
|
||||
|
||||
public void ensurePausedMissions() {
|
||||
|
|
|
@ -138,6 +138,7 @@ public class MissionsFragment extends Fragment {
|
|||
* deprecated in API level 23,
|
||||
* but must remain to allow compatibility with api<23
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
|
@ -273,6 +274,7 @@ public class MissionsFragment extends Fragment {
|
|||
}
|
||||
|
||||
mBinder.addMissionEventListener(mAdapter.getMessenger());
|
||||
mAdapter.checkMasterButtonsVisibility();
|
||||
}
|
||||
if (mBinder != null) mBinder.enableNotifications(false);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<menu xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item android:id="@+id/switch_mode"
|
||||
android:icon="?attr/ic_grid"
|
||||
android:title="@string/grid"
|
||||
app:showAsAction="ifRoom" />
|
||||
tools:ignore="AlwaysShowAction"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item android:id="@+id/start_downloads"
|
||||
android:visible="false"
|
||||
|
|
Loading…
Reference in New Issue