added incompatible message for shitty devices
This commit is contained in:
parent
b3d79c67fc
commit
c0a4e64933
|
@ -21,8 +21,8 @@ android {
|
|||
applicationId "org.mariotaku.twidere"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 23
|
||||
versionCode 183
|
||||
versionName "3.1.3.2"
|
||||
versionCode 184
|
||||
versionName "3.1.3.3"
|
||||
multiDexEnabled true
|
||||
|
||||
generatedDensities = []
|
||||
|
|
|
@ -20,10 +20,12 @@
|
|||
package org.mariotaku.twidere.util;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.crashlytics.android.Crashlytics;
|
||||
|
||||
import org.mariotaku.twidere.BuildConfig;
|
||||
import org.mariotaku.twidere.Constants;
|
||||
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
@ -46,6 +48,14 @@ public class TwidereBugReporter extends BugReporter implements Constants {
|
|||
@Override
|
||||
protected void initImpl(final Application application) {
|
||||
Fabric.with(application, new Crashlytics());
|
||||
Crashlytics.setBool("debug", BuildConfig.DEBUG);
|
||||
Crashlytics.setString("build.brand", Build.BRAND);
|
||||
Crashlytics.setString("build.device", Build.DEVICE);
|
||||
Crashlytics.setString("build.display", Build.DISPLAY);
|
||||
Crashlytics.setString("build.hardware", Build.HARDWARE);
|
||||
Crashlytics.setString("build.manufacturer", Build.MANUFACTURER);
|
||||
Crashlytics.setString("build.model", Build.MODEL);
|
||||
Crashlytics.setString("build.product", Build.PRODUCT);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -447,6 +447,10 @@
|
|||
android:label="@string/crop_image"
|
||||
android:theme="@style/Theme.Twidere.NoActionBar"
|
||||
android:windowSoftInputMode="adjustResize"/>
|
||||
<activity
|
||||
android:name=".activity.IncompatibleAlertActivity"
|
||||
android:label="@string/error_title_device_incompatible"
|
||||
android:theme="@android:style/Theme.DeviceDefault.Dialog"/>
|
||||
|
||||
<service
|
||||
android:name=".service.RefreshService"
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package org.mariotaku.twidere.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.mariotaku.twidere.BuildConfig;
|
||||
import org.mariotaku.twidere.R;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 16/4/4.
|
||||
*/
|
||||
public class IncompatibleAlertActivity extends Activity {
|
||||
private TextView mInfoText;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_device_incompatible);
|
||||
|
||||
mInfoText.append(String.format(Locale.US, "Twidere version %s (%d)\n",
|
||||
BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
|
||||
mInfoText.append(String.format(Locale.US, "Classpath %s\n", ClassLoader.getSystemClassLoader()));
|
||||
mInfoText.append(String.format(Locale.US, "Brand %s\n", Build.BRAND));
|
||||
mInfoText.append(String.format(Locale.US, "Device %s\n", Build.DEVICE));
|
||||
mInfoText.append(String.format(Locale.US, "Display %s\n", Build.DISPLAY));
|
||||
mInfoText.append(String.format(Locale.US, "Hardware %s\n", Build.HARDWARE));
|
||||
mInfoText.append(String.format(Locale.US, "Manufacturer %s\n", Build.MANUFACTURER));
|
||||
mInfoText.append(String.format(Locale.US, "Model %s\n", Build.MODEL));
|
||||
mInfoText.append(String.format(Locale.US, "Product %s\n", Build.PRODUCT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
mInfoText = (TextView) findViewById(R.id.info_text);
|
||||
}
|
||||
}
|
|
@ -28,6 +28,7 @@ import org.mariotaku.twidere.BuildConfig;
|
|||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.util.StrictModeUtils;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
||||
public class MainActivity extends Activity implements Constants {
|
||||
|
||||
|
@ -38,8 +39,13 @@ public class MainActivity extends Activity implements Constants {
|
|||
StrictModeUtils.detectAllThreadPolicy();
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
final Intent intent = new Intent(this, HomeActivity.class);
|
||||
startActivity(intent);
|
||||
if (Utils.checkDeviceCompatible()) {
|
||||
final Intent intent = new Intent(this, HomeActivity.class);
|
||||
startActivity(intent);
|
||||
} else {
|
||||
final Intent intent = new Intent(this, IncompatibleAlertActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ import android.support.v4.util.Pair;
|
|||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.view.accessibility.AccessibilityEventCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.view.menu.MenuBuilder;
|
||||
import android.system.ErrnoException;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateFormat;
|
||||
|
@ -102,6 +103,7 @@ import android.widget.Toast;
|
|||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.apache.commons.lang3.time.FastDateParser;
|
||||
import org.json.JSONException;
|
||||
import org.mariotaku.sqliteqb.library.AllColumns;
|
||||
import org.mariotaku.sqliteqb.library.Columns;
|
||||
|
@ -2299,4 +2301,13 @@ public final class Utils implements Constants {
|
|||
return location;
|
||||
}
|
||||
|
||||
public static boolean checkDeviceCompatible() {
|
||||
try {
|
||||
MenuBuilder.class.getDeclaredField("mContext");
|
||||
FastDateParser.class.getDeclaredMethod("parse", String.class);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_large">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/error_message_device_incompatible"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/element_spacing_large"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:typeface="monospace"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
|
@ -792,4 +792,6 @@
|
|||
<string name="group">Group</string>
|
||||
<string name="your_coarse_location">Your coarse location</string>
|
||||
<string name="location_countrywide">Countrywide</string>
|
||||
<string name="error_title_device_incompatible">Incompatible device</string>
|
||||
<string name="error_message_device_incompatible">This device is not compatible with Twidere, upgrade to latest Android OS is recommended.\nYou can send information below to help me add report this issue to device manufacturer.</string>
|
||||
</resources>
|
Loading…
Reference in New Issue