List of usage examples for android.app DownloadManager ACTION_VIEW_DOWNLOADS
String ACTION_VIEW_DOWNLOADS
To view the source code for android.app DownloadManager ACTION_VIEW_DOWNLOADS.
Click Source Link
From source file:me.kartikarora.transfersh.receivers.DownloadCompleteBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Intent i = new Intent(); i.setAction(DownloadManager.ACTION_VIEW_DOWNLOADS); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, i, 0); Notification notification = new NotificationCompat.Builder(context) .setContentTitle(context.getString(R.string.app_name)) .setContentText(context.getString(R.string.download_complete)) .setSmallIcon(R.drawable.ic_offline_pin).setContentIntent(pendingIntent).setAutoCancel(true) .setTicker(context.getString(R.string.download_complete)).build(); NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(NOTIFICATION_ID, notification); }
From source file:com.exercise.AndroidClient.AndroidClient.java
public void showDownload(View view) { Intent i = new Intent(); i.setAction(DownloadManager.ACTION_VIEW_DOWNLOADS); startActivity(i); }
From source file:com.tenmiles.helpstack.service.AttachmentDownloadReceiver.java
private void notificationClicked(Context context, Intent intent) { Intent i = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i);/* w w w . j av a 2 s. c om*/ }
From source file:com.tenmiles.helpstack.service.AttachmentDownloadReceiver.java
public PendingIntent getPendingIntent(Context context) { Intent i = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent pendinIntent = PendingIntent.getActivity(context, PENDING_INTENT_REQUEST_CODE, i, PendingIntent.FLAG_UPDATE_CURRENT); return pendinIntent; }
From source file:de.elanev.studip.android.app.frontend.courses.CourseDocumentsFragment.java
private void queryStatus(int queryStatus, int queryReason) { switch (queryStatus) { case DownloadManager.STATUS_FAILED: showToastMessage(getDownloadFailedReason(queryReason)); break;// w ww. j a va 2 s .c o m case DownloadManager.STATUS_SUCCESSFUL: showToastMessage(R.string.download_completed); try { // Show the download activity startActivity(new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS)); } catch (ActivityNotFoundException e) { // No download manager installed or active, let the user handle the downloads. } break; default: showToastMessage(R.string.unknown_error); break; } }
From source file:com.becapps.easydownloader.ShareActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case R.id.menu_settings: startActivity(new Intent(this, SettingsActivity.class)); return true; case R.id.menu_dm: Intent viewIntent = new Intent(android.app.DownloadManager.ACTION_VIEW_DOWNLOADS); if (viewIntent.resolveActivity(getPackageManager()) != null) { startActivity(viewIntent);/*w w w. j a v a 2 s .c o m*/ } else { Toast.makeText(this, getString(R.string.no_downloads_sys_app), Toast.LENGTH_LONG).show(); } return true; case R.id.menu_tutorials: startActivity(new Intent(this, TutorialsActivity.class)); return true; default: return super.onOptionsItemSelected(item); } }
From source file:dentex.youtube.downloader.ShareActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case R.id.menu_donate: startActivity(new Intent(this, DonateActivity.class)); return true; case R.id.menu_settings: startActivity(new Intent(this, SettingsActivity.class)); return true; case R.id.menu_about: startActivity(new Intent(this, AboutActivity.class)); return true; case R.id.menu_dm: Intent viewIntent = new Intent(android.app.DownloadManager.ACTION_VIEW_DOWNLOADS); if (viewIntent.resolveActivity(getPackageManager()) != null) { startActivity(viewIntent);// ww w . ja v a 2 s . c o m } else { Toast.makeText(this, getString(R.string.no_downloads_sys_app), Toast.LENGTH_LONG).show(); } return true; case R.id.menu_tutorials: startActivity(new Intent(this, TutorialsActivity.class)); return true; default: return super.onOptionsItemSelected(item); } }
From source file:org.crossconnect.bible.activity.main.ResourceFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); resourceService = ((MainActivity) getActivity()).getResourceService(); // Prepare the loader. Either re-connect with an existing one, // or start a new one. Bundle bundle = new Bundle(); bundle.putParcelable("BibleText", Utils.loadBibleText(getActivity().getSharedPreferences("APP SETTINGS", Context.MODE_PRIVATE))); getLoaderManager().initLoader(0, bundle, this); // Create an empty adapter we will use to display the loaded data. mAdapter = new ResourceListAdapter(getActivity()); setListAdapter(mAdapter);/* ww w. j a va2 s. c o m*/ dm = ((DownloadManager) getActivity().getSystemService("download")); BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0); Query query = new Query(); query.setFilterById(enqueue); Cursor c = dm.query(query); if (c.moveToFirst()) { int columnIndex = c.getColumnIndex(DownloadManager.COLUMN_STATUS); if (DownloadManager.STATUS_SUCCESSFUL == c.getInt(columnIndex)) { String uriString = c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI)); } } String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager) getActivity() .getSystemService(ns); int icon = R.drawable.icon_book_rss; CharSequence tickerText = "Resource Download Complete"; long when = System.currentTimeMillis(); Notification notification = new Notification(icon, tickerText, when); CharSequence contentTitle = "Download Complete"; CharSequence contentText = "Click to view downloaded resources"; Intent notificationIntent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //uncomment when better // Intent notificationIntent = new Intent(getActivity(), MusicActivity.class); PendingIntent contentIntent = PendingIntent.getActivity(getActivity(), 0, notificationIntent, 0); notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); notification.flags |= Notification.FLAG_AUTO_CANCEL; int HELLO_ID = 1; mNotificationManager.notify(HELLO_ID, notification); } } }; getActivity().registerReceiver(receiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); }
From source file:org.mozilla.gecko.GeckoApp.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Tab tab = null;/* w w w . java 2 s.c o m*/ Intent intent = null; switch (item.getItemId()) { case R.id.quit: synchronized (sLaunchState) { if (sLaunchState == LaunchState.GeckoRunning) GeckoAppShell.notifyGeckoOfEvent(GeckoEvent.createBroadcastEvent("Browser:Quit", null)); else System.exit(0); sLaunchState = LaunchState.GeckoExiting; } return true; case R.id.bookmark: tab = Tabs.getInstance().getSelectedTab(); if (tab != null) { if (item.isChecked()) { tab.removeBookmark(); Toast.makeText(this, R.string.bookmark_removed, Toast.LENGTH_SHORT).show(); item.setIcon(R.drawable.ic_menu_bookmark_add); } else { tab.addBookmark(); Toast.makeText(this, R.string.bookmark_added, Toast.LENGTH_SHORT).show(); item.setIcon(R.drawable.ic_menu_bookmark_remove); } } return true; case R.id.share: tab = Tabs.getInstance().getSelectedTab(); if (tab != null) { GeckoAppShell.openUriExternal(tab.getURL(), "text/plain", "", "", Intent.ACTION_SEND, tab.getTitle()); } return true; case R.id.reload: doReload(); return true; case R.id.forward: doForward(); return true; case R.id.save_as_pdf: GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SaveAs:PDF", null)); return true; case R.id.settings: intent = new Intent(this, GeckoPreferences.class); startActivity(intent); return true; case R.id.site_settings: GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Permissions:Get", null)); return true; case R.id.addons: loadUrlInTab("about:addons"); return true; case R.id.downloads: intent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS); startActivity(intent); return true; case R.id.char_encoding: GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("CharEncoding:Get", null)); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.stoutner.privacybrowser.MainWebViewActivity.java
@Override // removeAllCookies is deprecated, but it is required for API < 21. @SuppressWarnings("deprecation") public boolean onNavigationItemSelected(MenuItem menuItem) { int menuItemId = menuItem.getItemId(); switch (menuItemId) { case R.id.home: mainWebView.loadUrl(homepage);//from w w w .ja v a 2 s.c o m break; case R.id.back: if (mainWebView.canGoBack()) { mainWebView.goBack(); } break; case R.id.forward: if (mainWebView.canGoForward()) { mainWebView.goForward(); } break; case R.id.downloads: // Launch the system Download Manager. Intent downloadManagerIntent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS); // Launch as a new task so that Download Manager and Privacy Browser show as separate windows in the recent tasks list. downloadManagerIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(downloadManagerIntent); break; case R.id.settings: // Launch SettingsActivity. Intent settingsIntent = new Intent(this, SettingsActivity.class); startActivity(settingsIntent); break; case R.id.about: // Launch AboutActivity. Intent aboutIntent = new Intent(this, AboutActivity.class); startActivity(aboutIntent); break; case R.id.clearAndExit: // Clear DOM storage. WebStorage domStorage = WebStorage.getInstance(); domStorage.deleteAllData(); // Clear cookies. The commands changed slightly in API 21. if (Build.VERSION.SDK_INT >= 21) { cookieManager.removeAllCookies(null); } else { cookieManager.removeAllCookie(); } // Clear cache. The argument of "true" includes disk files. mainWebView.clearCache(true); // Clear the back/forward history. mainWebView.clearHistory(); // Destroy the internal state of the webview. mainWebView.destroy(); // Close Privacy Browser. finishAndRemoveTask also removes Privacy Browser from the recent app list. if (Build.VERSION.SDK_INT >= 21) { finishAndRemoveTask(); } else { finish(); } break; default: break; } // Close the navigation drawer. drawerLayout.closeDrawer(GravityCompat.START); return true; }