aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep2Fragment.java37
1 files changed, 6 insertions, 31 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep2Fragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep2Fragment.java
index fa0b2911c..f8322d3c4 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep2Fragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep2Fragment.java
@@ -18,8 +18,7 @@
package org.sufficientlysecure.keychain.ui.linked;
import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
+import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -30,9 +29,6 @@ import android.widget.EditText;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.linked.LinkedCookieResource;
import org.sufficientlysecure.keychain.pgp.linked.resources.TwitterResource;
-import org.sufficientlysecure.keychain.ui.util.Notify;
-
-import java.util.List;
public class LinkedIdCreateTwitterStep2Fragment extends LinkedIdCreateFinalFragment {
@@ -110,33 +106,12 @@ public class LinkedIdCreateTwitterStep2Fragment extends LinkedIdCreateFinalFragm
private void proofSend() {
- Intent tweetIntent = new Intent(Intent.ACTION_SEND);
- tweetIntent.putExtra(Intent.EXTRA_TEXT, mResourceString);
- tweetIntent.setType("text/plain");
-
- PackageManager packManager = getActivity().getPackageManager();
- List<ResolveInfo> resolvedInfoList = packManager.queryIntentActivities(tweetIntent,
- PackageManager.MATCH_DEFAULT_ONLY);
-
- boolean resolved = false;
- for(ResolveInfo resolveInfo : resolvedInfoList) {
- if(resolveInfo.activityInfo.packageName.startsWith("com.twitter.android")) {
- tweetIntent.setClassName(
- resolveInfo.activityInfo.packageName,
- resolveInfo.activityInfo.name );
- resolved = true;
- break;
- }
- }
-
- if (resolved) {
- startActivity(tweetIntent);
- } else {
- Notify.showNotify(getActivity(),
- "Twitter app is not installed, please use the send intent!",
- Notify.Style.ERROR);
- }
+ Uri.Builder builder = Uri.parse("https://twitter.com/intent/tweet").buildUpon();
+ builder.appendQueryParameter("text", mResourceString);
+ Uri uri = builder.build();
+ Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+ getActivity().startActivity(intent);
}
}