Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
ef2e0209
Commit
ef2e0209
authored
Jan 04, 2017
by
tonymanou
Committed by
topjohnwu
Jan 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use untranslatable string when storing theme
This fixes #30
parent
93598d3a
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
23 additions
and
9 deletions
+23
-9
AboutActivity.java
app/src/main/java/com/topjohnwu/magisk/AboutActivity.java
+3
-2
MainActivity.java
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
+2
-1
SettingsActivity.java
app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java
+2
-2
SplashActivity.java
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
+1
-1
Utils.java
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
+4
-0
WebWindow.java
app/src/main/java/com/topjohnwu/magisk/utils/WebWindow.java
+1
-1
arrays.xml
app/src/main/res/values/arrays.xml
+4
-0
strings.xml
app/src/main/res/values/strings.xml
+4
-0
app_settings.xml
app/src/main/res/xml/app_settings.xml
+2
-2
No files found.
app/src/main/java/com/topjohnwu/magisk/AboutActivity.java
View file @
ef2e0209
...
@@ -18,6 +18,7 @@ import android.view.WindowManager;
...
@@ -18,6 +18,7 @@ import android.view.WindowManager;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
...
@@ -45,7 +46,7 @@ public class AboutActivity extends AppCompatActivity {
...
@@ -45,7 +46,7 @@ public class AboutActivity extends AppCompatActivity {
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
Logger
.
dev
(
"AboutActivity: Theme is "
+
theme
);
Logger
.
dev
(
"AboutActivity: Theme is "
+
theme
);
if
(
theme
.
equals
(
"Dark"
))
{
if
(
Utils
.
isDarkTheme
(
theme
,
this
))
{
setTheme
(
R
.
style
.
AppTheme_dh
);
setTheme
(
R
.
style
.
AppTheme_dh
);
}
}
setContentView
(
R
.
layout
.
activity_about
);
setContentView
(
R
.
layout
.
activity_about
);
...
@@ -76,7 +77,7 @@ public class AboutActivity extends AppCompatActivity {
...
@@ -76,7 +77,7 @@ public class AboutActivity extends AppCompatActivity {
}
}
appChangelog
.
removeSummary
();
appChangelog
.
removeSummary
();
if
(
theme
.
equals
(
"Dark"
))
{
if
(
Utils
.
isDarkTheme
(
theme
,
this
))
{
builder
=
new
AlertDialog
.
Builder
(
this
,
R
.
style
.
AlertDialog_dh
);
builder
=
new
AlertDialog
.
Builder
(
this
,
R
.
style
.
AlertDialog_dh
);
}
else
{
}
else
{
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
=
new
AlertDialog
.
Builder
(
this
);
...
...
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
View file @
ef2e0209
...
@@ -27,6 +27,7 @@ import android.view.View;
...
@@ -27,6 +27,7 @@ import android.view.View;
import
com.topjohnwu.magisk.utils.CallbackHandler
;
import
com.topjohnwu.magisk.utils.CallbackHandler
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.ButterKnife
;
...
@@ -55,7 +56,7 @@ public class MainActivity extends AppCompatActivity
...
@@ -55,7 +56,7 @@ public class MainActivity extends AppCompatActivity
String
theme
=
prefs
.
getString
(
"theme"
,
""
);
String
theme
=
prefs
.
getString
(
"theme"
,
""
);
Logger
.
dev
(
"MainActivity: Theme is "
+
theme
);
Logger
.
dev
(
"MainActivity: Theme is "
+
theme
);
if
(
theme
.
equals
(
"Dark"
))
{
if
(
Utils
.
isDarkTheme
(
theme
,
this
))
{
setTheme
(
R
.
style
.
AppTheme_dh
);
setTheme
(
R
.
style
.
AppTheme_dh
);
alertBuilder
=
new
AlertDialog
.
Builder
(
this
,
R
.
style
.
AlertDialog_dh
);
alertBuilder
=
new
AlertDialog
.
Builder
(
this
,
R
.
style
.
AlertDialog_dh
);
}
else
{
}
else
{
...
...
app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java
View file @
ef2e0209
...
@@ -30,7 +30,7 @@ public class SettingsActivity extends AppCompatActivity {
...
@@ -30,7 +30,7 @@ public class SettingsActivity extends AppCompatActivity {
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplicationContext
()).
getString
(
"theme"
,
""
);
Logger
.
dev
(
"AboutActivity: Theme is "
+
theme
);
Logger
.
dev
(
"AboutActivity: Theme is "
+
theme
);
if
(
theme
.
equals
(
"Dark"
))
{
if
(
Utils
.
isDarkTheme
(
theme
,
this
))
{
setTheme
(
R
.
style
.
AppTheme_dh
);
setTheme
(
R
.
style
.
AppTheme_dh
);
}
}
...
@@ -123,7 +123,7 @@ public class SettingsActivity extends AppCompatActivity {
...
@@ -123,7 +123,7 @@ public class SettingsActivity extends AppCompatActivity {
String
theme
=
prefs
.
getString
(
key
,
""
);
String
theme
=
prefs
.
getString
(
key
,
""
);
themePreference
.
setSummary
(
theme
);
themePreference
.
setSummary
(
theme
);
if
(
theme
.
equals
(
"Dark"
))
{
if
(
Utils
.
isDarkTheme
(
theme
,
getActivity
()
))
{
getActivity
().
getApplication
().
setTheme
(
R
.
style
.
AppTheme_dh
);
getActivity
().
getApplication
().
setTheme
(
R
.
style
.
AppTheme_dh
);
}
else
{
}
else
{
getActivity
().
getApplication
().
setTheme
(
R
.
style
.
AppTheme
);
getActivity
().
getApplication
().
setTheme
(
R
.
style
.
AppTheme
);
...
...
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
View file @
ef2e0209
...
@@ -17,7 +17,7 @@ public class SplashActivity extends AppCompatActivity {
...
@@ -17,7 +17,7 @@ public class SplashActivity extends AppCompatActivity {
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplication
());
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getApplication
());
if
(
prefs
.
getString
(
"theme"
,
""
).
equals
(
"Dark"
))
{
if
(
Utils
.
isDarkTheme
(
prefs
.
getString
(
"theme"
,
null
),
this
))
{
setTheme
(
R
.
style
.
AppTheme_dh
);
setTheme
(
R
.
style
.
AppTheme_dh
);
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
ef2e0209
...
@@ -164,6 +164,10 @@ public class Utils {
...
@@ -164,6 +164,10 @@ public class Utils {
return
null
;
return
null
;
}
}
public
static
boolean
isDarkTheme
(
String
theme
,
Context
resources
)
{
return
theme
!=
null
&&
theme
.
equalsIgnoreCase
(
resources
.
getString
(
R
.
string
.
theme_dark_value
));
}
public
static
class
ByteArrayInOutStream
extends
ByteArrayOutputStream
{
public
static
class
ByteArrayInOutStream
extends
ByteArrayOutputStream
{
public
ByteArrayInputStream
getInputStream
()
{
public
ByteArrayInputStream
getInputStream
()
{
ByteArrayInputStream
in
=
new
ByteArrayInputStream
(
buf
,
0
,
count
);
ByteArrayInputStream
in
=
new
ByteArrayInputStream
(
buf
,
0
,
count
);
...
...
app/src/main/java/com/topjohnwu/magisk/utils/WebWindow.java
View file @
ef2e0209
...
@@ -14,7 +14,7 @@ public class WebWindow {
...
@@ -14,7 +14,7 @@ public class WebWindow {
public
WebWindow
(
String
title
,
String
url
,
Context
context
)
{
public
WebWindow
(
String
title
,
String
url
,
Context
context
)
{
AlertDialog
.
Builder
alert
;
AlertDialog
.
Builder
alert
;
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
getString
(
"theme"
,
""
);
String
theme
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
).
getString
(
"theme"
,
""
);
if
(
theme
.
equals
(
"Dark"
))
{
if
(
Utils
.
isDarkTheme
(
theme
,
context
))
{
alert
=
new
AlertDialog
.
Builder
(
context
,
R
.
style
.
AlertDialog_dh
);
alert
=
new
AlertDialog
.
Builder
(
context
,
R
.
style
.
AlertDialog_dh
);
}
else
{
}
else
{
alert
=
new
AlertDialog
.
Builder
(
context
);
alert
=
new
AlertDialog
.
Builder
(
context
);
...
...
app/src/main/res/values/arrays.xml
View file @
ef2e0209
...
@@ -4,4 +4,8 @@
...
@@ -4,4 +4,8 @@
<item>
"Default"
</item>
<item>
"Default"
</item>
<item>
"Dark"
</item>
<item>
"Dark"
</item>
</string-array>
</string-array>
<string-array
name=
"themes_values"
>
<item>
@string/theme_default_value
</item>
<item>
@string/theme_dark_value
</item>
</string-array>
</resources>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
ef2e0209
...
@@ -130,4 +130,8 @@
...
@@ -130,4 +130,8 @@
<string
name=
"settings_reboot_toast"
>
Reboot to apply settings
</string>
<string
name=
"settings_reboot_toast"
>
Reboot to apply settings
</string>
<!-- Themes -->
<string
name=
"theme_default_value"
translatable=
"false"
>
default
</string>
<string
name=
"theme_dark_value"
translatable=
"false"
>
dark
</string>
</resources>
</resources>
app/src/main/res/xml/app_settings.xml
View file @
ef2e0209
...
@@ -8,9 +8,9 @@
...
@@ -8,9 +8,9 @@
android:key=
"theme"
android:key=
"theme"
android:title=
"@string/settings_theme_title"
android:title=
"@string/settings_theme_title"
android:summary=
"@string/settings_theme_summary"
android:summary=
"@string/settings_theme_summary"
android:defaultValue=
"
Default
"
android:defaultValue=
"
@string/theme_default_value
"
android:entries=
"@array/themes"
android:entries=
"@array/themes"
android:entryValues=
"@array/themes"
/>
android:entryValues=
"@array/themes
_values
"
/>
</PreferenceCategory>
</PreferenceCategory>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment