List of usage examples for android.content Intent EXTRA_SUBJECT
String EXTRA_SUBJECT
To view the source code for android.content Intent EXTRA_SUBJECT.
Click Source Link
From source file:com.yi4all.rupics.ImageDetailActivity.java
private Intent createShareIntent() { String path = Utils.convertUrl2Path(this, imgList.get(imageSequence).getUrl()); if (path != null && new File(path).exists()) { Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.sendShareMmsSubject)); sendIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.sendShareMmsBody)); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(path)); sendIntent.setType("image/*"); return sendIntent; }/*w w w . ja v a2 s .c om*/ return null; }
From source file:com.streaming.sweetplayer.PlayerActivity.java
private Intent getDefaultIntent() { String urlToShare = Config.DOMAIN + sSongUrl; String sharingText = mActivity.getString(R.string.sharing_text) + " " + urlToShare + " " + mActivity.getString(R.string.sharing_android_app) + " " + Config.GOOGLE_PLAY_LINK; Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, sSongName); sharingIntent.putExtra(Intent.EXTRA_TEXT, sharingText); return sharingIntent; }
From source file:net.eledge.android.europeana.gui.activity.SearchActivity.java
private Intent createShareIntent() { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, searchController.getPortalUrl()); shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Check out this search on Europeana.eu!"); return shareIntent; }
From source file:com.readystatesoftware.ghostlog.ServerlessLogScreen.java
@Override public void onLogShare() { StringBuffer sb = new StringBuffer(); for (LogLine line : mLogBufferFiltered) { sb.append(line.getRaw());//w ww .j a va 2s . c o m sb.append("\n"); } Time now = new Time(); now.setToNow(); String ts = now.format3339(false); Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, sb.toString()); shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_subject) + " " + ts); shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(shareIntent); }
From source file:com.android.deskclock.stopwatch.StopwatchFragment.java
/** * Send stopwatch time and lap times to an external sharing application. *//* w ww. jav a2 s. com*/ private void doShare() { final String[] subjects = getResources().getStringArray(R.array.sw_share_strings); final String subject = subjects[(int) (Math.random() * subjects.length)]; final String text = mLapsAdapter.getShareText(); @SuppressLint("InlinedApi") @SuppressWarnings("deprecation") final Intent shareIntent = new Intent(Intent.ACTION_SEND) .addFlags(Utils.isLOrLater() ? Intent.FLAG_ACTIVITY_NEW_DOCUMENT : Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) .putExtra(Intent.EXTRA_SUBJECT, subject).putExtra(Intent.EXTRA_TEXT, text).setType("text/plain"); final Context context = getActivity(); final String title = context.getString(R.string.sw_share_button); final Intent shareChooserIntent = Intent.createChooser(shareIntent, title); try { context.startActivity(shareChooserIntent); } catch (ActivityNotFoundException anfe) { LogUtils.e("No compatible receiver is found"); } }
From source file:com.nexes.manager.EventHandler.java
/** * This method, handles the button presses of the top buttons found in the * Main activity.//www . j a v a 2 s . c o m */ @Override public void onClick(View v) { switch (v.getId()) { case R.id.back_button: if (mFileMang.getCurrentDir() != "/") { if (multi_select_flag) { mDelegate.killMultiSelect(true); Toast.makeText(mContext, "Multi-select is now off", Toast.LENGTH_SHORT).show(); } stopThumbnailThread(); updateDirectory(mFileMang.getPreviousDir()); if (mPathLabel != null) mPathLabel.setText(mFileMang.getCurrentDir()); } break; case R.id.home_button: if (multi_select_flag) { mDelegate.killMultiSelect(true); Toast.makeText(mContext, "Multi-select is now off", Toast.LENGTH_SHORT).show(); } stopThumbnailThread(); updateDirectory(mFileMang.setHomeDir("/sdcard")); if (mPathLabel != null) mPathLabel.setText(mFileMang.getCurrentDir()); break; case R.id.info_button: Intent info = new Intent(mContext, DirectoryInfo.class); info.putExtra("PATH_NAME", mFileMang.getCurrentDir()); mContext.startActivity(info); break; case R.id.help_button: Intent help = new Intent(mContext, HelpManager.class); mContext.startActivity(help); break; case R.id.manage_button: display_dialog(MANAGE_DIALOG); break; case R.id.multiselect_button: if (multi_select_flag) { mDelegate.killMultiSelect(true); } else { LinearLayout hidden_lay = (LinearLayout) ((Activity) mContext).findViewById(R.id.hidden_buttons); multi_select_flag = true; hidden_lay.setVisibility(LinearLayout.VISIBLE); } break; /* * three hidden buttons for multiselect */ case R.id.hidden_attach: /* check if user selected objects before going further */ if (mMultiSelectData == null || mMultiSelectData.isEmpty()) { mDelegate.killMultiSelect(true); break; } ArrayList<Uri> uris = new ArrayList<Uri>(); int length = mMultiSelectData.size(); Intent mail_int = new Intent(); mail_int.setAction(android.content.Intent.ACTION_SEND_MULTIPLE); mail_int.setType("application/mail"); mail_int.putExtra(Intent.EXTRA_BCC, ""); mail_int.putExtra(Intent.EXTRA_SUBJECT, " "); for (int i = 0; i < length; i++) { File file = new File(mMultiSelectData.get(i)); uris.add(Uri.fromFile(file)); } mail_int.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); mContext.startActivity(Intent.createChooser(mail_int, "Email using...")); mDelegate.killMultiSelect(true); break; case R.id.hidden_move: case R.id.hidden_copy: /* check if user selected objects before going further */ if (mMultiSelectData == null || mMultiSelectData.isEmpty()) { mDelegate.killMultiSelect(true); break; } if (v.getId() == R.id.hidden_move) delete_after_copy = true; mInfoLabel.setText("Holding " + mMultiSelectData.size() + " file(s)"); mDelegate.killMultiSelect(false); break; case R.id.hidden_delete: /* check if user selected objects before going further */ if (mMultiSelectData == null || mMultiSelectData.isEmpty()) { mDelegate.killMultiSelect(true); break; } final String[] data = new String[mMultiSelectData.size()]; int at = 0; for (String string : mMultiSelectData) data[at++] = string; AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setMessage( "Are you sure you want to delete " + data.length + " files? This cannot be " + "undone."); builder.setCancelable(false); builder.setPositiveButton("Delete", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { new BackgroundWork(DELETE_TYPE).execute(data); mDelegate.killMultiSelect(true); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mDelegate.killMultiSelect(true); dialog.cancel(); } }); builder.create().show(); break; } }
From source file:com.kasungunathilaka.sarigama.ui.HomeActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();/*from w w w . j a v a 2 s . c o m*/ break; case R.id.action_search: setFragment(new SearchFragment()); break; case R.id.action_about_developer: AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(HomeActivity.this); View dialogView = getLayoutInflater().inflate(R.layout.dialog_view_about_developer, null); alertDialogBuilder.setView(dialogView); ImageView ivClose = (ImageView) dialogView.findViewById(R.id.ivClose); TextView tvEmail = (TextView) dialogView.findViewById(R.id.tvEmail); final AlertDialog alertDialog = alertDialogBuilder.create(); tvEmail.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "developer.kasun.gunathilaka@gmail.com" }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Sarigama"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, ""); startActivity(emailIntent); alertDialog.dismiss(); } return false; } }); ivClose.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { alertDialog.dismiss(); } return false; } }); alertDialog.show(); break; case R.id.action_exit: finish(); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.cancel(9999); System.exit(0); break; } return super.onOptionsItemSelected(item); }
From source file:com.app.uafeed.fragment.EntryFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (mEntriesIds != null) { Activity activity = getActivity(); switch (item.getItemId()) { case R.id.menu_star: { mFavorite = !mFavorite;/*w ww. j av a 2 s. c om*/ if (mFavorite) { item.setTitle(R.string.menu_unstar).setIcon(R.drawable.rating_important); } else { item.setTitle(R.string.menu_star).setIcon(R.drawable.rating_not_important); } final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]); new Thread() { @Override public void run() { ContentValues values = new ContentValues(); values.put(EntryColumns.IS_FAVORITE, mFavorite ? 1 : 0); ContentResolver cr = MainApplication.getContext().getContentResolver(); cr.update(uri, values, null, null); // Update the cursor Cursor updatedCursor = cr.query(uri, null, null, null, null); updatedCursor.moveToFirst(); mEntryPagerAdapter.setUpdatedCursor(mCurrentPagerPos, updatedCursor); } }.start(); break; } case R.id.menu_share: { Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos); String link = cursor.getString(mLinkPos); if (link != null) { String title = cursor.getString(mTitlePos); startActivity(Intent.createChooser( new Intent(Intent.ACTION_SEND).putExtra(Intent.EXTRA_SUBJECT, title) .putExtra(Intent.EXTRA_TEXT, link).setType(Constants.MIMETYPE_TEXT_PLAIN), getString(R.string.menu_share))); } break; } case R.id.menu_full_screen: { toggleFullScreen(); break; } case R.id.menu_copy_clipboard: { Cursor cursor = mEntryPagerAdapter.getCursor(mCurrentPagerPos); String link = cursor.getString(mLinkPos); ClipboardManager clipboard = (ClipboardManager) activity .getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("Copied Text", link); clipboard.setPrimaryClip(clip); Toast.makeText(activity, R.string.copied_clipboard, Toast.LENGTH_SHORT).show(); break; } case R.id.menu_mark_as_unread: { final Uri uri = ContentUris.withAppendedId(mBaseUri, mEntriesIds[mCurrentPagerPos]); new Thread() { @Override public void run() { ContentResolver cr = MainApplication.getContext().getContentResolver(); cr.update(uri, FeedData.getUnreadContentValues(), null, null); } }.start(); activity.finish(); break; } } } return true; }
From source file:com.kncwallet.wallet.ui.ReceiveFragment.java
private void handleEmail() { Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); //i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"}); i.putExtra(Intent.EXTRA_SUBJECT, "My bitcoin address"); i.putExtra(Intent.EXTRA_TEXT, "My bitcoin address is: " + lastSelectedAddress.toString() + "\n\n\nDoes someone want to give me some copy for this???"); try {// ww w . jav a2 s .c o m startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { activity.toast("There are no email clients installed."); } }
From source file:com.alexcruz.papuhwalls.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { this.Preferences = new Preferences(getApplicationContext()); super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); context = this; CustomActivityOnCrash.install(this); prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); if (prefs.getBoolean(Preferences.IS_FIRST__RUN, true)) { startActivity(new Intent(this, Slides.class)); finish();//from ww w . j a v a2s . c o m } if (Build.VERSION.SDK_INT >= 23 && PermissionChecker.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PermissionChecker.PERMISSION_GRANTED) { requestPermissions(new String[] { Manifest.permission.READ_EXTERNAL_STORAGE }, REQUEST_READ_STORAGE_PERMISSION); } else { // Do absolutely NOTHING } final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); com.alexcruz.papuhwalls.Preferences.themeMe(this, toolbar); Home = getResources().getString(R.string.app_name); final String Home = getResources().getString(R.string.section_home); AllWalls = getResources().getString(R.string.section_all_walls); AndroidWalls = getResources().getString(R.string.section_android_walls); BwWalls = getResources().getString(R.string.section_bw_walls); BlurWalls = getResources().getString(R.string.section_blur_walls); CloudsWalls = getResources().getString(R.string.section_clouds_walls); MiscWalls = getResources().getString(R.string.section_misc_walls); MustachesWalls = getResources().getString(R.string.section_mustaches_walls); NexusWalls = getResources().getString(R.string.section_nexus_walls); OriginalWalls = getResources().getString(R.string.section_original_walls); PapuhWalls = getResources().getString(R.string.section_papuh_walls); SolidsWalls = getResources().getString(R.string.section_solids_walls); StarsWalls = getResources().getString(R.string.section_stars_walls); RomCategory = getResources().getString(R.string.section_rom_category); AicpWalls = getResources().getString(R.string.section_aicp_walls); BrokenOsWalls = getResources().getString(R.string.section_brokenos_walls); CandyWalls = getResources().getString(R.string.section_candy_walls); DuWalls = getResources().getString(R.string.section_du_walls); EosWalls = getResources().getString(R.string.section_eos_walls); LiquidsmoothWalls = getResources().getString(R.string.section_liquidsmooth_walls); OmniWalls = getResources().getString(R.string.section_omni_walls); OrionWalls = getResources().getString(R.string.section_orion_walls); PaWalls = getResources().getString(R.string.section_pa_walls); PacromWalls = getResources().getString(R.string.section_pacrom_walls); RrWalls = getResources().getString(R.string.section_rr_walls); SlimWalls = getResources().getString(R.string.section_slim_walls); TeslaWalls = getResources().getString(R.string.section_tesla_walls); TwistedAOSPWalls = getResources().getString(R.string.section_twistedaosp_walls); ValidusWalls = getResources().getString(R.string.section_validus_walls); Settings = getResources().getString(R.string.settings); LiveWallpaper = getResources().getString(R.string.live_wallpaper_description); MuzeiSettings = getResources().getString(R.string.muzei_settings); AboutApp = getResources().getString(R.string.section_aboutapp); currentItem = 1; final IProfile profile = new ProfileDrawerItem().withName("Alex Cruz aka Mazda") .withIcon(getResources().getDrawable(R.drawable.alexcruz)).withIdentifier(1); int header = Calendar.getInstance().get(Calendar.HOUR_OF_DAY); if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getString(R.string.time_context_headers), false)) { if (header < TIME_SUNRISE || header >= TIME_NIGHT) { if (PreferenceManager.getDefaultSharedPreferences(this) .getBoolean(getString(R.string.poly_time_context_headers), false)) { header = R.drawable.poly_night; } else { header = R.drawable.night; } } else if (header >= TIME_SUNRISE && header < TIME_MORNING) { if (PreferenceManager.getDefaultSharedPreferences(this) .getBoolean(getString(R.string.poly_time_context_headers), false)) { header = R.drawable.poly_sunrise; } else { header = R.drawable.sunrise; } } else if (header >= TIME_MORNING && header < TIME_NOON) { if (PreferenceManager.getDefaultSharedPreferences(this) .getBoolean(getString(R.string.poly_time_context_headers), false)) { header = R.drawable.poly_morning; } else { header = R.drawable.morning; } } else if (header >= TIME_NOON && header < TIME_AFTERNOON) { if (PreferenceManager.getDefaultSharedPreferences(this) .getBoolean(getString(R.string.poly_time_context_headers), false)) { header = R.drawable.poly_noon; } else { header = R.drawable.noon; } } else if (header >= TIME_AFTERNOON && header < TIME_SUNSET) { if (PreferenceManager.getDefaultSharedPreferences(this) .getBoolean(getString(R.string.poly_time_context_headers), false)) { header = R.drawable.poly_afternoon; } else { header = R.drawable.afternoon; } } else if (header >= TIME_SUNSET && header < TIME_NIGHT) { if (PreferenceManager.getDefaultSharedPreferences(this) .getBoolean(getString(R.string.poly_time_context_headers), false)) { header = R.drawable.poly_sunset; } else { header = R.drawable.sunset; } } } else { header = R.drawable.header; } String versionName; try { versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName; } catch (Exception e) { throw new RuntimeException(e); } headerResult = new AccountHeaderBuilder().withActivity(this).withHeaderBackground(header) .withSelectionFirstLine(getResources().getString(R.string.app_long_name)) .withSelectionSecondLine("v" + versionName).withSelectionListEnabledForSingleProfile(false) .addProfiles(profile).withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() { @Override public boolean onProfileChanged(View view, IProfile profile, boolean current) { if (profile instanceof IDrawerItem && ((IDrawerItem) profile).getIdentifier() == PROFILE_SETTING) { int count = 100 + headerResult.getProfiles().size() + 1; if (headerResult.getProfiles() != null) { Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { getResources().getString(R.string.email_address) }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getResources().getText(R.string.artsource_name)); emailIntent.setType("plain/text"); startActivity(Intent.createChooser(emailIntent, "Contact Alex")); } else { headerResult.addProfiles(profile); } } return false; } }).withSavedInstance(savedInstanceState).build(); result = new DrawerBuilder().withActivity(this).withToolbar(toolbar).withAccountHeader(headerResult) .withHeader(R.layout.header).withSavedInstance(savedInstanceState).withScrollToTopAfterClick(true) .withFooterDivider(true).withSliderBackgroundColor(Preferences.Drawer()) .withStatusBarColor( Preferences.StatusBarTint() ? tint(Preferences.Theme(), 0.8) : Preferences.Theme()) .addDrawerItems( new PrimaryDrawerItem().withName(Home).withIcon(R.drawable.ic_home) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(1), new PrimaryDrawerItem().withName(AllWalls).withIcon(R.drawable.ic_allwalls) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(2).withBadge("1630+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(AndroidWalls).withIcon(R.drawable.ic_android) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(3).withBadge("17+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(BwWalls).withIcon(R.drawable.ic_bw) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(4).withBadge("56+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(BlurWalls).withIcon(R.drawable.ic_blur) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(5).withBadge("10+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(CloudsWalls).withIcon(R.drawable.ic_clouds) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(6).withBadge("60+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(MiscWalls).withIcon(R.drawable.ic_misc) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(7).withBadge("41+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(MustachesWalls).withIcon(R.drawable.ic_mustaches) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(8).withBadge("10+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(NexusWalls).withIcon(R.drawable.ic_nexus) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(9).withBadge("98+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(OriginalWalls).withIcon(R.drawable.ic_original) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(10).withBadge("343+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(PapuhWalls).withIcon(R.drawable.ic_papuh) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(11).withBadge("24+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(SolidsWalls).withIcon(R.drawable.ic_solids) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(12).withBadge("72+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(StarsWalls).withIcon(R.drawable.ic_stars) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(13).withBadge("11+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new SectionDrawerItem().withName(RomCategory).withTypeface(Typeface.DEFAULT_BOLD) .withTextColor(Preferences.DrawerText()), new PrimaryDrawerItem().withName(AicpWalls).withIcon(R.drawable.ic_aicp) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(15).withBadge("84+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(BrokenOsWalls).withIcon(R.drawable.ic_brokenos) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(16).withBadge("53+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(CandyWalls).withIcon(R.drawable.ic_candy) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(17).withBadge("80+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(DuWalls).withIcon(R.drawable.ic_dirtyunicorns) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(18).withBadge("139+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(EosWalls).withIcon(R.drawable.ic_eos) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(19).withBadge("48+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(LiquidsmoothWalls).withIcon(R.drawable.ic_liquidsmooth) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(20).withBadge("65+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(OmniWalls).withIcon(R.drawable.ic_omni) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(21).withBadge("29+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(OrionWalls).withIcon(R.drawable.ic_orion) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(22).withBadge("10+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(PaWalls).withIcon(R.drawable.ic_pa) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(23).withBadge("10+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(PacromWalls).withIcon(R.drawable.ic_pacrom) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(24).withBadge("21+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(RrWalls).withIcon(R.drawable.ic_rr) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(25).withBadge("54+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(SlimWalls).withIcon(R.drawable.ic_slim) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(26).withBadge("8+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(TeslaWalls).withIcon(R.drawable.ic_tesla) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(27).withBadge("43+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(TwistedAOSPWalls).withIcon(R.drawable.ic_twistedaosp) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(28).withBadge("43+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new PrimaryDrawerItem().withName(ValidusWalls).withIcon(R.drawable.ic_validus) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(29).withBadge("258+") .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText()) .withColor(Preferences.BadgeBackground())), new DividerDrawerItem(), new SecondaryDrawerItem().withName(Settings).withIcon(R.drawable.ic_settings) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(30), new SecondaryDrawerItem().withName(LiveWallpaper) .withIcon(R.drawable.ic_device_now_wallpaper).withIconTintingEnabled(true) .withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(33), new SecondaryDrawerItem().withName(MuzeiSettings).withIcon(R.drawable.ic_muzei) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(31), new SecondaryDrawerItem().withName(AboutApp).withIcon(R.drawable.ic_about) .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon()) .withIconColor(Preferences.NormalIcon()) .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0)) .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0)) .withTextColor(Preferences.DrawerText()).withIdentifier(32)) .withOnDrawerListener(new Drawer.OnDrawerListener() { @Override public void onDrawerOpened(View drawerView) { } @Override public void onDrawerClosed(View drawerView) { } @Override public void onDrawerSlide(View drawerView, float slideOffset) { } }).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { boolean isMuzeiInstalled = Preferences.isAppInstalled(context, "net.nurik.roman.muzei"); boolean isConnected = isConnected(MainActivity.this); if (drawerItem != null) { switch (drawerItem.getIdentifier()) { case 1: switchFragment(1, Home, "BaseActivity"); break; case 2: if (isConnected) { switchWalls(2, AllWalls, "AllWalls"); } else { showNotConnectedDialog(); } break; case 3: if (isConnected) { switchWalls(3, AndroidWalls, "AndroidWalls"); } else { showNotConnectedDialog(); } break; case 4: if (isConnected) { switchWalls(4, BwWalls, "BwWalls"); } else { showNotConnectedDialog(); } break; case 5: if (isConnected) { switchWalls(5, BlurWalls, "BlurWalls"); } else { showNotConnectedDialog(); } break; case 6: if (isConnected) { switchWalls(6, BwWalls, "CloudsWalls"); } else { showNotConnectedDialog(); } break; case 7: if (isConnected) { switchWalls(7, MiscWalls, "MiscWalls"); } else { showNotConnectedDialog(); } break; case 8: if (isConnected) { switchWalls(8, MustachesWalls, "MustachesWalls"); } else { showNotConnectedDialog(); } break; case 9: if (isConnected) { switchWalls(9, NexusWalls, "NexusWalls"); } else { showNotConnectedDialog(); } break; case 10: if (isConnected) { switchWalls(10, OriginalWalls, "OriginalWalls"); } else { showNotConnectedDialog(); } break; case 11: if (isConnected) { switchWalls(11, PapuhWalls, "PapuhWalls"); } else { showNotConnectedDialog(); } break; case 12: if (isConnected) { switchWalls(12, SolidsWalls, "SolidsWalls"); } else { showNotConnectedDialog(); } break; case 13: if (isConnected) { switchWalls(13, StarsWalls, "StarsWalls"); } else { showNotConnectedDialog(); } break; case 14: setTitle(R.string.section_rom_category); ; break; case 15: if (isConnected) { switchWalls(15, AicpWalls, "AicpWalls"); } else { showNotConnectedDialog(); } break; case 16: if (isConnected) { switchWalls(16, BrokenOsWalls, "BrokenOsWalls"); } else { showNotConnectedDialog(); } break; case 17: if (isConnected) { switchWalls(17, CandyWalls, "CandyWalls"); } else { showNotConnectedDialog(); } break; case 18: if (isConnected) { switchWalls(18, DuWalls, "DuWalls"); } else { showNotConnectedDialog(); } break; case 19: if (isConnected) { switchWalls(19, EosWalls, "EosWalls"); } else { showNotConnectedDialog(); } break; case 20: if (isConnected) { switchWalls(20, LiquidsmoothWalls, "LiquidsmoothWalls"); } else { showNotConnectedDialog(); } break; case 21: if (isConnected) { switchWalls(21, OmniWalls, "OmniWalls"); } else { showNotConnectedDialog(); } break; case 22: if (isConnected) { switchWalls(22, OrionWalls, "OrionWalls"); } else { showNotConnectedDialog(); } break; case 23: if (isConnected) { switchWalls(23, PaWalls, "PaWalls"); } else { showNotConnectedDialog(); } break; case 24: if (isConnected) { switchWalls(24, PacromWalls, "PacromWalls"); } else { showNotConnectedDialog(); } break; case 25: if (isConnected) { switchWalls(25, RrWalls, "RrWalls"); } else { showNotConnectedDialog(); } break; case 26: if (isConnected) { switchWalls(26, SlimWalls, "SlimWalls"); } else { showNotConnectedDialog(); } break; case 27: if (isConnected) { switchWalls(27, TeslaWalls, "TeslaWalls"); } else { showNotConnectedDialog(); } break; case 28: if (isConnected) { switchWalls(28, TwistedAOSPWalls, "TwistedAOSPWalls"); } else { showNotConnectedDialog(); } break; case 29: if (isConnected) { switchWalls(29, ValidusWalls, "ValidusWalls"); } else { showNotConnectedDialog(); } break; case 30: Intent SettingsIntent = new Intent(MainActivity.this, SettingsActivity.class); startActivityForResult(SettingsIntent, 0); break; case 31: if (isMuzeiInstalled) { Intent launchMuzeiIntent = new Intent(MainActivity.this, Settings.class); startActivityForResult(launchMuzeiIntent, 0); } else { // Do absolutely NOTHING } break; case 32: switchFragment(32, AboutApp, "Credits"); break; case 33: Intent LWIntent = new Intent(MainActivity.this, com.alexcruz.papuhwalls.Live.Settings.class); startActivityForResult(LWIntent, 0); break; } } return false; } }).withOnDrawerItemLongClickListener(new Drawer.OnDrawerItemLongClickListener() { @Override public boolean onItemLongClick(View view, int position, IDrawerItem drawerItem) { if (drawerItem instanceof SecondaryDrawerItem) { } return false; } }).build(); result.setSelection(1, true); boolean isMuzeiInstalled = Preferences.isAppInstalled(context, "net.nurik.roman.muzei"); if (!isMuzeiInstalled) { result.removeItem(31); } else { // Do absolutely NOTHING } if (Preferences.getLiveWalls().size() == 0 & isConnected(this)) new SetupLW(this).execute(); }