Merge pull request #3680 from nextcloud/activityLocale

Enhance activities activity
This commit is contained in:
Andy Scherzinger 2019-02-26 22:39:55 +01:00 committed by GitHub
commit f4dec19e28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 7 deletions

View file

@ -1 +1 @@
482
481

View file

@ -25,6 +25,7 @@ import android.content.Context;
import android.os.AsyncTask;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudAccount;
@ -101,16 +102,16 @@ public class FilesServiceApiImpl implements FilesServiceApi {
return true;
} catch (com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException e) {
Log_OC.e(TAG, "Account not found", e);
errorMessage = "Account not found";
errorMessage = baseActivity.getString(R.string.account_not_found);
} catch (IOException e) {
Log_OC.e(TAG, "IO error", e);
errorMessage = "IO error";
errorMessage = baseActivity.getString(R.string.io_error);
} catch (OperationCanceledException e) {
Log_OC.e(TAG, "Operation has been canceled", e);
errorMessage = "Operation has been canceled";
errorMessage = baseActivity.getString(R.string.operation_canceled);
} catch (AuthenticatorException e) {
Log_OC.e(TAG, "Authentication Exception", e);
errorMessage = "Authentication Exception";
errorMessage = baseActivity.getString(R.string.authentication_exception);
}
return false;
@ -125,7 +126,7 @@ public class FilesServiceApiImpl implements FilesServiceApi {
callback.onLoaded(remoteOcFile);
return;
} else {
errorMessage = "File not found";
errorMessage = baseActivity.getString(R.string.file_not_found);
}
}

View file

@ -72,6 +72,7 @@ import com.owncloud.android.utils.svg.SvgSoftwareLayerSetter;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
@ -407,7 +408,11 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
return DisplayUtils.getRelativeDateTimeString(context, modificationTimestamp, DateUtils.DAY_IN_MILLIS,
DateUtils.WEEK_IN_MILLIS, 0);
} else {
return DateFormat.format("EEEE, MMMM d", modificationTimestamp);
String pattern = "EEEE, MMMM d";
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
pattern = DateFormat.getBestDateTimePattern(Locale.getDefault(), "EEEE, MMMM d");
}
return DateFormat.format(pattern, modificationTimestamp);
}
}

View file

@ -870,4 +870,7 @@
<string name="storage_music">Music</string>
<string name="storage_documents">Documents</string>
<string name="storage_downloads">Downloads</string>
<string name="io_error">IO error</string>
<string name="operation_canceled">Operation has been canceled</string>
<string name="authentication_exception">Authentication Exception</string>
</resources>