aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/ui/XmppActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/ui/XmppActivity.java')
-rw-r--r--src/eu/siacs/conversations/ui/XmppActivity.java29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java
index f13c112a..4ee51580 100644
--- a/src/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/eu/siacs/conversations/ui/XmppActivity.java
@@ -2,6 +2,7 @@ package eu.siacs.conversations.ui;
import java.io.FileNotFoundException;
import java.lang.ref.WeakReference;
+import java.util.List;
import java.util.concurrent.RejectedExecutionException;
import eu.siacs.conversations.Config;
@@ -24,6 +25,8 @@ import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.DialogInterface.OnClickListener;
import android.content.IntentSender.SendIntentException;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.content.Intent;
import android.content.ServiceConnection;
@@ -55,7 +58,9 @@ public abstract class XmppActivity extends Activity {
protected int mPrimaryTextColor;
protected int mSecondaryTextColor;
- protected int mWarningTextColor;
+ protected int mColorRed;
+ protected int mColorOrange;
+ protected int mColorGreen;
protected int mPrimaryColor;
private DisplayMetrics metrics;
@@ -151,8 +156,20 @@ public abstract class XmppActivity extends Activity {
public void onClick(DialogInterface dialog, int which) {
Uri uri = Uri
.parse("market://details?id=org.sufficientlysecure.keychain");
- Intent intent = new Intent(Intent.ACTION_VIEW, uri);
- startActivity(intent);
+ Intent marketIntent = new Intent(Intent.ACTION_VIEW,
+ uri);
+ PackageManager manager = getApplicationContext()
+ .getPackageManager();
+ List<ResolveInfo> infos = manager
+ .queryIntentActivities(marketIntent, 0);
+ if (infos.size() > 0) {
+ startActivity(marketIntent);
+ } else {
+ uri = Uri.parse("http://www.openkeychain.org/");
+ Intent browserIntent = new Intent(
+ Intent.ACTION_VIEW, uri);
+ startActivity(browserIntent);
+ }
finish();
}
});
@@ -183,7 +200,9 @@ public abstract class XmppActivity extends Activity {
ExceptionHelper.init(getApplicationContext());
mPrimaryTextColor = getResources().getColor(R.color.primarytext);
mSecondaryTextColor = getResources().getColor(R.color.secondarytext);
- mWarningTextColor = getResources().getColor(R.color.warningtext);
+ mColorRed = getResources().getColor(R.color.red);
+ mColorOrange = getResources().getColor(R.color.orange);
+ mColorGreen = getResources().getColor(R.color.green);
mPrimaryColor = getResources().getColor(R.color.primary);
if (getPreferences().getBoolean("use_larger_font", false)) {
setTheme(R.style.ConversationsTheme_LargerText);
@@ -475,7 +494,7 @@ public abstract class XmppActivity extends Activity {
}
public int getWarningTextColor() {
- return this.mWarningTextColor;
+ return this.mColorRed;
}
public int getPrimaryColor() {