mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-20 18:48:16 -04:00
Few fixes
This commit is contained in:
parent
dbbb4d1cdc
commit
58055acce3
@ -82,7 +82,7 @@ public class DownloadFragment extends Fragment {
|
||||
}
|
||||
}
|
||||
|
||||
public static void showNoWiFiWarning(Context context) {
|
||||
public static void showNoWiFiWarning(Context context, Runnable yesAction) {
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle(R.string.wifi_only_title)
|
||||
.setMessage(R.string.wifi_only_msg)
|
||||
@ -92,6 +92,7 @@ public class DownloadFragment extends Fragment {
|
||||
.putBoolean(KiwixSettingsActivity.PREF_WIFI_ONLY, false)
|
||||
.apply();
|
||||
KiwixMobileActivity.wifiOnly = false;
|
||||
yesAction.run();
|
||||
})
|
||||
.setNegativeButton(R.string.no, (dialog, i) -> {})
|
||||
.show();
|
||||
@ -208,7 +209,7 @@ public class DownloadFragment extends Fragment {
|
||||
int newPlayPauseState = LibraryFragment.mService.downloadStatus.get(mKeys[position]) == DownloadService.PLAY ? DownloadService.PAUSE : DownloadService.PLAY;
|
||||
|
||||
if (newPlayPauseState == DownloadService.PLAY && KiwixMobileActivity.wifiOnly && !NetworkUtils.isWiFi(getContext())) {
|
||||
showNoWiFiWarning(getContext());
|
||||
showNoWiFiWarning(getContext(), () -> {setPlayState(pause, position, newPlayPauseState);});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class ZimManageActivity extends AppCompatActivity {
|
||||
setUpToolbar();
|
||||
|
||||
if (DownloadService.ACTION_NO_WIFI.equals(getIntent().getAction())) {
|
||||
DownloadFragment.showNoWiFiWarning(this);
|
||||
DownloadFragment.showNoWiFiWarning(this, () -> {});
|
||||
}
|
||||
|
||||
// Create the adapter that will return a fragment for each of the three
|
||||
|
@ -261,7 +261,7 @@ public class LibraryFragment extends Fragment
|
||||
}
|
||||
|
||||
if (KiwixMobileActivity.wifiOnly && !NetworkUtils.isWiFi(getContext())) {
|
||||
DownloadFragment.showNoWiFiWarning(getContext());
|
||||
DownloadFragment.showNoWiFiWarning(getContext(), () -> {downloadFile((Book) parent.getAdapter().getItem(position));});
|
||||
} else {
|
||||
downloadFile((Book) parent.getAdapter().getItem(position));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user