List of usage examples for android.widget TextView setCompoundDrawablesWithIntrinsicBounds
@android.view.RemotableViewMethod public void setCompoundDrawablesWithIntrinsicBounds(@Nullable Drawable left, @Nullable Drawable top, @Nullable Drawable right, @Nullable Drawable bottom)
From source file:net.etuldan.sparss.fragment.EntriesListFragment.java
@Override public View inflateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_entry_list, container, true); if (mEntriesCursorAdapter != null) { setListAdapter(mEntriesCursorAdapter); }//from www . ja va 2 s . co m mListView = (ListView) rootView.findViewById(android.R.id.list); mListView.setOnTouchListener(new SwipeGestureListener(mListView.getContext())); if (PrefUtils.getBoolean(PrefUtils.DISPLAY_TIP, true)) { final TextView header = new TextView(mListView.getContext()); header.setMinimumHeight(UiUtils.dpToPixel(70)); int footerPadding = UiUtils.dpToPixel(10); header.setPadding(footerPadding, footerPadding, footerPadding, footerPadding); header.setText(R.string.tip_sentence); header.setGravity(Gravity.CENTER_VERTICAL); header.setCompoundDrawablePadding(UiUtils.dpToPixel(5)); header.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_info_outline, 0, R.drawable.ic_cancel, 0); header.setClickable(true); header.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mListView.removeHeaderView(header); PrefUtils.putBoolean(PrefUtils.DISPLAY_TIP, false); } }); mListView.addHeaderView(header); } UiUtils.addEmptyFooterView(mListView, 90); mHideReadButton = (FloatingActionButton) rootView.findViewById(R.id.hide_read_button); mHideReadButton.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { UiUtils.displayHideReadButtonAction(mListView.getContext()); return true; } }); UiUtils.updateHideReadButton(mHideReadButton); mSearchView = (SearchView) rootView.findViewById(R.id.searchView); if (savedInstanceState != null) { refreshUI(); // To hide/show the search bar } mSearchView.post(new Runnable() { // Do this AFTER the text has been restored from saveInstanceState @Override public void run() { mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mSearchView.getWindowToken(), 0); return false; } @Override public boolean onQueryTextChange(String s) { setData(EntryColumns.SEARCH_URI(s), true); return false; } }); } }); disableSwipe(); return rootView; }
From source file:com.cw.litenote.tabs.TabsHost.java
@Override public void onResume() { super.onResume(); // default/*from www . jav a2 s . c om*/ setFocus_tabPos(0); if (Drawer.getFolderCount() == 0) return;//todo Check again // restore focus view page int pageCount = mTabsPagerAdapter.dbFolder.getPagesCount(true); for (int i = 0; i < pageCount; i++) { int pageTableId = mTabsPagerAdapter.dbFolder.getPageTableId(i, true); if (pageTableId == Pref.getPref_focusView_page_tableId(MainAct.mAct)) { setFocus_tabPos(i); mFocusPageTableId = pageTableId; } } System.out.println("TabsHost / _onResume / _getFocus_tabPos = " + getFocus_tabPos()); // auto scroll to show focus tab new Handler().postDelayed(new Runnable() { @Override public void run() { if (mTabLayout.getTabAt(getFocus_tabPos()) != null) mTabLayout.getTabAt(getFocus_tabPos()).select(); } }, 100); // set audio icon after Key Protect TabLayout.Tab tab = mTabLayout.getTabAt(audioPlayTabPos); if (tab != null) { if ((MainAct.mPlaying_folderPos == FolderUi.getFocus_folderPos()) && (Audio_manager.getPlayerState() != Audio_manager.PLAYER_AT_STOP) && (tab.getPosition() == audioPlayTabPos)) { if (tab.getCustomView() == null) { LinearLayout tabLinearLayout = (LinearLayout) MainAct.mAct.getLayoutInflater() .inflate(R.layout.tab_custom, null); TextView title = (TextView) tabLinearLayout.findViewById(R.id.tabTitle); title.setText(mTabsPagerAdapter.dbFolder.getPageTitle(tab.getPosition(), true)); title.setTextColor(MainAct.mAct.getResources().getColor(R.color.colorWhite)); title.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_audio, 0, 0, 0); tab.setCustomView(title); } } else tab.setCustomView(null); } // for incoming phone call case or after Key Protect if ((audioUi_page != null) && (Audio_manager.getPlayerState() != Audio_manager.PLAYER_AT_STOP) && (Audio_manager.getAudioPlayMode() == Audio_manager.PAGE_PLAY_MODE)) { audioUi_page.initAudioBlock(MainAct.mAct); audioPlayer_page.page_runnable.run();//todo Why exception when adding new text? //todo Why dose this panel disappear? UtilAudio.updateAudioPanel(audioUi_page.audioPanel_play_button, audioUi_page.audio_panel_title_textView); } // set long click listener setLongClickListener(); }
From source file:com.tune.news.fragment.EntriesListFragment.java
@Override public View inflateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_entry_list, container, true); if (mEntriesCursorAdapter != null) { setListAdapter(mEntriesCursorAdapter); }/*from w ww .ja va 2s. co m*/ mListView = (ListView) rootView.findViewById(android.R.id.list); mListView.setFastScrollEnabled(true); // mListView.setOnTouchListener(new SwipeGestureListener(mListView.getContext())); if (PrefUtils.getBoolean(PrefUtils.DISPLAY_TIP, true)) { final TextView header = new TextView(mListView.getContext()); header.setMinimumHeight(UiUtils.dpToPixel(70)); int footerPadding = UiUtils.dpToPixel(10); header.setPadding(footerPadding, footerPadding, footerPadding, footerPadding); header.setText(R.string.tip_sentence); header.setGravity(Gravity.CENTER_VERTICAL); header.setCompoundDrawablePadding(UiUtils.dpToPixel(5)); header.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_about, 0, R.drawable.ic_action_cancel, 0); header.setClickable(true); header.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mListView.removeHeaderView(header); PrefUtils.putBoolean(PrefUtils.DISPLAY_TIP, false); } }); mListView.addHeaderView(header); } UiUtils.addEmptyFooterView(mListView, 90); mHideReadButton = (FloatingActionButton) rootView.findViewById(R.id.hide_read_button); mHideReadButton.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { UiUtils.displayHideReadButtonAction(mListView.getContext()); return true; } }); UiUtils.updateHideReadButton(mHideReadButton); mRefreshListBtn = (Button) rootView.findViewById(R.id.refreshListBtn); mRefreshListBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mNewEntriesNumber = 0; mListDisplayDate = new Date().getTime(); refreshUI(); if (mUri != null) { restartLoaders(); } } }); mSearchView = (SearchView) rootView.findViewById(R.id.searchView); if (savedInstanceState != null) { refreshUI(); // To hide/show the search bar } mSearchView.post(new Runnable() { // Do this AFTER the text has been restored from saveInstanceState @Override public void run() { mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mSearchView.getWindowToken(), 0); return false; } @Override public boolean onQueryTextChange(String s) { setData(EntryColumns.SEARCH_URI(s), true); return false; } }); } }); disableSwipe(); return rootView; }
From source file:com.viktorrudometkin.burramys.fragment.EntriesListFragment.java
@Override public View inflateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_entry_list, container, true); if (mEntriesCursorAdapter != null) { setListAdapter(mEntriesCursorAdapter); }/*from ww w. j av a2 s.c o m*/ mListView = (ListView) rootView.findViewById(android.R.id.list); mListView.setOnTouchListener(new SwipeGestureListener(mListView.getContext())); if (PrefUtils.getBoolean(PrefUtils.DISPLAY_TIP, true)) { final TextView header = new TextView(mListView.getContext()); header.setMinimumHeight(UiUtils.dpToPixel(70)); int footerPadding = UiUtils.dpToPixel(10); header.setPadding(footerPadding, footerPadding, footerPadding, footerPadding); header.setText(R.string.tip_sentence); header.setGravity(Gravity.CENTER_VERTICAL); header.setCompoundDrawablePadding(UiUtils.dpToPixel(5)); header.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_about, 0, R.drawable.ic_action_cancel, 0); header.setClickable(true); header.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mListView.removeHeaderView(header); PrefUtils.putBoolean(PrefUtils.DISPLAY_TIP, false); } }); mListView.addHeaderView(header); } UiUtils.addEmptyFooterView(mListView, 90); mRefreshListBtn = (Button) rootView.findViewById(R.id.refreshListBtn); mRefreshListBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mNewEntriesNumber = 0; mListDisplayDate = new Date().getTime(); refreshUI(); if (mCurrentUri != null) { restartLoaders(); } } }); disableSwipe(); return rootView; }
From source file:com.example.ryan.weixindemo.view.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null;//from w ww .ja v a 2 s. co m TextView tabTitleView = null; if (mTabViewLayoutId != 0) { // If there is a custom tab view layout id set, try and inflate it tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); } if (tabView == null) { tabView = createDefaultTabView(getContext()); } if (tabTitleView == null && TextView.class.isInstance(tabView)) { tabTitleView = (TextView) tabView; } if (tabs_icons != null && tabs_icons.length == adapter.getCount()) { tabTitleView.setCompoundDrawablesWithIntrinsicBounds(0, tabs_icons[i], 0, 0); } tabTitleView.setText(adapter.getPageTitle(i)); tabView.setOnClickListener(tabClickListener); mTabStrip.addView(tabView); } }
From source file:com.yahala.ui.GroupCreateActivity.java
@Override public void applySelfActionBar() { if (parentActivity == null) { return;/* w w w. ja v a 2 s . com*/ } ActionBar actionBar = parentActivity.getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayShowCustomEnabled(false); actionBar.setCustomView(null); actionBar.setTitle(LocaleController.getString("NewGroup", R.string.NewGroup)); actionBar.setSubtitle(String.format("%d/200 %s", selectedContacts.size(), LocaleController.getString("Members", R.string.Members))); TextView title = (TextView) parentActivity.findViewById(R.id.action_bar_title); if (title == null) { final int subtitleId = parentActivity.getResources().getIdentifier("action_bar_title", "id", "android"); title = (TextView) parentActivity.findViewById(subtitleId); } if (title != null) { title.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); title.setCompoundDrawablePadding(0); } }
From source file:com.baseutil.strip.PagerSlidingTabStrip.java
private void updateTabTextColorStyles(int pos, int color, int unselectedcolor) { 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); if (pos == i) { tab.setTextColor(color); } else { tab.setTextColor(unselectedcolor); }// w w w.j av a 2s . c om if (tabResources != null) { tab.setCompoundDrawablesWithIntrinsicBounds(tabResources[i], 0, 0, 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)); } } } } }
From source file:com.github.topbottomsnackbar.TBSnackbar.java
@Deprecated private TBSnackbar addIcon(int resource_id, int size) { final TextView tv = mView.getMessageView(); tv.setCompoundDrawablesWithIntrinsicBounds(new BitmapDrawable(Bitmap.createScaledBitmap( ((BitmapDrawable) (mContext.getResources().getDrawable(resource_id))).getBitmap(), size, size, true)), null, null, null);//from w ww . j a v a 2 s . c o m return this; }
From source file:com.hcpt.fastfood.widget.PagerSlidingTabStrip.java
private void addTextTab(final int position) { TextView tab = new TextView(getContext()); if (!arrTabs.isEmpty()) { // Set text tab.setText(arrTabs.get(position).getTitle()); tab.setTypeface(null, Typeface.BOLD); tab.setGravity(Gravity.CENTER_HORIZONTAL); tab.setSingleLine();/* ww w .ja v a 2s .c o m*/ // Set icon Drawable iconDrawable = getResources().getDrawable(arrTabs.get(position).getIcon()); tab.setCompoundDrawablesWithIntrinsicBounds(null, iconDrawable, null, null); } addTab(position, tab); }
From source file:de.baumann.hhsmoodle.data_todo.Todo_Fragment.java
public void setTodoList() { if (isFABOpen) { closeFABMenu();/* www.ja va 2 s .com*/ } NotificationManager nMgr = (NotificationManager) getActivity() .getSystemService(Context.NOTIFICATION_SERVICE); nMgr.cancelAll(); //display data final int layoutstyle = R.layout.list_item_notes; int[] xml_id = new int[] { R.id.textView_title_notes, R.id.textView_des_notes, R.id.textView_create_notes }; String[] column = new String[] { "todo_title", "todo_content", "todo_creation" }; final Cursor row = db.fetchAllData(getActivity()); adapter = new SimpleCursorAdapter(getActivity(), layoutstyle, row, column, xml_id, 0) { @Override public View getView(final int position, View convertView, ViewGroup parent) { Cursor row2 = (Cursor) lv.getItemAtPosition(position); final String _id = row2.getString(row2.getColumnIndexOrThrow("_id")); final String todo_title = row2.getString(row2.getColumnIndexOrThrow("todo_title")); final String todo_content = row2.getString(row2.getColumnIndexOrThrow("todo_content")); final String todo_icon = row2.getString(row2.getColumnIndexOrThrow("todo_icon")); final String todo_attachment = row2.getString(row2.getColumnIndexOrThrow("todo_attachment")); final String todo_creation = row2.getString(row2.getColumnIndexOrThrow("todo_creation")); View v = super.getView(position, convertView, parent); ImageView iv_icon = (ImageView) v.findViewById(R.id.icon_notes); ImageView iv_attachment = (ImageView) v.findViewById(R.id.att_notes); helper_main.switchIcon(getActivity(), todo_icon, "todo_icon", iv_icon); switch (todo_attachment) { case "true": iv_attachment.setVisibility(View.VISIBLE); iv_attachment.setImageResource(R.drawable.alert_circle); break; default: iv_attachment.setVisibility(View.VISIBLE); iv_attachment.setImageResource(R.drawable.alert_circle_red); int n = Integer.valueOf(_id); android.content.Intent iMain = new android.content.Intent(); iMain.setAction("shortcutToDo"); iMain.setClassName(getActivity(), "de.baumann.hhsmoodle.activities.Activity_splash"); PendingIntent piMain = PendingIntent.getActivity(getActivity(), n, iMain, 0); NotificationCompat.Builder builderSummary = new NotificationCompat.Builder(getActivity()) .setSmallIcon(R.drawable.school) .setColor(ContextCompat.getColor(getActivity(), R.color.colorPrimary)) .setGroup("HHS_Moodle").setGroupSummary(true).setContentIntent(piMain); Notification notification = new NotificationCompat.Builder(getActivity()) .setColor(ContextCompat.getColor(getActivity(), R.color.colorPrimary)) .setSmallIcon(R.drawable.school).setContentTitle(todo_title) .setContentText(todo_content).setContentIntent(piMain).setAutoCancel(true) .setGroup("HHS_Moodle") .setStyle(new NotificationCompat.BigTextStyle().bigText(todo_content)) .setPriority(Notification.PRIORITY_DEFAULT).setVibrate(new long[0]).build(); NotificationManager notificationManager = (NotificationManager) getActivity() .getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(n, notification); notificationManager.notify(0, builderSummary.build()); break; } iv_icon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { final helper_main.Item[] items = { new helper_main.Item(getString(R.string.note_priority_0), R.drawable.circle_green), new helper_main.Item(getString(R.string.note_priority_1), R.drawable.circle_yellow), new helper_main.Item(getString(R.string.note_priority_2), R.drawable.circle_red), }; ListAdapter adapter = new ArrayAdapter<helper_main.Item>(getActivity(), android.R.layout.select_dialog_item, android.R.id.text1, items) { @NonNull public View getView(int position, View convertView, @NonNull ViewGroup parent) { //Use super class to create the View View v = super.getView(position, convertView, parent); TextView tv = (TextView) v.findViewById(android.R.id.text1); tv.setTextSize(18); tv.setCompoundDrawablesWithIntrinsicBounds(items[position].icon, 0, 0, 0); //Add margin between image and text (support various screen densities) int dp5 = (int) (24 * getResources().getDisplayMetrics().density + 0.5f); tv.setCompoundDrawablePadding(dp5); return v; } }; new AlertDialog.Builder(getActivity()) .setPositiveButton(R.string.toast_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }).setAdapter(adapter, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { if (item == 0) { db.update(Integer.parseInt(_id), todo_title, todo_content, "3", todo_attachment, todo_creation); setTodoList(); } else if (item == 1) { db.update(Integer.parseInt(_id), todo_title, todo_content, "2", todo_attachment, todo_creation); setTodoList(); } else if (item == 2) { db.update(Integer.parseInt(_id), todo_title, todo_content, "1", todo_attachment, todo_creation); setTodoList(); } } }).show(); } }); iv_attachment.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { switch (todo_attachment) { case "true": db.update(Integer.parseInt(_id), todo_title, todo_content, todo_icon, "", todo_creation); setTodoList(); break; default: db.update(Integer.parseInt(_id), todo_title, todo_content, todo_icon, "true", todo_creation); setTodoList(); break; } } }); return v; } }; //display data by filter final String note_search = sharedPref.getString("filter_todoBY", "note_title"); sharedPref.edit().putString("filter_todoBY", "note_title").apply(); filter.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { adapter.getFilter().filter(s.toString()); } }); adapter.setFilterQueryProvider(new FilterQueryProvider() { public Cursor runQuery(CharSequence constraint) { return db.fetchDataByFilter(constraint.toString(), note_search); } }); lv.setAdapter(adapter); //onClick function lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterview, View view, int position, long id) { if (isFABOpen) { closeFABMenu(); } Cursor row2 = (Cursor) lv.getItemAtPosition(position); final String _id = row2.getString(row2.getColumnIndexOrThrow("_id")); final String todo_title = row2.getString(row2.getColumnIndexOrThrow("todo_title")); final String todo_content = row2.getString(row2.getColumnIndexOrThrow("todo_content")); final String todo_icon = row2.getString(row2.getColumnIndexOrThrow("todo_icon")); final String todo_attachment = row2.getString(row2.getColumnIndexOrThrow("todo_attachment")); final String todo_creation = row2.getString(row2.getColumnIndexOrThrow("todo_creation")); sharedPref.edit().putString("toDo_title", todo_title).apply(); sharedPref.edit().putString("toDo_text", todo_content).apply(); sharedPref.edit().putString("toDo_seqno", _id).apply(); sharedPref.edit().putString("toDo_icon", todo_icon).apply(); sharedPref.edit().putString("toDo_create", todo_creation).apply(); sharedPref.edit().putString("toDo_attachment", todo_attachment).apply(); helper_main.switchToActivity(getActivity(), Activity_todo.class, false); } }); lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { if (isFABOpen) { closeFABMenu(); } Cursor row2 = (Cursor) lv.getItemAtPosition(position); final String _id = row2.getString(row2.getColumnIndexOrThrow("_id")); final String todo_title = row2.getString(row2.getColumnIndexOrThrow("todo_title")); final String todo_content = row2.getString(row2.getColumnIndexOrThrow("todo_content")); final String todo_icon = row2.getString(row2.getColumnIndexOrThrow("todo_icon")); final String todo_attachment = row2.getString(row2.getColumnIndexOrThrow("todo_attachment")); final String todo_creation = row2.getString(row2.getColumnIndexOrThrow("todo_creation")); final CharSequence[] options = { getString(R.string.number_edit_entry), getString(R.string.bookmark_remove_bookmark), getString(R.string.todo_share), getString(R.string.bookmark_createNote), getString(R.string.count_create), getString(R.string.bookmark_createEvent) }; new AlertDialog.Builder(getActivity()) .setPositiveButton(R.string.toast_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }).setItems(options, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { if (options[item].equals(getString(R.string.number_edit_entry))) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); View dialogView = View.inflate(getActivity(), R.layout.dialog_edit_title, null); final EditText edit_title = (EditText) dialogView.findViewById(R.id.pass_title); edit_title.setHint(R.string.bookmark_edit_title); edit_title.setText(todo_title); builder.setView(dialogView); builder.setTitle(R.string.bookmark_edit_title); builder.setPositiveButton(R.string.toast_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String inputTag = edit_title.getText().toString().trim(); db.update(Integer.parseInt(_id), inputTag, todo_content, todo_icon, todo_attachment, todo_creation); setTodoList(); Snackbar.make(lv, R.string.bookmark_added, Snackbar.LENGTH_SHORT).show(); } }); builder.setNegativeButton(R.string.toast_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }); final AlertDialog dialog2 = builder.create(); // Display the custom alert dialog on interface dialog2.show(); helper_main.showKeyboard(getActivity(), edit_title); } if (options[item].equals(getString(R.string.todo_share))) { Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, todo_title); sharingIntent.putExtra(Intent.EXTRA_TEXT, todo_content); startActivity(Intent.createChooser(sharingIntent, (getString(R.string.note_share_2)))); } if (options[item].equals(getString(R.string.bookmark_createEvent))) { helper_main.createCalendarEvent(getActivity(), todo_title, todo_content); } if (options[item].equals(getString(R.string.bookmark_remove_bookmark))) { Snackbar snackbar = Snackbar .make(lv, R.string.note_remove_confirmation, Snackbar.LENGTH_LONG) .setAction(R.string.toast_yes, new View.OnClickListener() { @Override public void onClick(View view) { db.delete(Integer.parseInt(_id)); setTodoList(); } }); snackbar.show(); } if (options[item].equals(getString(R.string.bookmark_createNote))) { Notes_helper.newNote(getActivity(), todo_title, todo_content, "", "", "", ""); } if (options[item].equals(getString(R.string.count_create))) { Count_helper.newCount(getActivity(), todo_title, todo_content, getActivity().getString(R.string.note_content), false); } } }).show(); return true; } }); }