|
@@ -33,6 +33,7 @@ import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
import android.content.SyncResult;
|
|
|
import android.os.Bundle;
|
|
|
+import android.support.annotation.PluralsRes;
|
|
|
import android.support.v4.app.NotificationCompat;
|
|
|
|
|
|
import com.owncloud.android.R;
|
|
@@ -443,7 +444,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
|
|
|
getContext(), (int) System.currentTimeMillis(), new Intent(), 0
|
|
|
))
|
|
|
.setContentTitle(i18n(R.string.sync_fail_in_favourites_ticker))
|
|
|
- .setContentText(getContext().getResources().getQuantityString(
|
|
|
+ .setContentText(getQuantityString(
|
|
|
R.plurals.sync_fail_in_favourites_content,
|
|
|
mFailedResultsCounter,
|
|
|
mFailedResultsCounter + mConflictsFound, mConflictsFound
|
|
@@ -498,8 +499,12 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
|
|
|
getContext(), (int) System.currentTimeMillis(), explanationIntent, 0
|
|
|
))
|
|
|
.setContentTitle(i18n(R.string.sync_foreign_files_forgotten_ticker))
|
|
|
- .setContentText(i18n(R.string.sync_foreign_files_forgotten_content,
|
|
|
- mForgottenLocalFiles.size(), i18n(R.string.app_name)));
|
|
|
+ .setContentText(getQuantityString(
|
|
|
+ R.plurals.sync_foreign_files_forgotten_content,
|
|
|
+ mForgottenLocalFiles.size(),
|
|
|
+ mForgottenLocalFiles.size(),
|
|
|
+ i18n(R.string.app_name))
|
|
|
+ );
|
|
|
|
|
|
showNotification(R.string.sync_foreign_files_forgotten_ticker, notificationBuilder);
|
|
|
}
|
|
@@ -507,7 +512,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
|
|
|
/**
|
|
|
* Creates a notification builder with some commonly used settings
|
|
|
*
|
|
|
- * @return
|
|
|
+ * @return notification builder
|
|
|
*/
|
|
|
private NotificationCompat.Builder createNotificationBuilder() {
|
|
|
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getContext());
|
|
@@ -536,4 +541,16 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
|
|
|
private String i18n(int key, Object... args) {
|
|
|
return getContext().getString(key, args);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Shorthand plurals translation.
|
|
|
+ *
|
|
|
+ * @param id The desired plurals identifier.
|
|
|
+ * @param quantity The number used to get the correct string for the current language's plural rules.
|
|
|
+ * @param formatArgs The format arguments that will be used for substitution.
|
|
|
+ * @return formatted, plurals respecting string
|
|
|
+ */
|
|
|
+ private String getQuantityString(@PluralsRes int id, int quantity, Object... formatArgs) {
|
|
|
+ return getContext().getResources().getQuantityString(id, quantity, formatArgs);
|
|
|
+ }
|
|
|
}
|