summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2020-09-08 16:52:55 -0700
committerXin Li <delphij@google.com>2020-09-08 16:52:55 -0700
commit66674a4b40b19440f6855f78f5d6b6184bf70742 (patch)
treeb0f66e2bacf9250c370f5455691ab68403acbbe7
parentd4b1d127f1b96756c424f606c3308d73cb450dcc (diff)
parent9963fbe1afc0c8ecaeeb6709b509a973d581edff (diff)
downloadbuild-66674a4b40b19440f6855f78f5d6b6184bf70742.tar.gz
Merge Android R
Bug: 168057903 Merged-In: Iaee18ba48fc5a8ec511074dd10d69c383e92583b Change-Id: Ie95a9023e5a251cbb5414b16adb92c1dd8ee1e9a
-rw-r--r--prebuilts/androidtv/sample-inputs/app/src/main/java/com/example/android/sampletvinput/player/TvInputPlayer.java3
-rw-r--r--prebuilts/gradle/DarkTheme/.google/packaging.yaml13
-rw-r--r--prebuilts/gradle/DarkTheme/Application/build.gradle76
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/AndroidManifest.xml42
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/ColorUtils.java45
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/DarkThemeApplication.java33
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/MainActivity.java121
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/PreferencesFragment.java38
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/SettingsFragment.java47
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/ThemeHelper.java49
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/WelcomeFragment.java38
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/color/color_on_primary_mask.xml25
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/bottom_nav_item_background.xml21
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_brightness.xml26
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_brightness_2.xml30
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_dashboard.xml26
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_home.xml26
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_launcher_foreground.xml12
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_more_vert.xml26
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_settings.xml26
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/layout/activity_main.xml59
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/layout/fragment_preferences.xml98
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/layout/fragment_welcome.xml46
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/menu/main_menu.xml25
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/menu/navigation.xml35
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-hdpi/ic_launcher.pngbin0 -> 1279 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-hdpi/ic_launcher_round.pngbin0 -> 3249 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-mdpi/ic_launcher.pngbin0 -> 890 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-mdpi/ic_launcher_round.pngbin0 -> 1951 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xhdpi/ic_launcher.pngbin0 -> 1662 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xhdpi/ic_launcher_round.pngbin0 -> 4448 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxhdpi/ic_launcher.pngbin0 -> 2869 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxhdpi/ic_launcher_round.pngbin0 -> 7212 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.pngbin0 -> 4093 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxxhdpi/ic_launcher_round.pngbin0 -> 10846 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values-night/colors.xml25
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values-sw600dp/template-dimens.xml24
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values-sw600dp/template-styles.xml25
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values-v11/template-styles.xml22
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values-v21/base-template-styles.xml24
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values-v28/arrays.xml32
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values/arrays.xml32
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values/base-strings.xml30
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values/colors.xml25
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values/dimens.xml24
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values/ic_launcher_background.xml4
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values/strings.xml33
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values/styles.xml28
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values/template-dimens.xml32
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/values/template-styles.xml42
-rw-r--r--prebuilts/gradle/DarkTheme/Application/src/main/res/xml/preferences.xml35
-rw-r--r--prebuilts/gradle/DarkTheme/CONTRIBUTING.md35
-rw-r--r--prebuilts/gradle/DarkTheme/LICENSE203
-rw-r--r--prebuilts/gradle/DarkTheme/README.md165
-rw-r--r--prebuilts/gradle/DarkTheme/build.gradle3
-rw-r--r--prebuilts/gradle/DarkTheme/gradle.properties22
-rw-r--r--prebuilts/gradle/DarkTheme/gradle/wrapper/gradle-wrapper.jarbin0 -> 49896 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xprebuilts/gradle/DarkTheme/gradlew164
-rw-r--r--prebuilts/gradle/DarkTheme/gradlew.bat90
-rw-r--r--prebuilts/gradle/DarkTheme/screenshots/dark_1_welcome.pngbin0 -> 49992 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/screenshots/dark_3_settings.pngbin0 -> 42312 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/screenshots/dark_4_theme_options.pngbin0 -> 66537 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/screenshots/light_1_welcome.pngbin0 -> 49157 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/screenshots/light_2_preferences.pngbin0 -> 88942 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/screenshots/light_3_settings.pngbin0 -> 40991 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/screenshots/light_4_theme_options.pngbin0 -> 69448 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/screenshots/smart_dark_2_preferences.pngbin0 -> 89866 bytes
-rw-r--r--prebuilts/gradle/DarkTheme/settings.gradle2
70 files changed, 2112 insertions, 1 deletions
diff --git a/prebuilts/androidtv/sample-inputs/app/src/main/java/com/example/android/sampletvinput/player/TvInputPlayer.java b/prebuilts/androidtv/sample-inputs/app/src/main/java/com/example/android/sampletvinput/player/TvInputPlayer.java
index 30ee4128..f54b2581 100644
--- a/prebuilts/androidtv/sample-inputs/app/src/main/java/com/example/android/sampletvinput/player/TvInputPlayer.java
+++ b/prebuilts/androidtv/sample-inputs/app/src/main/java/com/example/android/sampletvinput/player/TvInputPlayer.java
@@ -452,7 +452,8 @@ public class TvInputPlayer implements TextRenderer {
} catch (PackageManager.NameNotFoundException e) {
versionName = "?";
}
- return "SampleTvInput/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE +
+ return "SampleTvInput/" + versionName + " (Linux;Android "
+ + Build.VERSION.RELEASE_OR_CODENAME +
") " + "ExoPlayerLib/" + ExoPlayerLibraryInfo.VERSION;
}
diff --git a/prebuilts/gradle/DarkTheme/.google/packaging.yaml b/prebuilts/gradle/DarkTheme/.google/packaging.yaml
new file mode 100644
index 00000000..36ce395a
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/.google/packaging.yaml
@@ -0,0 +1,13 @@
+
+# GOOGLE SAMPLE PACKAGING DATA
+#
+# This file is used by Google as part of our samples packaging process.
+# End users may safely ignore this file. It has no relevance to other systems.
+---
+status: PUBLISHED
+technologies: [Android]
+categories: [UI]
+languages: [Java]
+solutions: [Mobile]
+github: android-DarkTheme
+license: apache2
diff --git a/prebuilts/gradle/DarkTheme/Application/build.gradle b/prebuilts/gradle/DarkTheme/Application/build.gradle
new file mode 100644
index 00000000..f151085e
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/build.gradle
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+buildscript {
+ repositories {
+ google()
+ jcenter()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.3.2'
+ }
+}
+
+apply plugin: 'com.android.application'
+
+repositories {
+ google()
+ jcenter()
+}
+
+dependencies {
+ implementation 'com.google.android.material:material:1.1.0-alpha08'
+ implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
+ implementation 'androidx.preference:preference:1.1.0-rc01'
+}
+
+// The sample build uses multiple directories to
+// keep boilerplate and common code separate from
+// the main sample code.
+List<String> dirs = [
+ 'main', // main sample code; look here for the interesting stuff.
+ 'common', // components that are reused by multiple samples
+ 'template'] // boilerplate code that is generated by the sample template process
+
+android {
+ compileSdkVersion 29
+
+ defaultConfig {
+ minSdkVersion 14
+ targetSdkVersion 29
+ vectorDrawables.useSupportLibrary true
+ }
+
+ compileOptions {
+ sourceCompatibility 1.8
+ targetCompatibility 1.8
+ }
+
+ sourceSets {
+ main {
+ dirs.each { dir ->
+ java.srcDirs "src/${dir}/java"
+ res.srcDirs "src/${dir}/res"
+ }
+ }
+ androidTest.setRoot('tests')
+ androidTest.java.srcDirs = ['tests/src']
+
+ }
+
+}
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/AndroidManifest.xml b/prebuilts/gradle/DarkTheme/Application/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..a64f88a9
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.darktheme"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <application
+ android:name=".DarkThemeApplication"
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/DarkThemeApp">
+
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/ColorUtils.java b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/ColorUtils.java
new file mode 100644
index 00000000..f831ab0b
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/ColorUtils.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.darktheme;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Color;
+
+import androidx.annotation.AttrRes;
+import androidx.annotation.ColorInt;
+import androidx.annotation.NonNull;
+
+public class ColorUtils {
+
+ /**
+ * Queries the theme of the given {@code context} for a theme color.
+ *
+ * @param context the context holding the current theme.
+ * @param attrResId the theme color attribute to resolve.
+ * @return the theme color
+ */
+ @ColorInt
+ public static int getThemeColor(@NonNull Context context, @AttrRes int attrResId) {
+ TypedArray a = context.obtainStyledAttributes(null, new int[]{attrResId});
+ try {
+ return a.getColor(0, Color.MAGENTA);
+ } finally {
+ a.recycle();
+ }
+ }
+}
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/DarkThemeApplication.java b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/DarkThemeApplication.java
new file mode 100644
index 00000000..bd8dac4f
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/DarkThemeApplication.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.darktheme;
+
+import android.app.Application;
+import android.content.SharedPreferences;
+
+import androidx.preference.PreferenceManager;
+
+public class DarkThemeApplication extends Application {
+
+ public void onCreate() {
+ super.onCreate();
+ SharedPreferences sharedPreferences =
+ PreferenceManager.getDefaultSharedPreferences(this);
+ String themePref = sharedPreferences.getString("themePref", ThemeHelper.DEFAULT_MODE);
+ ThemeHelper.applyTheme(themePref);
+ }
+}
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/MainActivity.java b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/MainActivity.java
new file mode 100644
index 00000000..6d9a2659
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/MainActivity.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.darktheme;
+
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+
+import com.google.android.material.bottomnavigation.BottomNavigationView;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import androidx.core.graphics.drawable.DrawableCompat;
+import androidx.fragment.app.Fragment;
+
+public class MainActivity extends AppCompatActivity {
+
+ private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationListener
+ = new BottomNavigationView.OnNavigationItemSelectedListener() {
+
+ @Override
+ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.navigation_home:
+ showFragment(WelcomeFragment.TAG);
+ return true;
+ case R.id.navigation_preferences:
+ showFragment(PreferencesFragment.TAG);
+ return true;
+ case R.id.navigation_settings:
+ showFragment(SettingsFragment.TAG);
+ return true;
+ }
+ return false;
+ }
+ };
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
+
+ BottomNavigationView navigation = findViewById(R.id.navigation);
+ navigation.setOnNavigationItemSelectedListener(mOnNavigationListener);
+
+ if (savedInstanceState == null) {
+ showFragment(WelcomeFragment.TAG);
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main_menu, menu);
+
+ // This demonstrates how to programmatically tint a drawable
+ MenuItem item = menu.findItem(R.id.action_more);
+ Drawable drawableWrap = DrawableCompat.wrap(item.getIcon()).mutate();
+ DrawableCompat.setTint(drawableWrap, ColorUtils.getThemeColor(this, R.attr.colorOnPrimary));
+ item.setIcon(drawableWrap);
+
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ int id = item.getItemId();
+ if (id == R.id.action_more) {
+ // TODO
+ return true;
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+
+ private void showFragment(@NonNull String tag) {
+ Fragment fragment = getSupportFragmentManager().findFragmentByTag(tag);
+ if (fragment == null) {
+ switch (tag) {
+ case WelcomeFragment.TAG: {
+ fragment = new WelcomeFragment();
+ break;
+ }
+ case PreferencesFragment.TAG: {
+ fragment = new PreferencesFragment();
+ break;
+ }
+ case SettingsFragment.TAG: {
+ fragment = new SettingsFragment();
+ break;
+ }
+ default: {
+ fragment = new WelcomeFragment();
+ break;
+ }
+ }
+ }
+
+ getSupportFragmentManager()
+ .beginTransaction()
+ .replace(R.id.fragment_layout, fragment, tag)
+ .commit();
+ }
+}
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/PreferencesFragment.java b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/PreferencesFragment.java
new file mode 100644
index 00000000..f5608cdc
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/PreferencesFragment.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.darktheme;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
+public class PreferencesFragment extends Fragment {
+
+ static final String TAG = "PreferencesFragmentTag";
+
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+ @Nullable Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_preferences, container, false);
+ }
+}
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/SettingsFragment.java b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/SettingsFragment.java
new file mode 100644
index 00000000..de31f150
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/SettingsFragment.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.darktheme;
+
+import android.os.Bundle;
+
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.preference.ListPreference;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceFragmentCompat;
+
+public class SettingsFragment extends PreferenceFragmentCompat {
+
+ static final String TAG = "SettingsFragmentTag";
+
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ setPreferencesFromResource(R.xml.preferences, rootKey);
+
+ ListPreference themePreference = findPreference("themePref");
+ if (themePreference != null) {
+ themePreference.setOnPreferenceChangeListener(
+ new Preference.OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ String themeOption = (String) newValue;
+ ThemeHelper.applyTheme(themeOption);
+ return true;
+ }
+ });
+ }
+ }
+}
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/ThemeHelper.java b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/ThemeHelper.java
new file mode 100644
index 00000000..7b14dcf6
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/ThemeHelper.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.darktheme;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatDelegate;
+import androidx.core.os.BuildCompat;
+
+public class ThemeHelper {
+
+ public static final String LIGHT_MODE = "light";
+ public static final String DARK_MODE = "dark";
+ public static final String DEFAULT_MODE = "default";
+
+ public static void applyTheme(@NonNull String themePref) {
+ switch (themePref) {
+ case LIGHT_MODE: {
+ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
+ break;
+ }
+ case DARK_MODE: {
+ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
+ break;
+ }
+ default: {
+ if (BuildCompat.isAtLeastQ()) {
+ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
+ } else {
+ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY);
+ }
+ break;
+ }
+ }
+ }
+}
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/WelcomeFragment.java b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/WelcomeFragment.java
new file mode 100644
index 00000000..bda7af52
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/java/com/example/android/darktheme/WelcomeFragment.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.darktheme;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
+public class WelcomeFragment extends Fragment {
+
+ static final String TAG = "VectorDrawableFragmentTag";
+
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+ @Nullable Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_welcome, container, false);
+ }
+}
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/color/color_on_primary_mask.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/color/color_on_primary_mask.xml
new file mode 100644
index 00000000..e4fb6d4c
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/color/color_on_primary_mask.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<!--
+ Apply variations to a color using ColorStateList.
+ Instead of creating a new color with an alpha in hexadecimal values,
+ we reuse the color and specify the alpha with a percentage number.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:alpha="0.80" android:color="?attr/colorOnPrimary" />
+</selector>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable-hdpi/tile.9.png b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable-hdpi/tile.9.png
new file mode 100644
index 00000000..13586288
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/bottom_nav_item_background.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/bottom_nav_item_background.xml
new file mode 100644
index 00000000..fbb669ac
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/bottom_nav_item_background.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_checked="true" android:color="?attr/colorPrimary" />
+ <item android:state_checked="false" android:color="?attr/colorOnSurface" />
+</selector> \ No newline at end of file
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_brightness.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_brightness.xml
new file mode 100644
index 00000000..a8e48db7
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_brightness.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="52dp"
+ android:height="52dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M20,8.69L20,4h-4.69L12,0.69 8.69,4L4,4v4.69L0.69,12 4,15.31L4,20h4.69L12,23.31 15.31,20L20,20v-4.69L23.31,12 20,8.69zM12,18c-3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6 6,2.69 6,6 -2.69,6 -6,6zM12,8c-2.21,0 -4,1.79 -4,4s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4z" />
+</vector>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_brightness_2.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_brightness_2.xml
new file mode 100644
index 00000000..cd12e810
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_brightness_2.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="52dp"
+ android:height="52dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?attr/colorPrimary">
+ <!-- Use the android:tint attribute to tint the vectors -->
+ <!-- For the tint to work on API 19 and below, remember to use app:srcCompat in the view widget
+ and vectorDrawables.useSupportLibrary = true in your build.gradle file -->
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M10,2c-1.82,0 -3.53,0.5 -5,1.35C7.99,5.08 10,8.3 10,12s-2.01,6.92 -5,8.65C6.47,21.5 8.18,22 10,22c5.52,0 10,-4.48 10,-10S15.52,2 10,2z" />
+</vector>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_dashboard.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_dashboard.xml
new file mode 100644
index 00000000..641b07d8
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_dashboard.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M3,13h8L11,3L3,3v10zM3,21h8v-6L3,15v6zM13,21h8L21,11h-8v10zM13,3v6h8L21,3h-8z" />
+</vector>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_home.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_home.xml
new file mode 100644
index 00000000..5a623946
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_home.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" />
+</vector>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_launcher_foreground.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 00000000..eb95c9c2
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportWidth="42.14876"
+ android:viewportHeight="42.14876">
+ <group android:translateX="9.07438"
+ android:translateY="9.07438">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M20,8.69V4h-4.69L12,0.69 8.69,4H4v4.69L0.69,12 4,15.31V20h4.69L12,23.31 15.31,20H20v-4.69L23.31,12 20,8.69zM12,18c-0.89,0 -1.74,-0.2 -2.5,-0.55C11.56,16.5 13,14.42 13,12s-1.44,-4.5 -3.5,-5.45C10.26,6.2 11.11,6 12,6c3.31,0 6,2.69 6,6s-2.69,6 -6,6z"/>
+ </group>
+</vector>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_more_vert.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_more_vert.xml
new file mode 100644
index 00000000..047ad036
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_more_vert.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
+</vector>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_settings.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_settings.xml
new file mode 100644
index 00000000..c832bb56
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/drawable/ic_settings.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
+</vector>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/layout/activity_main.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/layout/activity_main.xml
new file mode 100644
index 00000000..4bc4041e
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/layout/activity_main.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<androidx.constraintlayout.widget.ConstraintLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".MainActivity">
+
+ <androidx.appcompat.widget.Toolbar
+ style="@style/Widget.MaterialComponents.Toolbar.Primary"
+ android:id="@+id/toolbar"
+ android:layout_width="0dp"
+ android:layout_height="?android:actionBarSize"
+ android:elevation="@dimen/toolbar_elevation"
+ android:title="@string/app_name"
+ app:layout_constraintRight_toRightOf="parent"
+ app:layout_constraintLeft_toLeftOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <FrameLayout
+ android:id="@+id/fragment_layout"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toTopOf="@+id/navigation"
+ app:layout_constraintLeft_toLeftOf="parent"
+ app:layout_constraintRight_toRightOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/toolbar" />
+
+ <com.google.android.material.bottomnavigation.BottomNavigationView
+ android:id="@+id/navigation"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ app:itemBackground="?attr/colorSurface"
+ app:itemIconTint="@drawable/bottom_nav_item_background"
+ app:itemTextColor="?attr/colorOnBackground"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintLeft_toLeftOf="parent"
+ app:layout_constraintRight_toRightOf="parent"
+ app:menu="@menu/navigation" />
+
+</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/layout/fragment_preferences.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/layout/fragment_preferences.xml
new file mode 100644
index 00000000..09df6d77
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/layout/fragment_preferences.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<!--
+ The colours in this file are hardcoded to showcase the Android Q Force Dark feature.
+ The system provide and "automatic" conversion of light apps/screens/views to dark.
+ We're setting android:forceDarkAllowed="true" in the layout above to make the
+ system force this layout to be dark-mode suitable automatically.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:padding="@dimen/margin_medium"
+ android:forceDarkAllowed="true"
+ android:background="#FFFFFF"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/margin_small"
+ android:textColor="#212121"
+ android:text="@string/preferences_explanation"/>
+
+ <TextView
+ style="?attr/textAppearanceHeadline6"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/margin_medium"
+ android:textColor="#212121"
+ android:text="@string/preferences"/>
+
+ <EditText
+ android:id="@+id/editText"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ems="10"
+ android:inputType="textPersonName"
+ android:layout_margin="@dimen/margin_small"
+ android:textColor="#212121"
+ android:textColorHint="#44212121"
+ android:hint="@string/your_name" />
+
+ <RadioGroup
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/margin_small">
+
+ <RadioButton
+ android:id="@+id/radioButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:textColor="#212121"
+ android:text="@string/developer" />
+
+ <RadioButton
+ android:id="@+id/radioButton2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:textColor="#212121"
+ android:text="@string/designer" />
+ </RadioGroup>
+
+ <Switch
+ android:id="@+id/switch1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/margin_small"
+ android:textColor="#212121"
+ android:text="@string/offline" />
+
+ <Button
+ android:id="@+id/button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/margin_small"
+ android:textColor="#FFFFFF"
+ android:background="#1976D2"
+ android:text="@string/save" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/layout/fragment_welcome.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/layout/fragment_welcome.xml
new file mode 100644
index 00000000..8e209981
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/layout/fragment_welcome.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:orientation="vertical"
+ android:gravity="center">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/welcome"/>
+
+ <!-- @drawable/ic_brightness is using hard-coded colours.
+ We set the tint to this drawable using the android:tint attribute -->
+ <ImageView
+ android:id="@+id/icon_light"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/margin_medium"
+ app:srcCompat="@drawable/ic_brightness"
+ android:tint="?attr/colorSecondary"/>
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/margin_medium"
+ app:srcCompat="@drawable/ic_brightness_2" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/menu/main_menu.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/menu/main_menu.xml
new file mode 100644
index 00000000..a4ce36d9
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/menu/main_menu.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ <item
+ android:id="@+id/action_more"
+ android:icon="@drawable/ic_more_vert"
+ android:title="@string/more_action"
+ app:showAsAction="ifRoom" />
+</menu>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/menu/navigation.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/menu/navigation.xml
new file mode 100644
index 00000000..25b337e4
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/menu/navigation.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item
+ android:id="@+id/navigation_home"
+ android:icon="@drawable/ic_home"
+ android:title="@string/title_home" />
+
+ <item
+ android:id="@+id/navigation_preferences"
+ android:icon="@drawable/ic_dashboard"
+ android:title="@string/title_preferences" />
+
+ <item
+ android:id="@+id/navigation_settings"
+ android:icon="@drawable/ic_settings"
+ android:title="@string/title_settings" />
+
+</menu>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-hdpi/ic_launcher.png b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 00000000..5d2672f7
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-hdpi/ic_launcher_round.png b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 00000000..9ab38fca
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-hdpi/ic_launcher_round.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-mdpi/ic_launcher.png b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 00000000..2fad7d22
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-mdpi/ic_launcher_round.png b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 00000000..03c77f39
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-mdpi/ic_launcher_round.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xhdpi/ic_launcher.png b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 00000000..0354d61c
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..20b354ef
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000..27d1742e
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..dba9bcc2
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 00000000..c778c5de
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..c095b4ce
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values-night/colors.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values-night/colors.xml
new file mode 100644
index 00000000..9240b1b5
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values-night/colors.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- app palette -->
+ <color name="primary">#64B5F6</color> <!-- Blue 300 -->
+ <color name="secondary">#FFCC80</color> <!-- Orange 200 -->
+ <color name="error">#Ef9A9A</color> <!-- Red 200 -->
+
+</resources>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values-sw600dp/template-dimens.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 00000000..859330fe
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values-sw600dp/template-dimens.xml
@@ -0,0 +1,24 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values-sw600dp/template-styles.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values-sw600dp/template-styles.xml
new file mode 100644
index 00000000..cce91776
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values-v11/template-styles.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values-v11/template-styles.xml
new file mode 100644
index 00000000..8e67e83d
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values-v21/base-template-styles.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values-v21/base-template-styles.xml
new file mode 100644
index 00000000..4c8c37ce
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values-v21/base-template-styles.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values-v28/arrays.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values-v28/arrays.xml
new file mode 100644
index 00000000..e76f0f33
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values-v28/arrays.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<resources>
+
+ <string-array name="themeListArray">
+ <item>Light</item>
+ <item>Dark</item>
+ <item>System default</item>
+ </string-array>
+
+ <string-array name="themeEntryArray">
+ <item>light</item>
+ <item>dark</item>
+ <item>default</item>
+ </string-array>
+
+</resources> \ No newline at end of file
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values/arrays.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/arrays.xml
new file mode 100644
index 00000000..792aa18e
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/arrays.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<resources>
+
+ <string-array name="themeListArray">
+ <item>Light</item>
+ <item>Dark</item>
+ <item>Set by Battery Saver</item>
+ </string-array>
+
+ <string-array name="themeEntryArray">
+ <item>light</item>
+ <item>dark</item>
+ <item>default</item>
+ </string-array>
+
+</resources> \ No newline at end of file
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values/base-strings.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/base-strings.xml
new file mode 100644
index 00000000..cc70f5f2
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/base-strings.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <string name="app_name">DarkTheme</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ Sample demonstrating the different ways to support Dark Mode on Android.
+ Uses the Material Design Components Library.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values/colors.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/colors.xml
new file mode 100644
index 00000000..70d15136
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/colors.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- app palette -->
+ <color name="primary">#1976D2</color> <!-- Blue 700 -->
+ <color name="secondary">#F57C00</color> <!-- Orange 700 -->
+ <color name="error">#E53935</color> <!-- Red 600 -->
+
+</resources> \ No newline at end of file
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values/dimens.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/dimens.xml
new file mode 100644
index 00000000..64295c7d
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/dimens.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<resources>
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+
+ <dimen name="toolbar_elevation">4dp</dimen>
+</resources>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values/ic_launcher_background.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/ic_launcher_background.xml
new file mode 100644
index 00000000..26344803
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/ic_launcher_background.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="ic_launcher_background">#FFCC80</color>
+</resources> \ No newline at end of file
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values/strings.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/strings.xml
new file mode 100644
index 00000000..fb55d5aa
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/strings.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<resources>
+
+ <string name="more_action">More</string>
+ <string name="title_home">Home</string>
+ <string name="title_preferences">Preferences</string>
+ <string name="title_settings">Settings</string>
+ <string name="welcome">Welcome to the Dark Theme code sample</string>
+ <string name="save">Save</string>
+ <string name="offline">Offline mode</string>
+ <string name="your_name">Your name</string>
+ <string name="developer">Developer</string>
+ <string name="designer">Designer</string>
+ <string name="preferences">Select your preferences</string>
+ <string name="preferences_explanation">Disclaimer: This screen will only be dark when Dark Mode is forced in the OS settings in Android Q and above.</string>
+
+</resources>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values/styles.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/styles.xml
new file mode 100644
index 00000000..47a176e3
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/styles.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<resources>
+
+ <style name="DarkThemeApp" parent="@style/Theme.MaterialComponents.DayNight.NoActionBar">
+ <item name="colorPrimary">@color/primary</item>
+ <item name="colorPrimaryDark">@color/primary</item>
+ <item name="colorSecondary">@color/secondary</item>
+ <item name="colorError">@color/error</item>
+ <item name="android:textColor">?attr/colorOnBackground</item>
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values/template-dimens.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/template-dimens.xml
new file mode 100644
index 00000000..a4f7b0f0
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/values/template-styles.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/template-styles.xml
new file mode 100644
index 00000000..b98fc8be
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/prebuilts/gradle/DarkTheme/Application/src/main/res/xml/preferences.xml b/prebuilts/gradle/DarkTheme/Application/src/main/res/xml/preferences.xml
new file mode 100644
index 00000000..8fba2f24
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/Application/src/main/res/xml/preferences.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<androidx.preference.PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
+
+ <PreferenceCategory
+ app:key="theme_category"
+ app:title="Theme">
+
+ <ListPreference
+ app:key="themePref"
+ app:title="Choose theme"
+ app:defaultValue="default"
+ app:dialogTitle="Choose theme"
+ app:entries="@array/themeListArray"
+ app:entryValues="@array/themeEntryArray"
+ app:useSimpleSummaryProvider="true"/>
+
+ </PreferenceCategory>
+
+</androidx.preference.PreferenceScreen>
diff --git a/prebuilts/gradle/DarkTheme/CONTRIBUTING.md b/prebuilts/gradle/DarkTheme/CONTRIBUTING.md
new file mode 100644
index 00000000..faa8b5c6
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/CONTRIBUTING.md
@@ -0,0 +1,35 @@
+# How to become a contributor and submit your own code
+
+## Contributor License Agreements
+
+We'd love to accept your sample apps and patches! Before we can take them, we
+have to jump a couple of legal hurdles.
+
+Please fill out either the individual or corporate Contributor License Agreement (CLA).
+
+ * If you are an individual writing original source code and you're sure you
+ own the intellectual property, then you'll need to sign an [individual CLA]
+ (https://cla.developers.google.com).
+ * If you work for a company that wants to allow you to contribute your work,
+ then you'll need to sign a [corporate CLA]
+ (https://cla.developers.google.com).
+
+Follow either of the two links above to access the appropriate CLA and
+instructions for how to sign and return it. Once we receive it, we'll be able to
+accept your pull requests.
+
+## Contributing A Patch
+
+1. Submit an issue describing your proposed change to the repo in question.
+1. The repo owner will respond to your issue promptly.
+1. If your proposed change is accepted, and you haven't already done so, sign a
+ Contributor License Agreement (see details above).
+1. Fork the desired repo, develop and test your code changes.
+1. Ensure that your code adheres to the existing style in the sample to which
+ you are contributing. Refer to the
+ [Android Code Style Guide]
+ (https://source.android.com/source/code-style.html) for the
+ recommended coding standards for this organization.
+1. Ensure that your code has an appropriate set of unit tests which all pass.
+1. Submit a pull request.
+
diff --git a/prebuilts/gradle/DarkTheme/LICENSE b/prebuilts/gradle/DarkTheme/LICENSE
new file mode 100644
index 00000000..ed114d41
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/LICENSE
@@ -0,0 +1,203 @@
+Apache License
+--------------
+
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/prebuilts/gradle/DarkTheme/README.md b/prebuilts/gradle/DarkTheme/README.md
new file mode 100644
index 00000000..9c9b79a7
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/README.md
@@ -0,0 +1,165 @@
+
+Android DarkTheme Sample
+===================================
+
+Sample demonstrating the different ways to support Dark Mode on Android.
+ Uses the Material Design Components Library.
+
+Introduction
+------------
+
+Android Q has explicit user support for Dark Mode, allowing users to choose
+whether the device theme is dark or not. There are multiple ways you can allow
+Dark Mode in your app:
+
+Night mode in AppCompat and Material Components
+------------
+
+AppCompat has had "night mode" APIs for a number of years now. It allows developers to
+implement dark mode in their apps using the -night resource qualifier. The [Material Design
+Components library][1] builds upon AppCompat and exposes its own DayNight themes.
+
+The DayNight theme in the AndroidX Material Components library provides Dark Theme backwards
+compatibility down to API 14. The theme we use in the app (specified in
+`AndroidManifest.xml#L23`) extends from DayNight (`values/styles.xml#L16`).
+
+Use theme-defined colours when defining colours for your drawables. For example, we use
+`?attr/colorOnBackground` for the generic text color of the app (`values/styles.xml#35`).
+
+When it's not possible to use theme-defined colours, you can use the -night qualifier to
+extract hard-coded values and switch them out when the configuration changes to night mode.
+For example, we use a different primary colour in dark mode. Check `values-night/colors.xml`
+for more details. You can also specify custom drawables creating a drawable-night folder.
+
+Tell AppCompat what mode to use by calling [`AppCompatDelegate.setDefaultNightMode()`][2] or
+`getDelegate().setLocalNightMode()`. It can take different values:
+- MODE_NIGHT_YES. Always use the dark theme.
+- MODE_NIGHT_NO. Always use the light theme (Smart Dark can override it).
+- MODE_NIGHT_FOLLOW_SYSTEM. Follows the current system setting
+- MODE_NIGHT_AUTO_BATTERY. Dark when battery saver is enabled, light otherwise.
+
+In the code sample, you can find the code related to this in the `ThemeHelper` class.
+
+Smart Dark
+------------
+
+Smart Dark is a new feature in Android Q which can automatically theme a light app to
+dark by dynamically re-coloring the app being drawn at runtime. It has no direct developer
+APIs. It is made for apps which do not have explicit Dark Theme support yet.
+
+Smart Dark applies to any theme whose value of `android:isLightTheme=true`. This is set on
+all of the `Theme.*.Light.*` variants, including those from AppCompat. You can opt-in and opt-out at
+both a theme and view level. Opt-in by setting `android:forceDarkAllowed="true"`
+in the view or theme. Alternatively, you can enable/disable it in the code by calling
+`View#setForceDarkAllowed(boolean)`.
+
+This feature is implemented in the `PreferencesFragment`. As you can see in the
+`layout/fragment_preferences.xml` file, all colours are hard-coded to be light-theme suitable.
+To make it use Smart Dark, the parent view sets `android:forceDarkAllowed="true"`
+(you can see it in `layout/fragment_preferences.xml#L19`). In this case, when Smart Dark is
+active, this screen will be automatically themed to be dark-mode friendly. The system will
+change most of the colours to make that happen.
+
+Dark Mode in the code sample
+------------
+
+The user can decide which theme to use within the app. In the Settings screen, the user
+can choose the Light theme, Dark theme, or System Default (when the app is running on
+Android Q+) or Set by Battery Saver (when running on Android P or earlier). When using the
+System Default option, the system decides the theme based on the Platform System Settings
+introduced in Android Q.
+
+These options, that are also listed above, are the settings that Google recommends.
+Also, it recommends that this user choice is stored and applied whenever the user opens
+the app again. In the code sample, the user preference is automatically stored in
+`SharedPreferences` because we use the androidX preference library. Check `SettingsFragment`
+and `preferences.xml` for more information about it. In the `DarkThemeApplication` class,
+we retrieve and apply the user theme preference when the user opens the app.
+
+Notice that the PreferencesFragment will be only in Dark Mode when the Smart Dark is active.
+You can force it by running `adb shell setprop debug.hwui.force_dark true` on your terminal console.
+
+Hands on
+------------
+
+In the sample, we make views Dark-Mode friendly in different ways:
+
+- *Vectors using tints*. `drawable/ic_brightness_2.xml` is Dark-Mode friendly by
+using the `android:tint` attribute.
+
+- *Vectors using hard-coded colours*. `drawable/ic_brightness.xml` is Dark-Mode friendly by
+setting its View tint in `fragment_welcome.xml#L38`. Also, you can set it programmatically
+as we do with the tinted menu icon `R.id.action_more`.
+
+- *Tinted menu icons*. `R.id.action_more` is tinted programmatically in `MainActivity.java#L85`.
+
+- *Different colorPrimary/colorsecondary for light/dark mode*. We define the primary color
+in `values/styles.xml#L21` where we set "colorPrimary" to `@color/primary`.
+`@color/primary` is defined in both `values/colors.xml` and `values-night/colors.xml`.
+
+- *Text color*. Same way as we did before, the text color is defined in `values/styles.xml`
+with the `"android:textColorPrimary"` attribute.
+
+- *Window background*. The window background is set in `values/styles.xml` with the
+`"android:windowBackground"` attribute. The value is set to `@color/background` so if
+Dark Mode is enabled the splash screen is black instead of white.
+
+- *Apply variations to a color using ColorStateList*. Check out `color/color_on_primary_mask.xml`.
+Instead of creating a new color with an alpha in hexadecimal values, we reuse the color and specify
+the alpha with a percentage number.
+
+- *Enable Smart Dark*. The `PreferenceFragment` is not Dark-Mode friendly. It has all colours
+hard-coded to be suitable for light mode. To opt the Fragment in for Smart Dark, we set
+`android:forceDarkAllowed="true"` in the root View of the Fragment. You can find the code
+in `layout/fragment_preferences.xml#19`.
+
+[1]: https://material.io/develop/android/docs/getting-started/
+[2]: https://developer.android.com/reference/android/support/v7/app/AppCompatDelegate#setdefaultnightmode
+
+Pre-requisites
+--------------
+
+- Android SDK 29
+- Android Support Repository
+
+Screenshots
+-------------
+
+<img src="screenshots/light_1_welcome.png" height="400" alt="Screenshot"/> <img src="screenshots/light_2_preferences.png" height="400" alt="Screenshot"/> <img src="screenshots/light_3_settings.png" height="400" alt="Screenshot"/> <img src="screenshots/light_4_theme_options.png" height="400" alt="Screenshot"/> <img src="screenshots/dark_1_welcome.png" height="400" alt="Screenshot"/> <img src="screenshots/smart_dark_2_preferences.png" height="400" alt="Screenshot"/> <img src="screenshots/dark_3_settings.png" height="400" alt="Screenshot"/> <img src="screenshots/dark_4_theme_options.png" height="400" alt="Screenshot"/>
+
+Getting Started
+---------------
+
+This sample uses the Gradle build system. To build this project, use the
+"gradlew build" command or use "Import Project" in Android Studio.
+
+Support
+-------
+
+- Stack Overflow: http://stackoverflow.com/questions/tagged/android
+
+If you've found an error in this sample, please file an issue:
+https://github.com/googlesamples/android-DarkTheme
+
+Patches are encouraged, and may be submitted by forking this project and
+submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
+
+License
+-------
+
+Copyright 2019 The Android Open Source Project, Inc.
+
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
+license agreements. See the NOTICE file distributed with this work for
+additional information regarding copyright ownership. The ASF licenses this
+file to you under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+https://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
diff --git a/prebuilts/gradle/DarkTheme/build.gradle b/prebuilts/gradle/DarkTheme/build.gradle
new file mode 100644
index 00000000..0d88ca3b
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/build.gradle
@@ -0,0 +1,3 @@
+if(hasProperty('target') && target == 'android') {
+ android.vectorDrawables.useSupportLibrary = true
+} \ No newline at end of file
diff --git a/prebuilts/gradle/DarkTheme/gradle.properties b/prebuilts/gradle/DarkTheme/gradle.properties
new file mode 100644
index 00000000..94f84728
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/gradle.properties
@@ -0,0 +1,22 @@
+
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Settings specified in this file will override any Gradle settings
+# configured through the IDE.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/prebuilts/gradle/DarkTheme/gradle/wrapper/gradle-wrapper.jar b/prebuilts/gradle/DarkTheme/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..8c0fb64a
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/gradle/wrapper/gradle-wrapper.properties b/prebuilts/gradle/DarkTheme/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..e623645e
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Tue Mar 26 16:16:53 CET 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
diff --git a/prebuilts/gradle/DarkTheme/gradlew b/prebuilts/gradle/DarkTheme/gradlew
new file mode 100755
index 00000000..91a7e269
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/prebuilts/gradle/DarkTheme/gradlew.bat b/prebuilts/gradle/DarkTheme/gradlew.bat
new file mode 100644
index 00000000..aec99730
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/prebuilts/gradle/DarkTheme/screenshots/dark_1_welcome.png b/prebuilts/gradle/DarkTheme/screenshots/dark_1_welcome.png
new file mode 100644
index 00000000..a3a0c660
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/screenshots/dark_1_welcome.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/screenshots/dark_3_settings.png b/prebuilts/gradle/DarkTheme/screenshots/dark_3_settings.png
new file mode 100644
index 00000000..127d0a40
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/screenshots/dark_3_settings.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/screenshots/dark_4_theme_options.png b/prebuilts/gradle/DarkTheme/screenshots/dark_4_theme_options.png
new file mode 100644
index 00000000..18b897e0
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/screenshots/dark_4_theme_options.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/screenshots/light_1_welcome.png b/prebuilts/gradle/DarkTheme/screenshots/light_1_welcome.png
new file mode 100644
index 00000000..27f98115
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/screenshots/light_1_welcome.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/screenshots/light_2_preferences.png b/prebuilts/gradle/DarkTheme/screenshots/light_2_preferences.png
new file mode 100644
index 00000000..966b3b17
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/screenshots/light_2_preferences.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/screenshots/light_3_settings.png b/prebuilts/gradle/DarkTheme/screenshots/light_3_settings.png
new file mode 100644
index 00000000..38ea7a2b
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/screenshots/light_3_settings.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/screenshots/light_4_theme_options.png b/prebuilts/gradle/DarkTheme/screenshots/light_4_theme_options.png
new file mode 100644
index 00000000..53ab0cff
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/screenshots/light_4_theme_options.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/screenshots/smart_dark_2_preferences.png b/prebuilts/gradle/DarkTheme/screenshots/smart_dark_2_preferences.png
new file mode 100644
index 00000000..6d61f15d
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/screenshots/smart_dark_2_preferences.png
Binary files differ
diff --git a/prebuilts/gradle/DarkTheme/settings.gradle b/prebuilts/gradle/DarkTheme/settings.gradle
new file mode 100644
index 00000000..0a5c310b
--- /dev/null
+++ b/prebuilts/gradle/DarkTheme/settings.gradle
@@ -0,0 +1,2 @@
+
+include 'Application'