Merge pull request #744 from beatbrot/default-dark-mode

Add "System default" to darkmode settings
This commit is contained in:
Niedermann IT-Dienstleistungen 2020-03-01 18:33:32 +01:00 committed by GitHub
commit a294800c15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 183 additions and 74 deletions

View file

@ -0,0 +1,66 @@
package it.niedermann.owncloud.notes.android;
import androidx.appcompat.app.AppCompatDelegate;
import java.util.NoSuchElementException;
/**
* Possible values of the Dark Mode Setting.
* <p>
* The Dark Mode Setting can be stored in {@link android.content.SharedPreferences} as String by using {@link DarkModeSetting#name()} and received via {@link DarkModeSetting#valueOf(String)}.
* <p>
* Additionally, the equivalent {@link AppCompatDelegate}-Mode can be received via {@link #getModeId()}. To convert a {@link AppCompatDelegate}-Mode to a {@link DarkModeSetting}, use {@link #fromModeID(int)}
*
* @see AppCompatDelegate#MODE_NIGHT_YES
* @see AppCompatDelegate#MODE_NIGHT_NO
* @see AppCompatDelegate#MODE_NIGHT_FOLLOW_SYSTEM
*/
public enum DarkModeSetting {
// WARNING - The names of the constants must *NOT* be changed since they are used as keys in SharedPreferences
/**
* Always use light mode.
*/
LIGHT(AppCompatDelegate.MODE_NIGHT_NO),
/**
* Always use dark mode.
*/
DARK(AppCompatDelegate.MODE_NIGHT_YES),
/**
* Follow the global system setting for dark mode.
*/
SYSTEM_DEFAULT(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
private final int modeId;
DarkModeSetting(int modeId) {
this.modeId = modeId;
}
public int getModeId() {
return modeId;
}
/**
* Returns the instance of {@link DarkModeSetting} that corresponds to the ModeID of {@link AppCompatDelegate}
* <p>
* Possible ModeIDs are:
* <ul>
* <li>{@link AppCompatDelegate#MODE_NIGHT_YES}</li>
* <li>{@link AppCompatDelegate#MODE_NIGHT_NO}</li>
* <li>{@link AppCompatDelegate#MODE_NIGHT_FOLLOW_SYSTEM}</li>
* </ul>
*
* @param id One of the {@link AppCompatDelegate}-Night-Modes
* @return An instance of {@link DarkModeSetting}
*/
public static DarkModeSetting fromModeID(int id) {
for (DarkModeSetting value : DarkModeSetting.values()) {
if (value.modeId == id) {
return value;
}
}
throw new NoSuchElementException("No NightMode with ID " + id + " found");
}
}

View file

@ -58,7 +58,7 @@ public class SelectSingleNoteActivity extends NotesListViewActivity {
sp.putLong(SingleNoteWidget.WIDGET_KEY + appWidgetId, noteID);
sp.putLong(SingleNoteWidget.ACCOUNT_ID_KEY + appWidgetId, note.getAccountId());
sp.putBoolean(SingleNoteWidget.DARK_THEME_KEY + appWidgetId, Notes.getAppTheme(getApplicationContext()));
sp.putString(SingleNoteWidget.DARK_THEME_KEY + appWidgetId, Notes.getAppTheme(getApplicationContext()).name());
sp.apply();
Intent updateIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null,

View file

@ -13,8 +13,10 @@ import android.util.Log;
import android.widget.RemoteViews;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.android.DarkModeSetting;
import it.niedermann.owncloud.notes.android.activity.EditNoteActivity;
import it.niedermann.owncloud.notes.android.activity.NotesListViewActivity;
import it.niedermann.owncloud.notes.util.Notes;
public class NoteListWidget extends AppWidgetProvider {
private static final String TAG = NoteListWidget.class.getSimpleName();
@ -28,7 +30,7 @@ public class NoteListWidget extends AppWidgetProvider {
static void updateAppWidget(Context context, AppWidgetManager awm, int[] appWidgetIds) {
RemoteViews views;
boolean darkTheme;
DarkModeSetting darkTheme;
for (int appWidgetId : appWidgetIds) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
@ -40,12 +42,12 @@ 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 = NoteWidgetHelper.getDarkThemeSetting(sp, DARK_THEME_KEY, appWidgetId);
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.putExtra(NoteListWidget.DARK_THEME_KEY + appWidgetId, darkTheme.name());
serviceIntent.setData(Uri.parse(serviceIntent.toUri(Intent.URI_INTENT_SCHEME)));
if (displayMode == NLW_DISPLAY_CATEGORY) {
@ -70,7 +72,7 @@ public class NoteListWidget extends AppWidgetProvider {
(new Intent(context, EditNoteActivity.class)),
PendingIntent.FLAG_UPDATE_CURRENT);
if (darkTheme) {
if (Notes.isDarkThemeActive(context, darkTheme)) {
views = new RemoteViews(context.getPackageName(), R.layout.widget_note_list_dark);
views.setTextViewText(R.id.widget_note_list_title_tv_dark, getWidgetTitle(context, displayMode, category));
views.setOnClickPendingIntent(R.id.widget_note_header_icon_dark, openAppI);

View file

@ -100,7 +100,7 @@ public class NoteListWidgetConfiguration extends AppCompatActivity {
}
sp.putLong(NoteListWidget.ACCOUNT_ID_KEY + appWidgetId, localAccount.getId());
sp.putBoolean(NoteListWidget.DARK_THEME_KEY + appWidgetId, Notes.getAppTheme(getApplicationContext()));
sp.putString(NoteListWidget.DARK_THEME_KEY + appWidgetId, Notes.getAppTheme(getApplicationContext()).name());
sp.apply();
Intent updateIntent = new Intent( AppWidgetManager.ACTION_APPWIDGET_UPDATE, null,

View file

@ -13,9 +13,13 @@ import android.widget.RemoteViewsService;
import java.util.List;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.android.DarkModeSetting;
import it.niedermann.owncloud.notes.android.activity.EditNoteActivity;
import it.niedermann.owncloud.notes.model.DBNote;
import it.niedermann.owncloud.notes.persistence.NotesDatabase;
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 final Context context;
@ -32,7 +36,8 @@ public class NoteListWidgetFactory implements RemoteViewsService.RemoteViewsFact
AppWidgetManager.INVALID_APPWIDGET_ID);
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);
DarkModeSetting theme = NoteWidgetHelper.getDarkThemeSetting(sp, DARK_THEME_KEY, appWidgetId);
darkTheme = Notes.isDarkThemeActive(context, theme);
category = sp.getString(NoteListWidget.WIDGET_CATEGORY_KEY + appWidgetId, "");
accountId = sp.getLong(NoteListWidget.ACCOUNT_ID_KEY + appWidgetId, -1);
}

View file

@ -0,0 +1,23 @@
package it.niedermann.owncloud.notes.android.appwidget;
import android.content.SharedPreferences;
import it.niedermann.owncloud.notes.android.DarkModeSetting;
final class NoteWidgetHelper {
private NoteWidgetHelper() {
// Helper class for static methods
}
@SuppressWarnings("WeakerAccess") //Making it package-private would generate a warning in PMD
public static DarkModeSetting getDarkThemeSetting(SharedPreferences prefs, String darkModeKey, int appWidgetId) {
try {
String themeName = prefs.getString(darkModeKey + appWidgetId, DarkModeSetting.SYSTEM_DEFAULT.name());
return DarkModeSetting.valueOf(themeName);
} catch (ClassCastException e) {
//DARK_THEME was a boolean in older versions of the app. We thereofre have to still support the old setting.
boolean isDarkTheme = prefs.getBoolean(darkModeKey + appWidgetId, false);
return isDarkTheme ? DarkModeSetting.DARK : DarkModeSetting.LIGHT;
}
}
}

View file

@ -12,8 +12,10 @@ import android.preference.PreferenceManager;
import android.widget.RemoteViews;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.android.DarkModeSetting;
import it.niedermann.owncloud.notes.android.activity.EditNoteActivity;
import it.niedermann.owncloud.notes.android.fragment.BaseNoteFragment;
import it.niedermann.owncloud.notes.util.Notes;
public class SingleNoteWidget extends AppWidgetProvider {
@ -32,11 +34,11 @@ public class SingleNoteWidget extends AppWidgetProvider {
return;
}
boolean darkTheme = sp.getBoolean(DARK_THEME_KEY + appWidgetId, false);
DarkModeSetting darkTheme = NoteWidgetHelper.getDarkThemeSetting(sp, DARK_THEME_KEY, appWidgetId);
templateIntent.putExtra(BaseNoteFragment.PARAM_ACCOUNT_ID, sp.getLong(ACCOUNT_ID_KEY + appWidgetId, -1));
PendingIntent templatePendingIntent = PendingIntent.getActivity(context, appWidgetId, templateIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent.FLAG_UPDATE_CURRENT);
Intent serviceIntent = new Intent(context, SingleNoteWidgetService.class);
serviceIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
@ -44,7 +46,7 @@ public class SingleNoteWidget extends AppWidgetProvider {
RemoteViews views;
if (darkTheme) {
if (Notes.isDarkThemeActive(context, darkTheme)) {
views = new RemoteViews(context.getPackageName(), R.layout.widget_single_note_dark);
views.setPendingIntentTemplate(R.id.single_note_widget_lv_dark, templatePendingIntent);
views.setRemoteAdapter(R.id.single_note_widget_lv_dark, serviceIntent);
@ -73,7 +75,7 @@ public class SingleNoteWidget extends AppWidgetProvider {
AppWidgetManager awm = AppWidgetManager.getInstance(context);
updateAppWidget(context, AppWidgetManager.getInstance(context),
(awm.getAppWidgetIds(new ComponentName(context, SingleNoteWidget.class))));
(awm.getAppWidgetIds(new ComponentName(context, SingleNoteWidget.class))));
}
@Override

View file

@ -18,6 +18,9 @@ import it.niedermann.owncloud.notes.android.activity.EditNoteActivity;
import it.niedermann.owncloud.notes.model.DBNote;
import it.niedermann.owncloud.notes.persistence.NotesDatabase;
import it.niedermann.owncloud.notes.util.MarkDownUtil;
import it.niedermann.owncloud.notes.util.Notes;
import static it.niedermann.owncloud.notes.android.appwidget.SingleNoteWidget.DARK_THEME_KEY;
public class SingleNoteWidgetFactory implements RemoteViewsService.RemoteViewsFactory {
@ -28,19 +31,19 @@ public class SingleNoteWidgetFactory implements RemoteViewsService.RemoteViewsFa
private NotesDatabase db;
private DBNote note;
private final SharedPreferences sp;
private static Boolean darkTheme;
private boolean darkModeActive;
private static final String TAG = SingleNoteWidget.class.getSimpleName();
SingleNoteWidgetFactory(Context context, Intent intent) {
this.context = context;
appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);
AppWidgetManager.INVALID_APPWIDGET_ID);
sp = PreferenceManager.getDefaultSharedPreferences(this.context);
darkTheme = sp.getBoolean(SingleNoteWidget.DARK_THEME_KEY + appWidgetId, false);
darkModeActive = Notes.isDarkThemeActive(context, NoteWidgetHelper.getDarkThemeSetting(sp, DARK_THEME_KEY, appWidgetId));
markdownProcessor = new MarkdownProcessor(this.context);
markdownProcessor.factory(TextFactory.create());
markdownProcessor.config(MarkDownUtil.getMarkDownConfiguration(this.context, darkTheme).build());
markdownProcessor.config(MarkDownUtil.getMarkDownConfiguration(this.context, darkModeActive).build());
}
@Override
@ -101,7 +104,7 @@ public class SingleNoteWidgetFactory implements RemoteViewsService.RemoteViewsFa
extras.putLong(EditNoteActivity.PARAM_ACCOUNT_ID, note.getAccountId());
fillInIntent.putExtras(extras);
fillInIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
if (darkTheme) {
if (darkModeActive) {
note_content = new RemoteViews(context.getPackageName(), R.layout.widget_single_note_content_dark);
note_content.setOnClickFillInIntent(R.id.single_note_content_tv_dark, fillInIntent);
note_content.setTextViewText(R.id.single_note_content_tv_dark, markdownProcessor.parse(note.getContent()));

View file

@ -10,6 +10,7 @@ import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.SwitchPreference;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.android.DarkModeSetting;
import it.niedermann.owncloud.notes.persistence.SyncWorker;
import it.niedermann.owncloud.notes.util.Notes;
@ -26,10 +27,10 @@ public class PreferencesFragment extends PreferenceFragmentCompat {
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.preferences);
final SwitchPreference themePref = findPreference(getString(R.string.pref_key_theme));
final ListPreference themePref = findPreference(getString(R.string.pref_key_theme));
assert themePref != null;
themePref.setOnPreferenceChangeListener((preference, newValue) -> {
Notes.setAppTheme((Boolean) newValue);
Notes.setAppTheme(DarkModeSetting.valueOf((String) newValue));
getActivity().setResult(Activity.RESULT_OK);
getActivity().recreate();
return true;

View file

@ -16,7 +16,9 @@ import androidx.annotation.Nullable;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
import it.niedermann.owncloud.notes.android.DarkModeSetting;
import it.niedermann.owncloud.notes.android.appwidget.NoteListWidget;
import it.niedermann.owncloud.notes.android.appwidget.SingleNoteWidget;
import it.niedermann.owncloud.notes.model.DBStatus;
@ -29,7 +31,7 @@ abstract class AbstractNotesDatabase extends SQLiteOpenHelper {
private static final String TAG = AbstractNotesDatabase.class.getSimpleName();
private static final int database_version = 10;
private static final int database_version = 11;
private final Context context;
protected static final String database_name = "OWNCLOUD_NOTES";
@ -245,6 +247,19 @@ abstract class AbstractNotesDatabase extends SQLiteOpenHelper {
}
cursor.close();
}
if (oldVersion < 11) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = sharedPreferences.edit();
Map<String, ?> prefs = sharedPreferences.getAll();
for (Map.Entry<String, ?> pref : prefs.entrySet()) {
String key = pref.getKey();
if ("darkTheme".equals(key) || key.startsWith(NoteListWidget.DARK_THEME_KEY) || key.startsWith(SingleNoteWidget.DARK_THEME_KEY)) {
Boolean darkTheme = (Boolean) pref.getValue();
editor.putString(pref.getKey(), darkTheme ? DarkModeSetting.DARK.name() : DarkModeSetting.LIGHT.name());
}
}
editor.apply();
}
}
@Override

View file

@ -36,7 +36,7 @@ public class MarkDownUtil {
* @return RxMDConfiguration
*/
public static Builder getMarkDownConfiguration(Context context) {
return getMarkDownConfiguration(context, Notes.getAppTheme(context));
return getMarkDownConfiguration(context, Notes.isDarkThemeActive(context));
}
public static Builder getMarkDownConfiguration(Context context, Boolean darkTheme) {

View file

@ -3,9 +3,13 @@ package it.niedermann.owncloud.notes.util;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.preference.PreferenceManager;
import androidx.appcompat.app.AppCompatDelegate;
import it.niedermann.owncloud.notes.android.DarkModeSetting;
public class Notes extends Application {
private static final String DARK_THEME = "darkTheme";
@ -15,16 +19,32 @@ public class Notes extends Application {
super.onCreate();
}
public static void setAppTheme(Boolean darkTheme) {
if (darkTheme) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
public static void setAppTheme(DarkModeSetting setting) {
AppCompatDelegate.setDefaultNightMode(setting.getModeId());
}
public static DarkModeSetting getAppTheme(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String mode;
try {
mode = prefs.getString(DARK_THEME, DarkModeSetting.SYSTEM_DEFAULT.name());
} catch (ClassCastException e) {
boolean darkModeEnabled = prefs.getBoolean(DARK_THEME, false);
mode = darkModeEnabled ? DarkModeSetting.DARK.name() : DarkModeSetting.LIGHT.name();
}
return DarkModeSetting.valueOf(mode);
}
public static boolean isDarkThemeActive(Context context, DarkModeSetting setting) {
if (setting == DarkModeSetting.SYSTEM_DEFAULT) {
return isDarkThemeActive(context);
} else {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
return setting == DarkModeSetting.DARK;
}
}
public static boolean getAppTheme(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
return prefs.getBoolean(DARK_THEME, false);
public static boolean isDarkThemeActive(Context context) {
int uiMode = context.getResources().getConfiguration().uiMode;
return (uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
}
}

View file

@ -83,7 +83,6 @@
<string name="shortcut_create_long">Create a new note</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Light</string>
<string name="pref_value_font_normal">Normal</string>
<string name="simple_error">Error</string>
<string name="simple_close">Close</string>

View file

@ -91,7 +91,6 @@
<string name="shortcut_create_long">Crea una nota nova</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Clar</string>
<string name="pref_value_font_normal">Normal</string>
<string name="pref_value_wifi_and_mobile">Sincronitza per Wi-Fi i dades mòbils</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Vytvořit novou poznámku</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Světlý</string>
<string name="pref_value_font_normal">Normální</string>
<string name="pref_value_wifi_and_mobile">Synchronizovat přes Wi-Fi a mobilní data</string>

View file

@ -83,7 +83,6 @@
<!-- Shortcuts -->
<string name="shortcut_create_long">Creu nodyn newydd</string>
<string name="pref_value_theme_light">Golau</string>
<string name="pref_value_font_normal">Arferol</string>
<string name="pref_value_wifi_and_mobile">Cysoni dros Wi-Fi a data symudol</string>
<string name="simple_error">Gwall</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Opret en ny note</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Lys</string>
<string name="pref_value_font_normal">Normal</string>
<string name="pref_value_wifi_and_mobile">Synk på Wi-Fi og mobil data</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Neue Notiz erstellen</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Hell</string>
<string name="pref_value_font_normal">Normal</string>
<string name="pref_value_wifi_and_mobile">Über WLAN und mobile Daten synchronisieren</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Δημιουργία νέας σημείωσης</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Φωτεινό</string>
<string name="pref_value_font_normal">Κανονικό</string>
<string name="pref_value_wifi_and_mobile">Συγχρονισμός μόνο σε Wi-Fi και δεδομένα κινητού</string>

View file

@ -82,7 +82,6 @@
<string name="shortcut_create_long">Crear una nota nueva</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Claro</string>
<string name="pref_value_font_normal">Normal</string>
<string name="simple_error">Error</string>
<string name="simple_close">Cerrar</string>

View file

@ -77,7 +77,6 @@
<!-- Shortcuts -->
<string name="shortcut_create_long">Crear una nota nueva</string>
<string name="pref_value_theme_light">Claro</string>
<string name="pref_value_font_normal">Normal</string>
<string name="simple_error">Error</string>
<string name="simple_close">Cerrar</string>

View file

@ -77,7 +77,6 @@
<!-- Shortcuts -->
<string name="shortcut_create_long">Crear una nota nueva</string>
<string name="pref_value_theme_light">Claro</string>
<string name="pref_value_font_normal">Normal</string>
<string name="simple_error">Error</string>
<string name="simple_close">Cerrar</string>

View file

@ -77,7 +77,6 @@
<!-- Shortcuts -->
<string name="shortcut_create_long">Crear una nota nueva</string>
<string name="pref_value_theme_light">Claro</string>
<string name="pref_value_font_normal">Normal</string>
<string name="simple_error">Error</string>
<string name="simple_close">Cerrar</string>

View file

@ -77,7 +77,6 @@
<!-- Shortcuts -->
<string name="shortcut_create_long">Crear una nota nueva</string>
<string name="pref_value_theme_light">Claro</string>
<string name="pref_value_font_normal">Normal</string>
<string name="simple_error">Error</string>
<string name="simple_close">Cerrar</string>

View file

@ -77,7 +77,6 @@
<!-- Shortcuts -->
<string name="shortcut_create_long">Crear una nota nueva</string>
<string name="pref_value_theme_light">Claro</string>
<string name="pref_value_font_normal">Normal</string>
<string name="simple_error">Error</string>
<string name="simple_close">Cerrar</string>

View file

@ -77,7 +77,6 @@
<!-- Shortcuts -->
<string name="shortcut_create_long">Crear una nota nueva</string>
<string name="pref_value_theme_light">Claro</string>
<string name="pref_value_font_normal">Normal</string>
<string name="simple_error">Error</string>
<string name="simple_close">Cerrar</string>

View file

@ -79,7 +79,6 @@
<!-- Shortcuts -->
<string name="shortcut_create_long">Crear una nota nueva</string>
<string name="pref_value_theme_light">Claro</string>
<string name="pref_value_font_normal">Normal</string>
<string name="simple_error">Error</string>
<string name="simple_close">Cerrar</string>

View file

@ -77,7 +77,6 @@
<!-- Shortcuts -->
<string name="shortcut_create_long">Crear una nota nueva</string>
<string name="pref_value_theme_light">Claro</string>
<string name="pref_value_font_normal">Normal</string>
<string name="simple_error">Error</string>
<string name="simple_close">Cerrar</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Crear una nota nueva</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Claro</string>
<string name="pref_value_font_normal">Normal</string>
<string name="pref_value_wifi_and_mobile">Sincronizar sobre Wi-Fi y datos móviles</string>

View file

@ -91,7 +91,6 @@
<string name="shortcut_create_long">Sortu ohar berria</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Argia</string>
<string name="pref_value_font_normal">Normala</string>
<string name="pref_value_wifi_and_mobile">Sinkronizatu wifi eta datu mugikorrekin</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">ساختن یادداشت جدید</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">روشن</string>
<string name="pref_value_font_normal">معمولی</string>
<string name="pref_value_wifi_and_mobile">همگام سازی داده های Wi-Fi و تلفن همراه</string>

View file

@ -79,7 +79,6 @@
<string name="shortcut_create_long">Luo uusi muistiinpano</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Vaalea</string>
<string name="pref_value_font_normal">Normaali</string>
<string name="pref_value_wifi_and_mobile">Synkronoi wifi- ja mobiilidatayhteydellä</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Créer une nouvelle note</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Clair</string>
<string name="pref_value_font_normal">Normal</string>
<string name="pref_value_wifi_and_mobile">Synchroniser en Wifi et données mobiles</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Crear unha nota nova</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Claro</string>
<string name="pref_value_font_normal">Normal</string>
<string name="pref_value_wifi_and_mobile">Sincronización con WiFi e con datos móbiles</string>

View file

@ -83,7 +83,6 @@
<string name="shortcut_create_long">יצירת פתק חדש</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">בהיר</string>
<string name="pref_value_font_normal">רגיל</string>
<string name="pref_value_wifi_and_mobile">עדכון דרך רשת אלחוטית ונתונים סלולריים</string>

View file

@ -89,7 +89,6 @@
<string name="shortcut_create_long">Stvori novu bilješku</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Svijetlo</string>
<string name="pref_value_font_normal">Normalno</string>
<string name="pref_value_wifi_and_mobile">Sinkronizacija putem bežičnih (Wi-Fi) i mobilnih podataka</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Új jegyzet létrehozása</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Világos</string>
<string name="pref_value_font_normal">Normál</string>
<string name="pref_value_wifi_and_mobile">Szinkronizálás Wi-Fin és mobil adatkapcsolaton</string>

View file

@ -83,7 +83,6 @@
<string name="shortcut_create_long">Búa til nýjan minnispunkt</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Ljóst</string>
<string name="pref_value_font_normal">Venjulegt</string>
<string name="pref_value_wifi_and_mobile">Samstilla á WiFi-neti og farsímatengingu</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Crea una nuova nota</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Chiaro</string>
<string name="pref_value_font_normal">Normale</string>
<string name="pref_value_wifi_and_mobile">Sincronizza su Wi-FI e dati mobili</string>

View file

@ -89,7 +89,6 @@
<string name="shortcut_create_long">新しいノートを作成</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">ライト</string>
<string name="pref_value_font_normal">ノーマル</string>
<string name="pref_value_wifi_and_mobile">Wi-Fiおよびモバイル接続時に同期する</string>

View file

@ -73,7 +73,6 @@
<!-- Shortcuts -->
<string name="shortcut_create_long">새 메모 쓰기</string>
<string name="pref_value_theme_light">밝게</string>
<string name="pref_value_font_normal">일반</string>
<string name="simple_error">오류</string>
<string name="simple_close">닫기</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Sukurti naujus užrašus</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Šviesus</string>
<string name="pref_value_font_normal">Normalus</string>
<string name="pref_value_wifi_and_mobile">Sinchronizuoti naudojant belaidį (Wi-Fi) ir mobiliuosius duomenis</string>

View file

@ -87,7 +87,6 @@
<string name="shortcut_create_long">Opprett et nytt notat</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Lys</string>
<string name="pref_value_font_normal">Normal</string>
<string name="pref_value_wifi_and_mobile">Synkroniser med WiFi og mobil data</string>

View file

@ -97,7 +97,6 @@
<string name="shortcut_create_long">Maak een nieuwe notitie</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Licht</string>
<string name="pref_value_font_normal">Normaal</string>
<string name="pref_value_wifi_and_mobile">Sync met Wi-Fi en mobiele data</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Utwórz nową notatkę</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Jasny</string>
<string name="pref_value_font_normal">Podstawowy</string>
<string name="pref_value_wifi_and_mobile">Synchronizacja w sieci Wi-Fi i komórkowej transmisji danych</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Criar uma nova anotação</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Claro</string>
<string name="pref_value_font_normal">Normal</string>
<string name="pref_value_wifi_and_mobile">Sincronizar por Wi-Fi e dados móveis</string>

View file

@ -85,7 +85,6 @@
<string name="shortcut_create_long">Создать новую заметку</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Светлая</string>
<string name="pref_value_font_normal">Обычный</string>
<string name="pref_value_wifi_and_mobile">Синхр. по Wi-Fi и мобильной связи</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Vytvoriť novú poznámku</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Svetlý</string>
<string name="pref_value_font_normal">Normálne</string>
<string name="pref_value_wifi_and_mobile">Synchronizovať na Wi-Fi a mobilných dátach</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Ustvari novo zabeležko</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Svetla</string>
<string name="pref_value_font_normal">Običajno</string>
<string name="pref_value_wifi_and_mobile">Usklajuj na Wi-Fi in mobilni povezavi</string>

View file

@ -78,7 +78,6 @@
<!-- Shortcuts -->
<string name="shortcut_create_long">Krijo një shënim të ri</string>
<string name="pref_value_theme_light">E çelët</string>
<string name="pref_value_font_normal">Normal</string>
<string name="simple_error">Error</string>
<string name="simple_close">Mbylleni</string>

View file

@ -87,7 +87,6 @@
<string name="shortcut_create_long">Napravi novu belešku</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Svetla</string>
<string name="pref_value_font_normal">Normalna</string>
<string name="pref_value_wifi_and_mobile">Sinhronizuj i na bežičnoj i na mobilnoj vezi</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Направи нову белешку</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Светла</string>
<string name="pref_value_font_normal">Нормална</string>
<string name="pref_value_wifi_and_mobile">Синхронизуј и на бежичној и на мобилној вези</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Skapa en ny anteckning</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Ljus</string>
<string name="pref_value_font_normal">Normal</string>
<string name="pref_value_wifi_and_mobile">Synkronisera med Wi-Fi och mobil data</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">Not ekle</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">ık</string>
<string name="pref_value_font_normal">Normal</string>
<string name="pref_value_wifi_and_mobile">Wi-Fi ve mobil veri ile eşitlensin</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">创建新便笺</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">浅色主题</string>
<string name="pref_value_font_normal">普通</string>
<string name="pref_value_wifi_and_mobile">在有 Wi-Fi 和移动数据网络时同步</string>

View file

@ -96,7 +96,6 @@
<string name="shortcut_create_long">建立新筆記</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">亮色</string>
<string name="pref_value_font_normal">一般</string>
<string name="pref_value_wifi_and_mobile">在使用 Wi-Fi 及行動網路時同步</string>

View file

@ -10,6 +10,11 @@
<item>@string/pref_value_font_size_medium</item>
<item>@string/pref_value_font_size_large</item>
</string-array>
<string-array name="darkMode_values">
<item>@string/pref_value_theme_light</item>
<item>@string/pref_value_theme_dark</item>
<item>@string/pref_value_theme_system_default</item>
</string-array>
<string-array name="sync_values">
<item>@string/pref_value_sync_off</item>
<item>@string/pref_value_sync_15_minutes</item>

View file

@ -125,8 +125,10 @@
<string name="pref_value_sync_15_minutes" translatable="false">15_minutes</string>
<string name="pref_value_sync_1_hour" translatable="false">1_hour</string>
<string name="pref_value_sync_6_hours" translatable="false">6_hours</string>
<string name="pref_value_theme_light" translatable="false">LIGHT</string>
<string name="pref_value_theme_dark" translatable="false">DARK</string>
<string name="pref_value_theme_system_default" translatable="false">SYSTEM_DEFAULT</string>
<!-- These values should not be translateable. They should be migrated at some point. -->
<string name="pref_value_theme_light">Light</string>
<string name="pref_value_font_normal">Normal</string>
<string name="pref_value_wifi_and_mobile">Sync on Wi-Fi and mobile data</string>
@ -179,6 +181,12 @@
<item>6 hours</item>
</string-array>
<string-array name="darkmode_entries">
<item>Light</item>
<item>Dark</item>
<item>System Default</item>
</string-array>
<!-- Plurals -->
<plurals name="ab_selected">
<item quantity="one">%d selected</item>

View file

@ -11,8 +11,11 @@
android:summary="%s"
android:title="@string/settings_note_mode" />
<SwitchPreference
android:defaultValue="@string/pref_value_theme_light"
<ListPreference
android:defaultValue="@string/pref_value_theme_system_default"
android:entries="@array/darkmode_entries"
android:entryValues="@array/darkMode_values"
android:summary="%s"
android:icon="@drawable/ic_brightness_2_grey_24dp"
android:key="@string/pref_key_theme"
android:layout="@layout/item_pref"