v2.2.00
This commit is contained in:
parent
ca4e9e7ef0
commit
767d0d918d
9 changed files with 509 additions and 26 deletions
|
@ -6,7 +6,6 @@ import android.os.Bundle;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
|
||||
|
@ -41,7 +40,7 @@ import static code.name.monkey.retromusic.Constants.USER_PROFILE;
|
|||
public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDialogFragment {
|
||||
|
||||
private static final String TAG = "MainOptionsBottomSheetD";
|
||||
private static ButterKnife.Setter<TextView, Integer> textColor = (view, value, index) -> view.setTextColor(ColorStateList.valueOf(value));
|
||||
private static ButterKnife.Setter<MaterialButton, Integer> textColor = (view, value, index) -> view.setTextColor(ColorStateList.valueOf(value));
|
||||
|
||||
|
||||
@BindViews({R.id.action_folders, R.id.action_about, R.id.action_buy_pro, R.id.action_rate,
|
||||
|
|
|
@ -174,12 +174,12 @@ public abstract class AbsThemeActivity extends ATHActivity implements Runnable {
|
|||
}
|
||||
|
||||
public void setImmersiveFullscreen() {
|
||||
int flags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
if (PreferenceUtil.getInstance().getFullScreenMode()) {
|
||||
getWindow().getDecorView().setSystemUiVisibility(flags);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ import android.widget.FrameLayout;
|
|||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StyleRes;
|
||||
|
@ -22,6 +24,7 @@ import code.name.monkey.appthemehelper.ThemeStore;
|
|||
import code.name.monkey.appthemehelper.util.VersionUtils;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity;
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
import code.name.monkey.retromusic.util.RetroUtil;
|
||||
|
||||
/**
|
||||
|
@ -30,23 +33,6 @@ import code.name.monkey.retromusic.util.RetroUtil;
|
|||
@SuppressLint("RestrictedApi")
|
||||
public class RoundedBottomSheetDialogFragment extends AppCompatDialogFragment {
|
||||
|
||||
/* @Override
|
||||
public int getTheme() {
|
||||
//noinspection ConstantConditions
|
||||
if (PreferenceUtil.getInstance().getGeneralTheme() == R.style.Theme_RetroMusic_Light) {
|
||||
return R.style.BottomSheetDialogTheme;
|
||||
} else if (PreferenceUtil.getInstance().getGeneralTheme() == R.style.Theme_RetroMusic_Color) {
|
||||
int color = ThemeStore.primaryColor(getContext());
|
||||
if (ColorUtil.isColorLight(color)) {
|
||||
return R.style.BottomSheetDialogTheme;
|
||||
} else {
|
||||
return R.style.BottomSheetDialogThemeDark;
|
||||
}
|
||||
} else {
|
||||
return R.style.BottomSheetDialogTheme;
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
@ -95,7 +81,7 @@ public class RoundedBottomSheetDialogFragment extends AppCompatDialogFragment {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
int width = getContext().getResources().getDimensionPixelSize(R.dimen.bottom_sheet_width);
|
||||
getWindow().setLayout(width > 0 ? width : ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
Objects.requireNonNull(getWindow()).setLayout(width > 0 ? width : ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
}
|
||||
}
|
||||
|
|
258
app/src/sans/AndroidManifest.xml
Normal file
258
app/src/sans/AndroidManifest.xml
Normal file
|
@ -0,0 +1,258 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="code.name.monkey.retromusic">
|
||||
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="com.android.vending.BILLING" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
|
||||
<application
|
||||
android:name=".RetroApplication"
|
||||
android:allowBackup="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.RetroMusic.Light"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity
|
||||
android:name=".ui.activities.MainActivity"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="android.intent.action.MUSIC_PLAYER" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="android.intent.category.APP_MUSIC" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:scheme="content" />
|
||||
<data android:mimeType="audio/*" />
|
||||
<data android:mimeType="application/ogg" />
|
||||
<data android:mimeType="application/x-ogg" />
|
||||
<data android:mimeType="application/itunes" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:scheme="file" />
|
||||
<data android:mimeType="audio/*" />
|
||||
<data android:mimeType="application/ogg" />
|
||||
<data android:mimeType="application/x-ogg" />
|
||||
<data android:mimeType="application/itunes" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="http" />
|
||||
<data android:mimeType="audio/*" />
|
||||
<data android:mimeType="application/ogg" />
|
||||
<data android:mimeType="application/x-ogg" />
|
||||
<data android:mimeType="application/itunes" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:mimeType="vnd.android.cursor.dir/playlist" />
|
||||
<data android:mimeType="vnd.android.cursor.dir/albums" />
|
||||
<data android:mimeType="vnd.android.cursor.dir/artists" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.cyanogenmod.eleven.AUDIO_PLAYER" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PICK" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.OPENABLE" />
|
||||
|
||||
<data android:mimeType="vnd.android.cursor.dir/audio" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ui.activities.album.AlbumDetailsActivity" />
|
||||
<activity android:name=".ui.activities.ArtistDetailActivity" />
|
||||
<activity android:name=".ui.activities.PlaylistDetailActivity" />
|
||||
<activity android:name=".ui.activities.PlayingQueueActivity" />
|
||||
<activity android:name=".ui.activities.AboutActivity" />
|
||||
<activity android:name=".ui.activities.tageditor.AlbumTagEditorActivity" />
|
||||
<activity android:name=".ui.activities.tageditor.SongTagEditorActivity" />
|
||||
<activity android:name=".ui.activities.SettingsActivity" />
|
||||
<activity android:name=".ui.activities.SearchActivity" />
|
||||
<activity android:name=".ui.activities.LyricsActivity" />
|
||||
<activity android:name=".ui.activities.UserInfoActivity" />
|
||||
<activity
|
||||
android:name=".appshortcuts.AppShortcutLauncherActivity"
|
||||
android:launchMode="singleInstance"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
|
||||
<activity
|
||||
android:name=".ui.activities.LockScreenActivity"
|
||||
android:autoRemoveFromRecents="true"
|
||||
android:launchMode="singleInstance"
|
||||
android:screenOrientation="sensorPortrait"
|
||||
android:showOnLockScreen="true" />
|
||||
<activity android:name=".ui.activities.SupportDevelopmentActivity" />
|
||||
<activity android:name=".ui.activities.GenreDetailsActivity" />
|
||||
<activity android:name=".ui.activities.LicenseActivity" />
|
||||
<activity android:name=".ui.activities.ProVersionActivity" />
|
||||
<activity android:name=".ui.activities.EqualizerActivity" />
|
||||
<activity android:name=".ui.activities.ErrorHandlerActivity" />
|
||||
<activity
|
||||
android:name=".cast.ExpandedCastControlsActivity"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleInstance"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.ExpandedCastController" />
|
||||
|
||||
<service
|
||||
android:name=".service.MusicService"
|
||||
android:enabled="true" />
|
||||
|
||||
<service
|
||||
android:name=".service.WearBrowserService"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.media.browse.MediaBrowserService" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<!--<service-->
|
||||
<!--android:name=".service.daydream.RetroMusicAlbums"-->
|
||||
<!--android:exported="true"-->
|
||||
<!--android:label="Retro Music Albums"-->
|
||||
<!--android:permission="android.permission.BIND_DREAM_SERVICE">-->
|
||||
<!--<intent-filter>-->
|
||||
<!--<action android:name="android.service.dreams.DreamService" />-->
|
||||
<!--<category android:name="android.intent.category.DEFAULT" />-->
|
||||
<!--</intent-filter>-->
|
||||
<!--</service>-->
|
||||
<!-- Widgets -->
|
||||
<!-- <receiver
|
||||
android:name=".headset.HeadsetReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.HEADSET_PLUG" />
|
||||
</intent-filter>
|
||||
</receiver>-->
|
||||
<receiver android:name=".appwidgets.BootReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".appwidgets.AppWidgetBig"
|
||||
android:exported="false"
|
||||
android:label="@string/app_widget_big_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/app_widget_big_info" />
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".appwidgets.AppWidgetClassic"
|
||||
android:exported="false"
|
||||
android:label="@string/app_widget_classic_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/app_widget_classic_info" />
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".appwidgets.AppWidgetSmall"
|
||||
android:exported="false"
|
||||
android:label="@string/app_widget_small_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/app_widget_small_info" />
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".appwidgets.AppWidgetCard"
|
||||
android:exported="false"
|
||||
android:label="@string/app_widget_card_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/app_widget_card_info" />
|
||||
</receiver>
|
||||
<receiver android:name=".service.MediaButtonIntentReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MEDIA_BUTTON" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<!--Widgets ends-->
|
||||
|
||||
|
||||
<meta-data
|
||||
android:name="android.max_aspect"
|
||||
android:value="2.1" />
|
||||
<meta-data
|
||||
android:name="com.lge.support.SPLIT_WINDOW"
|
||||
android:value="true" />
|
||||
<meta-data
|
||||
android:name="code.name.monkey.retromusic.glide.RetroMusicGlideModule"
|
||||
android:value="GlideModule" />
|
||||
<meta-data
|
||||
android:name="com.bumptech.glide.integration.okhttp3.OkHttpGlideModule"
|
||||
android:value="GlideModule" />
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
|
||||
android:value="code.name.monkey.retromusic.cast.CastOptionsProvider" />
|
||||
|
||||
<!-- <meta-data
|
||||
android:name="com.google.android.gms.car.application"
|
||||
android:resource="@xml/automotive_app_desc" />-->
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths" />
|
||||
</provider>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
BIN
app/src/sans/assets/fonts/product_sans_bold.ttf
Executable file
BIN
app/src/sans/assets/fonts/product_sans_bold.ttf
Executable file
Binary file not shown.
BIN
app/src/sans/assets/fonts/product_sans_regular.ttf
Executable file
BIN
app/src/sans/assets/fonts/product_sans_regular.ttf
Executable file
Binary file not shown.
|
@ -0,0 +1,119 @@
|
|||
package code.name.monkey.retromusic;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import com.anjlab.android.iab.v3.BillingProcessor;
|
||||
import com.anjlab.android.iab.v3.TransactionDetails;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager;
|
||||
import uk.co.chrisjenx.calligraphy.CalligraphyConfig;
|
||||
|
||||
public class RetroApplication extends MultiDexApplication {
|
||||
|
||||
public static final String PRO_VERSION_PRODUCT_ID = "pro_version";
|
||||
|
||||
private static RetroApplication app;
|
||||
|
||||
private BillingProcessor billingProcessor;
|
||||
|
||||
public static RetroApplication getInstance() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public static boolean isProVersion() {
|
||||
return BuildConfig.DEBUG || app.billingProcessor.isPurchased(PRO_VERSION_PRODUCT_ID);
|
||||
}
|
||||
|
||||
public static void deleteAppData() {
|
||||
try {
|
||||
// clearing app data
|
||||
String packageName = app.getPackageName();
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
runtime.exec("pm clear " + packageName);
|
||||
|
||||
System.exit(0);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
app = this;
|
||||
|
||||
setupErrorHandler();
|
||||
|
||||
// default theme
|
||||
if (!ThemeStore.isConfigured(this, 1)) {
|
||||
ThemeStore.editTheme(this)
|
||||
.accentColorRes(R.color.md_green_A200)
|
||||
.commit();
|
||||
}
|
||||
|
||||
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/circular_std_book.otf")
|
||||
.setFontAttrId(R.attr.fontPath)
|
||||
.build()
|
||||
);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
||||
new DynamicShortcutManager(this).initDynamicShortcuts();
|
||||
}
|
||||
|
||||
// automatically restores purchases
|
||||
billingProcessor = new BillingProcessor(this, BuildConfig.GOOGLE_PLAY_LICENSE_KEY,
|
||||
new BillingProcessor.IBillingHandler() {
|
||||
@Override
|
||||
public void onProductPurchased(@NonNull String productId, TransactionDetails details) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPurchaseHistoryRestored() {
|
||||
//Toast.makeText(App.this, R.string.restored_previous_purchase_please_restart, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBillingError(int errorCode, Throwable error) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBillingInitialized() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupErrorHandler() {
|
||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
@Override
|
||||
public void uncaughtException(Thread thread, Throwable throwable) {
|
||||
handleUncaughtException(thread, throwable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleUncaughtException(Thread thread, Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
deleteAppData();
|
||||
//Intent intent = new Intent(this, ErrorHandlerActivity.class);
|
||||
//intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
//startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
Glide.with(this).onLowMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
billingProcessor.release();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package code.name.monkey.retromusic;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import com.anjlab.android.iab.v3.BillingProcessor;
|
||||
import com.anjlab.android.iab.v3.TransactionDetails;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager;
|
||||
import uk.co.chrisjenx.calligraphy.CalligraphyConfig;
|
||||
|
||||
public class RetroApplication2 extends MultiDexApplication {
|
||||
|
||||
public static final String PRO_VERSION_PRODUCT_ID = "pro_version";
|
||||
|
||||
private static RetroApplication2 app;
|
||||
|
||||
private BillingProcessor billingProcessor;
|
||||
|
||||
public static RetroApplication2 getInstance() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public static boolean isProVersion() {
|
||||
return BuildConfig.DEBUG || app.billingProcessor.isPurchased(PRO_VERSION_PRODUCT_ID);
|
||||
}
|
||||
|
||||
public static void deleteAppData() {
|
||||
try {
|
||||
// clearing app data
|
||||
String packageName = app.getPackageName();
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
runtime.exec("pm clear " + packageName);
|
||||
|
||||
System.exit(0);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
app = this;
|
||||
|
||||
setupErrorHandler();
|
||||
|
||||
// default theme
|
||||
if (!ThemeStore.isConfigured(this, 1)) {
|
||||
ThemeStore.editTheme(this)
|
||||
.accentColorRes(R.color.md_green_A200)
|
||||
.commit();
|
||||
}
|
||||
|
||||
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/Product Sans Regular.ttf")
|
||||
.setFontAttrId(R.attr.fontPath)
|
||||
.build()
|
||||
);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
||||
new DynamicShortcutManager(this).initDynamicShortcuts();
|
||||
}
|
||||
|
||||
// automatically restores purchases
|
||||
billingProcessor = new BillingProcessor(this, BuildConfig.GOOGLE_PLAY_LICENSE_KEY,
|
||||
new BillingProcessor.IBillingHandler() {
|
||||
@Override
|
||||
public void onProductPurchased(@NonNull String productId, TransactionDetails details) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPurchaseHistoryRestored() {
|
||||
//Toast.makeText(App.this, R.string.restored_previous_purchase_please_restart, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBillingError(int errorCode, Throwable error) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBillingInitialized() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupErrorHandler() {
|
||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
@Override
|
||||
public void uncaughtException(Thread thread, Throwable throwable) {
|
||||
handleUncaughtException(thread, throwable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleUncaughtException(Thread thread, Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
deleteAppData();
|
||||
//Intent intent = new Intent(this, ErrorHandlerActivity.class);
|
||||
//intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
//startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
Glide.with(this).onLowMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
billingProcessor.release();
|
||||
}
|
||||
}
|
2
app/src/sans/res/values/donottranslate.xml
Normal file
2
app/src/sans/res/values/donottranslate.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
Loading…
Reference in a new issue