Skip to content

Commit 3446147

Browse files
committed
support change theme dynamic
1 parent 216a6b7 commit 3446147

File tree

6 files changed

+21
-55
lines changed

6 files changed

+21
-55
lines changed

lib-n-ide/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ android {
99
targetSdkVersion rootProject.ext.targetSdkVersion
1010
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1111
vectorDrawables.useSupportLibrary = true
12+
13+
versionCode 2
14+
versionName "Java I-NDE v" + versionCode
1215
}
1316

1417
testOptions {

lib-n-ide/src/main/java/com/jecelyin/editor/v2/ThemeSupportActivity.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import android.preference.PreferenceManager;
2222
import android.support.annotation.CallSuper;
2323
import android.support.annotation.Nullable;
24+
import android.support.annotation.StyleRes;
2425
import android.support.v7.app.AppCompatActivity;
2526
import android.support.v7.app.AppCompatDelegate;
2627
import android.view.MenuItem;
@@ -41,10 +42,15 @@ public abstract class ThemeSupportActivity extends AppCompatActivity implements
4142
protected void onCreate(@Nullable Bundle savedInstanceState) {
4243
super.onCreate(savedInstanceState);
4344
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
44-
setTheme(Preferences.getInstance(this).getAppTheme());
45+
setTheme(getThemeId());
4546
setFullScreenMode(isFullScreenMode());
4647
}
4748

49+
@StyleRes
50+
protected int getThemeId() {
51+
return Preferences.getInstance(this).getAppTheme();
52+
}
53+
4854
protected boolean isFullScreenMode() {
4955
return Preferences.getInstance(this).isFullScreenMode();
5056
}

lib-n-ide/src/main/res-file-expoler/layout/activity_file_explorer.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<layout xmlns:android="http://schemas.android.com/apk/res/android">
2+
<layout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
34

45
<data>
56

@@ -49,7 +50,9 @@
4950
android:inputType="textNoSuggestions"
5051
android:paddingLeft="5dp"
5152
android:paddingRight="5dp"
52-
android:textColor="#333" />
53+
android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"
54+
android:textColor="?android:textColorPrimary"
55+
tools:text="Sdcard/JavaNIDE" />
5356

5457
<android.support.v7.widget.AppCompatButton
5558
android:id="@+id/save_btn"
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
34
xmlns:tools="http://schemas.android.com/tools"
45
android:layout_width="wrap_content"
56
android:layout_height="wrap_content"
6-
xmlns:app="http://schemas.android.com/apk/res-auto"
77
android:background="?selectableItemBackground"
88
android:clickable="true"
99
android:focusable="true"
10-
android:padding="4dp"
11-
android:gravity="center_vertical">
10+
android:gravity="center_vertical"
11+
android:padding="4dp">
1212

13-
<android.support.v7.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android"
13+
<android.support.v7.widget.AppCompatTextView
1414
android:id="@+id/textView"
1515
android:layout_width="wrap_content"
1616
android:layout_height="wrap_content"
@@ -23,7 +23,7 @@
2323
<com.duy.common.view.TintImageView
2424
android:layout_width="wrap_content"
2525
android:layout_height="wrap_content"
26-
app:srcCompat="@drawable/ic_chevron_right_black_24dp"
27-
android:textColor="?android:textColorPrimary" />
26+
android:textColor="?android:textColorPrimary"
27+
app:srcCompat="@drawable/ic_chevron_right_black_24dp" />
2828

2929
</LinearLayout>

lib-n-ide/src/main/res/color/editor_primary_text_material_dark.xml

Lines changed: 0 additions & 23 deletions
This file was deleted.

lib-n-ide/src/main/res/color/editor_secondary_text_material_dark.xml

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)