disable trial stuff on amazon devices

This commit is contained in:
Andrew Dolgov 2013-11-21 09:39:43 +04:00
parent f955dac12b
commit d4caac40d4
3 changed files with 24 additions and 11 deletions

View File

@ -43,6 +43,10 @@ public class CommonActivity extends SherlockFragmentActivity {
public boolean getUnreadOnly() { public boolean getUnreadOnly() {
return m_prefs.getBoolean("show_unread_only", true); return m_prefs.getBoolean("show_unread_only", true);
} }
public static boolean isAmazonDevice() {
return android.os.Build.MANUFACTURER.equals("Amazon");
}
public void setUnreadOnly(boolean unread) { public void setUnreadOnly(boolean unread) {
SharedPreferences.Editor editor = m_prefs.edit(); SharedPreferences.Editor editor = m_prefs.edit();

View File

@ -127,8 +127,10 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
ft.commit(); ft.commit();
AppRater.appLaunched(this); if (!isAmazonDevice()) {
checkTrial(true); AppRater.appLaunched(this);
checkTrial(true);
}
} else { // savedInstanceState != null } else { // savedInstanceState != null
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled"); m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");

View File

@ -173,7 +173,10 @@ public class OnlineActivity extends CommonActivity {
if (isOffline) { if (isOffline) {
switchOfflineSuccess(); switchOfflineSuccess();
} else { } else {
checkTrial(false);
if (!isAmazonDevice()) {
checkTrial(false);
}
/* if (getIntent().getExtras() != null) { /* if (getIntent().getExtras() != null) {
Intent i = getIntent(); Intent i = getIntent();
@ -1226,15 +1229,19 @@ public class OnlineActivity extends CommonActivity {
initMenu(); initMenu();
List<PackageInfo> pkgs = getPackageManager() if (!isAmazonDevice()) {
.getInstalledPackages(0); List<PackageInfo> pkgs = getPackageManager()
.getInstalledPackages(0);
for (PackageInfo p : pkgs) {
if ("org.fox.ttrss.key".equals(p.packageName)) { for (PackageInfo p : pkgs) {
Log.d(TAG, "license apk found"); if ("org.fox.ttrss.key".equals(p.packageName)) {
menu.findItem(R.id.donate).setVisible(false); Log.d(TAG, "license apk found");
break; menu.findItem(R.id.donate).setVisible(false);
break;
}
} }
} else {
menu.findItem(R.id.donate).setVisible(false);
} }
return true; return true;