mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-21 03:02:59 -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)
|
new AlertDialog.Builder(context)
|
||||||
.setTitle(R.string.wifi_only_title)
|
.setTitle(R.string.wifi_only_title)
|
||||||
.setMessage(R.string.wifi_only_msg)
|
.setMessage(R.string.wifi_only_msg)
|
||||||
@ -92,6 +92,7 @@ public class DownloadFragment extends Fragment {
|
|||||||
.putBoolean(KiwixSettingsActivity.PREF_WIFI_ONLY, false)
|
.putBoolean(KiwixSettingsActivity.PREF_WIFI_ONLY, false)
|
||||||
.apply();
|
.apply();
|
||||||
KiwixMobileActivity.wifiOnly = false;
|
KiwixMobileActivity.wifiOnly = false;
|
||||||
|
yesAction.run();
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.no, (dialog, i) -> {})
|
.setNegativeButton(R.string.no, (dialog, i) -> {})
|
||||||
.show();
|
.show();
|
||||||
@ -208,7 +209,7 @@ public class DownloadFragment extends Fragment {
|
|||||||
int newPlayPauseState = LibraryFragment.mService.downloadStatus.get(mKeys[position]) == DownloadService.PLAY ? DownloadService.PAUSE : DownloadService.PLAY;
|
int newPlayPauseState = LibraryFragment.mService.downloadStatus.get(mKeys[position]) == DownloadService.PLAY ? DownloadService.PAUSE : DownloadService.PLAY;
|
||||||
|
|
||||||
if (newPlayPauseState == DownloadService.PLAY && KiwixMobileActivity.wifiOnly && !NetworkUtils.isWiFi(getContext())) {
|
if (newPlayPauseState == DownloadService.PLAY && KiwixMobileActivity.wifiOnly && !NetworkUtils.isWiFi(getContext())) {
|
||||||
showNoWiFiWarning(getContext());
|
showNoWiFiWarning(getContext(), () -> {setPlayState(pause, position, newPlayPauseState);});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public class ZimManageActivity extends AppCompatActivity {
|
|||||||
setUpToolbar();
|
setUpToolbar();
|
||||||
|
|
||||||
if (DownloadService.ACTION_NO_WIFI.equals(getIntent().getAction())) {
|
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
|
// 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())) {
|
if (KiwixMobileActivity.wifiOnly && !NetworkUtils.isWiFi(getContext())) {
|
||||||
DownloadFragment.showNoWiFiWarning(getContext());
|
DownloadFragment.showNoWiFiWarning(getContext(), () -> {downloadFile((Book) parent.getAdapter().getItem(position));});
|
||||||
} else {
|
} else {
|
||||||
downloadFile((Book) parent.getAdapter().getItem(position));
|
downloadFile((Book) parent.getAdapter().getItem(position));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user