List of usage examples for android.provider CalendarContract ACTION_HANDLE_CUSTOM_EVENT
String ACTION_HANDLE_CUSTOM_EVENT
To view the source code for android.provider CalendarContract ACTION_HANDLE_CUSTOM_EVENT.
Click Source Link
From source file:nl.mpcjanssen.simpletask.Simpletask.java
@Override protected void onNewIntent(@NotNull Intent intent) { super.onNewIntent(intent); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { Intent currentIntent = getIntent(); currentIntent.putExtra(SearchManager.QUERY, intent.getStringExtra(SearchManager.QUERY)); setIntent(currentIntent);/* w w w. jav a 2 s . c o m*/ options_menu.findItem(R.id.search).collapseActionView(); } else if (CalendarContract.ACTION_HANDLE_CUSTOM_EVENT.equals(intent.getAction())) { Uri uri = Uri.parse(intent.getStringExtra(CalendarContract.EXTRA_CUSTOM_APP_URI)); String search = uri.getLastPathSegment(); // TODO: activate search } else if (intent.getExtras() != null) { // Only change intent if it actually contains a filter setIntent(intent); } Log.v(TAG, "onNewIntent: " + intent); }
From source file:com.android.calendar.EventInfoFragment.java
private void updateCustomAppButton() { buttonSetup: {//ww w .j ava 2 s . co m final Button launchButton = (Button) mView.findViewById(R.id.launch_custom_app_button); if (launchButton == null) break buttonSetup; final String customAppPackage = mEventCursor.getString(EVENT_INDEX_CUSTOM_APP_PACKAGE); final String customAppUri = mEventCursor.getString(EVENT_INDEX_CUSTOM_APP_URI); if (TextUtils.isEmpty(customAppPackage) || TextUtils.isEmpty(customAppUri)) break buttonSetup; PackageManager pm = mContext.getPackageManager(); if (pm == null) break buttonSetup; ApplicationInfo info; try { info = pm.getApplicationInfo(customAppPackage, 0); if (info == null) break buttonSetup; } catch (NameNotFoundException e) { break buttonSetup; } Uri uri = ContentUris.withAppendedId(Events.CONTENT_URI, mEventId); final Intent intent = new Intent(CalendarContract.ACTION_HANDLE_CUSTOM_EVENT, uri); intent.setPackage(customAppPackage); intent.putExtra(CalendarContract.EXTRA_CUSTOM_APP_URI, customAppUri); intent.putExtra(EXTRA_EVENT_BEGIN_TIME, mStartMillis); // See if we have a taker for our intent if (pm.resolveActivity(intent, 0) == null) break buttonSetup; Drawable icon = pm.getApplicationIcon(info); if (icon != null) { Drawable[] d = launchButton.getCompoundDrawables(); icon.setBounds(0, 0, mCustomAppIconSize, mCustomAppIconSize); launchButton.setCompoundDrawables(icon, d[1], d[2], d[3]); } CharSequence label = pm.getApplicationLabel(info); if (label != null && label.length() != 0) { launchButton.setText(label); } else if (icon == null) { // No icon && no label. Hide button? break buttonSetup; } // Launch custom app launchButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { startActivityForResult(intent, 0); } catch (ActivityNotFoundException e) { // Shouldn't happen as we checked it already setVisibilityCommon(mView, R.id.launch_custom_app_container, View.GONE); } } }); setVisibilityCommon(mView, R.id.launch_custom_app_container, View.VISIBLE); return; } setVisibilityCommon(mView, R.id.launch_custom_app_container, View.GONE); return; }