List of usage examples for android.content Intent ACTION_SEND
String ACTION_SEND
To view the source code for android.content Intent ACTION_SEND.
Click Source Link
From source file:com.krayzk9s.imgurholo.tools.ImageUtils.java
public static void shareImage(Fragment fragment, JSONParcelable imageData) { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); try {//from w ww . jav a 2 s. c o m intent.putExtra(Intent.EXTRA_TEXT, imageData.getJSONObject().getString(ImgurHoloActivity.IMAGE_DATA_LINK)); } catch (JSONException e) { Log.e("Error!", "bad link to share"); } fragment.startActivity(intent); }
From source file:com.fvd.nimbus.PaintActivity.java
/** Called when the activity is first created. */ @Override//w ww. j av a 2 s . c om public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up ); overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); try { requestWindowFeature(Window.FEATURE_NO_TITLE); } catch (Exception e) { e.printStackTrace(); } ctx = this; prefs = PreferenceManager.getDefaultSharedPreferences(this); dWidth = prefs.getInt("dWidth", 2); fWidth = prefs.getInt("fWidth", 1); dColor = prefs.getInt(pColor, Color.RED); saveFormat = Integer.parseInt(prefs.getString("saveFormat", "1")); serverHelper.getInstance().setCallback(this, this); serverHelper.getInstance().setMode(saveFormat); setContentView(R.layout.screen_edit); drawer = (DrawerLayout) findViewById(R.id.root); findViewById(R.id.bDraw1).setOnClickListener(this); findViewById(R.id.bDraw2).setOnClickListener(this); findViewById(R.id.bDraw3).setOnClickListener(this); findViewById(R.id.bDraw4).setOnClickListener(this); findViewById(R.id.bDraw5).setOnClickListener(this); findViewById(R.id.bDraw6).setOnClickListener(this); findViewById(R.id.bDraw8).setOnClickListener(this); findViewById(R.id.bColor1).setOnClickListener(this); findViewById(R.id.bColor2).setOnClickListener(this); findViewById(R.id.bColor3).setOnClickListener(this); findViewById(R.id.bColor4).setOnClickListener(this); findViewById(R.id.bColor5).setOnClickListener(this); paletteButton = (CircleButton) findViewById(R.id.bToolColor); paletteButton.setOnClickListener(this); paletteButton_land = (CircleButton) findViewById(R.id.bToolColor_land); //paletteButton_land.setOnClickListener(this); ((SeekBar) findViewById(R.id.seekBarLine)).setProgress(dWidth * 10); ((SeekBar) findViewById(R.id.seekBarType)).setProgress(fWidth * 10); ((TextView) findViewById(R.id.tvTextType)).setText(String.format("%d", 40 + fWidth * 20)); findViewById(R.id.bUndo).setOnClickListener(this); findViewById(R.id.btnBack).setOnClickListener(this); findViewById(R.id.bClearAll).setOnClickListener(this); findViewById(R.id.bTurnLeft).setOnClickListener(this); findViewById(R.id.bTurnRight).setOnClickListener(this); findViewById(R.id.bDone).setOnClickListener(this); findViewById(R.id.bApplyText).setOnClickListener(this); ((ImageButton) findViewById(R.id.bStroke)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { v.setSelected(!v.isSelected()); } }); lineWidthListener = new OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub if (true || fromUser) { /*dWidth = (progress/10); drawView.setWidth((dWidth+1)*5);*/ dWidth = progress; drawView.setWidth(dWidth); Editor e = prefs.edit(); e.putInt("dWidth", dWidth); e.commit(); } } }; ((SeekBar) findViewById(R.id.seekBarLine)).setOnSeekBarChangeListener(lineWidthListener); ((SeekBar) findViewById(R.id.ls_seekBarLine)).setOnSeekBarChangeListener(lineWidthListener); fontSizeListener = new OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub if (fromUser) { fWidth = progress / 10; int c = 40 + fWidth * 20; drawView.setFontSize(c); Editor e = prefs.edit(); e.putInt("fWidth", fWidth); e.commit(); try { ((TextView) findViewById(R.id.tvTextType)).setText(String.format("%d", c)); ((TextView) findViewById(R.id.ls_tvTextType)).setText(String.format("%d", c)); } catch (Exception ex) { } } } }; ((SeekBar) findViewById(R.id.seekBarType)).setOnSeekBarChangeListener(fontSizeListener); ((SeekBar) findViewById(R.id.ls_seekBarType)).setOnSeekBarChangeListener(fontSizeListener); drawView = (DrawView) findViewById(R.id.painter); drawView.setWidth((dWidth + 1) * 5); drawView.setFontSize(40 + fWidth * 20); setBarConfig(getResources().getConfiguration().orientation); findViewById(R.id.bEditPage).setOnClickListener(this); findViewById(R.id.bToolColor).setOnClickListener(this); findViewById(R.id.bErase).setOnClickListener(this); findViewById(R.id.bToolShape).setOnClickListener(this); findViewById(R.id.bToolText).setOnClickListener(this); findViewById(R.id.bToolCrop).setOnClickListener(this); findViewById(R.id.btnBack).setOnClickListener(this); findViewById(R.id.bDone).setOnClickListener(this); findViewById(R.id.btnShare).setOnClickListener(this); findViewById(R.id.bSave2SD).setOnClickListener(this); findViewById(R.id.bSave2Nimbus).setOnClickListener(this); userMail = prefs.getString("userMail", ""); userPass = prefs.getString("userPass", ""); sessionId = prefs.getString("sessionId", ""); appSettings.sessionId = sessionId; appSettings.userMail = userMail; appSettings.userPass = userPass; storePath = ""; Intent intent = getIntent(); String action = intent.getAction(); String type = intent.getType(); //storePath= intent.getPackage().getClass().toString(); if ((Intent.ACTION_VIEW.equals(action) || Intent.ACTION_SEND.equals(action) || "com.onebit.nimbusnote.EDIT_PHOTO".equals(action)) && type != null) { if (type.startsWith("image/")) { Uri imageUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM); if (imageUri == null) imageUri = intent.getData(); if (imageUri != null) { String url = Uri.decode(imageUri.toString()); if (url.startsWith(CONTENT_PHOTOS_URI_PREFIX)) { url = getPhotosPhotoLink(url); } //else url=Uri.decode(url); ContentResolver cr = getContentResolver(); InputStream is; try { is = cr.openInputStream(Uri.parse(url)); if ("com.onebit.nimbusnote.EDIT_PHOTO".equals(action)) storePath = " ";//getGalleryPath(Uri.parse(url)); Bitmap bmp = BitmapFactory.decodeStream(is); if (bmp.getWidth() != -1 && bmp.getHeight() != -1) drawView.setBitmap(bmp, 0); } catch (Exception e) { appSettings.appendLog("paint:onCreate " + e.getMessage()); } } } } else { String act = getIntent().getExtras().getString("act"); if ("photo".equals(act)) { getPhoto(); } else if ("picture".equals(act)) { getPicture(); } else { String filePath = getIntent().getExtras().getString("path"); boolean isTemp = getIntent().getExtras().getBoolean("temp"); domain = getIntent().getExtras().getString("domain"); if (domain == null) domain = serverHelper.getDate(); if (filePath.contains("://")) { Bitmap bmp = helper.LoadImageFromWeb(filePath); if (bmp != null) { drawView.setBitmap(bmp, 0); } } else { File file = new File(filePath); if (file.exists()) { try { int orient = helper.getOrientationFromExif(filePath); Bitmap bmp = helper.decodeSampledBitmap(filePath, 1000, 1000); if (bmp != null) { drawView.setBitmap(bmp, orient); } } catch (Exception e) { appSettings.appendLog("paint.onCreate() " + e.getMessage()); } if (isTemp) file.delete(); } } } } drawView.setBackgroundColor(Color.WHITE); drawView.requestFocus(); drawView.setColour(dColor); setPaletteColor(dColor); drawView.setSelChangeListener(new shapeSelectionListener() { @Override public void onSelectionChanged(int shSize, int fSize, int shColor) { setSelectedFoot(0); setLandToolSelected(R.id.bEditPage_land); //updateColorDialog(shSize!=-1?(shSize/5)-1:dWidth, fSize!=-1?(fSize-40)/20:fWidth, shColor!=0?colorToId(shColor):dColor); dColor = shColor; ccolor = shColor; int sw = shSize != -1 ? shSize : dWidth; canChange = false; ((SeekBar) findViewById(R.id.seekBarLine)).setProgress(sw); ((SeekBar) findViewById(R.id.ls_seekBarLine)).setProgress(sw); setPaletteColor(dColor); drawView.setColour(dColor); canChange = true; } @Override public void onTextChanged(String text, boolean stroke) { if (findViewById(R.id.text_field).getVisibility() != View.VISIBLE) { hideTools(); findViewById(R.id.bStroke).setSelected(stroke); ((EditText) findViewById(R.id.etEditorText)).setText(text); findViewById(R.id.text_field).setVisibility(View.VISIBLE); findViewById(R.id.etEditorText).requestFocus(); ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)) .showSoftInput(findViewById(R.id.etEditorText), 0); findViewById(R.id.bToolText).postDelayed(new Runnable() { @Override public void run() { // TODO Auto-generated method stub setSelectedFoot(2); } }, 100); } } }); setColorButtons(dColor); //mPlanetTitles = getResources().getStringArray(R.array.lmenu_paint); /*ListView listView = (ListView) findViewById(R.id.left_drawer); listView.setAdapter(new DrawerMenuAdapter(this,getResources().getStringArray(R.array.lmenu_paint))); listView.setOnItemClickListener(this);*/ }
From source file:com.app.uafeed.activity.EditFeedActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); getActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.activity_feed_edit); setResult(RESULT_CANCELED);//from w w w. jav a2 s. c om Intent intent = getIntent(); mTabHost = (TabHost) findViewById(R.id.tabHost); mNameEditText = (EditText) findViewById(R.id.feed_title); mUrlEditText = (EditText) findViewById(R.id.feed_url); mRetrieveFulltextCb = (CheckBox) findViewById(R.id.retrieve_fulltext); mFiltersListView = (ListView) findViewById(android.R.id.list); View tabWidget = findViewById(android.R.id.tabs); View buttonLayout = findViewById(R.id.button_layout); mTabHost.setup(); mTabHost.addTab(mTabHost.newTabSpec("feedTab").setIndicator(getString(R.string.tab_feed_title)) .setContent(R.id.feed_tab)); mTabHost.addTab(mTabHost.newTabSpec("filtersTab").setIndicator(getString(R.string.tab_filters_title)) .setContent(R.id.filters_tab)); mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String s) { invalidateOptionsMenu(); } }); if (savedInstanceState != null) { mTabHost.setCurrentTab(savedInstanceState.getInt(STATE_CURRENT_TAB)); } if (intent.getAction().equals(Intent.ACTION_INSERT) || intent.getAction().equals(Intent.ACTION_SEND)) { setTitle(R.string.new_feed_title); tabWidget.setVisibility(View.GONE); if (intent.hasExtra(Intent.EXTRA_TEXT)) { mUrlEditText.setText(intent.getStringExtra(Intent.EXTRA_TEXT)); } } else if (intent.getAction().equals(Intent.ACTION_EDIT)) { setTitle(R.string.edit_feed_title); buttonLayout.setVisibility(View.GONE); mFiltersCursorAdapter = new FiltersCursorAdapter(this, null); mFiltersListView.setAdapter(mFiltersCursorAdapter); mFiltersListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { startActionMode(mFilterActionModeCallback); mFiltersCursorAdapter.setSelectedFilter(position); mFiltersListView.invalidateViews(); return true; } }); getLoaderManager().initLoader(0, null, this); if (savedInstanceState == null) { Cursor cursor = getContentResolver().query(intent.getData(), FEED_PROJECTION, null, null, null); if (cursor.moveToNext()) { mPreviousName = cursor.getString(0); mNameEditText.setText(mPreviousName); mUrlEditText.setText(cursor.getString(1)); mRetrieveFulltextCb.setChecked(cursor.getInt(2) == 1); cursor.close(); } else { cursor.close(); Toast.makeText(EditFeedActivity.this, R.string.error, Toast.LENGTH_SHORT).show(); finish(); } } } }
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.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; }//from w w w .j a v a 2 s .c om return null; }
From source file:mp.paschalis.WatchBookActivity.java
/** * Creates a sharing {@link Intent}.//from www.j ava2 s. c o m * * @return The sharing intent. */ private Intent createShareIntent() { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); String root = Environment.getExternalStorageDirectory() + ".SmartLib/Images"; new File(root).mkdirs(); File file = new File(root, app.selectedBook.isbn); try { FileOutputStream os = new FileOutputStream(file); bitmapBookCover.compress(CompressFormat.PNG, 80, os); os.flush(); os.close(); Uri uri = Uri.fromFile(file); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); } catch (Exception e) { Log.e(TAG, e.getStackTrace().toString()); } String bookInfo = "\n\n\n\n " + getString(R.string.bookInfo) + ":\n" + getString(R.string.title) + ": \t\t\t\t" + app.selectedBook.title + "\n" + getString(R.string.author) + ": \t\t\t" + app.selectedBook.authors + "\n" + getString(R.string.isbn) + ": \t\t\t\t" + app.selectedBook.isbn + "\n" + getString(R.string.published_) + " \t" + app.selectedBook.publishedYear + "\n" + getString(R.string.pages_) + " \t\t\t" + app.selectedBook.pageCount + "\n" + getString(R.string.isbn) + ": \t\t\t\t" + app.selectedBook.isbn + "\n" + getString(R.string.status) + ": \t\t\t" + App.getBookStatusString(app.selectedBook.status, WatchBookActivity.this) + "\n\n" + "http://books.google.com/books?vid=isbn" + app.selectedBook.isbn; shareIntent.putExtra(Intent.EXTRA_TEXT, bookInfo); return shareIntent; }
From source file:com.android.deskclock.stopwatch.StopwatchFragment.java
/** * Send stopwatch time and lap times to an external sharing application. */// w ww . j ava 2s .c om 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.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();/* ww w .j a v a2 s .co 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(); }
From source file:net.fred.feedex.activity.EditFeedActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_feed_edit); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/* w w w .j a v a 2 s . co m*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); setResult(RESULT_CANCELED); Intent intent = getIntent(); mTabHost = (TabHost) findViewById(R.id.tabHost); mNameEditText = (EditText) findViewById(R.id.feed_title); mUrlEditText = (EditText) findViewById(R.id.feed_url); mRetrieveFulltextCb = (CheckBox) findViewById(R.id.retrieve_fulltext); mFiltersListView = (ListView) findViewById(android.R.id.list); View tabWidget = findViewById(android.R.id.tabs); mTabHost.setup(); mTabHost.addTab(mTabHost.newTabSpec("feedTab").setIndicator(getString(R.string.tab_feed_title)) .setContent(R.id.feed_tab)); mTabHost.addTab(mTabHost.newTabSpec("filtersTab").setIndicator(getString(R.string.tab_filters_title)) .setContent(R.id.filters_tab)); mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String s) { invalidateOptionsMenu(); } }); if (savedInstanceState != null) { mTabHost.setCurrentTab(savedInstanceState.getInt(STATE_CURRENT_TAB)); } if (intent.getAction().equals(Intent.ACTION_INSERT) || intent.getAction().equals(Intent.ACTION_SEND)) { setTitle(R.string.new_feed_title); tabWidget.setVisibility(View.GONE); if (intent.hasExtra(Intent.EXTRA_TEXT)) { mUrlEditText.setText(intent.getStringExtra(Intent.EXTRA_TEXT)); } } else if (intent.getAction().equals(Intent.ACTION_VIEW)) { setTitle(R.string.new_feed_title); tabWidget.setVisibility(View.GONE); mUrlEditText.setText(intent.getDataString()); } else if (intent.getAction().equals(Intent.ACTION_EDIT)) { setTitle(R.string.edit_feed_title); mFiltersCursorAdapter = new FiltersCursorAdapter(this, Constants.EMPTY_CURSOR); mFiltersListView.setAdapter(mFiltersCursorAdapter); mFiltersListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { startSupportActionMode(mFilterActionModeCallback); mFiltersCursorAdapter.setSelectedFilter(position); mFiltersListView.invalidateViews(); return true; } }); getLoaderManager().initLoader(0, null, this); if (savedInstanceState == null) { Cursor cursor = getContentResolver().query(intent.getData(), FEED_PROJECTION, null, null, null); if (cursor != null && cursor.moveToNext()) { mNameEditText.setText(cursor.getString(0)); mUrlEditText.setText(cursor.getString(1)); mRetrieveFulltextCb.setChecked(cursor.getInt(2) == 1); if (cursor.getInt(3) == 1) { // if it's a group, we cannot edit it finish(); } } else { UiUtils.showMessage(EditFeedActivity.this, R.string.error); finish(); } if (cursor != null) { cursor.close(); } } } }