List of usage examples for android.content Intent ACTION_PICK
String ACTION_PICK
To view the source code for android.content Intent ACTION_PICK.
Click Source Link
From source file:com.ape.filemanager.FileExplorerTabActivityOld.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_pager); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setOffscreenPageLimit(DEFAULT_OFFSCREEN_PAGES); mIsMyOsOptionMenuStyle = getResources().getBoolean(R.bool.myos_option_menu_style); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_category), FileCategoryActivityMyOS.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_sd), FileViewActivity.class, null); if (getResources().getBoolean(R.bool.have_cloud_file)) { mTabsAdapter.addTab(bar.newTab().setText(R.string.cloud_storage), CloudFileActivity.class, null); } else {//from w ww .j av a 2 s. c o m mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_remote), ServerControlActivity.class, null); } int tabIndex; Intent intent = getIntent(); String action = intent.getAction(); if (getIntent().getData() != null) { tabIndex = Util.SDCARD_TAB_INDEX; } else if (!TextUtils.isEmpty(action)) { if (action.equals(Intent.ACTION_PICK) || action.equals(Intent.ACTION_GET_CONTENT) || action.equals("com.mediatek.filemanager.ADD_FILE")) { tabIndex = Util.CATEGORY_TAB_INDEX; } else if (action.equals(CloudFileUtil.CLOUD_STORAGE_ACTION)) { tabIndex = Util.REMOTE_TAB_INDEX; } else { tabIndex = Util.CATEGORY_TAB_INDEX; } } else { tabIndex = Util.CATEGORY_TAB_INDEX; //For market require. // tabIndex = PreferenceManager.getDefaultSharedPreferences(this) // .getInt(INSTANCESTATE_TAB, Util.CATEGORY_TAB_INDEX); } bar.setSelectedNavigationItem(tabIndex); mMountPointManager = MountPointManager.getInstance(); mMountPointManager.init(this); }
From source file:com.github.baoti.pioneer.ui.news.NewsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_news); ButterKnife.inject(this); getSupportFragmentManager().addOnBackStackChangedListener(this); String action = getIntent().getAction(); showList = !getIntent().hasExtra(EXTRA_NEWS); inPickMode = Intent.ACTION_PICK.equals(action); initContentFragment(savedInstanceState, action); }
From source file:ca.cmput301f13t03.adventure_datetime.view.FullScreen_Image.java
private void setUpView() { if (_fragment == null) return;//from ww w . j av a 2 s . c o m if (_pageAdapter == null) return; Button gallery = (Button) findViewById(R.id.gallery); Button camera = (Button) findViewById(R.id.camera); Button delete = (Button) findViewById(R.id.action_delete); gallery.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, GALLERY); } }); camera.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { File picDir = new File( Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "adventure.datetime"); if (!picDir.exists()) picDir.mkdirs(); File pic = new File(picDir.getPath(), File.separator + _fragment.getFragmentID().toString() + "-" + _fragment.getStoryMedia().size()); _newImage = Uri.fromFile(pic); Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); i.putExtra(MediaStore.EXTRA_OUTPUT, _newImage); startActivityForResult(i, CAMERA); } }); _pageAdapter.setIllustrations(_fragment.getStoryMedia(), getIntent().getBooleanExtra(TAG_AUTHOR, false)); /* ArrayList<String> list = new ArrayList<String>(); for (int i=0; i<5; i++) list.add(""+i); _pageAdapter.setIllustrations(list, getIntent(). getBooleanExtra(TAG_AUTHOR, false));*/ }
From source file:org.musicmod.android.app.QueryFragment.java
public void onServiceConnected(ComponentName name, IBinder service) { Bundle bundle = getArguments();/* w w w. j av a 2 s .c o m*/ String action = bundle != null ? bundle.getString(INTENT_KEY_ACTION) : null; String data = bundle != null ? bundle.getString(INTENT_KEY_DATA) : null; if (Intent.ACTION_VIEW.equals(action)) { // this is something we got from the search bar Uri uri = Uri.parse(data); if (data.startsWith("content://media/external/audio/media/")) { // This is a specific file String id = uri.getLastPathSegment(); long[] list = new long[] { Long.valueOf(id) }; MusicUtils.playAll(getActivity(), list, 0); getActivity().finish(); return; } else if (data.startsWith("content://media/external/audio/albums/")) { // This is an album, show the songs on it Intent i = new Intent(Intent.ACTION_PICK); i.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track"); i.putExtra("album", uri.getLastPathSegment()); startActivity(i); return; } else if (data.startsWith("content://media/external/audio/artists/")) { // This is an artist, show the albums for that artist Intent i = new Intent(Intent.ACTION_PICK); i.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/album"); i.putExtra("artist", uri.getLastPathSegment()); startActivity(i); return; } } mFilterString = bundle != null ? bundle.getString(SearchManager.QUERY) : null; if (MediaStore.INTENT_ACTION_MEDIA_SEARCH.equals(action)) { String focus = bundle != null ? bundle.getString(MediaStore.EXTRA_MEDIA_FOCUS) : null; String artist = bundle != null ? bundle.getString(MediaStore.EXTRA_MEDIA_ARTIST) : null; String album = bundle != null ? bundle.getString(MediaStore.EXTRA_MEDIA_ALBUM) : null; String title = bundle != null ? bundle.getString(MediaStore.EXTRA_MEDIA_TITLE) : null; if (focus != null) { if (focus.startsWith("audio/") && title != null) { mFilterString = title; } else if (Audio.Albums.ENTRY_CONTENT_TYPE.equals(focus)) { if (album != null) { mFilterString = album; if (artist != null) { mFilterString = mFilterString + " " + artist; } } } else if (Audio.Artists.ENTRY_CONTENT_TYPE.equals(focus)) { if (artist != null) { mFilterString = artist; } } } } mTrackList = getListView(); mTrackList.setTextFilterEnabled(true); }
From source file:com.ape.filemanager.FileExplorerTabActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar actionBar = getActionBar(); if (actionBar != null) actionBar.hide();/*from w w w. j a v a 2s . c o m*/ setContentView(R.layout.myos_activity_main); mMountPointManager = MountPointManager.getInstance(); mMountPointManager.init(this); initTabTitles(); mFragmentAdapter = new FileManagerFragmentAdapter(getFragmentManager(), this); restoreOrCreateFragment(savedInstanceState); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mFragmentAdapter); mViewPager.setOffscreenPageLimit(DEFAULT_OFFSCREEN_PAGES); mTagPagerIndicator = (TabPageIndicator) findViewById(R.id.indicator); mTagPagerIndicator.setViewPager(mViewPager); mTagPagerIndicator.setOnPageChangeListener(mPageChangeListener); int tabIndex; Intent intent = getIntent(); String action = intent.getAction(); if (getIntent().getData() != null) { tabIndex = Util.SDCARD_TAB_INDEX; } else if (!TextUtils.isEmpty(action)) { if (action.equals(Intent.ACTION_PICK) || action.equals(Intent.ACTION_GET_CONTENT) || action.equals("com.mediatek.filemanager.ADD_FILE")) { tabIndex = Util.CATEGORY_TAB_INDEX; } else if (action.equals(CloudFileUtil.CLOUD_STORAGE_ACTION)) { tabIndex = Util.REMOTE_TAB_INDEX; } else { tabIndex = Util.CATEGORY_TAB_INDEX; } } else { tabIndex = Util.CATEGORY_TAB_INDEX; //For market require. // tabIndex = PreferenceManager.getDefaultSharedPreferences(this) // .getInt(INSTANCESTATE_TAB, Util.CATEGORY_TAB_INDEX); mHandler.sendEmptyMessageDelayed(MSG_UPDATE_VERSION, 3000); } mTagPagerIndicator.setCurrentItem(tabIndex); upgradeManger = UpgradeManager.newInstance(this, getApplicationInfo().packageName, getString(R.string.app_name)); }
From source file:fr.bde_eseo.eseomega.profile.ViewProfileFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Find layout elements View rootView = inflater.inflate(R.layout.fragment_view_profile, container, false); tvUserName = (TextView) rootView.findViewById(R.id.tvUserName); tvDisconnect = (TextView) rootView.findViewById(R.id.tvDisconnect); imageView = (CircleImageView) rootView.findViewById(R.id.circleView); // Get current profile profile = new UserProfile(); profile.readProfilePromPrefs(getActivity()); //Log.d("PROFILE", profile.getId() + ", " + profile.getPushToken()); userName = profile.getName();// w w w . j ava 2s .c o m tvUserName.setText(userName); userFirst = profile.getFirstName(); setImageView(); // If user want to change its profile picture, call Intent to gallery imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { verifyStoragePermissions(getActivity()); Intent galleryIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(galleryIntent, INTENT_GALLERY_ID); } }); // If disconnects, reset profile and says bye-bye tvDisconnect.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { tvDisconnect.setBackgroundColor(0x2fffffff); final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { tvDisconnect.setBackgroundColor(0x00ffffff); } }, 500); MaterialDialog mdConfirm = new MaterialDialog.Builder(getActivity()).title("Dconnexion") .content("Hey, " + userFirst + ", en tes-vous vraiment sr ?\nVous ne pourrez plus accder nos services (et a, c'est dommage).") .positiveText("Oui, au revoir").negativeText("Non, je reste").cancelable(false) .callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { super.onPositive(dialog); AsyncDisconnect asyncDisconnect = new AsyncDisconnect(getActivity(), profile); asyncDisconnect.execute(profile); /* materialDialog = new MaterialDialog.Builder(getActivity()) .title("Au revoir, " + userFirst + ".") .content("Votre profil a t dconnect de nos services.") .negativeText("Fermer") .cancelable(false) .iconRes(R.drawable.ic_oppress) .limitIconToDefaultSize() .show();*/ } @Override public void onNegative(MaterialDialog dialog) { super.onNegative(dialog); Toast.makeText(getActivity(), "Vous avez fait le bon choix.", Toast.LENGTH_SHORT) .show(); } }).iconRes(R.drawable.ic_devil).limitIconToDefaultSize().show(); } }); return rootView; }
From source file:com.money.manager.ex.currency.list.CurrencyListFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MoneyManagerApplication.getApp().iocComponent.inject(this); mAction = getActivity().getIntent().getAction(); if (mAction.equals(Intent.ACTION_MAIN)) { mAction = Intent.ACTION_EDIT;/*ww w .j a va 2 s .c om*/ } // Filter currencies only if in the standalone Currencies list. Do not filter in pickers. mShowOnlyUsedCurrencies = !mAction.equals(Intent.ACTION_PICK); loaderCallbacks = initLoaderCallbacks(); }
From source file:net.henryco.opalette.api.utils.Utils.java
public static void loadGalleryImageActivity(ImageLoadable activity) { activity.getActivity().startActivityForResult( new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI), Utils.activity.REQUEST_PICK_IMAGE); }
From source file:net.reichholf.dreamdroid.activities.ServiceListActivity.java
@SuppressWarnings("unchecked") @Override//w w w . j a va 2s. c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String mode = getIntent().getAction(); if (mode.equals(Intent.ACTION_PICK)) { mPickMode = true; } else { mPickMode = false; } String ref = DreamDroid.SP.getString(DreamDroid.PREFS_KEY_DEFAULT_BOUQUET_REF, "default"); String name = DreamDroid.SP.getString(DreamDroid.PREFS_KEY_DEFAULT_BOUQUET_NAME, (String) getText(R.string.bouquet_overview)); mReference = getDataForKey(Event.SERVICE_REFERENCE, ref); mName = getDataForKey(Event.SERVICE_NAME, name); if (savedInstanceState != null) { mIsBouquetList = savedInstanceState.getBoolean("isBouquetList", true); mHistory = (ArrayList<ExtendedHashMap>) savedInstanceState.getSerializable("history"); } else { mIsBouquetList = DreamDroid.SP.getBoolean(DreamDroid.PREFS_KEY_DEFAULT_BOUQUET_IS_LIST, true); mHistory = new ArrayList<ExtendedHashMap>(); ExtendedHashMap map = new ExtendedHashMap(); map.put(Event.SERVICE_REFERENCE, mReference); map.put(Event.SERVICE_NAME, mName); mHistory.add(map); } setAdapter(); reload(); }
From source file:org.telegram.ui.Components.WallpaperUpdater.java
public void showAlert(final boolean fromTheme) { AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); CharSequence[] items;// www .j a va 2 s. c o m if (fromTheme) { items = new CharSequence[] { LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley), LocaleController.getString("SelectColor", R.string.SelectColor), LocaleController.getString("Default", R.string.Default), LocaleController.getString("Cancel", R.string.Cancel) }; } else { items = new CharSequence[] { LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley), LocaleController.getString("Cancel", R.string.Cancel) }; } builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { try { if (i == 0) { try { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File image = AndroidUtilities.generatePicturePath(); if (image != null) { if (Build.VERSION.SDK_INT >= 24) { takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, FileProvider.getUriForFile( parentActivity, BuildConfig.APPLICATION_ID + ".provider", image)); takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); takePictureIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); } else { takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(image)); } currentPicturePath = image.getAbsolutePath(); } parentActivity.startActivityForResult(takePictureIntent, 10); } catch (Exception e) { FileLog.e(e); } } else if (i == 1) { Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType("image/*"); parentActivity.startActivityForResult(photoPickerIntent, 11); } else if (fromTheme) { if (i == 2) { delegate.needOpenColorPicker(); } else if (i == 3) { delegate.didSelectWallpaper(null, null); } } } catch (Exception e) { FileLog.e(e); } } }); builder.show(); }