List of usage examples for android.content Intent EXTRA_UID
String EXTRA_UID
To view the source code for android.content Intent EXTRA_UID.
Click Source Link
From source file:com.money.manager.ex.assetallocation.AssetClassEditActivity.java
private void loadIntent() { Intent intent = getIntent();/*from ww w. jav a 2s . c om*/ if (intent == null) return; // Insert or Edit? mAction = intent.getAction(); if (mAction == null) return; AssetClass assetClass = null; switch (mAction) { case Intent.ACTION_INSERT: assetClass = AssetClass.create(""); int parentId = intent.getIntExtra(KEY_PARENT_ID, Constants.NOT_SET); assetClass.setParentId(parentId); break; case Intent.ACTION_EDIT: int id = intent.getIntExtra(Intent.EXTRA_UID, Constants.NOT_SET); this.assetClassId = id; // load class AssetClassRepository repo = new AssetClassRepository(this); assetClass = repo.load(id); if (assetClass == null) { new UIHelper(this).showToast("No asset class found in the database!"); // todo: show error message and return (close edit activity) return; } break; } AssetClassEditFragment fragment = getFragment(); fragment.assetClass = assetClass; }
From source file:com.khoahuy.phototag.HomeActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); mCurrentPhotoPath = savedInstanceState.getString("mCurrentPhotoPath"); Intent intent = getIntent();// w w w . j a v a 2 s . c o m if (intent != null && Intent.EXTRA_UID.equals(intent.getAction())) { setIntent(null); } }
From source file:com.khoahuy.phototag.HomeActivity.java
@Override protected void onResume() { super.onResume(); try {//w ww. ja va 2 s . com loadContent(); Intent callerIntent = getIntent(); if (callerIntent != null && Intent.EXTRA_UID.equals(callerIntent.getAction())) { Bundle packageFromCaller = callerIntent.getBundleExtra("MyPackage"); if (packageFromCaller != null) { nfcid = packageFromCaller.getString("nfcid"); // processNfcID(); setIntent(callerIntent); dispatchTakePictureIntent(ACTION_TAKE_PHOTO_B); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.songcode.materialnotes.ui.NoteEditActivity.java
/** * Current activity may be killed when the memory is low. Once it is killed, for another time * user load this activity, we should restore the former state */// w w w . j av a 2 s. co m @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); if (savedInstanceState != null && savedInstanceState.containsKey(Intent.EXTRA_UID)) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.putExtra(Intent.EXTRA_UID, savedInstanceState.getLong(Intent.EXTRA_UID)); if (!initActivityState(intent)) { finish(); return; } Log.d(TAG, "Restoring from killed activity"); } }
From source file:com.songcode.materialnotes.ui.NoteEditActivity.java
private boolean initActivityState(Intent intent) { /**/*from w w w . j av a 2 s .c om*/ * If the user specified the {@link Intent#ACTION_VIEW} but not provided with id, * then jump to the NotesListActivity */ mWorkingNote = null; if (TextUtils.equals(Intent.ACTION_VIEW, intent.getAction())) { long noteId = intent.getLongExtra(Intent.EXTRA_UID, 0); mUserQuery = ""; /** * Starting from the searched result */ if (intent.hasExtra(SearchManager.EXTRA_DATA_KEY)) { noteId = Long.parseLong(intent.getStringExtra(SearchManager.EXTRA_DATA_KEY)); mUserQuery = intent.getStringExtra(SearchManager.USER_QUERY); } if (!DataUtils.visibleInNoteDatabase(getContentResolver(), noteId, Notes.TYPE_NOTE)) { Intent jump = new Intent(this, NotesListActivity.class); startActivity(jump); showToast(R.string.error_note_not_exist); finish(); return false; } else { mWorkingNote = WorkingNote.load(this, noteId); if (mWorkingNote == null) { Log.e(TAG, "load note failed with note id" + noteId); finish(); return false; } } } else if (TextUtils.equals(Intent.ACTION_INSERT_OR_EDIT, intent.getAction())) { // New note long folderId = intent.getLongExtra(Notes.INTENT_EXTRA_FOLDER_ID, 0); int widgetId = intent.getIntExtra(Notes.INTENT_EXTRA_WIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); int widgetType = intent.getIntExtra(Notes.INTENT_EXTRA_WIDGET_TYPE, Notes.TYPE_WIDGET_INVALIDE); int bgResId = intent.getIntExtra(Notes.INTENT_EXTRA_BACKGROUND_ID, ResourceParser.getDefaultBgId(this)); // Parse call-record note String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); long callDate = intent.getLongExtra(Notes.INTENT_EXTRA_CALL_DATE, 0); if (callDate != 0 && phoneNumber != null) { if (TextUtils.isEmpty(phoneNumber)) { Log.w(TAG, "The call record number is null"); } long noteId = 0; if ((noteId = DataUtils.getNoteIdByPhoneNumberAndCallDate(getContentResolver(), phoneNumber, callDate)) > 0) { mWorkingNote = WorkingNote.load(this, noteId); if (mWorkingNote == null) { Log.e(TAG, "load call note failed with note id" + noteId); finish(); return false; } } else { mWorkingNote = WorkingNote.createEmptyNote(this, folderId, widgetId, widgetType, bgResId); mWorkingNote.convertToCallNote(phoneNumber, callDate); } } else { mWorkingNote = WorkingNote.createEmptyNote(this, folderId, widgetId, widgetType, bgResId); } } else { Log.e(TAG, "Intent not specified action, should not support"); finish(); return false; } getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); mWorkingNote.setOnSettingStatusChangedListener(this); return true; }
From source file:com.csipsimple.ui.filters.AccountFiltersListFragment.java
/** * Helper function to show the details of a selected item, either by * displaying a fragment in-place in the current UI, or starting a * whole new activity in which it is displayed. *//* w w w. java 2 s.c o m*/ private void showDetails(long filterId) { //curCheckPosition = index; /* if (dualPane) { // If we are not currently showing a fragment for the new // position, we need to create and install a new one. AccountEditFragment df = AccountEditFragment.newInstance(profileId); //df.setOnQuitListener(this); // Execute a transaction, replacing any existing fragment // with this one inside the frame. FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.details, df, null); // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.setTransition(FragmentTransaction.TRANSIT_NONE); //if(profileId != Profile.INVALID_ID) { // ft.addToBackStack(null); //} ft.commit(); } else { */ // Otherwise we need to launch a new activity to display // the dialog fragment with selected text. Intent it = new Intent(getActivity(), EditFilter.class); it.putExtra(Intent.EXTRA_UID, filterId); it.putExtra(Filter.FIELD_ACCOUNT, accountId); startActivity(it); /* } */ }
From source file:org.gnucash.android.test.ui.AccountsActivityTest.java
public void testIntentAccountCreation() { Intent intent = new Intent(Intent.ACTION_INSERT); intent.putExtra(Intent.EXTRA_TITLE, "Intent Account"); intent.putExtra(Intent.EXTRA_UID, "intent-account"); intent.putExtra(Account.EXTRA_CURRENCY_CODE, "EUR"); intent.setType(Account.MIME_TYPE);/*from w ww. java 2 s . c o m*/ getActivity().sendBroadcast(intent); //give time for the account to be created synchronized (mSolo) { try { mSolo.wait(2000); } catch (InterruptedException e) { e.printStackTrace(); } } AccountsDbAdapter dbAdapter = new AccountsDbAdapter(getActivity()); Account account = dbAdapter.getAccount("intent-account"); dbAdapter.close(); assertNotNull(account); assertEquals("Intent Account", account.getName()); assertEquals("intent-account", account.getUID()); assertEquals("EUR", account.getCurrency().getCurrencyCode()); }
From source file:org.mariotaku.twidere.app.TwidereApplication.java
@Override public void onCreate() { sInstance = this; if (BuildConfig.DEBUG) { StrictModeUtils.detectAllVmPolicy(); }/*from w w w . j a v a 2 s . c o m*/ final SharedPreferences preferences = getSharedPreferences(); resetTheme(preferences); super.onCreate(); mProfileImageViewViewProcessor = new ProfileImageViewViewProcessor(); mFontFamilyTagProcessor = new FontFamilyTagProcessor(); ATE.registerViewProcessor(TabPagerIndicator.class, new TabPagerIndicatorViewProcessor()); ATE.registerViewProcessor(FloatingActionButton.class, new FloatingActionButtonViewProcessor()); ATE.registerViewProcessor(ActionBarContextView.class, new ActionBarContextViewViewProcessor()); ATE.registerViewProcessor(SwipeRefreshLayout.class, new SwipeRefreshLayoutViewProcessor()); ATE.registerViewProcessor(TimelineContentTextView.class, new TimelineContentTextViewViewProcessor()); ATE.registerViewProcessor(TextView.class, new TextViewViewProcessor()); ATE.registerViewProcessor(ImageView.class, new ImageViewViewProcessor()); ATE.registerViewProcessor(MaterialEditText.class, new MaterialEditTextViewProcessor()); ATE.registerViewProcessor(ProgressWheel.class, new ProgressWheelViewProcessor()); ATE.registerViewProcessor(ProfileImageView.class, mProfileImageViewViewProcessor); ATE.registerTagProcessor(OptimalLinkColorTagProcessor.TAG, new OptimalLinkColorTagProcessor()); ATE.registerTagProcessor(FontFamilyTagProcessor.TAG, mFontFamilyTagProcessor); ATE.registerTagProcessor(IconActionButtonTagProcessor.PREFIX_COLOR, new IconActionButtonTagProcessor(IconActionButtonTagProcessor.PREFIX_COLOR)); ATE.registerTagProcessor(IconActionButtonTagProcessor.PREFIX_COLOR_ACTIVATED, new IconActionButtonTagProcessor(IconActionButtonTagProcessor.PREFIX_COLOR_ACTIVATED)); ATE.registerTagProcessor(IconActionButtonTagProcessor.PREFIX_COLOR_DISABLED, new IconActionButtonTagProcessor(IconActionButtonTagProcessor.PREFIX_COLOR_DISABLED)); ATE.registerTagProcessor(ThemedMultiValueSwitch.PREFIX_TINT, new ThemedMultiValueSwitch.TintTagProcessor()); mProfileImageViewViewProcessor.setStyle(Utils.getProfileImageStyle(preferences)); mFontFamilyTagProcessor.setFontFamily(ThemeUtils.getThemeFontFamily(preferences)); final int themeColor = preferences.getInt(KEY_THEME_COLOR, ContextCompat.getColor(this, R.color.branding_color)); if (!ATE.config(this, VALUE_THEME_NAME_LIGHT).isConfigured()) { //noinspection WrongConstant ATE.config(this, VALUE_THEME_NAME_LIGHT).primaryColor(themeColor) .accentColor(ThemeUtils.getOptimalAccentColor(themeColor, Color.BLACK)).coloredActionBar(true) .coloredStatusBar(true).commit(); } if (!ATE.config(this, VALUE_THEME_NAME_DARK).isConfigured()) { ATE.config(this, VALUE_THEME_NAME_DARK) .accentColor(ThemeUtils.getOptimalAccentColor(themeColor, Color.WHITE)).coloredActionBar(false) .coloredStatusBar(true).statusBarColor(Color.BLACK).commit(); } if (!ATE.config(this, null).isConfigured()) { ATE.config(this, null).accentColor(ThemeUtils.getOptimalAccentColor(themeColor, Color.WHITE)) .coloredActionBar(false).coloredStatusBar(false).commit(); } initializeAsyncTask(); initDebugMode(); initBugReport(); mHandler = new Handler(); final PackageManager pm = getPackageManager(); final ComponentName main = new ComponentName(this, MainActivity.class); final ComponentName main2 = new ComponentName(this, MainHondaJOJOActivity.class); final boolean mainDisabled = pm .getComponentEnabledSetting(main) != PackageManager.COMPONENT_ENABLED_STATE_ENABLED; final boolean main2Disabled = pm .getComponentEnabledSetting(main2) != PackageManager.COMPONENT_ENABLED_STATE_ENABLED; final boolean noEntry = mainDisabled && main2Disabled; if (noEntry) { pm.setComponentEnabledSetting(main, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); } else if (!mainDisabled) { pm.setComponentEnabledSetting(main2, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } if (!Utils.isComposeNowSupported(this)) { final ComponentName assist = new ComponentName(this, AssistLauncherActivity.class); pm.setComponentEnabledSetting(assist, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } migrateUsageStatisticsPreferences(); Utils.startRefreshServiceIfNeeded(this); DependencyHolder holder = DependencyHolder.get(this); registerActivityLifecycleCallbacks(holder.getActivityTracker()); final IntentFilter packageFilter = new IntentFilter(); packageFilter.addAction(Intent.ACTION_PACKAGE_CHANGED); packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED); packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); packageFilter.addAction(Intent.ACTION_PACKAGE_REPLACED); registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final int uid = intent.getIntExtra(Intent.EXTRA_UID, -1); final String[] packages = getPackageManager().getPackagesForUid(uid); DependencyHolder holder = DependencyHolder.get(context); final ExternalThemeManager manager = holder.getExternalThemeManager(); if (ArrayUtils.contains(packages, manager.getEmojiPackageName())) { manager.reloadEmojiPreferences(); } } }, packageFilter); }
From source file:com.songcode.materialnotes.ui.NoteEditActivity.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); /**/*w w w. ja v a 2 s .c om*/ * For new note without note id, we should firstly save it to * generate a id. If the editing note is not worth saving, there * is no id which is equivalent to create new note */ if (!mWorkingNote.existInDatabase()) { saveNote(); } outState.putLong(Intent.EXTRA_UID, mWorkingNote.getNoteId()); Log.d(TAG, "Save working note id: " + mWorkingNote.getNoteId() + " onSaveInstanceState"); }
From source file:com.abcvoipsip.ui.account.AccountsEditListFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK && data != null && data.getExtras() != null) { if (requestCode == CHOOSE_WIZARD) { // Wizard has been choosen, now create an account String wizardId = data.getStringExtra(WizardUtils.ID); if (wizardId != null) { showDetails(SipProfile.INVALID_ID, wizardId); }/*w w w. j av a 2 s . c om*/ } else if (requestCode == CHANGE_WIZARD) { // Change wizard done for this account. String wizardId = data.getStringExtra(WizardUtils.ID); long accountId = data.getLongExtra(Intent.EXTRA_UID, SipProfile.INVALID_ID); if (wizardId != null && accountId != SipProfile.INVALID_ID) { ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_WIZARD, wizardId); getActivity().getContentResolver().update( ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, accountId), cv, null, null); } } } }