List of usage examples for android.widget TextView setBackgroundColor
@RemotableViewMethod public void setBackgroundColor(@ColorInt int color)
From source file:es.upv.riromu.arbre.main.MainActivity.java
/***************************************************************/ @Override//from w ww . j a va 2 s.c o m protected void onActivityResult(int requestCode, int resultCode, Intent returnedIntent) { super.onActivityResult(requestCode, resultCode, returnedIntent); switch (requestCode) { case PICK_IMAGE: if (resultCode == RESULT_OK) { resetVisibility(PICK_IMAGE); try { state[PICK_IMAGE] = true; state[CROP_IMAGE] = false; state[TREAT_IMAGE] = false; captura = String.valueOf(System.currentTimeMillis() / 1000L); ImageView imv = (ImageView) findViewById(R.id.image_intro); image_uri = returnedIntent.getData(); InputStream is = getContentResolver().openInputStream(returnedIntent.getData()); imv.setImageBitmap(BitmapFactory.decodeStream(is)); is.close(); RangeSeekBar<Integer> seekBar = (RangeSeekBar<Integer>) findViewById(R.id.rangeseekbar); seekBar.setVisibility(View.GONE); } catch (IOException e) { Log.e(TAG, "Error reading from gallery" + e.getMessage()); } catch (Exception e) { Log.e(TAG, "Error reading from gallery" + e.getMessage()); } } break; case CAPTURE_IMAGE: try { if (resultCode == RESULT_OK) { resetVisibility(CAPTURE_IMAGE); captura = String.valueOf(System.currentTimeMillis() / 1000L); state[PICK_IMAGE] = false; state[CROP_IMAGE] = false; state[TREAT_IMAGE] = false; TextView imc = (TextView) findViewById(R.id.textView); imc.setBackgroundColor(Color.rgb(255, 255, 255)); RangeSeekBar<Integer> seekBar = (RangeSeekBar<Integer>) findViewById(R.id.rangeseekbar); seekBar.setVisibility(View.GONE); if (returnedIntent != null) { setPic(); Bundle extras = returnedIntent.getExtras(); setSelectedImage(returnedIntent.getData()); } else { ImageView imv = (ImageView) findViewById(R.id.image_intro); image = Util.decodeSampledBitmapFromUri(image_uri, MAX_SIZE, MAX_SIZE, this); imv.setImageBitmap(image); gpstracker = new GPSTracking(this); if (gpstracker.canGetLocation()) { latitude = String.valueOf(gpstracker.getLatitude()); longitude = String.valueOf(gpstracker.getLongitude()); } else { gpstracker.showSettingsAlert(); } } } } catch (Exception e) { Log.e(TAG, "Error " + e.getMessage()); } break; case CROP_IMAGE: try { if (resultCode == RESULT_OK) { state[CROP_IMAGE] = true; state[TREAT_IMAGE] = false; RangeSeekBar<Integer> seekBar = (RangeSeekBar<Integer>) findViewById(R.id.rangeseekbar); seekBar.setVisibility(View.VISIBLE); ImageTreatment imt = null; Bundle extras = returnedIntent.getExtras(); if (extras != null) { croppedimage_uri = Uri.parse(extras.getString(RETURN_DATA)); // croppedimage=extras.getParcelable(RETURN_DATA_AS_BITMAP); if (croppedimage_uri != null) { InputStream is = getContentResolver().openInputStream(croppedimage_uri); croppedimage = BitmapFactory.decodeStream(is); is.close(); } else { image = BitmapFactory.decodeResource(getResources(), R.drawable.platanus_hispanica); } ImageView imv = (ImageView) findViewById(R.id.image_intro); imv.setImageBitmap(croppedimage); colours[COLOUR_R] = (int) imt.getRedColor(); colours[COLOUR_B] = (int) imt.getBlueColor(); colours[COLOUR_G] = (int) imt.getGreenColor(); } } } catch (OutOfMemoryError e) { Log.e(TAG, "Error " + e.getMessage()); } catch (IOException e) { Log.e(TAG, "Error " + e.getMessage()); } catch (Exception e) { Log.e(TAG, "Error " + e.getMessage()); } } }
From source file:com.arya.portfolio.view_controller.fragment.UseCasesFragment.java
private void setViewSelected(TextView selectedView) { selectedView.setTextColor(ContextCompat.getColor(Env.appContext, R.color.color_white)); selectedView.setBackgroundColor(ContextCompat.getColor(Env.appContext, R.color.color_light_green)); selectedView.setSelected(true);//from w ww. j a v a 2 s . c o m txtLastSelectedView = selectedView; }
From source file:com.secbro.qark.filebrowser.FileBrowserFragment.java
private void createFileListAdapter() { adapter = new ArrayAdapter<Item>(getActivity(), android.R.layout.select_dialog_item, android.R.id.text1, fileList) {// ww w . java2 s.c o m @Override public View getView(int position, View convertView, ViewGroup parent) { // creates view View view = super.getView(position, convertView, parent); TextView textView = (TextView) view.findViewById(android.R.id.text1); // put the image on the text view int drawableID = 0; if (fileList.get(position).icon != -1) { // If icon == -1, then directory is empty drawableID = fileList.get(position).icon; } textView.setCompoundDrawablesWithIntrinsicBounds(drawableID, 0, 0, 0); textView.setEllipsize(null); // add margin between image and text (support various screen // densities) // int dp5 = (int) (5 * // getResources().getDisplayMetrics().density + 0.5f); int dp3 = (int) (3 * getResources().getDisplayMetrics().density + 0.5f); // TODO: change next line for empty directory, so text will be // centered textView.setCompoundDrawablePadding(dp3); textView.setBackgroundColor(Color.LTGRAY); return view; }// public View getView(int position, View convertView, ViewGroup };// adapter = new ArrayAdapter<Item>(this, }
From source file:org.sirimangalo.meditationplus.ActivityMain.java
private void populateLog(JSONArray jsonLogged) { Calendar utc = Calendar.getInstance(TimeZone.getTimeZone("UTC")); int hour = utc.get(Calendar.HOUR_OF_DAY); int max_hour = 0; int max_height = 100; LinearLayout hll = (LinearLayout) findViewById(R.id.time_log); if (hll == null) return;/*from w w w. j a v a2s .c o m*/ hll.removeAllViews(); try { max_hour = jsonLogged.getInt(0); for (int i = 1; i < jsonLogged.length(); i++) { max_hour = Math.max(max_hour, jsonLogged.getInt(i)); } for (int i = 0; i < jsonLogged.length(); i++) { int height = (int) Math.ceil(max_height * jsonLogged.getInt(i) / max_hour); LinearLayout ll = (LinearLayout) context.getLayoutInflater().inflate(R.layout.list_item_log, null); ImageView iv = (ImageView) ll.findViewById(R.id.min_cell); iv.getLayoutParams().height = height; iv.getLayoutParams().width = hll.getWidth() / 24; TextView tv = (TextView) ll.findViewById(R.id.hour_no); tv.setText(i + ""); if (hour == i) tv.setBackgroundColor(0xFFFFFF33); ImageView sv = (ImageView) ll.findViewById(R.id.space_cell); sv.getLayoutParams().height = 100 - height; hll.addView(ll); } } catch (JSONException e) { e.printStackTrace(); } }
From source file:com.newversion.tabstrip.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }/*from w w w. ja v a 2s.c om*/ } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); tab.setBackgroundColor(selectedTabTextBackground); } } } }
From source file:mika.com.android.ac.ui.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }/*from w ww . j a v a 2s . c om*/ } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); tab.setBackgroundColor(selectedTabColor); } } } }
From source file:terse.a1.TerseActivity.java
private void postMortem(Throwable ex) { String explain = Static.describe(ex); TextView explainv = new TextView(this); explainv.setText(explain);// w w w.j a v a 2 s . c o m explainv.setBackgroundColor(Color.BLACK); explainv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24); explainv.setTextColor(Color.RED); SetContentViewWithHomeButtonAndScroll(explainv); }
From source file:com.witmoon.xmb.ui.widget.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); View vs = null;//from ww w.j av a 2 s.c om v.setBackgroundResource(tabBackgroundResId); if (v instanceof LinearLayout) { vs = ((LinearLayout) v).getChildAt(0); } if (v instanceof LinearLayout) { v = ((LinearLayout) v).getChildAt(1); } if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); tab.setPadding(tabPadding, 0, tabPadding, 0); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } if (i == selectedTabPosition) { tab.setBackgroundColor(selectedTabBagC); tab.setTextColor(selectedTabTextColor); tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectedTabTextSize); } } if (null != vs) { if (vs instanceof ImageView) { ImageView ico = (ImageView) vs; if (i == 0) { ico.setImageResource(icoColor); } else { ico.setImageResource(icoColor1); } // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (i == selectedTabPosition) { ico.setImageResource(selectedIcoColor); if (i == 0) { ico.setImageResource(selectedIcoColor); } else { ico.setImageResource(selectedIcoColor1); } } } } } }
From source file:com.atomjack.vcfp.VideoControllerView.java
private void initControllerView(View v) { mPauseButton = (ImageButton) v.findViewById(R.id.pause); if (mPauseButton != null) { mPauseButton.requestFocus();/*from w w w.j av a 2 s.c o m*/ mPauseButton.setOnClickListener(mPauseListener); } mFullscreenButton = (ImageButton) v.findViewById(R.id.fullscreen); if (mFullscreenButton != null) { mFullscreenButton.requestFocus(); mFullscreenButton.setOnClickListener(mFullscreenListener); } mMediaOptionsButton = (ImageButton) v.findViewById(R.id.mediaOptions); if (mMediaOptionsButton != null) { mMediaOptionsButton.setOnClickListener(mMediaOptionsListener); } mMicButton = (ImageButton) v.findViewById(R.id.mic); if (mMicButton != null) { mMicButton.setOnClickListener(mMicListener); } mMediaControllerPosterContainer = (ViewGroup) v.findViewById(R.id.mediaControllerPosterContainer); mMediaControllerPosterContainer.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { mPlayer.onPosterContainerTouch(v, event); return true; } }); mFfwdButton = (ImageButton) v.findViewById(R.id.ffwd); if (mFfwdButton != null) { mFfwdButton.setOnClickListener(mFfwdListener); if (!mFromXml) { mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE); } } mRewButton = (ImageButton) v.findViewById(R.id.rew); if (mRewButton != null) { mRewButton.setOnClickListener(mRewListener); if (!mFromXml) { mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE); } } mStopButton = (ImageButton) v.findViewById(R.id.stop); if (mStopButton != null) { mStopButton.setOnClickListener(mStopListener); } // By default these are hidden. They will be enabled when setPrevNextListeners() is called mNextButton = (ImageButton) v.findViewById(R.id.next); if (mNextButton != null && !mFromXml && !mListenersSet) { mNextButton.setVisibility(View.GONE); } mPrevButton = (ImageButton) v.findViewById(R.id.prev); if (mPrevButton != null && !mFromXml && !mListenersSet) { mPrevButton.setVisibility(View.GONE); } mPoster = (ImageView) v.findViewById(R.id.poster); if (mPosterBitmap != null) mPoster.setImageBitmap(mPosterBitmap); mBitrateSpinner = (CustomSpinner) v.findViewById(R.id.bitrateSpinner); if (mBitrateSpinner != null) { mBitrateSpinner.getBackground().setColorFilter(ContextCompat.getColor(mContext, R.color.white), PorterDuff.Mode.SRC_ATOP); final ArrayList<String> list = new ArrayList<>( VoiceControlForPlexApplication.localVideoQualityOptions.keySet()); ArrayAdapter<String> adapter = new ArrayAdapter<String>(mContext, R.layout.bitrate_dropdown_item, list) { @Override public View getView(int position, View convertView, ViewGroup parent) { TextView textView = (TextView) super.getView(position, convertView, parent); textView.setTextColor(ContextCompat.getColor(mContext, R.color.white)); return textView; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { TextView textView = (TextView) super.getDropDownView(position, convertView, parent); textView.setTextColor(ContextCompat.getColor(mContext, textView.getText().equals(mCurrentVideoQuality) ? R.color.black : R.color.white)); textView.setBackgroundColor(ContextCompat.getColor(mContext, textView.getText().equals(mCurrentVideoQuality) ? R.color.white : R.color.mediaControllerBackground)); return textView; } }; mBitrateSpinner.setAdapter(adapter); mBitrateSpinner.setSelection(list.indexOf(mCurrentVideoQuality), false); mBitrateSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String item = list.get(position); // Only notify the activity if the bitrate clicked on is not the current one if (mBitrateChangeListener != null && !item.equals(mCurrentVideoQuality)) { hide(); mBitrateChangeListener.onBitrateChange(item); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mBitrateSpinner.setSpinnerEventsListener(new CustomSpinner.OnSpinnerEventsListener() { @Override public void onSpinnerOpened() { mBitrateSpinnerIsOpen = true; } @Override public void onSpinnerClosed() { mBitrateSpinnerIsOpen = false; // hide the controller after 3 seconds Message msg = mHandler.obtainMessage(FADE_OUT); mHandler.removeMessages(FADE_OUT); mHandler.sendMessageDelayed(msg, sDefaultTimeout); } }); } mProgress = (SeekBar) v.findViewById(R.id.mediacontroller_progress); if (mProgress != null) { if (mProgress instanceof SeekBar) { SeekBar seeker = (SeekBar) mProgress; seeker.setOnSeekBarChangeListener(mSeekListener); } mProgress.setMax(1000); } mEndTime = (TextView) v.findViewById(R.id.time); mCurrentTime = (TextView) v.findViewById(R.id.time_current); mFormatBuilder = new StringBuilder(); mFormatter = new Formatter(mFormatBuilder, Locale.getDefault()); installPrevNextListeners(); }
From source file:com.farmerbb.notepad.fragment.NoteViewFragment.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override/*from www.j a va 2 s.c om*/ public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Set values setRetainInstance(true); setHasOptionsMenu(true); // Get filename of saved note filename = getArguments().getString("filename"); // Change window title String title; try { title = listener.loadNoteTitle(filename); } catch (IOException e) { title = getResources().getString(R.string.view_note); } getActivity().setTitle(title); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Bitmap bitmap = ((BitmapDrawable) ContextCompat.getDrawable(getActivity(), R.drawable.ic_recents_logo)) .getBitmap(); ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(title, bitmap, ContextCompat.getColor(getActivity(), R.color.primary)); getActivity().setTaskDescription(taskDescription); } // Show the Up button in the action bar. ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Animate elevation change if (getActivity().findViewById(R.id.layoutMain).getTag().equals("main-layout-large") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { LinearLayout noteViewEdit = getActivity().findViewById(R.id.noteViewEdit); LinearLayout noteList = getActivity().findViewById(R.id.noteList); noteList.animate().z(0f); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) noteViewEdit.animate() .z(getResources().getDimensionPixelSize(R.dimen.note_view_edit_elevation_land)); else noteViewEdit.animate().z(getResources().getDimensionPixelSize(R.dimen.note_view_edit_elevation)); } // Set up content view TextView noteContents = getActivity().findViewById(R.id.textView); markdownView = getActivity().findViewById(R.id.markdownView); // Apply theme SharedPreferences pref = getActivity().getSharedPreferences(getActivity().getPackageName() + "_preferences", Context.MODE_PRIVATE); ScrollView scrollView = getActivity().findViewById(R.id.scrollView); String theme = pref.getString("theme", "light-sans"); int textSize = -1; int textColor = -1; String fontFamily = null; if (theme.contains("light")) { if (noteContents != null) { noteContents.setTextColor(ContextCompat.getColor(getActivity(), R.color.text_color_primary)); noteContents.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.window_background)); } if (markdownView != null) { markdownView.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.window_background)); textColor = ContextCompat.getColor(getActivity(), R.color.text_color_primary); } scrollView.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.window_background)); } if (theme.contains("dark")) { if (noteContents != null) { noteContents.setTextColor(ContextCompat.getColor(getActivity(), R.color.text_color_primary_dark)); noteContents .setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.window_background_dark)); } if (markdownView != null) { markdownView .setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.window_background_dark)); textColor = ContextCompat.getColor(getActivity(), R.color.text_color_primary_dark); } scrollView.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.window_background_dark)); } if (theme.contains("sans")) { if (noteContents != null) noteContents.setTypeface(Typeface.SANS_SERIF); if (markdownView != null) fontFamily = "sans-serif"; } if (theme.contains("serif")) { if (noteContents != null) noteContents.setTypeface(Typeface.SERIF); if (markdownView != null) fontFamily = "serif"; } if (theme.contains("monospace")) { if (noteContents != null) noteContents.setTypeface(Typeface.MONOSPACE); if (markdownView != null) fontFamily = "monospace"; } switch (pref.getString("font_size", "normal")) { case "smallest": textSize = 12; break; case "small": textSize = 14; break; case "normal": textSize = 16; break; case "large": textSize = 18; break; case "largest": textSize = 20; break; } if (noteContents != null) noteContents.setTextSize(textSize); String css = ""; if (markdownView != null) { String topBottom = " " + Float.toString(getResources().getDimension(R.dimen.padding_top_bottom) / getResources().getDisplayMetrics().density) + "px"; String leftRight = " " + Float.toString(getResources().getDimension(R.dimen.padding_left_right) / getResources().getDisplayMetrics().density) + "px"; String fontSize = " " + Integer.toString(textSize) + "px"; String fontColor = " #" + StringUtils.remove(Integer.toHexString(textColor), "ff"); String linkColor = " #" + StringUtils.remove( Integer.toHexString(new TextView(getActivity()).getLinkTextColors().getDefaultColor()), "ff"); css = "body { " + "margin:" + topBottom + topBottom + leftRight + leftRight + "; " + "font-family:" + fontFamily + "; " + "font-size:" + fontSize + "; " + "color:" + fontColor + "; " + "}" + "a { " + "color:" + linkColor + "; " + "}"; markdownView.getSettings().setJavaScriptEnabled(false); markdownView.getSettings().setLoadsImagesAutomatically(false); markdownView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) try { startActivity(intent); } catch (ActivityNotFoundException | FileUriExposedException e) { /* Gracefully fail */ } else try { startActivity(intent); } catch (ActivityNotFoundException e) { /* Gracefully fail */ } return true; } }); } // Load note contents try { contentsOnLoad = listener.loadNote(filename); } catch (IOException e) { showToast(R.string.error_loading_note); // Add NoteListFragment or WelcomeFragment Fragment fragment; if (getActivity().findViewById(R.id.layoutMain).getTag().equals("main-layout-normal")) fragment = new NoteListFragment(); else fragment = new WelcomeFragment(); getFragmentManager().beginTransaction().replace(R.id.noteViewEdit, fragment, "NoteListFragment") .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).commit(); } // Set TextView contents if (noteContents != null) noteContents.setText(contentsOnLoad); if (markdownView != null) markdownView.loadMarkdown(contentsOnLoad, "data:text/css;base64," + Base64.encodeToString(css.getBytes(), Base64.DEFAULT)); // Show a toast message if this is the user's first time viewing a note final SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE); firstLoad = sharedPref.getInt("first-load", 0); if (firstLoad == 0) { // Show dialog with info DialogFragment firstLoad = new FirstViewDialogFragment(); firstLoad.show(getFragmentManager(), "firstloadfragment"); // Set first-load preference to 1; we don't need to show the dialog anymore SharedPreferences.Editor editor = sharedPref.edit(); editor.putInt("first-load", 1); editor.apply(); } // Detect single and double-taps using GestureDetector final GestureDetector detector = new GestureDetector(getActivity(), new GestureDetector.OnGestureListener() { @Override public boolean onSingleTapUp(MotionEvent e) { return false; } @Override public void onShowPress(MotionEvent e) { } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return false; } @Override public void onLongPress(MotionEvent e) { } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return false; } @Override public boolean onDown(MotionEvent e) { return false; } }); detector.setOnDoubleTapListener(new GestureDetector.OnDoubleTapListener() { @Override public boolean onDoubleTap(MotionEvent e) { if (sharedPref.getBoolean("show_double_tap_message", true)) { SharedPreferences.Editor editor = sharedPref.edit(); editor.putBoolean("show_double_tap_message", false); editor.apply(); } Bundle bundle = new Bundle(); bundle.putString("filename", filename); Fragment fragment = new NoteEditFragment(); fragment.setArguments(bundle); getFragmentManager().beginTransaction().replace(R.id.noteViewEdit, fragment, "NoteEditFragment") .commit(); return false; } @Override public boolean onDoubleTapEvent(MotionEvent e) { return false; } @Override public boolean onSingleTapConfirmed(MotionEvent e) { if (sharedPref.getBoolean("show_double_tap_message", true) && showMessage) { showToastLong(R.string.double_tap); showMessage = false; } return false; } }); if (noteContents != null) noteContents.setOnTouchListener((v, event) -> { detector.onTouchEvent(event); return false; }); if (markdownView != null) markdownView.setOnTouchListener((v, event) -> { detector.onTouchEvent(event); return false; }); }