Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e93775d authored by stefan-niedermann's avatar stefan-niedermann
Browse files

Fix some Codacy issues

parent 4ff91983
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
                        shortcutManager.addDynamicShortcuts(newShortcuts);
                    }
                }
            }).run();
            }).start();
        }

        @Override
@@ -381,11 +381,11 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
                adapterCategories.setSelectedItem(item.id);

                // update current selection
                if (itemRecent == item) {
                if (itemRecent.equals(item)) {
                    navigationSelection = new Category(null, null);
                } else if (itemFavorites == item) {
                } else if (itemFavorites.equals(item)) {
                    navigationSelection = new Category(null, true);
                } else if (itemUncategorized == item) {
                } else if (itemUncategorized.equals(item)) {
                    navigationSelection = new Category("", null);
                } else {
                    navigationSelection = new Category(item.label, null);
@@ -531,18 +531,16 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
        NavigationAdapter adapterMenu = new NavigationAdapter(new NavigationAdapter.ClickListener() {
            @Override
            public void onItemClick(NavigationAdapter.NavigationItem item) {
                if (item == itemSettings) {
                if (itemSettings.equals(item)) {
                    Intent settingsIntent = new Intent(getApplicationContext(), PreferencesActivity.class);
                    startActivityForResult(settingsIntent, server_settings);
                } else if (item == itemAbout) {
                } else if (itemAbout.equals(item)) {
                    Intent aboutIntent = new Intent(getApplicationContext(), AboutActivity.class);
                    startActivityForResult(aboutIntent, about);
                } else if (item == itemTrashbin) {
                    if (localAccount != null) {
                } else if (itemTrashbin.equals(item) && localAccount != null) {
                    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(localAccount.getUrl() + "/index.php/apps/files/?dir=/&view=trashbin")));
                }
            }
            }

            @Override
            public void onIconClick(NavigationAdapter.NavigationItem item) {
+1 −1
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ public class NoteListWidget extends AppWidgetProvider {
            case NoteListWidget.NLW_DISPLAY_STARRED:
                return context.getString(R.string.label_favorites);
            case NoteListWidget.NLW_DISPLAY_CATEGORY:
                if (category.equals("")) {
                if ("".equals(category)) {
                    return context.getString(R.string.action_uncategorized);
                } else {
                    return category;
+2 −2
Original line number Diff line number Diff line
@@ -86,9 +86,9 @@ public class NoteListWidgetConfiguration extends AppCompatActivity {
            public void onItemClick(NavigationAdapter.NavigationItem item) {
                SharedPreferences.Editor sp = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit();

                if (item == itemRecent) {
                if (itemRecent.equals(item)) {
                    sp.putInt(NoteListWidget.WIDGET_MODE_KEY + appWidgetId, NoteListWidget.NLW_DISPLAY_ALL);
                } else if (item == itemFavorites) {
                } else if (itemFavorites.equals(item)) {
                    sp.putInt(NoteListWidget.WIDGET_MODE_KEY + appWidgetId, NoteListWidget.NLW_DISPLAY_STARRED);
                } else {
                    String category = "";
+2 −4
Original line number Diff line number Diff line
@@ -20,19 +20,17 @@ import it.niedermann.owncloud.notes.persistence.NoteSQLiteOpenHelper;
public class NoteListWidgetFactory implements RemoteViewsService.RemoteViewsFactory {
    private final Context context;
    private final int displayMode;
    private final int appWidgetId;
    private final boolean darkTheme;
    private String category;
    private final SharedPreferences sp;
    private NoteSQLiteOpenHelper db;
    private List<DBNote> dbNotes;
    private long accountId;

    NoteListWidgetFactory(Context context, Intent intent) {
        this.context = context;
        appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
        final int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
                AppWidgetManager.INVALID_APPWIDGET_ID);
        sp = PreferenceManager.getDefaultSharedPreferences(this.context);
        final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this.context);
        displayMode = sp.getInt(NoteListWidget.WIDGET_MODE_KEY + appWidgetId, -1);
        darkTheme = sp.getBoolean(NoteListWidget.DARK_THEME_KEY + appWidgetId, false);
        category = sp.getString(NoteListWidget.WIDGET_CATEGORY_KEY + appWidgetId, "");
+6 −6
Original line number Diff line number Diff line
@@ -48,12 +48,6 @@ public abstract class BaseNoteFragment extends Fragment implements CategoryDialo

    private static final String TAG = BaseNoteFragment.class.getSimpleName();

    public interface NoteFragmentListener {
        void close();

        void onNoteUpdated(DBNote note);
    }

    private static final int MENU_ID_PIN = -1;
    public static final String PARAM_NOTE_ID = "noteId";
    public static final String PARAM_ACCOUNT_ID = "accountId";
@@ -393,4 +387,10 @@ public abstract class BaseNoteFragment extends Fragment implements CategoryDialo
        db.setCategory(note, category, null);
        listener.onNoteUpdated(note);
    }

    public interface NoteFragmentListener {
        void close();

        void onNoteUpdated(DBNote note);
    }
}
Loading