Commit df9c40c0 authored by topjohnwu's avatar topjohnwu

Move to raw resources

parent 25b67017
......@@ -6,7 +6,7 @@
app/release
*.hprof
.externalNativeBuild/
src/main/assets/*.sh
src/main/assets
public.certificate.x509.pem
private.key.pk8
*.apk
......@@ -14,8 +14,6 @@ import com.topjohnwu.magisk.components.AboutCardRow;
import com.topjohnwu.magisk.components.Activity;
import com.topjohnwu.magisk.utils.Const;
import java.io.IOException;
import java.io.InputStream;
import java.util.Locale;
import butterknife.BindView;
......@@ -56,12 +54,8 @@ public class AboutActivity extends Activity {
appChangelog.removeSummary();
appChangelog.setOnClickListener(v -> {
try {
InputStream is = getAssets().open("changelog.md");
new MarkDownWindow(this, getString(R.string.app_changelog), is).exec();
} catch (IOException e) {
e.printStackTrace();
}
new MarkDownWindow(this, getString(R.string.app_changelog),
getResources().openRawResource(R.raw.changelog)).exec();
});
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.superuser.Shell;
import java.io.IOException;
import java.io.InputStream;
import butterknife.BindView;
import butterknife.ButterKnife;
......@@ -99,12 +96,8 @@ public class MainActivity extends Activity
if (mm.prefs.getInt(Const.Key.APP_VER, -1) < BuildConfig.VERSION_CODE) {
prefs.edit().putInt(Const.Key.APP_VER, BuildConfig.VERSION_CODE).apply();
try {
InputStream is = getAssets().open("changelog.md");
new MarkDownWindow(this, getString(R.string.app_changelog), is).exec();
} catch (IOException e) {
e.printStackTrace();
}
new MarkDownWindow(this, getString(R.string.app_changelog),
getResources().openRawResource(R.raw.changelog)).exec();
}
}
......
......@@ -54,11 +54,13 @@ public class MarkDownWindow extends ParallelTask<Void, Void, String> {
}
String css;
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()
) {
ShellUtils.pump(in, out);
css = out.toString();
in.close();
} catch (IOException e) {
e.printStackTrace();
return "";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment