Fix crashing on What' new
This commit is contained in:
parent
ea36131c01
commit
afd257f175
2 changed files with 11 additions and 13 deletions
|
@ -5,16 +5,16 @@ import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.widget.TextView;
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
import com.google.android.material.appbar.AppBarLayout;
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
|
|
||||||
import code.name.monkey.appthemehelper.ThemeStore;
|
import code.name.monkey.appthemehelper.ThemeStore;
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||||
|
@ -26,7 +26,6 @@ import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||||
|
|
||||||
public class WhatsNewActivity extends AbsBaseActivity {
|
public class WhatsNewActivity extends AbsBaseActivity {
|
||||||
WebView webView;
|
WebView webView;
|
||||||
TextView title;
|
|
||||||
Toolbar toolbar;
|
Toolbar toolbar;
|
||||||
AppBarLayout appBarLayout;
|
AppBarLayout appBarLayout;
|
||||||
|
|
||||||
|
@ -51,7 +50,6 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
||||||
setContentView(R.layout.activity_whats_new);
|
setContentView(R.layout.activity_whats_new);
|
||||||
|
|
||||||
webView = findViewById(R.id.webView);
|
webView = findViewById(R.id.webView);
|
||||||
title = findViewById(R.id.bannerTitle);
|
|
||||||
toolbar = findViewById(R.id.toolbar);
|
toolbar = findViewById(R.id.toolbar);
|
||||||
appBarLayout = findViewById(R.id.appBarLayout);
|
appBarLayout = findViewById(R.id.appBarLayout);
|
||||||
|
|
||||||
|
@ -65,14 +63,13 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
toolbar.setNavigationOnClickListener(v -> onBackPressed());
|
toolbar.setNavigationOnClickListener(v -> onBackPressed());
|
||||||
title.setTextColor(ThemeStore.Companion.textColorPrimary(this));
|
|
||||||
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.Companion.textColorSecondary(this));
|
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.Companion.textColorSecondary(this));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Load from phonograph-changelog.html in the assets folder
|
// Load from phonograph-changelog.html in the assets folder
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
InputStream json = getAssets().open("retro-changelog.html");
|
InputStream json = getAssets().open("retro-changelog.html");
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(json, "UTF-8"));
|
BufferedReader in = new BufferedReader(new InputStreamReader(json, StandardCharsets.UTF_8));
|
||||||
String str;
|
String str;
|
||||||
while ((str = in.readLine()) != null)
|
while ((str = in.readLine()) != null)
|
||||||
buf.append(str);
|
buf.append(str);
|
||||||
|
|
|
@ -21,15 +21,16 @@ import android.content.SharedPreferences.Editor;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import androidx.annotation.LayoutRes;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.StyleRes;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
|
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import androidx.annotation.LayoutRes;
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.StyleRes;
|
|
||||||
import androidx.viewpager.widget.ViewPager;
|
|
||||||
import code.name.monkey.retromusic.App;
|
import code.name.monkey.retromusic.App;
|
||||||
import code.name.monkey.retromusic.R;
|
import code.name.monkey.retromusic.R;
|
||||||
import code.name.monkey.retromusic.activities.MainActivity;
|
import code.name.monkey.retromusic.activities.MainActivity;
|
||||||
|
@ -277,7 +278,7 @@ public final class PreferenceUtil {
|
||||||
|
|
||||||
|
|
||||||
public final int getLastPage() {
|
public final int getLastPage() {
|
||||||
return mPreferences.getInt(LAST_PAGE, R.id.action_home);
|
return mPreferences.getInt(LAST_PAGE, R.id.action_song);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastPage(final int value) {
|
public void setLastPage(final int value) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue