List of usage examples for android.content Intent CATEGORY_DEFAULT
String CATEGORY_DEFAULT
To view the source code for android.content Intent CATEGORY_DEFAULT.
Click Source Link
From source file:com.nagravision.mediaplayer.FullscreenActivity.java
/** * *///from ww w . ja v a2 s. co m @SuppressLint("InlinedApi") @Override protected void onCreate(Bundle inBundle) { Log.v(LOG_TAG, "FullscreenActivity::onCreate - Enter\n"); super.onCreate(inBundle); getApplication().registerActivityLifecycleCallbacks(this); if (Build.VERSION.SDK_INT < 16) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_fullscreen); mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); mMoviesList = (ListView) findViewById(R.id.start_drawer); mUrlsAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_activated_1, MOVIES_ARR); mMoviesList.setAdapter(mUrlsAdapter); mVideoHolder = (VideoView) findViewById(R.id.fullscreen_content); View decorView = getWindow().getDecorView(); // Hide the status bar. int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN; if (Build.VERSION.SDK_INT >= 19) { uiOptions |= View.SYSTEM_UI_FLAG_IMMERSIVE; } decorView.setSystemUiVisibility(uiOptions); // Remember that you should never show the action bar if the // status bar is hidden, so hide that too if necessary. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); actionBar.hide(); mNotifBuilder = new Notification.Builder(this); mNotifMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mExplicitIntent = new Intent(Intent.ACTION_VIEW); mExplicitIntent.setClass(this, this.getClass()); mDefaultIntent = PendingIntent.getActivity(this, REQUEST_DISPLAY, mExplicitIntent, Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_DEBUG_LOG_RESOLUTION); mInfosActionIntent = new Intent(); mInfosActionIntent.setAction("com.nagravision.mediaplayer.VIDEO_INFOS"); mInfosActionIntent.addCategory(Intent.CATEGORY_DEFAULT); mInfosActionIntent.addCategory(Intent.CATEGORY_INFO); mInfosIntent = PendingIntent.getActivity(this, REQUEST_INFOS, mInfosActionIntent, Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_DEBUG_LOG_RESOLUTION); if (Build.VERSION.SDK_INT >= 19) { mVideoHolder.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE); } else { mVideoHolder.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN); } OnItemClickListener mMessageClickedHandler = new OnItemClickListener() { public void onItemClick(@SuppressWarnings("rawtypes") AdapterView parent, View v, int position, long id) { Log.v(LOG_TAG, "FullscreenActivity.onCreate.OnItemClickListener::onItemClick - Enter\n"); ClickItem(position, 0); } }; mMoviesList.setOnItemClickListener(mMessageClickedHandler); getWindow().setFormat(PixelFormat.TRANSLUCENT); mControlsView = new MediaController(this, true); mControlsView.setPrevNextListeners(new View.OnClickListener() { /* * Next listener */ @Override public void onClick(View view) { Log.v(LOG_TAG, "FullscreenActivity.onCreate.OnClickListener::onClick(next) - Enter\n"); mVideoHolder.stopPlayback(); int position = 0; if (mLastPosition > 0) position = mLastPosition + 1; if (position >= MOVIES_URLS.length) position = 0; ClickItem(position, 0); String toaststr = getResources().getString(R.string.next_movie_toast_string) + MOVIES_ARR[position]; Toast.makeText(FullscreenActivity.this, toaststr, Toast.LENGTH_LONG).show(); } }, new View.OnClickListener() { /* * Prev listener */ @Override public void onClick(View view) { Log.v(LOG_TAG, "FullscreenActivity.onCreate.OnClickListener::onClick(prev) - Enter\n"); mVideoHolder.stopPlayback(); int position = 0; if (mLastPosition > 0) position = mLastPosition - 1; if (position < 0) position = MOVIES_URLS.length - 1; ClickItem(position, 0); String toaststr = getResources().getString(R.string.prev_movie_toast_string) + MOVIES_ARR[position]; Toast.makeText(FullscreenActivity.this, toaststr, Toast.LENGTH_LONG).show(); } }); mVideoHolder.setMediaController(mControlsView); // Set up an instance of SystemUiHider to control the system UI for // this activity. mSystemUiHider = SystemUiHider.getInstance(this, mVideoHolder, HIDER_FLAGS); mSystemUiHider.setup(); mSystemUiHider.setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() { // Cached values. int mControlsHeight; int mShortAnimTime; @Override @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) public void onVisibilityChange(boolean visible) { Log.v(LOG_TAG, "FullscreenActivity.OnVisibilityChangeListener::onVisibilityChange - Enter\n"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { if (mControlsHeight == 0) mControlsHeight = mControlsView.getHeight(); if (mShortAnimTime == 0) mShortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); mControlsView.animate().translationY(visible ? 0 : mControlsHeight).setDuration(mShortAnimTime); } else mControlsView.setVisibility(visible ? View.VISIBLE : View.GONE); if (visible && AUTO_HIDE) delayedHide(AUTO_HIDE_DELAY_MILLIS); } }); // Set up the user interaction to manually show or hide the system UI. mVideoHolder.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (TOGGLE_ON_CLICK) { mSystemUiHider.toggle(); } else { mSystemUiHider.show(); } } }); mDrawer.openDrawer(mMoviesList); }
From source file:jackpal.androidterm.RemoteInterface.java
protected String openNewWindow(String iInitialCommand) { TermService service = getTermService(); String initialCommand = getInitialCommand(); if (iInitialCommand != null) { if (initialCommand != null) { initialCommand += "\r" + iInitialCommand; } else {//ww w.j a va2 s.c om initialCommand = iInitialCommand; } } try { TermSession session = Term.createTermSession(this, mSettings, initialCommand); session.setFinishCallback(service); service.getSessions().add(session); String handle = UUID.randomUUID().toString(); ((GenericTermSession) session).setHandle(handle); Intent intent = new Intent(PRIVACT_OPEN_NEW_WINDOW); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); return handle; } catch (IOException e) { return null; } }
From source file:org.familab.app.supportfiles.IntentIntegrator.java
/** * Shares the given text by encoding it as a barcode, such that another user can * scan the text off the screen of the device. * * @param text the text string to encode as a barcode * @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type} constants. * @return the {@link android.app.AlertDialog} that was shown to the user prompting them to download the app * if a prompt was needed, or null otherwise */// w ww.ja v a 2 s . co m public final AlertDialog shareText(CharSequence text, CharSequence type) { Intent intent = new Intent(); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setAction(BS_PACKAGE + ".ENCODE"); intent.putExtra("ENCODE_TYPE", type); intent.putExtra("ENCODE_DATA", text); String targetAppPackage = findTargetAppPackage(intent); if (targetAppPackage == null) { return showDownloadDialog(); } intent.setPackage(targetAppPackage); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); attachMoreExtras(intent); activity.startActivity(intent); return null; }
From source file:net.sylvek.sharemyposition.ShareMyPosition.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { default:// w w w . jav a 2 s .com return super.onCreateDialog(id); case MAP_DLG: final View sharedMapView = LayoutInflater.from(this).inflate(R.layout.sharedmap, null); final FrameLayout map = (FrameLayout) sharedMapView.findViewById(R.id.sharedmap); map.addView(this.sharedMap); final CheckBox latlonAddress = (CheckBox) sharedMapView.findViewById(R.id.add_lat_lon_location); final CheckBox geocodeAddress = (CheckBox) sharedMapView.findViewById(R.id.add_address_location); final RadioButton nourl = (RadioButton) sharedMapView.findViewById(R.id.add_no_url_location); final RadioButton url = (RadioButton) sharedMapView.findViewById(R.id.add_url_location); final RadioButton gmap = (RadioButton) sharedMapView.findViewById(R.id.add_native_location); final EditText body = (EditText) sharedMapView.findViewById(R.id.body); final ToggleButton track = (ToggleButton) sharedMapView.findViewById(R.id.add_track_location); latlonAddress.setChecked(pref.getBoolean(PREF_LAT_LON_CHECKED, true)); geocodeAddress.setChecked(pref.getBoolean(PREF_ADDRESS_CHECKED, true)); final boolean isUrl = pref.getBoolean(PREF_URL_CHECKED, true); final boolean isGmap = pref.getBoolean(PREF_GMAP_CHECKED, false); url.setChecked(isUrl); gmap.setChecked(isGmap); nourl.setChecked(!isUrl && !isGmap); body.setText(pref.getString(PREF_BODY_DEFAULT, getString(R.string.body))); track.setChecked(pref.getBoolean(PREF_TRACK_CHECKED, false)); if (track.isChecked()) { latlonAddress.setEnabled(false); latlonAddress.setChecked(false); geocodeAddress.setEnabled(false); geocodeAddress.setChecked(false); url.setEnabled(false); url.setChecked(true); gmap.setEnabled(false); gmap.setChecked(false); nourl.setEnabled(false); nourl.setChecked(false); } track.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { latlonAddress.setEnabled(!isChecked); latlonAddress.setChecked(!isChecked); geocodeAddress.setEnabled(!isChecked); geocodeAddress.setChecked(!isChecked); url.setEnabled(!isChecked); url.setChecked(true); gmap.setEnabled(!isChecked); gmap.setChecked(!isChecked); nourl.setEnabled(!isChecked); nourl.setChecked(!isChecked); } }); return new AlertDialog.Builder(this).setTitle(R.string.app_name).setView(sharedMapView) .setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { finish(); } }).setNeutralButton(R.string.options, new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { /* needed to display neutral button */ } }).setPositiveButton(R.string.share_it, new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { final boolean isLatLong = ((CheckBox) sharedMapView .findViewById(R.id.add_lat_lon_location)).isChecked(); final boolean isGeocodeAddress = ((CheckBox) sharedMapView .findViewById(R.id.add_address_location)).isChecked(); final boolean isUrl = ((RadioButton) sharedMapView.findViewById(R.id.add_url_location)) .isChecked(); final boolean isGmap = ((RadioButton) sharedMapView .findViewById(R.id.add_native_location)).isChecked(); final EditText body = (EditText) sharedMapView.findViewById(R.id.body); final boolean isTracked = ((ToggleButton) sharedMapView .findViewById(R.id.add_track_location)).isChecked(); final String uuid = UUID.randomUUID().toString(); pref.edit().putBoolean(PREF_LAT_LON_CHECKED, isLatLong) .putBoolean(PREF_ADDRESS_CHECKED, isGeocodeAddress) .putBoolean(PREF_URL_CHECKED, isUrl).putBoolean(PREF_GMAP_CHECKED, isGmap) .putString(PREF_BODY_DEFAULT, body.getText().toString()) .putBoolean(PREF_TRACK_CHECKED, isTracked).commit(); final Intent t = new Intent(Intent.ACTION_SEND); t.setType("text/plain"); t.addCategory(Intent.CATEGORY_DEFAULT); final Intent share = Intent.createChooser(t, getString(R.string.app_name)); final GeoPoint p = sharedMap.getMapCenter(); final String text = body.getText().toString(); share(p.getLatitude(), p.getLongitude(), t, share, text, isGeocodeAddress, isUrl, isGmap, isLatLong, isTracked, uuid); } }).create(); case PROGRESS_DLG: final ProgressDialog dlg = new ProgressDialog(this); dlg.setTitle(getText(R.string.app_name)); dlg.setMessage(getText(R.string.progression_desc)); dlg.setIndeterminate(true); dlg.setCancelable(true); dlg.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { finish(); } }); return dlg; case PROVIDERS_DLG: return new AlertDialog.Builder(this).setTitle(R.string.app_name).setCancelable(false) .setIcon(android.R.drawable.ic_menu_help).setMessage(R.string.providers_needed) .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }).setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent gpsProperty = new Intent( android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(gpsProperty); } }).create(); } }
From source file:be.brunoparmentier.wifikeyshare.ui.activities.WifiNetworkActivity.java
private void setupForegroundDispatch() { /* initialize the PendingIntent to start for the dispatch */ nfcPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); /* initialize the IntentFilters to override dispatching for */ nfcIntentFilters = new IntentFilter[3]; nfcIntentFilters[0] = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED); nfcIntentFilters[0].addCategory(Intent.CATEGORY_DEFAULT); nfcIntentFilters[1] = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED); nfcIntentFilters[1].addCategory(Intent.CATEGORY_DEFAULT); nfcIntentFilters[2] = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED); nfcIntentFilters[2].addCategory(Intent.CATEGORY_DEFAULT); try {// w w w . ja va 2s. co m nfcIntentFilters[0].addDataType("*/*"); // Handle all MIME based dispatches. } catch (IntentFilter.MalformedMimeTypeException e) { Log.e(TAG, "setupForegroundDispatch: " + e.getMessage()); } /* Initialize the tech lists used to perform matching for dispatching of the * ACTION_TECH_DISCOVERED intent */ nfcTechLists = new String[][] {}; }
From source file:jackpal.androidterm.RemoteInterface.java
protected String appendToWindow(String handle, String iInitialCommand) { TermService service = getTermService(); // Find the target window SessionList sessions = service.getSessions(); GenericTermSession target = null;//from w w w .ja va 2 s.co m int index; for (index = 0; index < sessions.size(); ++index) { GenericTermSession session = (GenericTermSession) sessions.get(index); String h = session.getHandle(); if (h != null && h.equals(handle)) { target = session; break; } } if (target == null) { // Target window not found, open a new one return openNewWindow(iInitialCommand); } if (iInitialCommand != null) { target.write(iInitialCommand); target.write('\r'); } Intent intent = new Intent(PRIVACT_SWITCH_WINDOW); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(PRIVEXTRA_TARGET_WINDOW, index); startActivity(intent); return handle; }
From source file:com.trail.octo.UploadDocs.java
public boolean askCameraPermission() { check = false;//from www .j a v a 2 s. c o m // Here, thisActivity is the current activity if (ContextCompat.checkSelfPermission(UploadDocs.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { // Should we show an explanation? if (ActivityCompat.shouldShowRequestPermissionRationale(UploadDocs.this, Manifest.permission.CAMERA)) { Log.e("Permission", "Explain here"); Toast.makeText(getApplicationContext(), "OCTO requires this Permission to upload Images!", Toast.LENGTH_LONG).show(); final Intent i = new Intent(); i.setAction(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); i.addCategory(Intent.CATEGORY_DEFAULT); i.setData(Uri.parse("package:" + UploadDocs.this.getPackageName())); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); startActivity(i); // Show an expanation to the user *asynchronously* -- don't block // this thread waiting for the user's response! After the user // sees the explanation, try again to request the permission. } else { // No explanation needed, we can request the permission. Log.e("Permission", "Requesting"); ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA }, PERMISSION_REQUEST_CAMERA); // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an // app-defined int constant. The callback method gets the // result of the request. } } else { return true; } return check; }
From source file:com.gnuroot.debian.GNURootMain.java
private void setupFirstHalf() { errOcc = false;/*from ww w .ja v a 2 s .c o m*/ expectingResult = true; Intent downloadIntent = new Intent(); downloadIntent.addCategory(Intent.CATEGORY_DEFAULT); downloadIntent.setClassName("com.gnuroot.debian", "com.gnuroot.debian.GNURootDownloaderActivity"); startActivityForResult(downloadIntent, 0); }
From source file:it.imwatch.nfclottery.MainActivity.java
/** * Sets up the dispatching of NFC events a the foreground Activity. * * @param activity The {@link android.app.Activity} to setup the foreground dispatch for * @param adapter The {@link android.nfc.NfcAdapter} to setup the foreground dispatch for *///from w ww . j ava 2 s.com public static void setupForegroundDispatch(final Activity activity, NfcAdapter adapter) { if (adapter != null) { final Intent intent = new Intent(activity.getApplicationContext(), activity.getClass()); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); final PendingIntent pendingIntent = PendingIntent.getActivity(activity.getApplicationContext(), 0, intent, 0); IntentFilter[] filters = new IntentFilter[1]; String[][] techList = new String[][] {}; // Notice that this is the same filter we define in our manifest. // This ensures we're not stealing events for other types of NDEF. filters[0] = new IntentFilter(); IntentFilter filter = filters[0]; filter.addAction(NfcAdapter.ACTION_NDEF_DISCOVERED); filter.addCategory(Intent.CATEGORY_DEFAULT); try { filter.addDataType(MIME_VCARD); filter.addDataType(MIME_XVCARD); } catch (IntentFilter.MalformedMimeTypeException e) { throw new RuntimeException("Mime type not supported."); } adapter.enableForegroundDispatch(activity, pendingIntent, filters, techList); } }
From source file:com.tasomaniac.openwith.resolver.ResolverActivity.java
protected void onIntentSelected(ResolveInfo ri, Intent intent, boolean alwaysCheck) { final ChooserHistory history = getHistory(); if ((mAlwaysUseOption || mAdapter.hasFilteredItem()) && mAdapter.mOrigResolveList != null) { // Build a reasonable intent filter, based on what matched. IntentFilter filter = new IntentFilter(); if (intent.getAction() != null) { filter.addAction(intent.getAction()); }/* w ww . jav a 2 s . c o m*/ Set<String> categories = intent.getCategories(); if (categories != null) { for (String cat : categories) { filter.addCategory(cat); } } filter.addCategory(Intent.CATEGORY_DEFAULT); int cat = ri.match & IntentFilter.MATCH_CATEGORY_MASK; Uri data = intent.getData(); if (cat == IntentFilter.MATCH_CATEGORY_TYPE) { String mimeType = intent.resolveType(this); if (mimeType != null) { try { filter.addDataType(mimeType); } catch (IntentFilter.MalformedMimeTypeException e) { Log.w("ResolverActivity", e); filter = null; } } } if (filter != null && data != null && data.getScheme() != null) { // We need the data specification if there was no type, // OR if the scheme is not one of our magical "file:" // or "content:" schemes (see IntentFilter for the reason). if (cat != IntentFilter.MATCH_CATEGORY_TYPE || (!"file".equals(data.getScheme()) && !"content".equals(data.getScheme()))) { filter.addDataScheme(data.getScheme()); // Look through the resolved filter to determine which part // of it matched the original Intent. if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { Iterator<PatternMatcher> pIt = ri.filter.schemeSpecificPartsIterator(); if (pIt != null) { String ssp = data.getSchemeSpecificPart(); while (ssp != null && pIt.hasNext()) { PatternMatcher p = pIt.next(); if (p.match(ssp)) { filter.addDataSchemeSpecificPart(p.getPath(), p.getType()); break; } } } } Iterator<IntentFilter.AuthorityEntry> aIt = ri.filter.authoritiesIterator(); if (aIt != null) { while (aIt.hasNext()) { IntentFilter.AuthorityEntry a = aIt.next(); if (a.match(data) >= 0) { int port = a.getPort(); filter.addDataAuthority(a.getHost(), port >= 0 ? Integer.toString(port) : null); break; } } } Iterator<PatternMatcher> pIt = ri.filter.pathsIterator(); if (pIt != null) { String path = data.getPath(); while (path != null && pIt.hasNext()) { PatternMatcher p = pIt.next(); if (p.match(path)) { filter.addDataPath(p.getPath(), p.getType()); break; } } } } } if (filter != null) { ContentValues values = new ContentValues(3); values.put(HOST, mRequestedUri.getHost()); values.put(COMPONENT, intent.getComponent().flattenToString()); if (alwaysCheck) { values.put(PREFERRED, true); } values.put(LAST_CHOSEN, true); getContentResolver().insert(CONTENT_URI, values); history.add(intent.getComponent().getPackageName()); } } if (intent != null) { startActivity(intent); } history.save(this); }