@SuppressLint("JavascriptInterface") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); Activity activity = this.getActivity(); appBarLayout = (CollapsingToolbarLayout) activity.findViewById(R.id.toolbar_layout); Intent i_getvalue = activity.getIntent(); String action = i_getvalue.getAction(); if (Intent.ACTION_VIEW.equals(action)) { Uri uri = i_getvalue.getData(); if (uri != null) { String title = uri.getQueryParameter("title"); postid = uri.getQueryParameter("postid"); appBarLayout.setTitle(title); // 设置文章标题 } } else if (getArguments().containsKey(ARG_ITEM_ID)) { // Load the models rawData specified by the fragment // arguments. In a real-world scenario, use a Loader // to load rawData from a rawData provider. postid = getArguments().getString(ARG_ITEM_ID); String title = getArguments().getString(ARG_POST_TITLE); appBarLayout.setTitle(title); // 设置文章标题 SinglePostActivity.shareTitle = title; } }
private void handleAppShortcuts(Intent intent) { if (intent != null && Intent.ACTION_VIEW.equals(intent.getAction()) && intent.hasExtra(EXTRA_KEY_APP_SHORTCUT_ID)) { final String shortcutId = intent.getStringExtra(EXTRA_KEY_APP_SHORTCUT_ID); intent.removeExtra(EXTRA_KEY_APP_SHORTCUT_ID); switch (shortcutId) { case "keyboards": onNavigateToKeyboardAddonSettings(null); break; case "themes": onNavigateToKeyboardThemeSettings(null); break; case "gestures": onNavigateToGestureSettings(null); break; case "quick_keys": onNavigateToQuickTextSettings(null); break; case "ui_tweaks": onNavigateToUserInterfaceSettings(null); break; default: throw new IllegalArgumentException("Unknown app-shortcut " + shortcutId); } } }
private void handleIntents() { Intent i = getIntent(); if (i.getAction() == null) return; if (Constants.ACTION_RESTART_APP.equals(i.getAction())) { OmniNotes.restartApp(getApplicationContext()); } if (receivedIntent(i)) { Note note = i.getParcelableExtra(Constants.INTENT_NOTE); if (note == null) { note = DbHelper.getInstance(this).getNote(i.getIntExtra(Constants.INTENT_KEY, 0)); } // Checks if the same note is already opened to avoid to open again if (note != null && noteAlreadyOpened(note)) { return; } // Empty note instantiation if (note == null) { note = new Note(); } switchToDetail(note); } if (Constants.ACTION_SEND_AND_EXIT.equals(i.getAction())) { saveAndExit(i); } // Tag search if (Intent.ACTION_VIEW.equals(i.getAction())) { switchToList(); } }
private void loadFragment() { Intent intent = getIntent(); Fragment fragment = new LoginFragment(); Bundle extras = intent.getExtras(); if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri uri = intent.getData(); String url = null; try { url = URLDecoder.decode(uri.toString(), "UTF-8") .replace("https://kalturaplay.appspot.com/play?", ""); } catch (UnsupportedEncodingException e) { Log.w(TAG, "couldn't decode/split intent url"); e.printStackTrace(); } if (url != null) { extras.putSerializable("config", KPPlayerConfig.valueOf(url)); fragment = new FullscreenFragment(); } else { Log.w(TAG, "didn't load iframe, invalid iframeUrl parameter was passed"); } } FragmentUtilities.loadFragment(false, fragment, extras, getFragmentManager()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!Intent.ACTION_VIEW.equals(getIntent().getAction()) && !Intent.ACTION_PICK.equals(getIntent().getAction())) { LOG.error( "Unsupported action. Expected [{}] or [{}] but received [{}].", new Object[] {Intent.ACTION_VIEW, Intent.ACTION_PICK, getIntent().getAction()}); onTerminalError(); } else { Cursor splitMarkerSetCursor = managedQuery(TrackLoggerData.SplitMarkerSet.CONTENT_URI, null, null, null, null); SimpleCursorAdapter adapter = new SimpleCursorAdapter( this, R.layout.split_marker_set_list_item, splitMarkerSetCursor, new String[] { TrackLoggerData.SplitMarkerSet._ID, TrackLoggerData.SplitMarkerSet.COLUMN_NAME_NAME }, new int[] {R.id.splitMarkerSetId, R.id.splitMarkerSetName}); setContentView(R.layout.split_marker_set_list); setListAdapter(adapter); getListView().setOnCreateContextMenuListener(this); } }
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); String[] parameters = getIntent().getStringArrayExtra(EXTRAS); if (parameters != null) { for (String s : parameters) { s = s.replace("\\,", ","); } } if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { Uri uri = getIntent().getData(); if (uri != null) { Log.i(TAG, "MojoShellActivity opening " + uri); if (parameters == null) { parameters = new String[] {uri.toString()}; } else { String[] newParameters = new String[parameters.length + 1]; System.arraycopy(parameters, 0, newParameters, 0, parameters.length); newParameters[parameters.length] = uri.toString(); parameters = newParameters; } } } // TODO(ppi): Gotcha - the call below will work only once per process lifetime, but the OS // has no obligation to kill the application process between destroying and restarting the // activity. If the application process is kept alive, initialization parameters sent with // the intent will be stale. // TODO(qsr): We should be passing application context here as required by // InitApplicationContext on the native side. Currently we can't, as PlatformViewportAndroid // relies on this being the activity context. ShellMain.ensureInitialized(this, parameters); ShellMain.start(); }
/** * Returns a list id from an intent if it contains one, either as part of its URI or as an extra * * <p>Returns -1 if no id was contained, this includes insert actions */ long getListId(final Intent intent) { long retval = -1; if (intent != null && intent.getData() != null && (Intent.ACTION_EDIT.equals(intent.getAction()) || Intent.ACTION_VIEW.equals(intent.getAction()) || Intent.ACTION_INSERT.equals(intent.getAction()))) { if ((intent.getData().getPath().startsWith(NotePad.Lists.PATH_VISIBLE_LISTS) || intent.getData().getPath().startsWith(NotePad.Lists.PATH_LISTS) || intent.getData().getPath().startsWith(TaskList.URI.getPath()))) { try { retval = Long.parseLong(intent.getData().getLastPathSegment()); } catch (NumberFormatException e) { retval = -1; } } else if (-1 != intent.getLongExtra(LegacyDBHelper.NotePad.Notes.COLUMN_NAME_LIST, -1)) { retval = intent.getLongExtra(LegacyDBHelper.NotePad.Notes.COLUMN_NAME_LIST, -1); } else if (-1 != intent.getLongExtra(TaskDetailFragment.ARG_ITEM_LIST_ID, -1)) { retval = intent.getLongExtra(TaskDetailFragment.ARG_ITEM_LIST_ID, -1); } else if (-1 != intent.getLongExtra(Task.Columns.DBLIST, -1)) { retval = intent.getLongExtra(Task.Columns.DBLIST, -1); } } return retval; }
/** * Returns a note id from an intent if it contains one, either as part of its URI or as an extra * * <p>Returns -1 if no id was contained, this includes insert actions */ long getNoteId(final Intent intent) { long retval = -1; if (intent != null && intent.getData() != null && (Intent.ACTION_EDIT.equals(intent.getAction()) || Intent.ACTION_VIEW.equals(intent.getAction()))) { if (intent.getData().getPath().startsWith(TaskList.URI.getPath())) { // Find it in the extras. See DashClock extension for an example retval = intent.getLongExtra(Task.TABLE_NAME, -1); } else if ((intent .getData() .getPath() .startsWith(LegacyDBHelper.NotePad.Notes.PATH_VISIBLE_NOTES) || intent.getData().getPath().startsWith(LegacyDBHelper.NotePad.Notes.PATH_NOTES) || intent.getData().getPath().startsWith(Task.URI.getPath()))) { retval = Long.parseLong(intent.getData().getLastPathSegment()); } // else if (null != intent // .getStringExtra(TaskDetailFragment.ARG_ITEM_ID)) { // retval = Long.parseLong(intent // .getStringExtra(TaskDetailFragment.ARG_ITEM_ID)); // } } return retval; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); textView = (TextView) findViewById(R.id.textView); Intent intent = getIntent(); String name = ""; String age = ""; if (intent != null) { /** ************通过intent启动****************** */ name = intent.getStringExtra("name"); age = intent.getStringExtra("age"); String action = intent.getAction(); /** ************通过scheme 启动****************** */ if (Intent.ACTION_VIEW.equals(action)) { Uri uri = intent.getData(); if (uri != null) { name = uri.getQueryParameter("name"); age = uri.getQueryParameter("age"); } } textView.setText(name + "\n" + age); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.todo_create); ButterKnife.inject(this); mTodoManager = new TodoManager(this); setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar)); getSupportActionBar().setTitle(R.string.todo_create); getSupportActionBar().setDisplayHomeAsUpEnabled(true); Intent intent = getIntent(); String action = intent.getAction(); if (Intent.ACTION_VIEW.equals(action)) { Uri uri = intent.getData(); if (uri != null) { mEditText.setText(uri.getQueryParameter("text")); } } else { Bundle extras = intent.getExtras(); if (extras != null) { int id = (extras.containsKey(EXTRA_ID)) ? extras.getInt(EXTRA_ID) : -1; if (id != -1) { mTodo = mTodoManager.find(id); mEditText.setText(mTodo.getName()); getSupportActionBar().setTitle(R.string.todo_update); } } } mEditText.setKeyEventListener(this); mEditText.addTextChangedListener(this); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); }
@Override protected void onResume() { super.onResume(); Log.d(TAG, "Selected item is going to be displayed: " + uriToDisplay); if (uriToDisplay == null) { final Intent intent = getIntent(); if (intent != null && Intent.ACTION_VIEW.equals(intent.getAction())) { uriToDisplay = intent.getData(); } else { Log.w(TAG, "No data or invalid intent is received:" + intent); return; } } // create cursor for the view final Cursor cursor = getContentResolver() .query( uriToDisplay, new String[] { RSSObject.F__ID, RSSObject.F_TITLE, RSSObject.F_DESCRIPTION, RSSItem.F_AUTHOR, RSSItem.F_PUBDATE, RSSObject.F_LINK }, null, null, RSSItem.DEFAULT_SORT_ORDER); if (cursor.moveToFirst()) { final String description = cursor.getString(cursor.getColumnIndex(RSSItem.F_DESCRIPTION)); ((WebView) findViewById(R.id.webView)) .loadDataWithBaseURL( "http://androidportal.hu", description, "text/html", "utf-8", "http://androidportal.hu"); ((TextView) findViewById(R.id.titleText)) .setText(cursor.getString(cursor.getColumnIndex(RSSItem.F_TITLE))); ((TextView) findViewById(R.id.author)) .setText( ItemListActivity.getAuthorText( cursor.getString(cursor.getColumnIndex(RSSItem.F_AUTHOR)), cursor.getString(cursor.getColumnIndex(RSSItem.F_PUBDATE)))); url = cursor.getString(cursor.getColumnIndex(RSSObject.F_LINK)); } else { Log.w(TAG, "Item is not found in DB: " + uriToDisplay); } cursor.close(); }
public boolean loadIntent(Intent intent) { String action = intent.getAction(); if (Intent.ACTION_VIEW.equals(action)) { loadUrl(intent.getDataString()); return true; } return false; }
private void checkIntent() { Intent intent = getIntent(); String action = intent.getAction(); String type = intent.getType(); if (Intent.ACTION_VIEW.equals(action) && type != null) { Toast.makeText(this, intent.getData().getPath(), Toast.LENGTH_LONG).show(); openMission(intent.getData().getPath()); update(); zoom(); } }
private void handleIntent(Intent intent) { if (Intent.ACTION_VIEW.equals(intent.getAction())) { Intent wordIntent = new Intent(this, WordActivity.class); wordIntent.setData(intent.getData()); startActivity(wordIntent); finish(); } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); showResults(query); } }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { // start super.onCreate(savedInstanceState); setContentView(R.layout.browserhook); mDbHelperConverter = new Converter(this); mDbHelperConverter.open(); mDBHelperHistory = new History(this); mDBHelperHistory.open(); mSharedPrefs = getSharedPreferences(PREFS_NAME, 0); // bind mWdgDirectBtn = (Button) findViewById(R.id.ButtonDirect); mWdgDirectBtn.setOnClickListener(this); mWdgConvertBtn = (Button) findViewById(R.id.ButtonConvert); mWdgConvertBtn.setOnClickListener(this); mWdgHistoryBtn = (Button) findViewById(R.id.ButtonHistory); mWdgHistoryBtn.setOnClickListener(this); mWdgSettingBtn = (Button) findViewById(R.id.ButtonSetting); mWdgSettingBtn.setOnClickListener(this); // インテントが渡されたか単体起動かを判別 if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { URI = getIntent().getData(); setTitle(getText(R.string.apptitle_main).toString() + ": " + URI.toString()); // タイトルを設定 IS_STANDALONE = false; // Log.d(TAG, "oc:i:got"); // 履歴が許可されているなら記録 final Boolean historyAvailable = mSharedPrefs.getBoolean(sPrefKeyDisableHistory, false); if (!historyAvailable) { Date currentTime_1 = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); String dateString = formatter.format(currentTime_1); // Log.d(TAG, "sba:cv:" + dateString); mDBHelperHistory.createItem(URI.toString(), dateString); } // load shared prefs mLastBrowser = mSharedPrefs.getString("lastBrowser", ""); // build spinner buildBrowserSpinner(); buildConvertSpinner(); } else { IS_STANDALONE = true; startConverterlistActivity(); finish(); } return; }
@Override public void onCreate(Bundle savedInstanceState) { if (Intent.ACTION_VIEW.equals(getIntent().getAction()) || Intent.ACTION_SEND.equals(getIntent().getAction()) || Intent.ACTION_SENDTO.equals(getIntent().getAction()) || Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())) { ActivityManager.getInstance().startNewTask(this); } super.onCreate(savedInstanceState); if (isFinishing()) { return; } setContentView(R.layout.contact_list); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default); toolbar.setOnClickListener(this); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerToggle = new ActionBarDrawerToggle( this, drawerLayout, toolbar, R.string.application_title_short, R.string.application_title_short); drawerLayout.setDrawerListener(drawerToggle); toolbar.inflateMenu(R.menu.contact_list); optionsMenu = toolbar.getMenu(); setUpSearchView(optionsMenu); toolbar.setOnMenuItemClickListener(this); barPainter = new BarPainter(this, toolbar); barPainter.setDefaultColor(); toolbar.setTitle(R.string.application_title_full); if (savedInstanceState != null) { sendText = savedInstanceState.getString(SAVED_SEND_TEXT); action = savedInstanceState.getString(SAVED_ACTION); } else { getSupportFragmentManager() .beginTransaction() .add(R.id.container, new ContactListFragment(), CONTACT_LIST_TAG) .commit(); sendText = null; action = getIntent().getAction(); } getIntent().setAction(null); }
/** Returns true if the given intent contains a phone number to populate the dialer with */ private boolean isDialIntent(Intent intent) { final String action = intent.getAction(); if (Intent.ACTION_DIAL.equals(action) || ACTION_TOUCH_DIALER.equals(action)) { return true; } if (Intent.ACTION_VIEW.equals(action)) { final Uri data = intent.getData(); if (data != null && CallUtil.SCHEME_TEL.equals(data.getScheme())) { return true; } } return false; }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mAlertBuilder = new AlertDialog.Builder(this); if (core == null) { core = (MuPDFCore) getLastNonConfigurationInstance(); if (savedInstanceState != null && savedInstanceState.containsKey("FileName")) { mFileName = savedInstanceState.getString("FileName"); } } if (core == null) { Intent intent = getIntent(); if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri uri = intent.getData(); if (uri.toString().startsWith("content://")) { // Handle view requests from the Transformer Prime's file manager // Hopefully other file managers will use this same scheme, if not // using explicit paths. Cursor cursor = getContentResolver().query(uri, new String[] {"_data"}, null, null, null); if (cursor.moveToFirst()) { uri = Uri.parse(cursor.getString(0)); } } core = openFile(Uri.decode(uri.getEncodedPath())); SearchTaskResult.set(null); } if (core != null && core.needsPassword()) { requestPassword(savedInstanceState); return; } } if (core == null) { AlertDialog alert = mAlertBuilder.create(); alert.setTitle(R.string.open_failed); alert.setButton( AlertDialog.BUTTON_POSITIVE, "Dismiss", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { finish(); } }); alert.show(); return; } createUI(savedInstanceState); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { final Object note = savedInstanceState.get(ORIGINAL_NOTE); if (note != null) mOriginalNote = (Note) note; } final Intent intent = getIntent(); final String action = intent.getAction(); if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_EDIT.equals(action)) { mState = STATE_EDIT; mUri = intent.getData(); } else if (Intent.ACTION_INSERT.equals(action)) { mState = STATE_INSERT; if (mOriginalNote == null) { mUri = getContentResolver().insert(intent.getData(), null); } else { mUri = mOriginalNote.getUri(); } setResult(RESULT_OK, (new Intent()).setAction(mUri.toString())); } if (mUri == null) { finish(); return; } setContentView(R.layout.edit); mBodyText = (EditText) findViewById(R.id.body); Button confirmButton = (Button) findViewById(R.id.confirm); confirmButton.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { finish(); } }); Button cancelButton = (Button) findViewById(R.id.cancel); cancelButton.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { cancelNote(); } }); }
private boolean handleIntent(Intent intent) { Log.v(Config.TAG, "INTENT: " + intent.getAction()); if (Intent.ACTION_VIEW.equals(intent.getAction())) { List<String> segments = intent.getData().getPathSegments(); Log.v(Config.TAG, "INTENT : " + intent.getData()); if (segments.size() == 1) { String room = segments.get(0); Place place = Place.getPlaceByName(this, room); if (place != null) { showPlaceOnMap(place); return true; } } } return false; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.view_bookmark); setTitle(R.string.view_bookmark_title); Intent intent = getIntent(); if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri data = intent.getData(); if (data != null) { path = data.getPath(); username = data.getUserInfo(); } else username = mAccount.name; bookmark = new Bookmark(); if (path.contains("/bookmarks")) { if (isMyself()) { int id = Integer.parseInt(data.getLastPathSegment()); bookmark.setId(id); } else { bookmark.setDescription(data.getQueryParameter("title")); bookmark.setUrl(data.getQueryParameter("url")); bookmark.setNotes(data.getQueryParameter("notes")); bookmark.setTime(Long.parseLong(data.getQueryParameter("time"))); if (!data.getQueryParameter("tags").equals("null")) bookmark.setTagString(data.getQueryParameter("tags")); bookmark.setAccount(data.getQueryParameter("account")); } } BookmarkViewType type = (BookmarkViewType) intent.getSerializableExtra("com.pindroid.BookmarkViewType"); if (type == null) type = BookmarkViewType.VIEW; ViewBookmarkFragment frag = (ViewBookmarkFragment) getSupportFragmentManager().findFragmentById(R.id.view_bookmark_fragment); frag.setBookmark(bookmark, type); } }
private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); Toast.makeText(this, "typed: " + query, Toast.LENGTH_SHORT).show(); } else if (Intent.ACTION_VIEW.equals(intent.getAction())) { Bundle bundle = this.getIntent().getExtras(); assert (bundle != null); if (bundle != null) { ResultItem receivedItem = bundle.getParcelable(CustomSearchableConstants.CLICKED_RESULT_ITEM); ((ContactsFragment) viewPagerAdapter.getItem(1)) .updateRecyclerViewFromSearchSelection(receivedItem.getHeader()); } } }
private void handleIntent(Intent intent) { if (Intent.ACTION_MAIN.equals(intent.getAction())) { fillDataTransaction("", "date DESC", "5"); } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String searchQuery = intent.getStringExtra(SearchManager.QUERY); fillDataTransaction(searchQuery, "date DESC", ""); } else if (Intent.ACTION_VIEW.equals(intent.getAction())) { String id = checkIntentForID(); onItemSelected(id); } else if (Intent.ACTION_DELETE.equals(intent.getAction())) { NotesDAO.deleteNote( getApplicationContext(), Integer.parseInt(intent.getStringExtra("itemId"))); fillDataTransaction("", "date DESC", ""); Toast.makeText(getApplicationContext(), "Note Deleted!", Toast.LENGTH_SHORT).show(); } }
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); Log.i(TAG, "Got search query: " + query); ((FreeItemsFragment) mSectionsPagerAdapter.getFreeItemsFragment()).searchQuery(query); } else if (Intent.ACTION_VIEW.equals(intent.getAction())) { Long itemID = getSelectedItemID(); if (itemID != null) { getActionBar().selectTab(getActionBar().getTabAt(FREE_ITEMS_TAB)); ((FreeItemsFragment) mSectionsPagerAdapter.getFreeItemsFragment()) .displaySingleItem(itemID); } } else { Log.i(TAG, "Action = " + intent.getAction()); } }
@Override public void onNewIntent(Intent intent) { if (mCurrentReactContext == null) { FLog.w(ReactConstants.TAG, "Instance detached from instance manager"); } else { String action = intent.getAction(); Uri uri = intent.getData(); if (Intent.ACTION_VIEW.equals(action) && uri != null) { DeviceEventManagerModule deviceEventManagerModule = Assertions.assertNotNull(mCurrentReactContext) .getNativeModule(DeviceEventManagerModule.class); deviceEventManagerModule.emitNewIntentReceived(uri); } mCurrentReactContext.onNewIntent(mCurrentActivity, intent); } }
@Override protected void onNewIntent(Intent intent) { if (checkLaunchState(LaunchState.GeckoExiting)) { // We're exiting and shouldn't try to do anything else just incase // we're hung for some reason we'll force the process to exit System.exit(0); return; } final String action = intent.getAction(); if (ACTION_DEBUG.equals(action) && checkAndSetLaunchState(LaunchState.Launching, LaunchState.WaitForDebugger)) { mMainHandler.postDelayed( new Runnable() { public void run() { Log.i(LOG_FILE_NAME, "Launching from debug intent after 5s wait"); setLaunchState(LaunchState.Launching); launch(null); } }, 1000 * 5 /* 5 seconds */); Log.i(LOG_FILE_NAME, "Intent : ACTION_DEBUG - waiting 5s before launching"); return; } if (checkLaunchState(LaunchState.WaitForDebugger) || launch(intent)) return; if (Intent.ACTION_MAIN.equals(action)) { Log.i(LOG_FILE_NAME, "Intent : ACTION_MAIN"); GeckoAppShell.sendEventToGecko(new GeckoEvent("")); } else if (Intent.ACTION_VIEW.equals(action)) { String uri = intent.getDataString(); GeckoAppShell.sendEventToGecko(new GeckoEvent(uri)); Log.i(LOG_FILE_NAME, "onNewIntent: " + uri); } else if (ACTION_WEBAPP.equals(action)) { String uri = intent.getStringExtra("args"); GeckoAppShell.sendEventToGecko(new GeckoEvent(uri)); Log.i(LOG_FILE_NAME, "Intent : WEBAPP - " + uri); } else if (ACTION_BOOKMARK.equals(action)) { String args = intent.getStringExtra("args"); GeckoAppShell.sendEventToGecko(new GeckoEvent(args)); Log.i(LOG_FILE_NAME, "Intent : BOOKMARK - " + args); } }
@Override protected void onNewIntent(Intent intent) { final Uri data = intent.getData(); final FBReaderApp fbReader = (FBReaderApp) FBReaderApp.Instance(); if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) { super.onNewIntent(intent); } else if (Intent.ACTION_VIEW.equals(intent.getAction()) && data != null && "fbreader-action".equals(data.getScheme())) { fbReader.runAction(data.getEncodedSchemeSpecificPart(), data.getFragment()); } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) { final String pattern = intent.getStringExtra(SearchManager.QUERY); final Runnable runnable = new Runnable() { public void run() { final TextSearchPopup popup = (TextSearchPopup) fbReader.getPopupById(TextSearchPopup.ID); popup.initPosition(); fbReader.TextSearchPatternOption.setValue(pattern); if (fbReader.getTextView().search(pattern, true, false, false, false) != 0) { runOnUiThread( new Runnable() { public void run() { fbReader.showPopup(popup.getId()); } }); } else { runOnUiThread( new Runnable() { public void run() { UIUtil.showErrorMessage(FBReader.this, "textNotFound"); popup.StartPosition = null; } }); } } }; UIUtil.wait("search", runnable, this); } else { super.onNewIntent(intent); } }
@Override protected void onStart() { super.onStart(); Intent i = new Intent().setClass(this, FoodService.class); stopService(i); Intent intent = getIntent(); if (Intent.ACTION_VIEW.equals(intent.getAction())) { if (FoodProvider.buildUriMatcher().match(intent.getData()) == FoodProvider.CODE_FOOD) { Intent foodIntent = new Intent(Intent.ACTION_VIEW, intent.getData()); startActivity(foodIntent); } } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) { final String term = intent.getStringExtra(SearchManager.QUERY); Intent si = new Intent(this, SearchResultActivity.class); si.putExtra(SearchManager.QUERY, term); startActivity(si); finish(); } GenericRateTheAppDialog rateAppDialog = GenericRateTheAppDialog.createInstance(); rateAppDialog.showMaybe(getSupportFragmentManager(), this); }
/** Returns true the intent URI targets a note. Either an edit/view or insert. */ boolean isNoteIntent(final Intent intent) { if (intent == null) { return false; } if (Intent.ACTION_SEND.equals(intent.getAction()) || "com.google.android.gm.action.AUTO_SEND".equals(intent.getAction())) { return true; } if (intent.getData() != null && (Intent.ACTION_EDIT.equals(intent.getAction()) || Intent.ACTION_VIEW.equals(intent.getAction()) || Intent.ACTION_INSERT.equals(intent.getAction())) && (intent.getData().getPath().startsWith(LegacyDBHelper.NotePad.Notes.PATH_VISIBLE_NOTES) || intent.getData().getPath().startsWith(LegacyDBHelper.NotePad.Notes.PATH_NOTES) || intent.getData().getPath().startsWith(Task.URI.getPath())) && !intent.getData().getPath().startsWith(TaskList.URI.getPath())) { return true; } return false; }
private void handleIntent(Intent intent) { android.support.v4.app.FragmentManager fm = getSupportFragmentManager(); // Called by the search bar if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); if (isOnline() && Integer.parseInt(query) <= ComicBrowserFragment.sNewestComicNumber) { // Get the ComicBrowserFragment and update it sProgress = ProgressDialog.show( MainActivity.this, "", this.getResources().getString(R.string.loading_comics), true); ComicBrowserFragment.sComicMap.clear(); ComicBrowserFragment.sLastComicNumber = Integer.parseInt(query); ComicBrowserFragment fragment = (ComicBrowserFragment) fm.findFragmentByTag("browser"); fragment.new pagerUpdate().execute(Integer.parseInt(query)); hideKeyboard(this); } else { if (isOnline()) { Toast toast = Toast.makeText(this, R.string.comic_error, Toast.LENGTH_SHORT); toast.show(); } else { Toast toast = Toast.makeText(this, R.string.no_connection, Toast.LENGTH_SHORT); toast.show(); hideKeyboard(this); } } return; } // Called when users open xkcd.com or m.xkcd.com links if (Intent.ACTION_VIEW.equals(intent.getAction())) { // Get the ComicBrowserFragment and update it ComicBrowserFragment fragment = (ComicBrowserFragment) fm.findFragmentByTag("browser"); ComicBrowserFragment.sLastComicNumber = getNumberFromUrl(intent.getDataString()); fragment.new pagerUpdate().execute(ComicBrowserFragment.sLastComicNumber); } }