mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 23:17:39 +00:00
Move to raw resources
This commit is contained in:
parent
25b67017e4
commit
df9c40c035
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,7 +6,7 @@
|
|||||||
app/release
|
app/release
|
||||||
*.hprof
|
*.hprof
|
||||||
.externalNativeBuild/
|
.externalNativeBuild/
|
||||||
src/main/assets/*.sh
|
src/main/assets
|
||||||
public.certificate.x509.pem
|
public.certificate.x509.pem
|
||||||
private.key.pk8
|
private.key.pk8
|
||||||
*.apk
|
*.apk
|
||||||
|
@ -14,8 +14,6 @@ import com.topjohnwu.magisk.components.AboutCardRow;
|
|||||||
import com.topjohnwu.magisk.components.Activity;
|
import com.topjohnwu.magisk.components.Activity;
|
||||||
import com.topjohnwu.magisk.utils.Const;
|
import com.topjohnwu.magisk.utils.Const;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
@ -56,12 +54,8 @@ public class AboutActivity extends Activity {
|
|||||||
|
|
||||||
appChangelog.removeSummary();
|
appChangelog.removeSummary();
|
||||||
appChangelog.setOnClickListener(v -> {
|
appChangelog.setOnClickListener(v -> {
|
||||||
try {
|
new MarkDownWindow(this, getString(R.string.app_changelog),
|
||||||
InputStream is = getAssets().open("changelog.md");
|
getResources().openRawResource(R.raw.changelog)).exec();
|
||||||
new MarkDownWindow(this, getString(R.string.app_changelog), is).exec();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
String translators = getString(R.string.translators);
|
String translators = getString(R.string.translators);
|
||||||
|
@ -23,9 +23,6 @@ import com.topjohnwu.magisk.utils.Topic;
|
|||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
import com.topjohnwu.superuser.Shell;
|
import com.topjohnwu.superuser.Shell;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
@ -99,12 +96,8 @@ public class MainActivity extends Activity
|
|||||||
|
|
||||||
if (mm.prefs.getInt(Const.Key.APP_VER, -1) < BuildConfig.VERSION_CODE) {
|
if (mm.prefs.getInt(Const.Key.APP_VER, -1) < BuildConfig.VERSION_CODE) {
|
||||||
prefs.edit().putInt(Const.Key.APP_VER, BuildConfig.VERSION_CODE).apply();
|
prefs.edit().putInt(Const.Key.APP_VER, BuildConfig.VERSION_CODE).apply();
|
||||||
try {
|
new MarkDownWindow(this, getString(R.string.app_changelog),
|
||||||
InputStream is = getAssets().open("changelog.md");
|
getResources().openRawResource(R.raw.changelog)).exec();
|
||||||
new MarkDownWindow(this, getString(R.string.app_changelog), is).exec();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,11 +54,13 @@ public class MarkDownWindow extends ParallelTask<Void, Void, String> {
|
|||||||
}
|
}
|
||||||
String css;
|
String css;
|
||||||
try (
|
try (
|
||||||
InputStream in = mm.getAssets().open(mm.isDarkTheme ? "dark.css" : "light.css");
|
InputStream in = mm.getResources().openRawResource(
|
||||||
|
mm.isDarkTheme ? R.raw.dark : R.raw.light);
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream()
|
ByteArrayOutputStream out = new ByteArrayOutputStream()
|
||||||
) {
|
) {
|
||||||
ShellUtils.pump(in, out);
|
ShellUtils.pump(in, out);
|
||||||
css = out.toString();
|
css = out.toString();
|
||||||
|
in.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return "";
|
return "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user