List of usage examples for android.content Intent getAction
public @Nullable String getAction()
From source file:com.perm.DoomPlay.ListVkActivity.java
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); setIntent(intent);//ww w. j a v a 2 s . c o m ArrayList<Audio> tempTracks = intent.getParcelableArrayListExtra(MainScreenActivity.keyOpenInListTrack); if (tempTracks != null) { audios = tempTracks; adapter.changeData(audios); } currentAction = intent.getAction(); }
From source file:net.eledge.android.europeana.gui.activity.SearchActivity.java
private void handleIntent(Intent intent) { String query = null;// w w w . java2 s . c o m String[] qf = null; if (intent != null) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { query = intent.getStringExtra(SearchManager.QUERY); qf = splitFacets(intent.getStringExtra(SearchManager.USER_QUERY)); } else if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) { Parcelable[] parcelables = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); NdefMessage msg = (NdefMessage) parcelables[0]; Uri uri = Uri.parse(new String(msg.getRecords()[0].getPayload())); query = uri.getQueryParameter("query"); qf = StringArrayUtils.toArray(uri.getQueryParameters("qf")); } else if (Intent.ACTION_VIEW.equals(intent.getAction())) { query = intent.getDataString(); if (!TextUtils.isEmpty(query)) { if (StringUtils.contains(query, "europeana.eu/")) { Uri uri = Uri.parse(query); query = uri.getQueryParameter("query"); qf = StringArrayUtils.toArray(uri.getQueryParameters("qf")); } } } else { // no search action recognized? end this activity... closeSearchActivity(); } if (!TextUtils.isEmpty(query) && !TextUtils.equals(runningSearch, query)) { runningSearch = query; if (StringArrayUtils.isNotBlank(qf)) { searchController.newSearch(this, query, qf); } else { searchController.newSearch(this, query); } getSupportActionBar().setTitle(searchController.getSearchTitle(this)); } } }
From source file:ca.rmen.android.poetassistant.main.MainActivity.java
@Override protected void onNewIntent(Intent intent) { Log.d(TAG, "onNewIntent() called with: " + "intent = [" + intent + "]"); setIntent(intent);/* www .j av a2 s . c om*/ // The user entered a search term either by typing or by voice if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getDataString(); if (TextUtils.isEmpty(query)) { query = intent.getStringExtra(SearchManager.QUERY); } if (TextUtils.isEmpty(query)) { CharSequence userQuery = intent.getCharSequenceExtra(SearchManager.USER_QUERY); if (!TextUtils.isEmpty(userQuery)) query = userQuery.toString(); } if (TextUtils.isEmpty(query)) return; mSearch.addSuggestions(query); mSearch.search(query); } // We got here from a deep link else if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri data = getIntent().getData(); handleDeepLink(data); } // Play some text in the tts tab else if (Intent.ACTION_SEND.equals(intent.getAction())) { mBinding.viewPager.setCurrentItem(mPagerAdapter.getPositionForTab(Tab.READER)); String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT); ReaderFragment readerFragment = (ReaderFragment) mPagerAdapter.getFragment(mBinding.viewPager, Tab.READER); readerFragment.setText(sharedText); } }
From source file:com.google.android.apps.santatracker.presentquest.PlacesIntentService.java
@Override protected void onHandleIntent(Intent intent) { if (intent != null) { final String action = intent.getAction(); switch (action) { case ACTION_SEARCH_NEARBY: // Don't allow more than X queries at once. if (mQueriesInProgress.get() >= MAX_QUERIES_IN_PROGRESS) { Log.d(TAG, "Dropping excess query"); return; }/*from w w w . j a va2 s . com*/ // Mark query started mQueriesInProgress.incrementAndGet(); if (mPreferences == null) { mPreferences = new PreferencesUtil(this); } if (mConfig == null) { mConfig = new Config(); } // Perform query final LatLng center = intent.getParcelableExtra(EXTRA_LAT_LNG); final int radius = intent.getIntExtra(EXTRA_RADIUS, 0); getPlaceAndBroadcast(center, radius); // Mark query finished mQueriesInProgress.decrementAndGet(); break; default: Log.w(TAG, "Unknown action: " + action); } } }
From source file:com.meiste.greg.ptw.WidgetProvider.java
@Override public void onReceive(final Context context, final Intent intent) { if (intent.hasExtra(Intent.EXTRA_ALARM_COUNT)) { Util.log("WidgetProvider.onReceive: Widget alarm"); new UpdateWidgetThread(context).start(); setAlarm(context);/*from w ww.j av a2s.c o m*/ } else if (intent.getAction().equals(Intent.ACTION_TIME_CHANGED)) { Util.log("WidgetProvider.onReceive: Time change"); setAlarm(context); } else if (intent.getAction().equals(PTW.INTENT_ACTION_SCHEDULE)) { Util.log("WidgetProvider.onReceive: Schedule Updated"); final int[] appWidgetIds = getInstalledWidgets(context); if (appWidgetIds.length > 0) { /* Force full widget update */ sRace = null; onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds); } } else if (intent.getAction().equals(PTW.INTENT_ACTION_ANSWERS)) { Util.log("WidgetProvider.onReceive: Answers submitted"); final int[] appWidgetIds = getInstalledWidgets(context); if (appWidgetIds.length > 0) { new UpdateWidgetThread(context).start(); } } else super.onReceive(context, intent); }
From source file:es.uma.lcc.lockpic.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mainactivity); System.loadLibrary("jpg"); // load native libraries // This activity is able to open images directly from a file browser. // If this is the case, we store the path, which will be used in onPostCreate Intent intent = getIntent(); if (Intent.ACTION_VIEW.equals(intent.getAction()) && intent.getType() != null && (savedInstanceState == null || savedInstanceState.getBoolean("firstTime", true))) { if (intent.getType().startsWith("image/")) { mDirectDecryptPath = LockPicIO.getPathFromIntent(MainActivity.this, intent); if (mDirectDecryptPath == null) Toast.makeText(this, R.string.unknownIntent, Toast.LENGTH_SHORT).show(); }// w w w . j a v a 2s .co m } // disable screen capture getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE); }
From source file:com.actionlauncher.api.LiveWallpaperSource.java
@Override protected void onHandleIntent(Intent intent) { if (intent == null) { return;/*ww w .j a v a 2 s .c o m*/ } String action = intent.getAction(); LOGD("LiveWallpaperSource.onHandleIntent() - action:" + action + ", id:" + mName); // TODO: permissions? if (ACTION_SUBSCRIBE.equals(action)) { processSubscribe((ComponentName) intent.getParcelableExtra(EXTRA_SUBSCRIBER_COMPONENT), intent.getStringExtra(EXTRA_TOKEN)); } else if (ACTION_FETCH_PALETTE.equals(action)) { publishCurrentPalette(); } else if (action.equals(ProtocolConstants.ACTION_PUBLISH_STATE)) { boolean wallpaperInfoSet = false; if (intent.hasExtra(EXTRA_LIVE_WALLPAPER_INFO)) { Bundle bundle = intent.getExtras().getBundle(EXTRA_LIVE_WALLPAPER_INFO); if (bundle != null) { LiveWallpaperInfo info = LiveWallpaperInfo.fromBundle(bundle); mCurrentState.setCurrentLiveWallpaperInfo(info); LOGD("LiveWallpaperInfo.fromBundle():" + (info != null ? info.toString() : null)); wallpaperInfoSet = true; } } if (!wallpaperInfoSet) { mCurrentState.setCurrentLiveWallpaperInfo(null); } publishCurrentPalette(); } }
From source file:info.guardianproject.otr.app.im.app.WelcomeActivity.java
private void doOnResume() { mHandler.registerForBroadcastEvents(); int countSignedIn = accountsSignedIn(); int countAvailable = accountsAvailable(); int countConfigured = accountsConfigured(); if (countAvailable == 1) { // If just one account is available for auto-signin, go there immediately after service starts trying // to connect. mSignInHelper.setSignInListener(new SignInHelper.SignInListener() { @Override/*from w w w . ja v a 2 s. c o m*/ public void connectedToService() { } @Override public void stateChanged(int state, long accountId) { if (state == ImConnection.LOGGING_IN) { mSignInHelper.goToAccount(accountId); } } }); } else { mSignInHelper.setSignInListener(null); } Intent intent = getIntent(); if (intent != null && intent.getAction() != null && (!intent.getAction().equals(Intent.ACTION_MAIN))) { handleIntentAPILaunch(intent); } else { if (countSignedIn == 0 && countAvailable > 0 && !mDidAutoLaunch && mDoSignIn) { mDidAutoLaunch = true; signInAll(); showAccounts(); } else if (countSignedIn >= 1) { showActiveAccount(); } else { showAccounts(); } } }
From source file:ch.luklanis.esscan.history.HistoryActivity.java
@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.activity_history); getActionBar().setDisplayHomeAsUpEnabled(true); this.historyFragment = (HistoryFragment) getFragmentManager().findFragmentById(R.id.history); if (findViewById(R.id.ps_detail_container) != null) { twoPane = true;/* w ww . ja va 2 s . c o m*/ this.historyFragment.setActivateOnItemClick(true); } tmpPositions = new int[2]; tmpPositions[0] = ListView.INVALID_POSITION; // old position tmpPositions[1] = ListView.INVALID_POSITION; // new position dtaFileCreator = new DTAFileCreator(this); mHistoryManager = new HistoryManager(getApplicationContext()); Intent intent = getIntent(); if (intent.getAction() != null && intent.getAction().equals(ACTION_SHOW_RESULT)) { String codeRow = intent.getStringExtra(EXTRA_CODE_ROW); PsResult psResult = PsResult.getInstance(codeRow); this.mHistoryManager.addHistoryItem(psResult); if (twoPane) { setNewDetails(0); intent.setAction(null); } else { Intent detailIntent = new Intent(this, PsDetailActivity.class); detailIntent.putExtra(PsDetailFragment.ARG_POSITION, 0); startActivityForResult(detailIntent, DETAILS_REQUEST_CODE); } } }
From source file:gpsalarm.app.service.PostMonitor.java
@Override protected void doWakefulWork(Intent i) { if (i.getAction().equals(POLL_ACTION)) { myAccount = new Account(prefs.getString("user", null), prefs.getString("password", ""), null); if (myAccount.user != null) { pollForReminderUpdates(myAccount, team); pollStatusUpdates(myAccount); // pollForReminderUpdates(myAccount, "PUBLIC"); updateLocation(myAccount);//from w w w . ja va 2s . c o m pollForProximityAlerts(myAccount); } } setAlarm(isBatteryLow.get() ? POLL_PERIOD * 10 : POLL_PERIOD); }