Added plural forms for download related strings (#6930)
Co-authored-by: Tobi <TobiGr@users.noreply.github.com>
This commit is contained in:
parent
023a2c1d9c
commit
43e91ae4ae
69 changed files with 27 additions and 194 deletions
|
|
@ -226,6 +226,16 @@ public final class Localization {
|
|||
shortCount(context, subscriberCount));
|
||||
}
|
||||
|
||||
public static String downloadCount(final Context context, final int downloadCount) {
|
||||
return getQuantity(context, R.plurals.download_finished_notification, 0,
|
||||
downloadCount, shortCount(context, downloadCount));
|
||||
}
|
||||
|
||||
public static String deletedDownloadCount(final Context context, final int deletedCount) {
|
||||
return getQuantity(context, R.plurals.deleted_downloads_toast, 0,
|
||||
deletedCount, shortCount(context, deletedCount));
|
||||
}
|
||||
|
||||
private static String getQuantity(final Context context, @PluralsRes final int pluralId,
|
||||
@StringRes final int zeroCaseStringId, final long count,
|
||||
final String formattedCount) {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ import us.shandian.giga.get.DownloadMission;
|
|||
import us.shandian.giga.get.MissionRecoveryInfo;
|
||||
import org.schabi.newpipe.streams.io.StoredDirectoryHelper;
|
||||
import org.schabi.newpipe.streams.io.StoredFileHelper;
|
||||
import org.schabi.newpipe.util.Localization;
|
||||
|
||||
import us.shandian.giga.postprocessing.Postprocessing;
|
||||
import us.shandian.giga.service.DownloadManager.NetworkState;
|
||||
|
||||
|
|
@ -467,7 +469,8 @@ public class DownloadManagerService extends Service {
|
|||
.setContentIntent(makePendingIntent(ACTION_OPEN_DOWNLOADS_FINISHED));
|
||||
}
|
||||
|
||||
if (downloadDoneCount < 1) {
|
||||
downloadDoneCount++;
|
||||
if (downloadDoneCount == 1) {
|
||||
downloadDoneList.append(name);
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
|
|
@ -476,9 +479,9 @@ public class DownloadManagerService extends Service {
|
|||
downloadDoneNotification.setContentTitle(null);
|
||||
}
|
||||
|
||||
downloadDoneNotification.setContentText(getString(R.string.download_finished));
|
||||
downloadDoneNotification.setContentText(Localization.downloadCount(this, downloadDoneCount));
|
||||
downloadDoneNotification.setStyle(new NotificationCompat.BigTextStyle()
|
||||
.setBigContentTitle(getString(R.string.download_finished))
|
||||
.setBigContentTitle(Localization.downloadCount(this, downloadDoneCount))
|
||||
.bigText(name)
|
||||
);
|
||||
} else {
|
||||
|
|
@ -486,12 +489,11 @@ public class DownloadManagerService extends Service {
|
|||
downloadDoneList.append(name);
|
||||
|
||||
downloadDoneNotification.setStyle(new NotificationCompat.BigTextStyle().bigText(downloadDoneList));
|
||||
downloadDoneNotification.setContentTitle(getString(R.string.download_finished_more, String.valueOf(downloadDoneCount + 1)));
|
||||
downloadDoneNotification.setContentTitle(Localization.downloadCount(this, downloadDoneCount));
|
||||
downloadDoneNotification.setContentText(downloadDoneList);
|
||||
}
|
||||
|
||||
mNotificationManager.notify(DOWNLOADS_NOTIFICATION_ID, downloadDoneNotification.build());
|
||||
downloadDoneCount++;
|
||||
}
|
||||
|
||||
public void notifyFailedDownload(DownloadMission mission) {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import org.schabi.newpipe.extractor.NewPipe;
|
|||
import org.schabi.newpipe.error.ErrorActivity;
|
||||
import org.schabi.newpipe.error.ErrorInfo;
|
||||
import org.schabi.newpipe.error.UserAction;
|
||||
import org.schabi.newpipe.util.Localization;
|
||||
import org.schabi.newpipe.util.NavigationHelper;
|
||||
import org.schabi.newpipe.util.external_communication.ShareUtils;
|
||||
|
||||
|
|
@ -596,7 +597,7 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
|
|||
}
|
||||
applyChanges();
|
||||
|
||||
String msg = String.format(mContext.getString(R.string.deleted_downloads), mHidden.size());
|
||||
String msg = Localization.deletedDownloadCount(mContext, mHidden.size());
|
||||
mSnackbar = Snackbar.make(mView, msg, Snackbar.LENGTH_INDEFINITE);
|
||||
mSnackbar.setAction(R.string.undo, s -> {
|
||||
Iterator<Mission> i = mHidden.iterator();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue