List of usage examples for android.content Intent ACTION_INSERT
String ACTION_INSERT
To view the source code for android.content Intent ACTION_INSERT.
Click Source Link
From source file:fr.bde_eseo.eseomega.events.EventItem.java
public Intent toCalendarIntent() { Intent calIntent = new Intent(Intent.ACTION_INSERT); calIntent.setType("vnd.android.cursor.item/event"); calIntent.putExtra(CalendarContract.Events.TITLE, name); calIntent.putExtra(CalendarContract.Events.EVENT_LOCATION, (lieu != null ? lieu : "")); calIntent.putExtra(CalendarContract.Events.DESCRIPTION, (details != null ? details : "")); SimpleDateFormat sdf = new SimpleDateFormat("HH'h'mm", Locale.FRANCE); String sDate = sdf.format(this.date); boolean allDay = sDate.equals(HOUR_PASS_ALLDAY); calIntent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, allDay); calIntent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, cal.getTimeInMillis()); if (!allDay)// w w w.j av a 2 s. co m calIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, calFin.getTimeInMillis()); return calIntent; }
From source file:com.money.manager.ex.investment.PortfolioFragment.java
private void openEditInvestmentActivity(Integer stockId) { Intent intent = new Intent(getActivity(), InvestmentTransactionEditActivity.class); intent.putExtra(InvestmentTransactionEditActivity.ARG_ACCOUNT_ID, mAccountId); intent.putExtra(InvestmentTransactionEditActivity.ARG_STOCK_ID, stockId); intent.setAction(Intent.ACTION_INSERT); startActivity(intent);/* w w w. j a v a 2 s . c om*/ }
From source file:at.jclehner.rxdroid.DrugEditFragment.java
@Override public void onResume() { super.onResume(); Intent intent = getActivity().getIntent(); String action = intent.getAction(); Drug drug = null;/*from www .jav a2 s . c o m*/ mWrapper = new DrugWrapper(); mFocusOnCurrentSupply = false; if (Intent.ACTION_EDIT.equals(action)) { final int drugId = intent.getIntExtra(DrugEditActivity2.EXTRA_DRUG_ID, -1); if (drugId == -1) throw new IllegalStateException("ACTION_EDIT requires EXTRA_DRUG_ID"); drug = Drug.get(drugId); if (LOGV) Util.dumpObjectMembers(TAG, Log.VERBOSE, drug, "drug"); mWrapper.set(drug); mDrugHash = drug.hashCode(); mIsEditing = true; if (intent.getBooleanExtra(DrugEditActivity2.EXTRA_FOCUS_ON_CURRENT_SUPPLY, false)) mFocusOnCurrentSupply = true; setActivityTitle(drug.getName()); } else if (Intent.ACTION_INSERT.equals(action)) { mIsEditing = false; mWrapper.set(new Drug()); setActivityTitle(R.string._title_new_drug); } else throw new IllegalArgumentException("Unhandled action " + action); if (mWrapper.refillSize == 0) mWrapper.currentSupply = Fraction.ZERO; OTPM.mapToPreferenceHierarchy(getPreferenceScreen(), mWrapper); getPreferenceScreen().setOnPreferenceChangeListener(mListener); if (!mIsEditing) { final Preference p = findPreference("active"); if (p != null) p.setEnabled(false); } if (mWrapper.refillSize == 0) { final Preference p = findPreference("currentSupply"); if (p != null) p.setEnabled(false); } if (mFocusOnCurrentSupply) { Log.i(TAG, "Will focus on current supply preference"); performPreferenceClick("currentSupply"); } getActivity().supportInvalidateOptionsMenu(); }
From source file:com.android.contacts.util.AccountFilterUtil.java
/** * Start editor intent; and if filter is an account filter, we pass account info to editor so * as to create a contact in that account. *///from ww w . ja v a 2 s.c om public static void startEditorIntent(Context context, Intent src, ContactListFilter filter) { final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI); intent.putExtras(src); // If we are in account view, we pass the account explicitly in order to // create contact in the account. This will prevent the default account dialog // from being displayed. if (!isAllContactsFilter(filter) && filter.accountName != null && filter.accountType != null) { final Account account = new Account(filter.accountName, filter.accountType); intent.putExtra(Intents.Insert.EXTRA_ACCOUNT, account); intent.putExtra(Intents.Insert.EXTRA_DATA_SET, filter.dataSet); } else if (isDeviceContactsFilter(filter)) { intent.putExtra(ContactEditorActivity.EXTRA_ACCOUNT_WITH_DATA_SET, filter.toAccountWithDataSet()); } try { ImplicitIntentsUtil.startActivityInApp(context, intent); } catch (ActivityNotFoundException ex) { Toast.makeText(context, R.string.missing_app, Toast.LENGTH_SHORT).show(); } }
From source file:com.android.firewall.FirewallListPage.java
/** * Process Intent, For example, add black/white list *///ww w . ja v a2 s . c o m private void handleIntent() { Intent intent = getIntent(); if (intent != null) { if (intent.getAction().equals(Intent.ACTION_INSERT)) { Bundle bundle = intent.getExtras(); if (bundle.getString(FirewallConstants.KEY_MODE).equals("blacklist")) { BlacklistInfo info = new BlacklistInfo(); String num = Utils.getPurePhoneNum(bundle.getString("number")); info.setId(-1); if (num != null) info.setPhone_num(num); String name = bundle.getString("name"); if (name != null) info.setName(name); info.setMsg_mode(FirewallConstants.BLOCK); info.setPhone_mode(FirewallConstants.BLOCK); DatabaseManager.getInstance(getApplicationContext()).insertOrUpdateBlacklist(info); } } } }
From source file:edu.mit.mobile.android.livingpostcards.CameraActivity.java
private void processIntent(Intent intent) { final String action = intent.getAction(); if (ACTION_ADD_PHOTO.equals(action)) { mCardDir = null;/*ww w .j a va 2 s . co m*/ loadCard(intent.getData()); } else if (Intent.ACTION_INSERT.equals(action)) { mCard = null; mCardDir = intent.getData(); } else { Toast.makeText(this, "Unable to handle requested action", Toast.LENGTH_LONG).show(); setResult(RESULT_CANCELED); finish(); } }
From source file:com.money.manager.ex.budget.BudgetListFragment.java
private void createBudget() { Intent intent = new Intent(getActivity(), BudgetEditActivity.class); intent.setAction(Intent.ACTION_INSERT); startActivityForResult(intent, REQUEST_EDIT_BUDGET); }
From source file:com.money.manager.ex.home.HomeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) return null; // inflate layout View view = inflater.inflate(R.layout.home_fragment, container, false); linearHome = (FrameLayout) view.findViewById(R.id.linearLayoutHome); txtTotalAccounts = (TextView) view.findViewById(R.id.textViewTotalAccounts); createWelcomeView(view);//from www . ja v a2 s . co m setUpAccountsList(view); prgAccountBills = (ProgressBar) view.findViewById(R.id.progressAccountBills); mFloatingActionButton = (FloatingActionButton) view.findViewById(R.id.fab); mFloatingActionButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), CheckingTransactionEditActivity.class); intent.setAction(Intent.ACTION_INSERT); startActivity(intent); } }); return view; }
From source file:de.baumann.hhsmoodle.helper.helper_main.java
public static void createCalendarEvent(Activity activity, String title, String description) { Intent calIntent = new Intent(Intent.ACTION_INSERT); calIntent.setType("vnd.android.cursor.item/event"); calIntent.putExtra(CalendarContract.Events.TITLE, title); calIntent.putExtra(CalendarContract.Events.DESCRIPTION, description); activity.startActivity(calIntent);/*ww w. j av a 2s . c o m*/ }
From source file:com.salesforce.marketingcloud.android.demoapp.LearningAppApplication.java
@Override public NotificationCompat.Builder setupNotificationBuilder(@NonNull Context context, @NonNull NotificationMessage notificationMessage) { NotificationCompat.Builder builder = NotificationManager.getDefaultNotificationBuilder(context, notificationMessage, NotificationManager.createDefaultNotificationChannel(context), R.drawable.ic_stat_app_logo_transparent); Map<String, String> customKeys = notificationMessage.customKeys(); if (!customKeys.containsKey("category") || !customKeys.containsKey("sale_date")) { return builder; }/*from ww w. ja v a 2 s . com*/ if ("sale".equalsIgnoreCase(customKeys.get("category"))) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); simpleDateFormat.setTimeZone(TimeZone.getDefault()); try { Date saleDate = simpleDateFormat.parse(customKeys.get("sale_date")); Intent intent = new Intent(Intent.ACTION_INSERT).setData(CalendarContract.Events.CONTENT_URI) .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, saleDate.getTime()) .putExtra(CalendarContract.EXTRA_EVENT_END_TIME, saleDate.getTime()) .putExtra(CalendarContract.Events.TITLE, customKeys.get("event_title")) .putExtra(CalendarContract.Events.DESCRIPTION, customKeys.get("alert")) .putExtra(CalendarContract.Events.HAS_ALARM, 1) .putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true); PendingIntent pendingIntent = PendingIntent.getActivity(context, R.id.interactive_notification_reminder, intent, PendingIntent.FLAG_CANCEL_CURRENT); builder.addAction(android.R.drawable.ic_menu_my_calendar, getString(R.string.in_btn_add_reminder), pendingIntent); } catch (ParseException e) { Log.e(TAG, e.getMessage(), e); } } return builder; }