Fix some linter issues

Signed-off-by: stefan-niedermann <info@niedermann.it>
This commit is contained in:
stefan-niedermann 2020-02-24 19:54:58 +01:00
parent c426e1839c
commit 98e8754e94
32 changed files with 115 additions and 138 deletions

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="it.niedermann.owncloud.notes">
<uses-permission android:name="android.permission.INTERNET" />
@ -14,7 +15,8 @@
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:targetApi="n">
<activity
android:name="it.niedermann.owncloud.notes.android.activity.SplashscreenActivity"
@ -44,19 +46,22 @@
android:value="it.niedermann.owncloud.notes.android.activity.NotesListViewActivity" />
</activity>
<activity
android:name="it.niedermann.owncloud.notes.android.activity.ExceptionActivity"
android:label="@string/app_name" />
<activity
android:name="it.niedermann.owncloud.notes.android.activity.PreferencesActivity"
android:label="@string/action_settings"
android:parentActivityName="it.niedermann.owncloud.notes.android.activity.NotesListViewActivity"
android:windowSoftInputMode="stateHidden"
/>
android:windowSoftInputMode="stateHidden" />
<activity
android:name="it.niedermann.owncloud.notes.android.activity.EditNoteActivity"
android:label="@string/simple_edit"
android:launchMode="singleTask"
android:parentActivityName="it.niedermann.owncloud.notes.android.activity.NotesListViewActivity"
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTask">
android:windowSoftInputMode="stateHidden">
<intent-filter android:label="@string/action_create">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
@ -64,13 +69,14 @@
</intent-filter>
<!-- Voice command "note to self" in google search -->
<intent-filter android:label="@string/action_create">
<action android:name="com.google.android.gm.action.AUTO_SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
<action android:name="com.google.android.gm.action.AUTO_SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content" />
<data android:host="*" />
<data android:mimeType="text/*" />
@ -82,8 +88,7 @@
android:label="@string/simple_about"
android:parentActivityName="it.niedermann.owncloud.notes.android.activity.NotesListViewActivity" />
<activity
android:name=".android.activity.SelectSingleNoteActivity">
<activity android:name=".android.activity.SelectSingleNoteActivity">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
@ -145,9 +150,9 @@
<service
android:name="it.niedermann.owncloud.notes.android.quicksettings.NewNoteTileService"
android:description="@string/action_create"
android:icon="@drawable/ic_quicksettings_new"
android:label="@string/action_create"
android:description="@string/action_create"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />

View file

@ -30,22 +30,20 @@ import it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper.ViewProvide
public class MultiSelectedActionModeCallback implements Callback {
private Context context;
private ViewProvider viewProvider;
private NoteSQLiteOpenHelper db;
private ActionMode actionMode;
private ItemAdapter adapter;
private RecyclerView recyclerView;
private Runnable refreshLists;
private FragmentManager fragmentManager;
private SearchView searchView;
private final Context context;
private final ViewProvider viewProvider;
private final NoteSQLiteOpenHelper db;
private final ItemAdapter adapter;
private final RecyclerView recyclerView;
private final Runnable refreshLists;
private final FragmentManager fragmentManager;
private final SearchView searchView;
public MultiSelectedActionModeCallback(
Context context, ViewProvider viewProvider, NoteSQLiteOpenHelper db, ActionMode actionMode, ItemAdapter adapter, RecyclerView recyclerView, Runnable refreshLists, FragmentManager fragmentManager, SearchView searchView) {
this.context = context;
this.viewProvider = viewProvider;
this.db = db;
this.actionMode = actionMode;
this.adapter = adapter;
this.recyclerView = recyclerView;
this.refreshLists = refreshLists;
@ -120,7 +118,6 @@ public class MultiSelectedActionModeCallback implements Callback {
@Override
public void onDestroyActionMode(ActionMode mode) {
adapter.clearSelection(recyclerView);
actionMode = null;
adapter.notifyDataSetChanged();
}
}

View file

@ -44,7 +44,7 @@ public class AboutActivity extends AppCompatActivity {
private class TabsPagerAdapter extends FragmentPagerAdapter {
TabsPagerAdapter(FragmentManager fragmentManager) {
super(fragmentManager);
super(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
}
@Override

View file

@ -142,7 +142,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
private ActionMode mActionMode;
private NoteSQLiteOpenHelper db = null;
private SearchView searchView = null;
private ISyncCallback syncCallBack = () -> {
private final ISyncCallback syncCallBack = () -> {
adapter.clearSelection(listView);
if (mActionMode != null) {
mActionMode.finish();
@ -262,7 +262,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
private void setupHeader() {
accountChooser.removeAllViews();
for (LocalAccount localAccount : db.getAccounts()) {
View v = getLayoutInflater().inflate(R.layout.item_account, null);
View v = View.inflate(this, R.layout.item_account, null);
((TextView) v.findViewById(R.id.accountItemLabel)).setText(localAccount.getAccountName());
Glide
.with(this)
@ -293,7 +293,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
});
accountChooser.addView(v);
}
View addButton = getLayoutInflater().inflate(R.layout.item_account, null);
View addButton = View.inflate(this, R.layout.item_account, null);
((TextView) addButton.findViewById(R.id.accountItemLabel)).setText(getString(R.string.add_account));
((AppCompatImageView) addButton.findViewById(R.id.accountItemAvatar)).setImageResource(R.drawable.ic_person_add_grey600_24dp);
addButton.setOnClickListener((btn) -> askForNewAccount(this));

View file

@ -21,10 +21,10 @@ public class NoteListWidgetFactory implements RemoteViewsService.RemoteViewsFact
private final Context context;
private final int displayMode;
private final boolean darkTheme;
private String category;
private final String category;
private final long accountId;
private NoteSQLiteOpenHelper db;
private List<DBNote> dbNotes;
private long accountId;
NoteListWidgetFactory(Context context, Intent intent) {
this.context = context;

View file

@ -21,13 +21,13 @@ import it.niedermann.owncloud.notes.util.MarkDownUtil;
public class SingleNoteWidgetFactory implements RemoteViewsService.RemoteViewsFactory {
private MarkdownProcessor markdownProcessor;
private final MarkdownProcessor markdownProcessor;
private final Context context;
private final int appWidgetId;
private NoteSQLiteOpenHelper db;
private DBNote note;
private SharedPreferences sp;
private final SharedPreferences sp;
private static Boolean darkTheme;
private static final String TAG = SingleNoteWidget.class.getSimpleName();

View file

@ -25,11 +25,11 @@ import it.niedermann.owncloud.notes.model.LocalAccount;
public class AccountChooserAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
@NonNull
private List<LocalAccount> localAccounts;
private final List<LocalAccount> localAccounts;
@NonNull
private AccountChooserListener accountChooserListener;
private final AccountChooserListener accountChooserListener;
@NonNull
private Context context;
private final Context context;
AccountChooserAdapter(@NonNull List<LocalAccount> localAccounts, @NonNull AccountChooserListener accountChooserListener, @NonNull Context context) {
super();
@ -49,9 +49,7 @@ public class AccountChooserAdapter extends RecyclerView.Adapter<RecyclerView.Vie
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
LocalAccount localAccount = localAccounts.get(position);
AccountChooserViewHolder accountChooserViewHolder = (AccountChooserViewHolder) holder;
accountChooserViewHolder.accountLayout.setOnClickListener((v) -> {
accountChooserListener.onAccountChosen(localAccount);
});
accountChooserViewHolder.accountLayout.setOnClickListener((v) -> accountChooserListener.onAccountChosen(localAccount));
Glide
.with(context)

View file

@ -48,16 +48,16 @@ public class AccountChooserDialogFragment extends AppCompatDialogFragment implem
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View view = requireActivity().getLayoutInflater().inflate(R.layout.dialog_choose_account, null);
View view = View.inflate(getContext(), R.layout.dialog_choose_account, null);
ButterKnife.bind(this, view);
NoteSQLiteOpenHelper db = NoteSQLiteOpenHelper.getInstance(getActivity());
List<LocalAccount> accountsList = db.getAccounts();
RecyclerView.Adapter adapter = new AccountChooserAdapter(accountsList, this, getActivity());
RecyclerView.Adapter adapter = new AccountChooserAdapter(accountsList, this, requireActivity());
accountRecyclerView.setAdapter(adapter);
return new AlertDialog.Builder(getActivity())
return new AlertDialog.Builder(requireActivity())
.setView(view)
.setTitle(R.string.simple_move)
.setNegativeButton(android.R.string.cancel, null)

View file

@ -26,8 +26,6 @@ import com.nextcloud.android.sso.exceptions.NoCurrentAccountSelectedException;
import com.nextcloud.android.sso.helper.SingleAccountHelper;
import com.nextcloud.android.sso.model.SingleSignOnAccount;
import java.util.Objects;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.android.activity.EditNoteActivity;
import it.niedermann.owncloud.notes.android.fragment.CategoryDialogFragment.CategoryDialogListener;
@ -69,23 +67,23 @@ public abstract class BaseNoteFragment extends Fragment implements CategoryDialo
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
this.ssoAccount = SingleAccountHelper.getCurrentSingleSignOnAccount(getActivity().getApplicationContext());
this.ssoAccount = SingleAccountHelper.getCurrentSingleSignOnAccount(requireActivity().getApplicationContext());
this.localAccount = db.getLocalAccountByAccountName(ssoAccount.name);
if (savedInstanceState == null) {
long id = getArguments().getLong(PARAM_NOTE_ID);
long id = requireArguments().getLong(PARAM_NOTE_ID);
if (id > 0) {
long accountId = getArguments().getLong(PARAM_ACCOUNT_ID);
long accountId = requireArguments().getLong(PARAM_ACCOUNT_ID);
if (accountId > 0) {
/* Switch account if account id has been provided */
this.localAccount = db.getAccount(accountId);
SingleAccountHelper.setCurrentAccount(getActivity().getApplicationContext(), localAccount.getAccountName());
SingleAccountHelper.setCurrentAccount(requireActivity().getApplicationContext(), localAccount.getAccountName());
}
isNew = false;
note = originalNote = db.getNote(localAccount.getId(), id);
} else {
CloudNote cloudNote = (CloudNote) getArguments().getSerializable(PARAM_NEWNOTE);
String content = getArguments().getString(PARAM_CONTENT);
CloudNote cloudNote = (CloudNote) requireArguments().getSerializable(PARAM_NEWNOTE);
String content = requireArguments().getString(PARAM_CONTENT);
if (cloudNote == null) {
if (content == null) {
throw new IllegalArgumentException(PARAM_NOTE_ID + " is not given, argument " + PARAM_NEWNOTE + " is missing and " + PARAM_CONTENT + " is missing.");
@ -194,7 +192,7 @@ public abstract class BaseNoteFragment extends Fragment implements CategoryDialo
showCategorySelector();
return true;
case R.id.menu_move:
AccountChooserDialogFragment.newInstance().show(Objects.requireNonNull(getFragmentManager()), BaseNoteFragment.class.getCanonicalName());
AccountChooserDialogFragment.newInstance().show(requireActivity().getSupportFragmentManager(), BaseNoteFragment.class.getCanonicalName());
return true;
case R.id.menu_share:
Intent shareIntent = new Intent();
@ -216,25 +214,31 @@ public abstract class BaseNoteFragment extends Fragment implements CategoryDialo
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
ShortcutManager shortcutManager = requireActivity().getSystemService(ShortcutManager.class);
if (shortcutManager.isRequestPinShortcutSupported()) {
Intent intent = new Intent(getActivity(), EditNoteActivity.class);
intent.putExtra(EditNoteActivity.PARAM_NOTE_ID, note.getId());
intent.setAction(ACTION_SHORTCUT);
if(shortcutManager != null) {
if (shortcutManager.isRequestPinShortcutSupported()) {
Intent intent = new Intent(getActivity(), EditNoteActivity.class);
intent.putExtra(EditNoteActivity.PARAM_NOTE_ID, note.getId());
intent.setAction(ACTION_SHORTCUT);
ShortcutInfo pinShortcutInfo = new ShortcutInfo.Builder(getActivity(), note.getId() + "")
.setShortLabel(note.getTitle())
.setIcon(Icon.createWithResource(getActivity().getApplicationContext(), note.isFavorite() ? R.drawable.ic_star_yellow_24dp : R.drawable.ic_star_grey_ccc_24dp))
.setIntent(intent)
.build();
ShortcutInfo pinShortcutInfo = new ShortcutInfo.Builder(getActivity(), note.getId() + "")
.setShortLabel(note.getTitle())
.setIcon(Icon.createWithResource(requireActivity().getApplicationContext(), note.isFavorite() ? R.drawable.ic_star_yellow_24dp : R.drawable.ic_star_grey_ccc_24dp))
.setIntent(intent)
.build();
Intent pinnedShortcutCallbackIntent =
shortcutManager.createShortcutResultIntent(pinShortcutInfo);
Intent pinnedShortcutCallbackIntent =
shortcutManager.createShortcutResultIntent(pinShortcutInfo);
PendingIntent successCallback = PendingIntent.getBroadcast(getActivity(), /* request code */ 0,
pinnedShortcutCallbackIntent, /* flags */ 0);
PendingIntent successCallback = PendingIntent.getBroadcast(getActivity(), /* request code */ 0,
pinnedShortcutCallbackIntent, /* flags */ 0);
shortcutManager.requestPinShortcut(pinShortcutInfo,
successCallback.getIntentSender());
shortcutManager.requestPinShortcut(pinShortcutInfo,
successCallback.getIntentSender());
} else {
Log.i(TAG, "RequestPinShortcut is not supported");
}
} else {
Log.e(TAG, "ShortcutManager is null");
}
}
@ -292,7 +296,7 @@ public abstract class BaseNoteFragment extends Fragment implements CategoryDialo
*/
private void showCategorySelector() {
final String fragmentId = "fragment_category";
FragmentManager manager = Objects.requireNonNull(getFragmentManager());
FragmentManager manager = requireActivity().getSupportFragmentManager();
Fragment frag = manager.findFragmentByTag(fragmentId);
if (frag != null) {
manager.beginTransaction().remove(frag).commit();

View file

@ -28,8 +28,8 @@ public class CategoryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
@NonNull
private List<NavigationItem> categories = new ArrayList<>();
@NonNull
private CategoryListener listener;
private Context context;
private final CategoryListener listener;
private final Context context;
CategoryAdapter(@NonNull Context context, @NonNull CategoryListener categoryListener) {
this.context = context;

View file

@ -19,7 +19,6 @@ import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import java.util.Objects;
import butterknife.BindView;
import butterknife.ButterKnife;
@ -68,8 +67,8 @@ public class CategoryDialogFragment extends AppCompatDialogFragment {
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
if (getArguments() != null && getArguments().containsKey(PARAM_ACCOUNT_ID)) {
accountId = getArguments().getLong(PARAM_ACCOUNT_ID);
if (requireArguments() != null && requireArguments().containsKey(PARAM_ACCOUNT_ID)) {
accountId = requireArguments().getLong(PARAM_ACCOUNT_ID);
} else {
throw new IllegalArgumentException("Provide at least \"" + PARAM_ACCOUNT_ID + "\"");
}
@ -87,12 +86,12 @@ public class CategoryDialogFragment extends AppCompatDialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View dialogView = requireActivity().getLayoutInflater().inflate(R.layout.dialog_change_category, null);
View dialogView = View.inflate(getContext(), R.layout.dialog_change_category, null);
ButterKnife.bind(this, dialogView);
if (savedInstanceState == null) {
if (getArguments() != null && getArguments().containsKey(PARAM_CATEGORY)) {
editCategory.setText(getArguments().getString(PARAM_CATEGORY));
if (requireArguments().containsKey(PARAM_CATEGORY)) {
editCategory.setText(requireArguments().getString(PARAM_CATEGORY));
}
} else if (savedInstanceState.containsKey(STATE_CATEGORY)) {
editCategory.setText(savedInstanceState.getString(STATE_CATEGORY));

View file

@ -11,8 +11,8 @@ import java.util.Calendar;
*/
public class DBNote extends CloudNote implements Item, Serializable {
private long id;
private long accountId;
private final long id;
private final long accountId;
private DBStatus status;
private String excerpt;

View file

@ -29,7 +29,7 @@ public class ItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final NoteClickListener noteClickListener;
private List<Item> itemList;
private boolean showCategory = true;
private List<Integer> selected;
private final List<Integer> selected;
public ItemAdapter(@NonNull NoteClickListener noteClickListener) {
this.itemList = new ArrayList<>();
@ -170,10 +170,10 @@ public class ItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
public class NoteViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener, View.OnClickListener {
@BindView(R.id.noteSwipeable)
public View noteSwipeable;
View noteSwipeFrame;
ImageView noteFavoriteLeft;
ImageView noteDeleteRight;
TextView noteTitle;
final View noteSwipeFrame;
final ImageView noteFavoriteLeft;
final ImageView noteDeleteRight;
final TextView noteTitle;
@BindView(R.id.noteCategory)
TextView noteCategory;
@BindView(R.id.noteExcerpt)

View file

@ -107,7 +107,7 @@ public class NavigationAdapter extends RecyclerView.Adapter<NavigationAdapter.Vi
private List<NavigationItem> items = new ArrayList<>();
private String selectedItem = null;
@NonNull
private ClickListener clickListener;
private final ClickListener clickListener;
public NavigationAdapter(@NonNull ClickListener clickListener) {
this.clickListener = clickListener;

View file

@ -88,8 +88,8 @@ public class NoteSQLiteOpenHelper extends SQLiteOpenHelper {
private static NoteSQLiteOpenHelper instance;
private NoteServerSyncHelper serverSyncHelper;
private Context context;
private final NoteServerSyncHelper serverSyncHelper;
private final Context context;
private NoteSQLiteOpenHelper(Context context) {
super(context, database_name, null, database_version);
@ -115,12 +115,12 @@ public class NoteSQLiteOpenHelper extends SQLiteOpenHelper {
*/
@Override
public void onCreate(SQLiteDatabase db) {
createAccountTable(db, table_accounts);
createNotesTable(db, table_notes);
createAccountTable(db);
createNotesTable(db);
}
private void createNotesTable(@NonNull SQLiteDatabase db, @NonNull String tableName) {
db.execSQL("CREATE TABLE " + tableName + " ( " +
private void createNotesTable(@NonNull SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + table_notes + " ( " +
key_id + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
key_remote_id + " INTEGER, " +
key_account_id + " INTEGER, " +
@ -136,8 +136,8 @@ public class NoteSQLiteOpenHelper extends SQLiteOpenHelper {
createNotesIndexes(db);
}
private void createAccountTable(@NonNull SQLiteDatabase db, @NonNull String tableName) {
db.execSQL("CREATE TABLE " + tableName + " ( " +
private void createAccountTable(@NonNull SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + table_accounts + " ( " +
key_id + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
key_url + " TEXT, " +
key_username + " TEXT, " +
@ -147,6 +147,7 @@ public class NoteSQLiteOpenHelper extends SQLiteOpenHelper {
createAccountIndexes(db);
}
@SuppressWarnings("deprecation")
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion < 3) {
@ -191,7 +192,7 @@ public class NoteSQLiteOpenHelper extends SQLiteOpenHelper {
}
if (oldVersion < 9) {
// Create accounts table
createAccountTable(db, table_accounts);
createAccountTable(db);
// Add accountId to notes table
db.execSQL("ALTER TABLE " + table_notes + " ADD COLUMN " + key_account_id + " INTEGER NOT NULL DEFAULT 0");

View file

@ -67,8 +67,8 @@ public class NoteServerSyncHelper {
private static NoteServerSyncHelper instance;
private NoteSQLiteOpenHelper db;
private Context context;
private final NoteSQLiteOpenHelper db;
private final Context context;
// Track network connection changes using a BroadcastReceiver
private boolean isSyncPossible = false;
@ -79,6 +79,7 @@ public class NoteServerSyncHelper {
/**
* @see <a href="https://stackoverflow.com/a/3104265">Do not make this a local variable.</a>
*/
@SuppressWarnings("FieldCanBeLocal")
private SharedPreferences.OnSharedPreferenceChangeListener onSharedPreferenceChangeListener = (SharedPreferences prefs, String key) -> {
if (syncOnlyOnWifiKey.equals(key)) {
syncOnlyOnWifi = prefs.getBoolean(syncOnlyOnWifiKey, false);
@ -101,13 +102,13 @@ public class NoteServerSyncHelper {
};
// current state of the synchronization
private Map<String, Boolean> syncActive = new HashMap<>();
private Map<String, Boolean> syncScheduled = new HashMap<>();
private NotesClient notesClient;
private final Map<String, Boolean> syncActive = new HashMap<>();
private final Map<String, Boolean> syncScheduled = new HashMap<>();
private final NotesClient notesClient;
// list of callbacks for both parts of synchronziation
private Map<String, List<ISyncCallback>> callbacksPush = new HashMap<>();
private Map<String, List<ISyncCallback>> callbacksPull = new HashMap<>();
private final Map<String, List<ISyncCallback>> callbacksPush = new HashMap<>();
private final Map<String, List<ISyncCallback>> callbacksPull = new HashMap<>();
private NoteServerSyncHelper(NoteSQLiteOpenHelper db) {
this.db = db;
@ -286,7 +287,7 @@ public class NoteServerSyncHelper {
private final SingleSignOnAccount ssoAccount;
private final boolean onlyLocalChanges;
@NonNull private final Map<String, List<ISyncCallback>> callbacks = new HashMap<>();
@NonNull private List<Throwable> exceptions = new ArrayList<>();
@NonNull private final List<Throwable> exceptions = new ArrayList<>();
SyncTask(@NonNull LocalAccount localAccount, @NonNull SingleSignOnAccount ssoAccount, boolean onlyLocalChanges) {
this.localAccount = localAccount;

View file

@ -35,7 +35,7 @@ public class NotesClient {
private static final String TAG = NotesClient.class.getSimpleName();
private final Context appContext;
private static Map<String, NextcloudAPI> mNextcloudAPIs = new HashMap<>();
private static final Map<String, NextcloudAPI> mNextcloudAPIs = new HashMap<>();
/**
* This entity class is used to return relevant data of the HTTP reponse.
@ -112,7 +112,6 @@ public class NotesClient {
*
* @param note {@link CloudNote} - the new Note
* @return Created Note including generated Title, ID and lastModified-Date
* @throws Exception
*/
NoteResponse createNote(SingleSignOnAccount ssoAccount, CloudNote note) throws Exception {
return putNote(ssoAccount, note, "notes", METHOD_POST);

View file

@ -25,7 +25,7 @@ public abstract class NotesTextWatcher implements TextWatcher {
private boolean afterTextChangedHandeled = false;
private int resetSelectionTo = -1;
private EditText editText;
private final EditText editText;
protected NotesTextWatcher(EditText editText) {
this.editText = editText;

View file

@ -42,6 +42,7 @@ public class SupportUtil {
if (Build.VERSION.SDK_INT >= 24) {
return Html.fromHtml(source, Html.FROM_HTML_MODE_LEGACY);
} else {
//noinspection deprecation
return Html.fromHtml(source);
}
}

View file

@ -21,7 +21,7 @@ public class ContextBasedFormattingCallback implements ActionMode.Callback {
private static final String TAG = ContextBasedFormattingCallback.class.getCanonicalName();
private EditText editText;
private final EditText editText;
public ContextBasedFormattingCallback(EditText editText) {
this.editText = editText;

View file

@ -18,7 +18,7 @@ public class ContextBasedRangeFormattingCallback implements ActionMode.Callback
private static final String TAG = ContextBasedRangeFormattingCallback.class.getCanonicalName();
private EditText editText;
private final EditText editText;
public ContextBasedRangeFormattingCallback(EditText editText) {
this.editText = editText;

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Selector is used for Background Colors in List Items -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- :selected -->
<item android:color="@color/fg_default_low" android:state_enabled="false" />
<item android:color="@color/fg_default" />
</selector>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!-- Selector is used for Background Colors in List Items -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- :selected -->
<item android:color="@color/fg_default_high" android:state_enabled="false" />
<item android:color="@color/fg_contrast" />
</selector>

View file

@ -1,5 +0,0 @@
<vector android:height="24dp" android:tint="#757575"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M2.5,4v3h5v12h3L10.5,7h5L15.5,4h-13zM21.5,9h-9v3h3v7h3v-7h3L21.5,9z"/>
</vector>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!-- Selector is used for Header Color in List Items -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- :selected -->
<item android:color="@color/fg_default_selection" android:state_activated="true" />
<item android:color="@color/fg_default" />
</selector>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!-- Selector is used for Sub Title Color in List Items -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- :selected -->
<!--item android:color="@color/fg_contrast" android:state_activated="true"/-->
<item android:color="@color/fg_default_low" />
</selector>

View file

@ -16,6 +16,7 @@
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/change_category_title"
android:importantForAutofill="no"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>

View file

@ -9,7 +9,7 @@
android:orientation="vertical"
android:padding="@dimen/activity_horizontal_margin">
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"

View file

@ -2,7 +2,6 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/widget_background">
<ListView

View file

@ -7,7 +7,6 @@
<!-- Buttons -->
<dimen name="button_padding">16dp</dimen>
<dimen name="button_elevation">5dp</dimen>
<dimen name="primary_font_size">16sp</dimen>
<dimen name="secondary_font_size">14sp</dimen>

View file

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:initialKeyguardLayout="@layout/widget_create_note"
android:initialLayout="@layout/widget_create_note"
android:minHeight="40dp"
android:minWidth="40dp"
android:minHeight="40dp"
android:previewImage="@drawable/ic_widget_create"
android:resizeMode="none"
android:text="@string/widget_create_note"
android:updatePeriodMillis="86400000"
android:widgetCategory="home_screen"
android:text="@string/widget_create_note"
android:resizeMode="none"></appwidget-provider>
tools:targetApi="jelly_bean_mr1" />

View file

@ -40,6 +40,7 @@ public class NoteLinksUtilsTest extends TestCase {
Assert.assertEquals(markdown, NoteLinksUtils.replaceNoteLinksWithDummyUrls(markdown, Collections.emptySet()));
}
@SuppressWarnings("MarkdownUnresolvedFileReference")
public void testDoNotReplaceNormalLinks() {
//language=md
String markdown = "[normal link](https://example.com) and another [note link](123456)";