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

Commit aa5a7742 authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

Merge branch 'Issue-2829' into 'master'

2829-P,Q-Dark mode implementation

See merge request e/apps/notes!20
parents f358b394 965df19e
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@
            android:name="foundation.e.notes.android.activity.EditNoteActivity"
            android:label="@string/simple_edit"
            android:launchMode="singleTask"
            android:theme="@style/Preferences"
            android:parentActivityName="foundation.e.notes.android.activity.NotesListViewActivity"
            android:windowSoftInputMode="stateHidden">
            <intent-filter android:label="@string/action_create">
@@ -79,6 +80,7 @@
        <activity
            android:name="foundation.e.notes.android.activity.AboutActivity"
            android:label="@string/simple_about"
            android:theme="@style/Preferences"
            android:parentActivityName="foundation.e.notes.android.activity.NotesListViewActivity" />
        <activity
            android:name="foundation.e.notes.android.activity.SelectSingleNoteActivity"
+3 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import androidx.appcompat.view.ActionMode;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.recyclerview.widget.ItemTouchHelper;
@@ -341,7 +342,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
        drawerToggle.setHomeAsUpIndicator(lineageos.platform.R.drawable.ic_hamburger);

        if (toolbar.getNavigationIcon() != null)
            toolbar.getNavigationIcon().setTint(getResources().getColor(lineageos.platform.R.color.color_default_accent));
            toolbar.getNavigationIcon().setTint(ContextCompat.getColor(this, lineageos.platform.R.color.color_default_accent));

        drawerToggle.setToolbarNavigationClickListener(new View.OnClickListener() {
            @Override
@@ -753,6 +754,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        // Check which request we're responding to
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == create_note_cmd) {
            // Make sure the request was successful
            if (resultCode == RESULT_OK) {
+0 −1
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ public class SelectSingleNoteActivity extends NotesListViewActivity {
        SharedPreferences.Editor sp = PreferenceManager.getDefaultSharedPreferences(this).edit();

        sp.putLong(SingleNoteWidget.WIDGET_KEY + appWidgetId, noteID);
        sp.putBoolean(SingleNoteWidget.DARK_THEME_KEY + appWidgetId, Notes.getAppTheme(getApplicationContext()));
        sp.apply();

        Intent updateIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null,
+2 −4
Original line number Diff line number Diff line
@@ -15,11 +15,11 @@ import android.widget.RemoteViews;
import foundation.e.notes.android.activity.EditNoteActivity;
import foundation.e.notes.android.activity.NotesListViewActivity;
import foundation.e.notes.R;
import foundation.e.notes.util.Notes;

public class NoteListWidget extends AppWidgetProvider {
    public static final String WIDGET_MODE_KEY = "NLW_mode";
    public static final String WIDGET_CATEGORY_KEY = "NLW_cat";
    public static final String DARK_THEME_KEY = "NLW_darkTheme";
    public static final int NLW_DISPLAY_ALL = 0;
    public static final int NLW_DISPLAY_STARRED = 1;
    public static final int NLW_DISPLAY_CATEGORY = 2;
@@ -38,12 +38,11 @@ public class NoteListWidget extends AppWidgetProvider {
            }

            String category = sp.getString(NoteListWidget.WIDGET_CATEGORY_KEY + appWidgetId, null);
            darkTheme = sp.getBoolean(NoteListWidget.DARK_THEME_KEY + appWidgetId, false);
            darkTheme = Notes.getAppTheme(context);

            Intent serviceIntent = new Intent(context, NoteListWidgetService.class);
            serviceIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
            serviceIntent.putExtra(NoteListWidget.WIDGET_MODE_KEY + appWidgetId, displayMode);
            serviceIntent.putExtra(NoteListWidget.DARK_THEME_KEY + appWidgetId, darkTheme);
            serviceIntent.setData(Uri.parse(serviceIntent.toUri(Intent.URI_INTENT_SCHEME)));

            if (displayMode == NLW_DISPLAY_CATEGORY) {
@@ -131,7 +130,6 @@ public class NoteListWidget extends AppWidgetProvider {
        for (int appWidgetId : appWidgetIds) {
            editor.remove(WIDGET_MODE_KEY + appWidgetId);
            editor.remove(WIDGET_CATEGORY_KEY + appWidgetId);
            editor.remove(DARK_THEME_KEY + appWidgetId);
        }

        editor.apply();
+2 −17
Original line number Diff line number Diff line
@@ -4,23 +4,17 @@ import android.app.Activity;
import android.appwidget.AppWidgetManager;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.Toast;

import androidx.annotation.ColorInt;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -29,13 +23,6 @@ import foundation.e.notes.android.activity.NotesListViewActivity;
import foundation.e.notes.model.NavigationAdapter;
import foundation.e.notes.persistence.NoteSQLiteOpenHelper;
import foundation.e.notes.persistence.NoteServerSyncHelper;
import foundation.e.notes.util.Notes;
import foundation.e.notes.R;
import foundation.e.notes.android.activity.NotesListViewActivity;
import foundation.e.notes.model.NavigationAdapter;
import foundation.e.notes.persistence.NoteSQLiteOpenHelper;
import foundation.e.notes.persistence.NoteServerSyncHelper;
import foundation.e.notes.util.Notes;

public class NoteListWidgetConfiguration extends AppCompatActivity {
    private static final String TAG = Activity.class.getSimpleName();
@@ -101,8 +88,6 @@ public class NoteListWidgetConfiguration extends AppCompatActivity {
                    sp.putInt(NoteListWidget.WIDGET_MODE_KEY + appWidgetId, NoteListWidget.NLW_DISPLAY_CATEGORY);
                    sp.putString(NoteListWidget.WIDGET_CATEGORY_KEY + appWidgetId, category);
                }

                sp.putBoolean(NoteListWidget.DARK_THEME_KEY + appWidgetId, Notes.getAppTheme(getApplicationContext()));
                sp.apply();

                Intent updateIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null,
Loading