#768 Support API v1.0 and #762 Theming

This commit is contained in:
Stefan Niedermann 2020-04-15 11:07:21 +02:00
parent 7c7f1b27a7
commit 8bf6b65598
28 changed files with 296 additions and 59 deletions

View file

@ -13,7 +13,7 @@ import it.niedermann.owncloud.notes.android.activity.ExceptionActivity;
public class ExceptionHandler implements Thread.UncaughtExceptionHandler {
private static final String TAG = ExceptionHandler.class.getCanonicalName();
private static final String TAG = ExceptionHandler.class.getSimpleName();
private Context context;
private Class<? extends Activity> errorActivity;
public static final String KEY_THROWABLE = "T";

View file

@ -107,7 +107,7 @@ public class MultiSelectedActionModeCallback implements Callback {
}
return true;
case R.id.menu_move:
AccountChooserDialogFragment.newInstance().show(fragmentManager, NotesListViewActivity.class.getCanonicalName());
AccountChooserDialogFragment.newInstance().show(fragmentManager, NotesListViewActivity.class.getSimpleName());
return true;
default:
return false;

View file

@ -24,7 +24,7 @@ import it.niedermann.owncloud.notes.persistence.NotesDatabase;
public class NotesListViewItemTouchHelper extends ItemTouchHelper {
private static final String TAG = NotesListViewItemTouchHelper.class.getCanonicalName();
private static final String TAG = NotesListViewItemTouchHelper.class.getSimpleName();
public NotesListViewItemTouchHelper(
@NonNull SingleSignOnAccount ssoAccount,

View file

@ -16,7 +16,7 @@ import it.niedermann.owncloud.notes.util.Notes;
public abstract class LockedActivity extends AppCompatActivity {
private static final String TAG = LockedActivity.class.getCanonicalName();
private static final String TAG = LockedActivity.class.getSimpleName();
private static final int REQUEST_CODE_UNLOCK = 100;

View file

@ -50,6 +50,7 @@ import it.niedermann.owncloud.notes.android.MultiSelectedActionModeCallback;
import it.niedermann.owncloud.notes.android.NotesListViewItemTouchHelper;
import it.niedermann.owncloud.notes.android.fragment.AccountChooserAdapter.AccountChooserListener;
import it.niedermann.owncloud.notes.databinding.DrawerLayoutBinding;
import it.niedermann.owncloud.notes.model.Capabilities;
import it.niedermann.owncloud.notes.model.Category;
import it.niedermann.owncloud.notes.model.DBNote;
import it.niedermann.owncloud.notes.model.ISyncCallback;
@ -58,6 +59,8 @@ import it.niedermann.owncloud.notes.model.ItemAdapter;
import it.niedermann.owncloud.notes.model.LocalAccount;
import it.niedermann.owncloud.notes.model.NavigationAdapter;
import it.niedermann.owncloud.notes.model.NavigationAdapter.NavigationItem;
import it.niedermann.owncloud.notes.persistence.CapabilitiesClient;
import it.niedermann.owncloud.notes.persistence.CapabilitiesWorker;
import it.niedermann.owncloud.notes.persistence.LoadNotesListTask;
import it.niedermann.owncloud.notes.persistence.LoadNotesListTask.NotesLoadedListener;
import it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper;
@ -127,6 +130,7 @@ public class NotesListViewActivity extends LockedActivity implements ItemAdapter
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CapabilitiesWorker.update(this);
binding = DrawerLayoutBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
this.coordinatorLayout = binding.activityNotesListView.activityNotesListView;
@ -308,6 +312,18 @@ public class NotesListViewActivity extends LockedActivity implements ItemAdapter
Log.i(TAG, "Clearing Glide disk cache");
Glide.get(getApplicationContext()).clearDiskCache();
}).start();
new Thread(() -> {
Log.i(TAG, "Refreshing capabilities for " + ssoAccount.name);
final Capabilities capabilities;
try {
capabilities = CapabilitiesClient.getCapabilities(getApplicationContext(), ssoAccount);
db.updateBrand(localAccount.getId(), capabilities);
db.updateApiVersion(localAccount.getId(), capabilities.getApiVersion());
Log.i(TAG, capabilities.toString());
} catch (Exception e) {
e.printStackTrace();
}
}).start();
synchronize();
}
});

View file

@ -24,7 +24,7 @@ import it.niedermann.owncloud.notes.util.Notes;
import static it.niedermann.owncloud.notes.android.appwidget.NoteListWidget.DARK_THEME_KEY;
public class NoteListWidgetFactory implements RemoteViewsService.RemoteViewsFactory {
private static final String TAG = NoteListWidgetFactory.class.getCanonicalName();
private static final String TAG = NoteListWidgetFactory.class.getSimpleName();
private final Context context;
private final int displayMode;

View file

@ -38,7 +38,7 @@ public class AccountChooserDialogFragment extends AppCompatDialogFragment implem
if (context instanceof AccountChooserListener) {
this.accountChooserListener = (AccountChooserListener) context;
} else {
throw new ClassCastException("Caller must implement " + AccountChooserListener.class.getCanonicalName());
throw new ClassCastException("Caller must implement " + AccountChooserListener.class.getSimpleName());
}
}

View file

@ -192,7 +192,7 @@ public abstract class BaseNoteFragment extends Fragment implements CategoryDialo
showCategorySelector();
return true;
case R.id.menu_move:
AccountChooserDialogFragment.newInstance().show(requireActivity().getSupportFragmentManager(), BaseNoteFragment.class.getCanonicalName());
AccountChooserDialogFragment.newInstance().show(requireActivity().getSupportFragmentManager(), BaseNoteFragment.class.getSimpleName());
return true;
case R.id.menu_share:
Intent shareIntent = new Intent();

View file

@ -72,7 +72,7 @@ public class CategoryDialogFragment extends AppCompatDialogFragment {
} else if (getActivity() instanceof CategoryDialogListener) {
listener = (CategoryDialogListener) getActivity();
} else {
throw new IllegalArgumentException("Calling activity or target fragment must implement " + CategoryDialogListener.class.getCanonicalName());
throw new IllegalArgumentException("Calling activity or target fragment must implement " + CategoryDialogListener.class.getSimpleName());
}
db = NotesDatabase.getInstance(getActivity());
}

View file

@ -21,7 +21,7 @@ import it.niedermann.owncloud.notes.R;
public abstract class SearchableBaseNoteFragment extends BaseNoteFragment {
private static final String TAG = SearchableBaseNoteFragment.class.getCanonicalName();
private static final String TAG = SearchableBaseNoteFragment.class.getSimpleName();
private static final String saved_instance_key_searchQuery = "searchQuery";
private static final String saved_instance_key_currentOccurrence = "currentOccurrence";

View file

@ -22,7 +22,7 @@ import java.io.InputStream;
@GlideModule
public final class SingleSignOnLibraryGlideModule extends LibraryGlideModule {
private static final String TAG = SingleSignOnLibraryGlideModule.class.getCanonicalName();
private static final String TAG = SingleSignOnLibraryGlideModule.class.getSimpleName();
@Override
public void registerComponents(

View file

@ -23,7 +23,7 @@ import java.io.InputStream;
*/
public class SingleSignOnUrlLoader implements ModelLoader<GlideUrl, InputStream> {
private static final String TAG = SingleSignOnUrlLoader.class.getCanonicalName();
private static final String TAG = SingleSignOnUrlLoader.class.getSimpleName();
private final NextcloudAPI client;
// Public API.

View file

@ -0,0 +1,108 @@
package it.niedermann.owncloud.notes.model;
import androidx.annotation.NonNull;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@SuppressWarnings("WeakerAccess")
public class ApiVersion implements Comparable<ApiVersion> {
private static final Pattern NUMBER_EXTRACTION_PATTERN = Pattern.compile("[0-9]+");
private String originalVersion = "?";
private int major = 0;
private int minor = 0;
private int patch = 0;
public ApiVersion(String originalVersion, int major, int minor, int patch) {
this(major, minor, patch);
this.originalVersion = originalVersion;
}
public ApiVersion(int major, int minor, int patch) {
this.major = major;
this.minor = minor;
this.patch = patch;
}
public int getMajor() {
return major;
}
public int getMinor() {
return minor;
}
public int getPatch() {
return patch;
}
public boolean isGreaterOrEqualTo(ApiVersion v) {
return compareTo(v) >= 0;
}
public String getOriginalVersion() {
return originalVersion;
}
public static ApiVersion of(String versionString) {
int major = 0, minor = 0, micro = 0;
if (versionString != null) {
String[] split = versionString.split("\\.");
if (split.length > 0) {
major = extractNumber(split[0]);
if (split.length > 1) {
minor = extractNumber(split[1]);
if (split.length > 2) {
micro = extractNumber(split[2]);
}
}
}
}
return new ApiVersion(versionString, major, minor, micro);
}
private static int extractNumber(String containsNumbers) {
final Matcher matcher = NUMBER_EXTRACTION_PATTERN.matcher(containsNumbers);
if (matcher.find()) {
return Integer.parseInt(matcher.group());
}
return 0;
}
/**
* @param compare another version object
* @return -1 if the compared version is <strong>higher</strong> than the current version
* 0 if the compared version is equal to the current version
* 1 if the compared version is <strong>lower</strong> than the current version
*/
@Override
public int compareTo(ApiVersion compare) {
if (compare.getMajor() > getMajor()) {
return -1;
} else if (compare.getMajor() < getMajor()) {
return 1;
} else if (compare.getMinor() > getMinor()) {
return -1;
} else if (compare.getMinor() < getMinor()) {
return 1;
} else if (compare.getPatch() > getPatch()) {
return -1;
} else if (compare.getPatch() < getPatch()) {
return 1;
}
return 0;
}
@NonNull
@Override
public String toString() {
return "Version{" +
"originalVersion='" + originalVersion + '\'' +
", major=" + major +
", minor=" + minor +
", patch=" + patch +
'}';
}
}

View file

@ -0,0 +1,79 @@
package it.niedermann.owncloud.notes.model;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
/**
* This entity class is used to return relevant data of the HTTP reponse.
*/
public class Capabilities {
private static final String TAG = Capabilities.class.getSimpleName();
private static final String JSON_OCS = "ocs";
private static final String JSON_OCS_META = "meta";
private static final String JSON_OCS_META_STATUSCODE = "statuscode";
private static final String JSON_OCS_DATA = "data";
private static final String JSON_OCS_DATA_CAPABILITIES = "capabilities";
private static final String JSON_OCS_DATA_CAPABILITIES_NOTES = "notes";
private static final String JSON_OCS_DATA_CAPABILITIES_NOTES_API_VERSION = "api_version";
private static final String JSON_OCS_DATA_CAPABILITIES_THEMING = "theming";
private static final String JSON_OCS_DATA_CAPABILITIES_THEMING_COLOR = "color";
private static final String JSON_OCS_DATA_CAPABILITIES_THEMING_COLOR_TEXT = "color-text";
private String apiVersion = null;
private String color = null;
private String textColor = null;
public Capabilities(String response) {
final JSONObject ocs;
try {
ocs = new JSONObject(response).getJSONObject(JSON_OCS);
if (ocs.has(JSON_OCS_META)) {
final JSONObject meta = ocs.getJSONObject(JSON_OCS_META);
if (meta.has(JSON_OCS_META_STATUSCODE)) {
if (meta.getInt(JSON_OCS_META_STATUSCODE) == 503) {
Log.i(TAG, "Capabilities Endpoint: This instance is currently in maintenance mode.");
}
}
}
if (ocs.has(JSON_OCS_DATA)) {
final JSONObject data = ocs.getJSONObject(JSON_OCS_DATA);
if (data.has(JSON_OCS_DATA_CAPABILITIES)) {
final JSONObject capabilities = data.getJSONObject(JSON_OCS_DATA_CAPABILITIES);
if (capabilities.has(JSON_OCS_DATA_CAPABILITIES_NOTES)) {
final JSONObject notes = data.getJSONObject(JSON_OCS_DATA_CAPABILITIES_NOTES);
if (notes.has(JSON_OCS_DATA_CAPABILITIES_NOTES_API_VERSION)) {
this.apiVersion = notes.getString(JSON_OCS_DATA_CAPABILITIES_NOTES_API_VERSION);
}
}
if (capabilities.has(JSON_OCS_DATA_CAPABILITIES_THEMING)) {
final JSONObject theming = capabilities.getJSONObject(JSON_OCS_DATA_CAPABILITIES_THEMING);
if (theming.has(JSON_OCS_DATA_CAPABILITIES_THEMING_COLOR)) {
this.color = theming.getString(JSON_OCS_DATA_CAPABILITIES_THEMING_COLOR);
}
if (theming.has(JSON_OCS_DATA_CAPABILITIES_THEMING_COLOR_TEXT)) {
this.textColor = theming.getString(JSON_OCS_DATA_CAPABILITIES_THEMING_COLOR_TEXT);
}
}
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
public String getApiVersion() {
return apiVersion;
}
public String getColor() {
return color;
}
public String getTextColor() {
return textColor;
}
}

View file

@ -22,7 +22,7 @@ import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
public class ItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final String TAG = ItemAdapter.class.getCanonicalName();
private static final String TAG = ItemAdapter.class.getSimpleName();
private static final int section_type = 0;
private static final int note_type = 1;

View file

@ -12,19 +12,18 @@ import com.nextcloud.android.sso.api.Response;
import com.nextcloud.android.sso.exceptions.NextcloudFilesAppNotSupportedException;
import com.nextcloud.android.sso.model.SingleSignOnAccount;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import it.niedermann.owncloud.notes.model.Capabilities;
@SuppressWarnings("WeakerAccess")
@WorkerThread
public class CapabilitiesClient {
private static final String TAG = CapabilitiesClient.class.getCanonicalName();
private static final String TAG = CapabilitiesClient.class.getSimpleName();
private static final int MIN_NEXTCLOUD_FILES_APP_VERSION_CODE = 30090000;
@ -70,25 +69,4 @@ public class CapabilitiesClient {
}
}
}
/**
* This entity class is used to return relevant data of the HTTP reponse.
*/
public static class Capabilities {
Capabilities(String responseString) throws JSONException {
JSONObject response = new JSONObject(responseString);
if (response.getJSONObject("ocs").getJSONObject("meta").getInt("statuscode") == 503) {
Log.i(TAG, "Capabilities Endpoint: This instance is currently in maintenance mode.");
}
// {
// "ocs": {
// "data": {
// "capabilities": {
// "notes": {
// "api_version": [ "0.2", "1.0" ]
}
}
}

View file

@ -18,12 +18,12 @@ import com.nextcloud.android.sso.model.SingleSignOnAccount;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import it.niedermann.owncloud.notes.model.Capabilities;
import it.niedermann.owncloud.notes.model.LocalAccount;
import it.niedermann.owncloud.notes.persistence.CapabilitiesClient.Capabilities;
public class CapabilitiesWorker extends Worker {
private static final String TAG = Objects.requireNonNull(CapabilitiesWorker.class.getCanonicalName());
private static final String TAG = Objects.requireNonNull(CapabilitiesWorker.class.getSimpleName());
private static final String WORKER_TAG = "capabilities";
private static final Constraints constraints = new Constraints.Builder()
@ -46,7 +46,8 @@ public class CapabilitiesWorker extends Worker {
SingleSignOnAccount ssoAccount = AccountImporter.getSingleSignOnAccount(getApplicationContext(), account.getAccountName());
Log.i(TAG, "Refreshing capabilities for " + ssoAccount.name);
final Capabilities capabilities = CapabilitiesClient.getCapabilities(getApplicationContext(), ssoAccount);
// TODO Update capabilities for account in database
db.updateBrand(account.getId(), capabilities);
db.updateApiVersion(account.getId(), capabilities.getApiVersion());
Log.i(TAG, capabilities.toString());
} catch (Exception e) {
e.printStackTrace();

View file

@ -219,11 +219,10 @@ public class NoteServerSyncHelper {
return;
}
final NotesClient notesClient;
if (notesClients.containsKey(ssoAccount.name)) {
notesClient = notesClients.get(ssoAccount.name);
} else {
notesClient = notesClients.put(ssoAccount.name, NotesClient.newInstance(localAccount, context));
if (!notesClients.containsKey(ssoAccount.name)) {
notesClients.put(ssoAccount.name, NotesClient.newInstance(localAccount, context));
}
notesClient = notesClients.get(ssoAccount.name);
if (notesClient == null) {
Log.e(TAG, NotesClient.class.getSimpleName() + " for ssoAccount \"" + ssoAccount.name + "\" is null. Cannot synchronize.", new IllegalStateException());
return;
@ -497,7 +496,7 @@ public class NoteServerSyncHelper {
if (context instanceof ViewProvider && context instanceof AppCompatActivity) {
Snackbar.make(((ViewProvider) context).getView(), R.string.error_synchronization, Snackbar.LENGTH_LONG)
.setAction(R.string.simple_more, v -> ExceptionDialogFragment.newInstance(exceptions)
.show(((AppCompatActivity) context).getSupportFragmentManager(), ExceptionDialogFragment.class.getCanonicalName()))
.show(((AppCompatActivity) context).getSupportFragmentManager(), ExceptionDialogFragment.class.getSimpleName()))
.show();
}
}

View file

@ -34,7 +34,7 @@ import it.niedermann.owncloud.notes.util.ServerResponse.NotesResponse;
public abstract class NotesClient {
final static int MIN_NEXTCLOUD_FILES_APP_VERSION_CODE = 30090000;
private static final String TAG = NotesClient.class.getCanonicalName();
private static final String TAG = NotesClient.class.getSimpleName();
protected final Context appContext;

View file

@ -22,6 +22,9 @@ import androidx.annotation.WorkerThread;
import com.nextcloud.android.sso.model.SingleSignOnAccount;
import org.json.JSONArray;
import org.json.JSONException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
@ -35,6 +38,8 @@ import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.android.activity.EditNoteActivity;
import it.niedermann.owncloud.notes.android.appwidget.NoteListWidget;
import it.niedermann.owncloud.notes.android.appwidget.SingleNoteWidget;
import it.niedermann.owncloud.notes.model.ApiVersion;
import it.niedermann.owncloud.notes.model.Capabilities;
import it.niedermann.owncloud.notes.model.CloudNote;
import it.niedermann.owncloud.notes.model.DBNote;
import it.niedermann.owncloud.notes.model.DBStatus;
@ -655,7 +660,7 @@ public class NotesDatabase extends AbstractNotesDatabase {
public LocalAccount getAccount(long accountId) {
validateAccountId(accountId);
final SQLiteDatabase db = getReadableDatabase();
final Cursor cursor = db.query(table_accounts, new String[]{key_id, key_url, key_account_name, key_username, key_etag, key_modified, key_api_version, key_color, key_text_color}, key_id + " = ?", new String[]{accountId + ""}, null, null, null, null);
final Cursor cursor = db.query(table_accounts, new String[]{key_id, key_url, key_account_name, key_username, key_etag, key_modified, key_api_version, key_color, key_text_color}, key_id + " = ?", new String[]{String.valueOf(accountId)}, null, null, null, null);
final LocalAccount account = new LocalAccount();
while (cursor.moveToNext()) {
account.setId(cursor.getLong(0));
@ -717,6 +722,57 @@ public class NotesDatabase extends AbstractNotesDatabase {
return account;
}
public void updateBrand(long accountId, @NonNull Capabilities capabilities) throws IllegalArgumentException {
validateAccountId(accountId);
// Validate color format
Color.parseColor(capabilities.getColor());
Color.parseColor(capabilities.getTextColor());
final SQLiteDatabase db = this.getWritableDatabase();
final ContentValues values = new ContentValues();
values.put(key_color, capabilities.getColor().substring(1));
values.put(key_text_color, capabilities.getTextColor().substring(1));
final int updatedRows = db.update(table_accounts, values, key_id + " = ?", new String[]{String.valueOf(accountId)});
if (updatedRows == 1) {
Log.v(TAG, "Updated " + key_color + " to " + capabilities.getColor() + " and " + key_text_color + " to " + capabilities.getTextColor() + " for " + key_account_id + " = " + accountId);
} else {
Log.e(TAG, "Updated " + updatedRows + " but expected only 1 for accountId = " + accountId + " and " + key_color + " = " + capabilities.getColor() + " and " + key_text_color + " = " + capabilities.getTextColor());
}
}
public void updateApiVersion(long accountId, @Nullable String apiVersion) throws IllegalArgumentException {
validateAccountId(accountId);
if (apiVersion != null) {
try {
JSONArray apiVersions = new JSONArray(apiVersion);
for (int i = 0; i < apiVersions.length(); i++) {
ApiVersion.of(apiVersions.getString(i));
}
if (apiVersions.length() == 0) {
final SQLiteDatabase db = this.getWritableDatabase();
final ContentValues values = new ContentValues();
values.put(key_api_version, apiVersion);
final int updatedRows = db.update(table_accounts, values, key_id + " = ?", new String[]{String.valueOf(accountId)});
if (updatedRows == 1) {
Log.v(TAG, "Updated apiVersion to \"" + apiVersion + "\" for accountId = " + accountId);
} else {
Log.e(TAG, "Updated " + updatedRows + " but expected only 1 for accountId = " + accountId + " and apiVersion = \"" + apiVersion + "\"");
}
} else {
Log.i(TAG, "Given API version is a valid JSON array but does not contain any valid API versions. Do not update database.");
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("API version does contain a non-valid version.");
} catch (JSONException e) {
throw new IllegalArgumentException("API version must contain be a JSON array.");
}
} else {
Log.i(TAG, "Given API version is null. Do not update database");
}
}
/**
* @param accountId the id of the account that should be deleted
* @throws IllegalArgumentException if no account has been deleted by the given accountId
@ -724,14 +780,14 @@ public class NotesDatabase extends AbstractNotesDatabase {
public void deleteAccount(long accountId) throws IllegalArgumentException {
validateAccountId(accountId);
SQLiteDatabase db = this.getWritableDatabase();
int deletedAccounts = db.delete(table_accounts, key_id + " = ?", new String[]{accountId + ""});
int deletedAccounts = db.delete(table_accounts, key_id + " = ?", new String[]{String.valueOf(accountId)});
if (deletedAccounts < 1) {
Log.e(TAG, "AccountId '" + accountId + "' did not delete any account");
throw new IllegalArgumentException("The given accountId does not delete any row");
} else if (deletedAccounts > 1) {
Log.e(TAG, "AccountId '" + accountId + "' deleted unexpectedly '" + deletedAccounts + "' accounts");
}
final int deletedNotes = db.delete(table_notes, key_account_id + " = ?", new String[]{accountId + ""});
final int deletedNotes = db.delete(table_notes, key_account_id + " = ?", new String[]{String.valueOf(accountId)});
Log.v(TAG, "Deleted " + deletedNotes + " notes from account " + accountId);
}
@ -740,7 +796,7 @@ public class NotesDatabase extends AbstractNotesDatabase {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(key_etag, etag);
final int updatedRows = db.update(table_accounts, values, key_id + " = ?", new String[]{accountId + ""});
final int updatedRows = db.update(table_accounts, values, key_id + " = ?", new String[]{String.valueOf(accountId)});
if (updatedRows == 1) {
Log.v(TAG, "Updated etag to " + etag + " for accountId = " + accountId);
} else {
@ -756,7 +812,7 @@ public class NotesDatabase extends AbstractNotesDatabase {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(key_modified, modified);
final int updatedRows = db.update(table_accounts, values, key_id + " = ?", new String[]{accountId + ""});
final int updatedRows = db.update(table_accounts, values, key_id + " = ?", new String[]{String.valueOf(accountId)});
if (updatedRows == 1) {
Log.v(TAG, "Updated modified to " + modified + " for accountId = " + accountId);
} else {

View file

@ -24,7 +24,7 @@ import it.niedermann.owncloud.notes.model.LocalAccount;
public class SyncWorker extends Worker {
private static final String TAG = Objects.requireNonNull(SyncWorker.class.getCanonicalName());
private static final String TAG = Objects.requireNonNull(SyncWorker.class.getSimpleName());
private static final String WORKER_TAG = "background_synchronization";
private static final Constraints constraints = new Constraints.Builder()

View file

@ -19,7 +19,7 @@ import static android.content.Context.CLIPBOARD_SERVICE;
public class ClipboardUtil {
private static final String TAG = ClipboardUtil.class.getCanonicalName();
private static final String TAG = ClipboardUtil.class.getSimpleName();
private ClipboardUtil() {
// Util class

View file

@ -10,7 +10,7 @@ import android.util.Log;
*/
public class DeviceCredentialUtil {
private static final String TAG = DeviceCredentialUtil.class.getCanonicalName();
private static final String TAG = DeviceCredentialUtil.class.getSimpleName();
private DeviceCredentialUtil() {
// utility class -> private constructor

View file

@ -25,7 +25,7 @@ import it.niedermann.owncloud.notes.R;
@SuppressWarnings("WeakerAccess")
public class MarkDownUtil {
private static final String TAG = MarkDownUtil.class.getCanonicalName();
private static final String TAG = MarkDownUtil.class.getSimpleName();
public static final String CHECKBOX_UNCHECKED_MINUS = "- [ ]";
public static final String CHECKBOX_UNCHECKED_MINUS_TRAILING_SPACE = CHECKBOX_UNCHECKED_MINUS + " ";

View file

@ -13,7 +13,7 @@ import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.android.DarkModeSetting;
public class Notes extends Application {
private static final String TAG = Notes.class.getCanonicalName();
private static final String TAG = Notes.class.getSimpleName();
private static final long LOCK_TIME = 30 * 1000;
private static boolean lockedPreference = false;

View file

@ -15,7 +15,7 @@ import static it.niedermann.owncloud.notes.util.MarkDownUtil.CHECKBOX_UNCHECKED_
*/
public abstract class NotesTextWatcher implements TextWatcher {
private static final String TAG = NotesTextWatcher.class.getCanonicalName();
private static final String TAG = NotesTextWatcher.class.getSimpleName();
private static final String codeBlock = "```";

View file

@ -20,7 +20,7 @@ import static it.niedermann.owncloud.notes.util.MarkDownUtil.getStartOfLine;
public class ContextBasedFormattingCallback implements ActionMode.Callback {
private static final String TAG = ContextBasedFormattingCallback.class.getCanonicalName();
private static final String TAG = ContextBasedFormattingCallback.class.getSimpleName();
private final EditText editText;

View file

@ -16,7 +16,7 @@ import static it.niedermann.owncloud.notes.util.ClipboardUtil.getClipboardURLorN
public class ContextBasedRangeFormattingCallback implements ActionMode.Callback {
private static final String TAG = ContextBasedRangeFormattingCallback.class.getCanonicalName();
private static final String TAG = ContextBasedRangeFormattingCallback.class.getSimpleName();
private final EditText editText;