Browse Source

migrate to androidx, support daynight theme

Andrew Dolgov 8 months ago
parent
commit
4457fb3090
29 changed files with 251 additions and 152 deletions
  1. 2 0
      gradle.properties
  2. 11 10
      org.fox.ttirc/build.gradle
  3. 60 41
      org.fox.ttirc/org.fox.ttirc.iml
  4. 2 2
      org.fox.ttirc/src/main/java/org/fox/ttirc/Application.java
  5. 3 3
      org.fox.ttirc/src/main/java/org/fox/ttirc/ChannelFragment.java
  6. 6 5
      org.fox.ttirc/src/main/java/org/fox/ttirc/ChannelPager.java
  7. 38 14
      org.fox.ttirc/src/main/java/org/fox/ttirc/CommonActivity.java
  8. 4 4
      org.fox.ttirc/src/main/java/org/fox/ttirc/EmoticonSearchDialog.java
  9. 5 5
      org.fox.ttirc/src/main/java/org/fox/ttirc/EmoticonSearchDialogAdapter.java
  10. 2 2
      org.fox.ttirc/src/main/java/org/fox/ttirc/LogcatActivity.java
  11. 2 9
      org.fox.ttirc/src/main/java/org/fox/ttirc/LoginActivity.java
  12. 11 14
      org.fox.ttirc/src/main/java/org/fox/ttirc/MainActivity.java
  13. 3 8
      org.fox.ttirc/src/main/java/org/fox/ttirc/PreferencesActivity.java
  14. 2 1
      org.fox.ttirc/src/main/java/org/fox/ttirc/StateSavedFragment.java
  15. 3 2
      org.fox.ttirc/src/main/java/org/fox/ttirc/backend/UpdateService.java
  16. 4 2
      org.fox.ttirc/src/main/java/org/fox/ttirc/utils/GetFileService.java
  17. 4 3
      org.fox.ttirc/src/main/java/org/fox/ttirc/utils/ScrimInsetsFrameLayout.java
  18. 2 2
      org.fox.ttirc/src/main/res/layout-sw600dp-port/activity_main.xml
  19. 2 2
      org.fox.ttirc/src/main/res/layout-sw600dp-port/fragment_channel.xml
  20. 2 2
      org.fox.ttirc/src/main/res/layout/activity_logcat.xml
  21. 2 2
      org.fox.ttirc/src/main/res/layout/activity_main.xml
  22. 2 2
      org.fox.ttirc/src/main/res/layout/channel_pager.xml
  23. 2 2
      org.fox.ttirc/src/main/res/layout/fragment_channel.xml
  24. 1 1
      org.fox.ttirc/src/main/res/layout/toolbar.xml
  25. 11 0
      org.fox.ttirc/src/main/res/values-night-v21/style.xml
  26. 53 0
      org.fox.ttirc/src/main/res/values-night/style.xml
  27. 1 9
      org.fox.ttirc/src/main/res/values-v21/style.xml
  28. 9 3
      org.fox.ttirc/src/main/res/values/arrays.xml
  29. 2 2
      org.fox.ttirc/src/main/res/values/style.xml

+ 2 - 0
gradle.properties

@@ -0,0 +1,2 @@
+android.enableJetifier=true
+android.useAndroidX=true

+ 11 - 10
org.fox.ttirc/build.gradle

@@ -1,15 +1,15 @@
 apply plugin: 'com.android.application'
 
 android {
-    compileSdkVersion 27
+    compileSdkVersion 29
     buildToolsVersion '28.0.3'
     useLibrary 'org.apache.http.legacy'
 
     defaultConfig {
         applicationId "org.fox.ttirc"
         buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
-        minSdkVersion 16
-        targetSdkVersion 27
+        minSdkVersion 19
+        targetSdkVersion 29
     }
 
     signingConfigs {
@@ -53,18 +53,19 @@ android {
 
 dependencies {
     implementation 'com.viewpagerindicator:library:2.4.1'
-    implementation 'com.android.support:support-v4:27.1.1'
-    implementation 'com.google.code.gson:gson:2.8.2'
+    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+    implementation 'com.google.code.gson:gson:2.8.5'
     implementation 'com.github.bumptech.glide:glide:3.8.0'
-    implementation 'com.android.support:appcompat-v7:27.1.1'
-    implementation 'com.android.support:customtabs:27.1.1'
+    implementation 'androidx.appcompat:appcompat:1.1.0'
+    implementation 'androidx.browser:browser:1.0.0'
     implementation 'frankiesardo:icepick:3.2.0'
     compileOnly 'frankiesardo:icepick-processor:3.2.0'
     annotationProcessor 'frankiesardo:icepick-processor:3.2.0'
     implementation 'com.github.livefront:bridge:v1.1.1'
     implementation 'com.github.mirrajabi:search-dialog:1.2.3'
-    implementation 'org.apache.httpcomponents:httpcore:4.3.+'
-    implementation 'org.apache.httpcomponents:httpmime:4.3.+'
-    implementation 'org.apache.httpcomponents:httpclient:4.3.+'
+    implementation 'org.apache.httpcomponents:httpcore:4.4.10'
+    implementation 'org.apache.httpcomponents:httpmime:4.5.6'
+    //implementation 'org.apache.httpcomponents:httpclient:4.3.+'
     implementation 'org.apache.james:apache-mime4j:0.7.2'
+    implementation 'androidx.recyclerview:recyclerview:1.1.0'
 }

+ 60 - 41
org.fox.ttirc/org.fox.ttirc.iml

@@ -4,8 +4,8 @@
     <facet type="android-gradle" name="Android-Gradle">
       <configuration>
         <option name="GRADLE_PROJECT_PATH" value=":org.fox.ttirc" />
-        <option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="3.3.0" />
-        <option name="LAST_KNOWN_AGP_VERSION" value="3.3.0" />
+        <option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="3.5.2" />
+        <option name="LAST_KNOWN_AGP_VERSION" value="3.5.2" />
       </configuration>
     </facet>
     <facet type="android" name="Android">
@@ -19,30 +19,30 @@
         <option name="ALLOW_USER_CONFIGURATION" value="false" />
         <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
         <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
-        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/rs/debug;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
-        <option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" />
+        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
+        <option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
         <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
       </configuration>
     </facet>
   </component>
   <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
-    <output url="file://$MODULE_DIR$/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes" />
-    <output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/compileDebugUnitTestJavaWithJavac/classes" />
+    <output url="file://$MODULE_DIR$/build/intermediates/javac/debug/classes" />
+    <output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/classes" />
     <exclude-output />
     <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out" isTestSource="false" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out" isTestSource="false" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out" isTestSource="true" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/compileDebugAndroidTestRenderscript/out" isTestSource="true" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugUnitTest/out" isTestSource="true" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
@@ -87,15 +87,27 @@
       <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
       <excludeFolder url="file://$MODULE_DIR$/build" />
     </content>
-    <orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />
+    <orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="library" name="Gradle: frankiesardo:icepick-processor:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.code.gson:gson:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.collection:collection:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.arch.core:core-common:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.annotation:annotation:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.google.code.gson:gson:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.github.bumptech.glide:glide:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: frankiesardo:icepick:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpmime:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpclient:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpmime:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpclient:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.james:apache-mime4j-examples:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.james:apache-mime4j-benchmark:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: commons-logging:commons-logging:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: commons-codec:commons-codec:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.james:apache-mime4j-storage:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.james:apache-mime4j-dom:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.james:apache-mime4j-core:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: commons-io:commons-io:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: stencil:stencil:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: scout:scout:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: quoin:quoin:[email protected]" level="project" />
@@ -104,37 +116,44 @@
     <orderEntry type="library" name="Gradle: org.clojure:data.priority-map:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: org.clojure:clojure:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.google.auto.service:auto-service:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-annotations:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.james:apache-mime4j-examples:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.james:apache-mime4j-benchmark:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: commons-logging:commons-logging:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: commons-codec:commons-codec:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.james:apache-mime4j-storage:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.james:apache-mime4j-dom:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.james:apache-mime4j-core:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.google.auto:auto-common:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.google.guava:guava:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: commons-io:commons-io:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:common:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.core:common:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.viewpagerindicator:library:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-v4:27.1.1@aar" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-v4:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.github.livefront:bridge:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.appcompat:appcompat:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.browser:browser:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.recyclerview:recyclerview:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.media:media:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-ui:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-utils:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.fragment:fragment:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.appcompat:appcompat-resources:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.viewpager:viewpager:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.coordinatorlayout:coordinatorlayout:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.slidingpanelayout:slidingpanelayout:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.customview:customview:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.loader:loader:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.swiperefreshlayout:swiperefreshlayout:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.activity:activity:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.core:core:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.interpolator:interpolator:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.documentfile:documentfile:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.localbroadcastmanager:localbroadcastmanager:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.print:print:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.savedstate:savedstate:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.github.mirrajabi:search-dialog:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:appcompat-v7:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:customtabs:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-media-compat:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-fragment:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:recyclerview-v7:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-core-ui:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-core-utils:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-compat:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata-core:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.core:runtime:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.http.legacy-android-27" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.http.legacy-android-29" level="project" />
   </component>
 </module>

+ 2 - 2
org.fox.ttirc/src/main/java/org/fox/ttirc/Application.java

@@ -1,8 +1,6 @@
 package org.fox.ttirc;
 
 import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
 
 import com.livefront.bridge.Bridge;
 import com.livefront.bridge.SavedStateHandler;
@@ -13,6 +11,8 @@ import java.net.CookieHandler;
 import java.net.CookieManager;
 import java.util.concurrent.ConcurrentHashMap;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import icepick.Icepick;
 
 public class Application extends android.app.Application {

+ 3 - 3
org.fox.ttirc/src/main/java/org/fox/ttirc/ChannelFragment.java

@@ -13,7 +13,6 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
 import android.preference.PreferenceManager;
-import android.support.v4.widget.DrawerLayout;
 import android.text.Spannable;
 import android.text.SpannableString;
 import android.text.style.ForegroundColorSpan;
@@ -66,6 +65,7 @@ import java.util.Locale;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import androidx.drawerlayout.widget.DrawerLayout;
 import icepick.State;
 
 public class ChannelFragment extends StateSavedFragment implements OnEditorActionListener, ChannelView {
@@ -619,7 +619,7 @@ public class ChannelFragment extends StateSavedFragment implements OnEditorActio
 					    nickColor = tv.data;
 					} else {					
 						try {
-							nickColor = m_prefs.getString("theme", CommonActivity.THEME_DEFAULT).equals(CommonActivity.THEME_LIGHT) ? ColorMapLight[msg.sender_color] : 
+							nickColor = !m_activity.isUiNightMode() ? ColorMapLight[msg.sender_color] :
 								ColorMapDark[msg.sender_color];
 						} catch (ArrayIndexOutOfBoundsException e) {
 							// wtf, backend!
@@ -669,7 +669,7 @@ public class ChannelFragment extends StateSavedFragment implements OnEditorActio
 								}
 							});
 
-							Glide.with(ChannelFragment.this)
+							Glide.with(m_activity)
 									.load(thumbnailUrl)
 									.diskCacheStrategy(DiskCacheStrategy.ALL)
 									.skipMemoryCache(false)

+ 6 - 5
org.fox.ttirc/src/main/java/org/fox/ttirc/ChannelPager.java

@@ -8,10 +8,6 @@ import android.content.SharedPreferences;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.preference.PreferenceManager;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentStatePagerAdapter;
-import android.support.v4.view.ViewPager;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -30,6 +26,11 @@ import java.util.List;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentStatePagerAdapter;
+import androidx.viewpager.widget.ViewPager;
+
 public class ChannelPager extends Fragment implements ChannelView {
 
 	private final String TAG = "ChannelPager";
@@ -241,7 +242,7 @@ public class ChannelPager extends Fragment implements ChannelView {
 		m_indicator = view.findViewById(R.id.article_titles);
 		m_indicator.setViewPager(m_pager);
 		
-		if (CommonActivity.THEME_LIGHT.equals(m_prefs.getString("theme", CommonActivity.THEME_DEFAULT))) {
+		if (!m_activity.isUiNightMode()) {
 				m_indicator.setTextColor(getResources().getColor(android.R.color.black));
 				m_indicator.setSelectedColor(getResources().getColor(android.R.color.black));				
 		}

+ 38 - 14
org.fox.ttirc/src/main/java/org/fox/ttirc/CommonActivity.java

@@ -9,17 +9,12 @@ import android.content.ComponentName;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
+import android.content.res.Configuration;
 import android.graphics.BitmapFactory;
 import android.net.Uri;
 import android.os.Build;
 import android.os.Bundle;
 import android.preference.PreferenceManager;
-import android.support.customtabs.CustomTabsCallback;
-import android.support.customtabs.CustomTabsClient;
-import android.support.customtabs.CustomTabsIntent;
-import android.support.customtabs.CustomTabsServiceConnection;
-import android.support.customtabs.CustomTabsSession;
-import android.support.v7.app.AppCompatActivity;
 import android.util.Log;
 import android.util.TypedValue;
 import android.view.Display;
@@ -31,16 +26,19 @@ import com.livefront.bridge.Bridge;
 
 import org.fox.ttirc.types.Constants;
 
-import java.util.Arrays;
-
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.app.AppCompatDelegate;
+import androidx.browser.customtabs.CustomTabsCallback;
+import androidx.browser.customtabs.CustomTabsClient;
+import androidx.browser.customtabs.CustomTabsIntent;
+import androidx.browser.customtabs.CustomTabsServiceConnection;
+import androidx.browser.customtabs.CustomTabsSession;
 import icepick.State;
 
 public class CommonActivity extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
 	private final String TAG = this.getClass().getSimpleName();
 	
-	public static final String THEME_HOLO = "THEME_HOLO";
-	public static final String THEME_LIGHT = "THEME_LIGHT";
-	public static final String THEME_DEFAULT = THEME_LIGHT;
+	public static final String THEME_DEFAULT = "THEME_AUTO";
 
 	public final static String NOTIFICATION_CHANNEL_GROUP = "channel_group_chat";
 	public final static String NOTIFICATION_CHANNEL_PRIORITY = "channel_priority";
@@ -75,6 +73,30 @@ public class CommonActivity extends AppCompatActivity implements SharedPreferenc
 		}
 	};
 
+	protected boolean isUiNightMode() {
+		int nightModeFlags = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
+
+		return Configuration.UI_MODE_NIGHT_YES == nightModeFlags;
+	}
+
+	protected void setAppTheme(SharedPreferences prefs) {
+		String theme = prefs.getString("theme", CommonActivity.THEME_DEFAULT);
+
+		Log.d(TAG, "setting theme to: " + theme);
+
+		if ("THEME_DARK".equals(theme)) {
+			AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
+		} else if ("THEME_LIGHT".equals(theme)) {
+			AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
+		} else if ("THEME_FOLLOW_DEVICE".equals(theme)) {
+			AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
+		} else {
+			AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO_TIME);
+		}
+
+		setTheme(R.style.AppTheme);
+	}
+
 	protected void setSmallScreen(boolean smallScreen) {
 		Log.d(TAG, "m_smallScreenMode=" + smallScreen);
 		m_smallScreenMode = smallScreen;
@@ -137,6 +159,8 @@ public class CommonActivity extends AppCompatActivity implements SharedPreferenc
 				.getDefaultSharedPreferences(getApplicationContext());
 		m_prefs.registerOnSharedPreferenceChangeListener(this);
 
+		setAppTheme(m_prefs);
+
 		Bridge.restoreInstanceState(this, savedInstanceState);
 
 		if (savedInstanceState == null) {
@@ -178,9 +202,9 @@ public class CommonActivity extends AppCompatActivity implements SharedPreferenc
 	public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
 		Log.d(TAG, "onSharedPreferenceChanged:" + key);
 
-		String[] filter = new String[] { "theme" };
-
-		m_needRestart = Arrays.asList(filter).indexOf(key) != -1;
+		if ("theme".equals(key)) {
+			setAppTheme(sharedPreferences);
+		}
 	}
 
 	@Override

+ 4 - 4
org.fox.ttirc/src/main/java/org/fox/ttirc/EmoticonSearchDialog.java

@@ -2,10 +2,6 @@ package org.fox.ttirc;
 
 import android.content.Context;
 import android.os.Handler;
-import android.support.annotation.IdRes;
-import android.support.annotation.LayoutRes;
-import android.support.annotation.Nullable;
-import android.support.v7.widget.RecyclerView;
 import android.view.View;
 import android.widget.EditText;
 import android.widget.Filter;
@@ -16,6 +12,10 @@ import org.fox.ttirc.types.Emoticon;
 
 import java.util.ArrayList;
 
+import androidx.annotation.IdRes;
+import androidx.annotation.LayoutRes;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.RecyclerView;
 import ir.mirrajabi.searchdialog.core.BaseFilter;
 import ir.mirrajabi.searchdialog.core.BaseSearchDialogCompat;
 import ir.mirrajabi.searchdialog.core.FilterResultListener;

+ 5 - 5
org.fox.ttirc/src/main/java/org/fox/ttirc/EmoticonSearchDialogAdapter.java

@@ -3,11 +3,6 @@ package org.fox.ttirc;
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.os.Build;
-import android.support.annotation.ColorRes;
-import android.support.annotation.IdRes;
-import android.support.annotation.LayoutRes;
-import android.support.annotation.Nullable;
-import android.support.v7.widget.RecyclerView;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -20,6 +15,11 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
+import androidx.annotation.ColorRes;
+import androidx.annotation.IdRes;
+import androidx.annotation.LayoutRes;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.RecyclerView;
 import ir.mirrajabi.searchdialog.StringsHelper;
 import ir.mirrajabi.searchdialog.core.BaseSearchDialogCompat;
 import ir.mirrajabi.searchdialog.core.SearchResultListener;

+ 2 - 2
org.fox.ttirc/src/main/java/org/fox/ttirc/LogcatActivity.java

@@ -1,8 +1,6 @@
 package org.fox.ttirc;
 
 import android.os.Bundle;
-import android.support.v4.widget.SwipeRefreshLayout;
-import android.support.v7.widget.Toolbar;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
@@ -13,6 +11,8 @@ import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.util.ArrayList;
 
+import androidx.appcompat.widget.Toolbar;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
 import icepick.State;
 
 public class LogcatActivity extends CommonActivity {

+ 2 - 9
org.fox.ttirc/src/main/java/org/fox/ttirc/LoginActivity.java

@@ -11,7 +11,6 @@ import android.content.SharedPreferences;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.preference.PreferenceManager;
-import android.support.v7.widget.Toolbar;
 import android.util.Log;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -26,6 +25,8 @@ import org.fox.ttirc.net.HttpRequestTask;
 
 import java.util.HashMap;
 
+import androidx.appcompat.widget.Toolbar;
+
 public class LoginActivity extends CommonActivity {
 	private final String TAG = this.getClass().getSimpleName();
 
@@ -35,14 +36,6 @@ public class LoginActivity extends CommonActivity {
 	public void onCreate(Bundle savedInstanceState) {
 		m_prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
 
-        //requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
-
-        if (m_prefs.getString("theme", THEME_DEFAULT).equals(THEME_LIGHT)) {
-			setTheme(R.style.LightTheme);
-		} else {
-			setTheme(R.style.DarkTheme);
-		}
-
 		super.onCreate(savedInstanceState);
 
 		setContentView(R.layout.activity_login);

+ 11 - 14
org.fox.ttirc/src/main/java/org/fox/ttirc/MainActivity.java

@@ -22,10 +22,6 @@ import android.os.Handler;
 import android.os.IBinder;
 import android.preference.PreferenceManager;
 import android.provider.MediaStore;
-import android.support.v4.app.FragmentTransaction;
-import android.support.v4.widget.DrawerLayout;
-import android.support.v7.app.ActionBarDrawerToggle;
-import android.support.v7.widget.Toolbar;
 import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.Gravity;
@@ -65,6 +61,10 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Locale;
 
+import androidx.appcompat.app.ActionBarDrawerToggle;
+import androidx.appcompat.widget.Toolbar;
+import androidx.drawerlayout.widget.DrawerLayout;
+import androidx.fragment.app.FragmentTransaction;
 import icepick.State;
 import ir.mirrajabi.searchdialog.core.BaseSearchDialogCompat;
 import ir.mirrajabi.searchdialog.core.SearchResultListener;
@@ -150,12 +150,6 @@ public class MainActivity extends CommonActivity {
 		m_prefs = PreferenceManager
 				.getDefaultSharedPreferences(getApplicationContext());
 
-		if (m_prefs.getString("theme", THEME_DEFAULT).equals(THEME_LIGHT)) {
-			setTheme(R.style.LightTheme);
-		} else {
-			setTheme(R.style.DarkTheme);
-		}
-
 		super.onCreate(savedInstanceState);
 
 		setContentView(R.layout.activity_main);
@@ -201,7 +195,7 @@ public class MainActivity extends CommonActivity {
 			m_drawerToggle.setDrawerIndicatorEnabled(true);
 
 			if (savedInstanceState == null) {
-				drawerLayout.openDrawer(Gravity.START);
+				drawerLayout.openDrawer(Gravity.LEFT);
 			}
 
 			getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@@ -399,10 +393,10 @@ public class MainActivity extends CommonActivity {
 				DrawerLayout drawerLayout = findViewById(R.id.main_drawer);
 
 				if (drawerLayout != null) {
-					if (drawerLayout.isDrawerOpen(Gravity.START)) {
+					if (drawerLayout.isDrawerOpen(Gravity.LEFT)) {
 						drawerLayout.closeDrawers();
 					} else {
-						drawerLayout.openDrawer(Gravity.START);
+						drawerLayout.openDrawer(Gravity.LEFT);
 					}
 				}
 
@@ -451,7 +445,7 @@ public class MainActivity extends CommonActivity {
 				DrawerLayout drawer = findViewById(R.id.channel_drawer);
 
 				if (drawer != null) {
-					drawer.openDrawer(Gravity.END);
+					drawer.openDrawer(Gravity.RIGHT);
 				}
 
 				return true;
@@ -653,7 +647,10 @@ public class MainActivity extends CommonActivity {
 		}
 	}
 
+	@Override
 	public void onActivityResult(int requestCode, int resultCode, Intent data) {
+		super.onActivityResult(requestCode, resultCode, data);
+
 		if (resultCode == RESULT_OK && requestCode == REQUEST_IMAGE_PICKER) {
 			final Uri selectedMediaUri = data.getData();
 

+ 3 - 8
org.fox.ttirc/src/main/java/org/fox/ttirc/PreferencesActivity.java

@@ -2,9 +2,10 @@ package org.fox.ttirc;
 
 import android.os.Bundle;
 import android.preference.PreferenceManager;
-import android.support.v7.widget.Toolbar;
 import android.view.MenuItem;
 
+import androidx.appcompat.widget.Toolbar;
+
 public class PreferencesActivity extends CommonActivity {
 	@Override
     public void onCreate(Bundle savedInstanceState) {
@@ -12,17 +13,11 @@ public class PreferencesActivity extends CommonActivity {
         m_prefs = PreferenceManager
                 .getDefaultSharedPreferences(getApplicationContext());
 
-        if (m_prefs.getString("theme", THEME_DEFAULT).equals(THEME_LIGHT)) {
-            setTheme(R.style.LightTheme);
-        } else {
-            setTheme(R.style.DarkTheme);
-        }
-
         super.onCreate(savedInstanceState);
 
         setContentView(R.layout.activity_preferences);
 
-        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+        Toolbar toolbar = findViewById(R.id.toolbar);
         setSupportActionBar(toolbar);
 
         getSupportActionBar().setDisplayHomeAsUpEnabled(true);

+ 2 - 1
org.fox.ttirc/src/main/java/org/fox/ttirc/StateSavedFragment.java

@@ -1,10 +1,11 @@
 package org.fox.ttirc;
 
 import android.os.Bundle;
-import android.support.v4.app.Fragment;
 
 import com.livefront.bridge.Bridge;
 
+import androidx.fragment.app.Fragment;
+
 public class StateSavedFragment extends Fragment {
     @Override
     public void onCreate(Bundle savedInstanceState) {

+ 3 - 2
org.fox.ttirc/src/main/java/org/fox/ttirc/backend/UpdateService.java

@@ -12,8 +12,6 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
 import android.preference.PreferenceManager;
-import android.support.v4.app.JobIntentService;
-import android.support.v4.app.NotificationCompat;
 import android.util.Log;
 
 import com.google.gson.Gson;
@@ -54,6 +52,9 @@ import java.util.Map;
 import java.util.Timer;
 import java.util.TimerTask;
 
+import androidx.core.app.JobIntentService;
+import androidx.core.app.NotificationCompat;
+
 public class UpdateService extends Service {
 	private final String TAG = this.getClass().getSimpleName();
 	private static final String CONNSTATE_PERSIST_NAME = "connstate.object-";

+ 4 - 2
org.fox.ttirc/src/main/java/org/fox/ttirc/utils/GetFileService.java

@@ -2,7 +2,6 @@ package org.fox.ttirc.utils;
 
 import android.content.Intent;
 import android.net.http.AndroidHttpClient;
-import android.support.v4.app.JobIntentService;
 import android.util.Base64;
 import android.util.Log;
 
@@ -11,6 +10,9 @@ import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
+
+import androidx.core.app.JobIntentService;
 
 public class GetFileService extends JobIntentService {
 	private final String TAG = this.getClass().getSimpleName();
@@ -43,7 +45,7 @@ public class GetFileService extends JobIntentService {
 
 			if (m_httpLogin.length() > 0) {
 				conn.setRequestProperty("Authorization", "Basic " + 
-					Base64.encodeToString((m_httpLogin + ":" + m_httpPassword).getBytes("UTF-8"), Base64.NO_WRAP)); 				
+					Base64.encodeToString((m_httpLogin + ":" + m_httpPassword).getBytes(StandardCharsets.UTF_8), Base64.NO_WRAP));
 			}
 
 			InputStream content = conn.getInputStream();

+ 4 - 3
org.fox.ttirc/src/main/java/org/fox/ttirc/utils/ScrimInsetsFrameLayout.java

@@ -20,12 +20,13 @@ import android.content.res.TypedArray;
 import android.graphics.Canvas;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
-import android.support.v4.view.ViewCompat;
 import android.util.AttributeSet;
 import android.widget.FrameLayout;
 
 import org.fox.ttirc.R;
 
+import androidx.core.view.ViewCompat;
+
 /**
  * A layout that draws something in the insets passed to {@link #fitSystemWindows(Rect)}, i.e. the area above UI chrome
  * (status and navigation bars, overlay action bars).
@@ -135,7 +136,7 @@ public class ScrimInsetsFrameLayout extends FrameLayout {
         mOnInsetsCallback = onInsetsCallback;
     }
 
-    public static interface OnInsetsCallback {
-        public void onInsetsChanged(Rect insets);
+    public interface OnInsetsCallback {
+        void onInsetsChanged(Rect insets);
     }
 }

+ 2 - 2
org.fox.ttirc/src/main/res/layout-sw600dp-port/activity_main.xml

@@ -1,4 +1,4 @@
-    <android.support.v4.widget.DrawerLayout
+    <androidx.drawerlayout.widget.DrawerLayout
         xmlns:android="http://schemas.android.com/apk/res/android"
         android:fitsSystemWindows="true"
         android:id="@+id/main_drawer"
@@ -42,4 +42,4 @@
 
         </org.fox.ttirc.utils.ScrimInsetsFrameLayout>
 
-    </android.support.v4.widget.DrawerLayout>
+    </androidx.drawerlayout.widget.DrawerLayout>

+ 2 - 2
org.fox.ttirc/src/main/res/layout-sw600dp-port/fragment_channel.xml

@@ -1,4 +1,4 @@
-<android.support.v4.widget.DrawerLayout
+<androidx.drawerlayout.widget.DrawerLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:fitsSystemWindows="true"
     android:id="@+id/channel_drawer"
@@ -126,4 +126,4 @@
         </ListView>
     </FrameLayout>
 
-</android.support.v4.widget.DrawerLayout>
+</androidx.drawerlayout.widget.DrawerLayout>

+ 2 - 2
org.fox.ttirc/src/main/res/layout/activity_logcat.xml

@@ -6,7 +6,7 @@
 
     <include layout="@layout/toolbar" android:id="@+id/toolbar" />
 
-    <android.support.v4.widget.SwipeRefreshLayout
+    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
         android:id="@+id/logcat_swipe_container"
         android:layout_below="@+id/toolbar"
         android:layout_alignParentBottom="true"
@@ -21,6 +21,6 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent"/>
 
-    </android.support.v4.widget.SwipeRefreshLayout>
+    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
 
 </RelativeLayout>

+ 2 - 2
org.fox.ttirc/src/main/res/layout/activity_main.xml

@@ -1,4 +1,4 @@
-    <android.support.v4.widget.DrawerLayout
+    <androidx.drawerlayout.widget.DrawerLayout
         xmlns:android="http://schemas.android.com/apk/res/android"
         android:fitsSystemWindows="true"
         android:id="@+id/main_drawer"
@@ -57,4 +57,4 @@
 
         </org.fox.ttirc.utils.ScrimInsetsFrameLayout>
 
-    </android.support.v4.widget.DrawerLayout>
+    </androidx.drawerlayout.widget.DrawerLayout>

+ 2 - 2
org.fox.ttirc/src/main/res/layout/channel_pager.xml

@@ -9,12 +9,12 @@
         android:layout_width="fill_parent"
         android:layout_height="wrap_content" />
 
-    <android.support.v4.view.ViewPager
+    <androidx.viewpager.widget.ViewPager
         android:id="@+id/channel_pager"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:layout_below="@+id/article_titles" >
 
-    </android.support.v4.view.ViewPager>
+    </androidx.viewpager.widget.ViewPager>
 
 </RelativeLayout>

+ 2 - 2
org.fox.ttirc/src/main/res/layout/fragment_channel.xml

@@ -1,4 +1,4 @@
-<android.support.v4.widget.DrawerLayout
+<androidx.drawerlayout.widget.DrawerLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:fitsSystemWindows="true"
     android:id="@+id/channel_drawer"
@@ -96,5 +96,5 @@
         </ListView>
     </FrameLayout>
 
-</android.support.v4.widget.DrawerLayout>
+</androidx.drawerlayout.widget.DrawerLayout>
 

+ 1 - 1
org.fox.ttirc/src/main/res/layout/toolbar.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<android.support.v7.widget.Toolbar
+<androidx.appcompat.widget.Toolbar
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/toolbar"

+ 11 - 0
org.fox.ttirc/src/main/res/values-night-v21/style.xml

@@ -0,0 +1,11 @@
+<resources>
+    <style name="DialogTheme" parent="android:Theme.Material.Dialog"></style>
+
+    <style name="AppTheme.Base" parent="Theme.AppCompat.DayNight.NoActionBar">
+        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
+        <item name="android:statusBarColor">@android:color/transparent</item>
+        <item name="android:windowBackground">@color/window_background_dark</item>
+        <item name="android:navigationBarColor">@android:color/black</item>
+    </style>
+
+</resources>

+ 53 - 0
org.fox.ttirc/src/main/res/values-night/style.xml

@@ -0,0 +1,53 @@
+<resources>
+
+    <style name="AppTheme.Base" parent="Theme.AppCompat.DayNight.NoActionBar">
+        <item name="android:windowNoTitle">true</item>
+    </style>
+
+    <style name="DialogTheme" parent="android:Theme.Dialog">
+	</style>
+
+    <style name="DialogTheme.Compat.Light" parent="Theme.AppCompat.Light.Dialog">
+    </style>
+
+    <style name="AppTheme" parent="DarkTheme.Base">
+
+    	<item name="windowActionModeOverlay">true</item>
+
+        <item name="connectionsBackground">#303030</item>
+		<item name="nicklistBackground">@android:color/black</item>
+        <!--  <item name="messagesBackground">@android:color/transparent</item> -->
+        <item name="messagesBackground">@android:color/black</item>
+        <item name="nicklistDivider">@android:drawable/divider_horizontal_dark</item>
+        <item name="connectionNameColor">@android:color/primary_text_dark</item>
+        <item name="connectionNameSelectedColor">@android:color/primary_text_dark</item>
+        <item name="connectionOfflineNameColor">#999999</item>
+        <item name="connectionCounterColor">#33b5e5</item>
+        <item name="messageOwnNickColor">#00ffff</item>
+        <item name="messageNickColor">#00ff00</item>
+        <item name="messageTsColor">#f0f0f0</item>
+        <item name="messageBracketColor">#00ff00</item>
+        <item name="selectedConnBackground">#1c1c1c</item>
+        <item name="messageActionColor">@android:color/darker_gray</item>
+        <item name="messageSystemColor">#88b0f0</item>
+        <item name="topicColor">#909090</item>
+        <item name="channelDivider">#33b5e5</item>
+        <item name="loadingBackground">@android:color/black</item>
+        <item name="connectionStatusBackground">#990000</item>
+        <item name="connectedColor">#4CAF50</item>
+
+        <item name="colorPrimary">#22667f</item>
+        <item name="colorPrimaryDark">#174556</item>
+        <item name="colorAccent">#D84315</item>
+
+        <item name="ic_channel">@drawable/ic_channel_dark</item>
+        <item name="ic_send">@drawable/ic_send_dark</item>
+        <item name="ic_account">@drawable/ic_account_dark</item>
+        <item name="ic_online">@drawable/ic_online_dark</item>
+        <item name="ic_offline">@drawable/ic_offline_dark</item>
+
+        <item name="drawer_header">@drawable/drawer_header_dark</item>
+
+	</style>
+
+</resources>

+ 1 - 9
org.fox.ttirc/src/main/res/values-v21/style.xml

@@ -1,17 +1,9 @@
 <resources>
     <style name="DialogTheme" parent="android:Theme.Material.Dialog"></style>
     
-    <style name="LightTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
+    <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
         <item name="android:windowDrawsSystemBarBackgrounds">true</item>
         <item name="android:statusBarColor">@android:color/transparent</item>
         <item name="android:windowBackground">@color/window_background</item>
     </style>
-
-    <style name="DarkTheme.Base" parent="Theme.AppCompat.NoActionBar">
-        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
-        <item name="android:statusBarColor">@android:color/transparent</item>
-        <item name="android:windowBackground">@color/window_background_dark</item>
-        <item name="android:navigationBarColor">@android:color/black</item>
-    </style>
-
 </resources>

+ 9 - 3
org.fox.ttirc/src/main/res/values/arrays.xml

@@ -1,13 +1,17 @@
 
     <resources>
 		<string-array name="pref_theme_names">
+			<item>@string/theme_auto</item>
+			<item>@string/theme_follow_device</item>
         	<item>@string/theme_light</item>
         	<item>@string/theme_holo</item>        		
     	</string-array>
     	
     	<string-array name="pref_theme_values">
+			<item>THEME_AUTO</item>
+			<item>THEME_FOLLOW_DEVICE</item>
         	<item>THEME_LIGHT</item>
-        	<item>THEME_HOLO</item>
+        	<item>THEME_DARK</item>
     	</string-array>
     	
   		<string-array name="pref_font_size_names">
@@ -21,5 +25,7 @@
         	<item>1</item>
         	<item>2</item>
     	</string-array>
-    	    
-    </resources>
+
+		<string name="theme_follow_device">Same as device</string>
+		<string name="theme_auto">Auto (by time)</string>
+	</resources>

+ 2 - 2
org.fox.ttirc/src/main/res/values/style.xml

@@ -1,6 +1,6 @@
 <resources>
 
-    <style name="LightTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
+    <style name="AppTheme.Base" parent="Theme.AppCompat.DayNight.NoActionBar">
         <item name="android:windowNoTitle">true</item>
     </style>
 
@@ -10,7 +10,7 @@
     <style name="DialogTheme.Compat.Light" parent="Theme.AppCompat.Light.Dialog">
     </style>
 
-    <style name="LightTheme" parent="LightTheme.Base">
+    <style name="AppTheme" parent="AppTheme.Base">
 
      	<item name="windowActionModeOverlay">true</item>