mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-16 02:48:08 -04:00
more indenting
This commit is contained in:
parent
0e769fe47a
commit
d51759b4b9
@ -98,19 +98,19 @@ public class DownloadFragment extends Fragment {
|
|||||||
|
|
||||||
public static void showNoWiFiWarning(Context context, Runnable yesAction) {
|
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)
|
||||||
.setPositiveButton(R.string.yes, (dialog, i) -> {
|
.setPositiveButton(R.string.yes, (dialog, i) -> {
|
||||||
PreferenceManager.getDefaultSharedPreferences(context)
|
PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
.edit()
|
.edit()
|
||||||
.putBoolean(KiwixSettingsActivity.PREF_WIFI_ONLY, false)
|
.putBoolean(KiwixSettingsActivity.PREF_WIFI_ONLY, false)
|
||||||
.apply();
|
.apply();
|
||||||
KiwixMobileActivity.wifiOnly = false;
|
KiwixMobileActivity.wifiOnly = false;
|
||||||
yesAction.run();
|
yesAction.run();
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.no, (dialog, i) -> {
|
.setNegativeButton(R.string.no, (dialog, i) -> {
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toHumanReadableTime(int seconds) {
|
public static String toHumanReadableTime(int seconds) {
|
||||||
@ -120,19 +120,19 @@ public class DownloadFragment extends Fragment {
|
|||||||
|
|
||||||
if (Math.round(seconds / DAYS) > 0)
|
if (Math.round(seconds / DAYS) > 0)
|
||||||
return String.format(Locale.getDefault(), "%d %s %s", Math.round(seconds / DAYS),
|
return String.format(Locale.getDefault(), "%d %s %s", Math.round(seconds / DAYS),
|
||||||
KiwixApplication.getInstance().getResources().getString(R.string.time_day),
|
KiwixApplication.getInstance().getResources().getString(R.string.time_day),
|
||||||
KiwixApplication.getInstance().getResources().getString(R.string.time_left));
|
KiwixApplication.getInstance().getResources().getString(R.string.time_left));
|
||||||
if (Math.round(seconds / HOURS) > 0)
|
if (Math.round(seconds / HOURS) > 0)
|
||||||
return String.format(Locale.getDefault(), "%d %s %s", Math.round(seconds / HOURS),
|
return String.format(Locale.getDefault(), "%d %s %s", Math.round(seconds / HOURS),
|
||||||
KiwixApplication.getInstance().getResources().getString(R.string.time_hour),
|
KiwixApplication.getInstance().getResources().getString(R.string.time_hour),
|
||||||
KiwixApplication.getInstance().getResources().getString(R.string.time_left));
|
KiwixApplication.getInstance().getResources().getString(R.string.time_left));
|
||||||
if (Math.round(seconds / MINUTES) > 0)
|
if (Math.round(seconds / MINUTES) > 0)
|
||||||
return String.format(Locale.getDefault(), "%d %s %s", Math.round(seconds / MINUTES),
|
return String.format(Locale.getDefault(), "%d %s %s", Math.round(seconds / MINUTES),
|
||||||
KiwixApplication.getInstance().getResources().getString(R.string.time_minute),
|
KiwixApplication.getInstance().getResources().getString(R.string.time_minute),
|
||||||
KiwixApplication.getInstance().getResources().getString(R.string.time_left));
|
KiwixApplication.getInstance().getResources().getString(R.string.time_left));
|
||||||
return String.format(Locale.getDefault(), "%d %s %s", seconds,
|
return String.format(Locale.getDefault(), "%d %s %s", seconds,
|
||||||
KiwixApplication.getInstance().getResources().getString(R.string.time_second),
|
KiwixApplication.getInstance().getResources().getString(R.string.time_second),
|
||||||
KiwixApplication.getInstance().getResources().getString(R.string.time_left));
|
KiwixApplication.getInstance().getResources().getString(R.string.time_left));
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DownloadAdapter extends BaseAdapter {
|
public class DownloadAdapter extends BaseAdapter {
|
||||||
@ -270,25 +270,25 @@ public class DownloadFragment extends Fragment {
|
|||||||
hasArtificiallyPaused = LibraryFragment.mService.downloadStatus.get(mKeys[position]) == DownloadService.PLAY;
|
hasArtificiallyPaused = LibraryFragment.mService.downloadStatus.get(mKeys[position]) == DownloadService.PLAY;
|
||||||
setPlayState(pause, position, DownloadService.PAUSE);
|
setPlayState(pause, position, DownloadService.PAUSE);
|
||||||
new AlertDialog.Builder(faActivity, dialogStyle())
|
new AlertDialog.Builder(faActivity, dialogStyle())
|
||||||
.setTitle(R.string.confirm_stop_download_title)
|
.setTitle(R.string.confirm_stop_download_title)
|
||||||
.setMessage(R.string.confirm_stop_download_msg)
|
.setMessage(R.string.confirm_stop_download_msg)
|
||||||
.setPositiveButton(R.string.yes, (dialog, i) -> {
|
.setPositiveButton(R.string.yes, (dialog, i) -> {
|
||||||
LibraryFragment.mService.stopDownload(mKeys[position]);
|
LibraryFragment.mService.stopDownload(mKeys[position]);
|
||||||
mDownloads.remove(mKeys[position]);
|
mDownloads.remove(mKeys[position]);
|
||||||
mDownloadFiles.remove(mKeys[position]);
|
mDownloadFiles.remove(mKeys[position]);
|
||||||
downloadAdapter.notifyDataSetChanged();
|
downloadAdapter.notifyDataSetChanged();
|
||||||
updateNoDownloads();
|
updateNoDownloads();
|
||||||
if (zimManageActivity.mSectionsPagerAdapter.libraryFragment.libraryAdapter != null) {
|
if (zimManageActivity.mSectionsPagerAdapter.libraryFragment.libraryAdapter != null) {
|
||||||
zimManageActivity.mSectionsPagerAdapter.libraryFragment.libraryAdapter.getFilter().filter(((ZimManageActivity) getActivity()).searchView.getQuery());
|
zimManageActivity.mSectionsPagerAdapter.libraryFragment.libraryAdapter.getFilter().filter(((ZimManageActivity) getActivity()).searchView.getQuery());
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.no, (dialog, i) -> {
|
.setNegativeButton(R.string.no, (dialog, i) -> {
|
||||||
if (hasArtificiallyPaused) {
|
if (hasArtificiallyPaused) {
|
||||||
hasArtificiallyPaused = false;
|
hasArtificiallyPaused = false;
|
||||||
setPlayState(pause, position, DownloadService.PLAY);
|
setPlayState(pause, position, DownloadService.PLAY);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Return the completed view to render on screen
|
// Return the completed view to render on screen
|
||||||
|
@ -92,7 +92,8 @@ public class LibraryFragment extends Fragment
|
|||||||
|
|
||||||
private DownloadServiceConnection mConnection = new DownloadServiceConnection();
|
private DownloadServiceConnection mConnection = new DownloadServiceConnection();
|
||||||
|
|
||||||
@Inject ConnectivityManager conMan;
|
@Inject
|
||||||
|
ConnectivityManager conMan;
|
||||||
|
|
||||||
private ZimManageActivity faActivity;
|
private ZimManageActivity faActivity;
|
||||||
|
|
||||||
@ -145,7 +146,7 @@ public class LibraryFragment extends Fragment
|
|||||||
faActivity.searchView.getQuery(),
|
faActivity.searchView.getQuery(),
|
||||||
i -> stopScanningContent());
|
i -> stopScanningContent());
|
||||||
} else {
|
} else {
|
||||||
libraryAdapter.getFilter().filter("", i -> stopScanningContent() );
|
libraryAdapter.getFilter().filter("", i -> stopScanningContent());
|
||||||
}
|
}
|
||||||
libraryAdapter.notifyDataSetChanged();
|
libraryAdapter.notifyDataSetChanged();
|
||||||
libraryList.setOnItemClickListener(this);
|
libraryList.setOnItemClickListener(this);
|
||||||
@ -257,7 +258,9 @@ public class LibraryFragment extends Fragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (KiwixMobileActivity.wifiOnly && !NetworkUtils.isWiFi(getContext())) {
|
if (KiwixMobileActivity.wifiOnly && !NetworkUtils.isWiFi(getContext())) {
|
||||||
DownloadFragment.showNoWiFiWarning(getContext(), () -> {downloadFile((Book) parent.getAdapter().getItem(position));});
|
DownloadFragment.showNoWiFiWarning(getContext(), () -> {
|
||||||
|
downloadFile((Book) parent.getAdapter().getItem(position));
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
downloadFile((Book) parent.getAdapter().getItem(position));
|
downloadFile((Book) parent.getAdapter().getItem(position));
|
||||||
}
|
}
|
||||||
@ -323,7 +326,8 @@ public class LibraryFragment extends Fragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onServiceDisconnected(ComponentName arg0) { }
|
public void onServiceDisconnected(ComponentName arg0) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user