List of usage examples for android.content IntentFilter create
public static IntentFilter create(String action, String dataType)
From source file:com.barbourbooks.biblecrosswordpuzzles.BaseActivity.java
/** * //from w ww . ja va 2s .c o m * <p> * This is the method for registerActivityFinishReceiver. * </p> */ private void registerActivityFinishReceiver() { activityFinishReceiver = new ActivityFinishReceiver(); try { registerReceiver(activityFinishReceiver, IntentFilter.create("goToHome", "text/plain")); } catch (Exception e) { Log.d("Exception BaseActivity", "registerActivityFinishReceiver() " + e); } }
From source file:org.tlhInganHol.android.klingonassistant.BaseActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { mActivePosition = savedInstanceState.getInt(STATE_ACTIVE_POSITION); }//www .j a v a 2 s .c o m // Close the floating window, if there is one. Work around a race condition. Log.d(TAG, "Starting activity with non-floating window. Close floating window."); Handler killFloatingWindowHandler = new Handler(); Runnable killFloatingWindowRunnable = new Runnable() { public void run() { StandOutWindow.closeAll(BaseActivity.this, FloatingWindow.class); } }; killFloatingWindowHandler.postDelayed(killFloatingWindowRunnable, 100); // 100 ms // Get the action bar. ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); if (sharedPrefs.getBoolean(Preferences.KEY_KLINGON_FONT_CHECKBOX_PREFERENCE, /* default */false)) { // Display the action bar title in Klingon font. SpannableString title = new SpannableString("?"); Typeface klingonTypeface = KlingonAssistant.getKlingonFontTypeface(getBaseContext()); title.setSpan(new KlingonTypefaceSpan("", klingonTypeface), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); actionBar.setTitle(title); } // If the device is in landscape orientation and the screen size is large (or bigger), then // make the slide-out menu static. Otherwise, hide it by default. MenuDrawer.Type drawerType = MenuDrawer.Type.BEHIND; if (isHorizontalTablet()) { drawerType = MenuDrawer.Type.STATIC; } mDrawer = MenuDrawer.attach(this, drawerType, Position.LEFT, MenuDrawer.MENU_DRAG_CONTENT); List<Object> items = new ArrayList<Object>(); if (sharedPrefs.getBoolean(Preferences.KEY_KLINGON_UI_CHECKBOX_PREFERENCE, /* default */false)) { items.add(new SlideMenuCategory(R.string.menu_reference_tlh)); items.add(new SlideMenuItem(R.string.menu_pronunciation_tlh, R.id.pronunciation, 0)); items.add(new SlideMenuItem(R.string.menu_prefixes_tlh, R.id.prefixes, 0)); items.add(new SlideMenuItem(R.string.menu_prefix_charts_tlh, R.id.prefix_charts, 0)); items.add(new SlideMenuItem(R.string.menu_noun_suffixes_tlh, R.id.noun_suffixes, 0)); items.add(new SlideMenuItem(R.string.menu_verb_suffixes_tlh, R.id.verb_suffixes, 0)); items.add(new SlideMenuCategory(R.string.menu_phrases_tlh)); items.add(new SlideMenuItem(R.string.beginners_conversation_tlh, R.id.beginners_conversation, 0)); items.add(new SlideMenuItem(R.string.jokes_tlh, R.id.jokes, 0)); items.add(new SlideMenuItem(R.string.nentay_tlh, R.id.nentay, 0)); items.add(new SlideMenuItem(R.string.military_celebration_tlh, R.id.military_celebration, 0)); items.add(new SlideMenuItem(R.string.toasts_tlh, R.id.toasts, 0)); items.add(new SlideMenuItem(R.string.lyrics_tlh, R.id.lyrics, 0)); items.add(new SlideMenuItem(R.string.curse_warfare_tlh, R.id.curse_warfare, 0)); items.add(new SlideMenuItem(R.string.replacement_proverbs_tlh, R.id.replacement_proverbs, 0)); items.add(new SlideMenuItem(R.string.secrecy_proverbs_tlh, R.id.secrecy_proverbs, 0)); items.add(new SlideMenuItem(R.string.empire_union_day_tlh, R.id.empire_union_day, 0)); items.add(new SlideMenuItem(R.string.rejection_tlh, R.id.rejection, 0)); items.add(new SlideMenuCategory(R.string.menu_media_tlh)); items.add(new SlideMenuItem(R.string.media_1_title_tlh, R.id.media_1, 0)); items.add(new SlideMenuItem(R.string.media_2_title_tlh, R.id.media_2, 0)); items.add(new SlideMenuItem(R.string.media_3_title_tlh, R.id.media_3, 0)); items.add(new SlideMenuItem(R.string.media_4_title_tlh, R.id.media_4, 0)); items.add(new SlideMenuItem(R.string.media_5_title_tlh, R.id.media_5, 0)); items.add(new SlideMenuItem(R.string.media_6_title_tlh, R.id.media_6, 0)); /* items.add(new SlideMenuCategory(R.string.menu_social_tlh)); items.add(new SlideMenuItem(R.string.menu_gplus_tlh, R.id.gplus, 0)); items.add(new SlideMenuItem(R.string.menu_facebook_tlh, R.id.facebook, 0)); items.add(new SlideMenuItem(R.string.menu_kag_tlh, R.id.kag, 0)); items.add(new SlideMenuItem(R.string.menu_kidc_tlh, R.id.kidc, 0)); */ } else { items.add(new SlideMenuCategory(R.string.menu_reference)); items.add(new SlideMenuItem(R.string.menu_pronunciation, R.id.pronunciation, 0)); items.add(new SlideMenuItem(R.string.menu_prefixes, R.id.prefixes, 0)); items.add(new SlideMenuItem(R.string.menu_prefix_charts, R.id.prefix_charts, 0)); items.add(new SlideMenuItem(R.string.menu_noun_suffixes, R.id.noun_suffixes, 0)); items.add(new SlideMenuItem(R.string.menu_verb_suffixes, R.id.verb_suffixes, 0)); items.add(new SlideMenuCategory(R.string.menu_phrases)); items.add(new SlideMenuItem(R.string.beginners_conversation, R.id.beginners_conversation, 0)); items.add(new SlideMenuItem(R.string.jokes, R.id.jokes, 0)); items.add(new SlideMenuItem(R.string.nentay, R.id.nentay, 0)); items.add(new SlideMenuItem(R.string.military_celebration, R.id.military_celebration, 0)); items.add(new SlideMenuItem(R.string.toasts, R.id.toasts, 0)); items.add(new SlideMenuItem(R.string.lyrics, R.id.lyrics, 0)); items.add(new SlideMenuItem(R.string.curse_warfare, R.id.curse_warfare, 0)); items.add(new SlideMenuItem(R.string.replacement_proverbs, R.id.replacement_proverbs, 0)); items.add(new SlideMenuItem(R.string.secrecy_proverbs, R.id.secrecy_proverbs, 0)); items.add(new SlideMenuItem(R.string.empire_union_day, R.id.empire_union_day, 0)); items.add(new SlideMenuItem(R.string.rejection, R.id.rejection, 0)); // Not all general proverbs are properly tagged yet. // Too many idioms; also no known Klingon term for "idiom". items.add(new SlideMenuCategory(R.string.menu_media)); items.add(new SlideMenuItem(R.string.media_1_title, R.id.media_1, 0)); items.add(new SlideMenuItem(R.string.media_2_title, R.id.media_2, 0)); items.add(new SlideMenuItem(R.string.media_3_title, R.id.media_3, 0)); items.add(new SlideMenuItem(R.string.media_4_title, R.id.media_4, 0)); items.add(new SlideMenuItem(R.string.media_5_title, R.id.media_5, 0)); items.add(new SlideMenuItem(R.string.media_6_title, R.id.media_6, 0)); /* items.add(new SlideMenuCategory(R.string.menu_social)); items.add(new SlideMenuItem(R.string.menu_gplus, R.id.gplus, 0)); items.add(new SlideMenuItem(R.string.menu_facebook, R.id.facebook, 0)); items.add(new SlideMenuItem(R.string.menu_kag, R.id.kag, 0)); items.add(new SlideMenuItem(R.string.menu_kidc, R.id.kidc, 0)); */ } mList = new ListView(this); mAdapter = new SlideMenuAdapter(this, items); mAdapter.setListener(this); mAdapter.setActivePosition(mActivePosition); mList.setAdapter(mAdapter); mList.setOnItemClickListener(mItemClickListener); mDrawer.setMenuView(mList); // Allow the menu to slide out when any part of the screen is dragged. mDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_FULLSCREEN); // The drawable that replaces the up indicator in the action bar. mDrawer.setSlideDrawable(R.drawable.ic_drawer); // Whether the previous drawable should be shown. mDrawer.setDrawerIndicatorEnabled(true); // Activate type-to-search for local search. Typing will automatically // start a search of the database. setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); // Register a receiver for the kill order. mKillReceiver = new KillReceiver(); registerReceiver(mKillReceiver, IntentFilter.create(ACTION_KILL, KILL_TYPE)); }