diff options
Diffstat (limited to 'android/3rd_party/HoloEverywhere/library/src/org/holoeverywhere/ChooserActivity.java')
-rw-r--r-- | android/3rd_party/HoloEverywhere/library/src/org/holoeverywhere/ChooserActivity.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/android/3rd_party/HoloEverywhere/library/src/org/holoeverywhere/ChooserActivity.java b/android/3rd_party/HoloEverywhere/library/src/org/holoeverywhere/ChooserActivity.java new file mode 100644 index 0000000000..fddb647c3e --- /dev/null +++ b/android/3rd_party/HoloEverywhere/library/src/org/holoeverywhere/ChooserActivity.java @@ -0,0 +1,42 @@ + +package org.holoeverywhere; + +import org.holoeverywhere.app.ResolverActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.os.Parcelable; +import android.util.Log; + +public class ChooserActivity extends ResolverActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + Intent intent = getIntent(); + Parcelable targetParcelable = intent.getParcelableExtra(Intent.EXTRA_INTENT); + if (!(targetParcelable instanceof Intent)) { + Log.w("ChooseActivity", "Target is not an intent: " + targetParcelable); + finish(); + return; + } + Intent target = (Intent) targetParcelable; + CharSequence title = intent.getCharSequenceExtra(Intent.EXTRA_TITLE); + if (title == null) { + title = getResources().getText(R.string.chooseActivity); + } + Parcelable[] pa = intent.getParcelableArrayExtra(Intent.EXTRA_INITIAL_INTENTS); + Intent[] initialIntents = null; + if (pa != null) { + initialIntents = new Intent[pa.length]; + for (int i = 0; i < pa.length; i++) { + if (!(pa[i] instanceof Intent)) { + Log.w("ChooseActivity", "Initial intent #" + i + + " not an Intent: " + pa[i]); + finish(); + return; + } + initialIntents[i] = (Intent) pa[i]; + } + } + onCreate(savedInstanceState, target, title, initialIntents, null, false); + } +} |