List of usage examples for android.widget ImageView setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:de.baumann.hhsmoodle.data_notes.Notes_Fragment.java
public void setNotesList() { if (isFABOpen) { closeFABMenu();/*from w ww. j a v a 2 s . c o m*/ } //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[] { "note_title", "note_content", "note_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 note_title = row2.getString(row2.getColumnIndexOrThrow("note_title")); final String note_content = row2.getString(row2.getColumnIndexOrThrow("note_content")); final String note_icon = row2.getString(row2.getColumnIndexOrThrow("note_icon")); final String note_attachment = row2.getString(row2.getColumnIndexOrThrow("note_attachment")); final String note_creation = row2.getString(row2.getColumnIndexOrThrow("note_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(), note_icon, "note_icon", iv_icon); switch (note_attachment) { case "": iv_attachment.setVisibility(View.GONE); break; default: iv_attachment.setVisibility(View.VISIBLE); iv_attachment.setImageResource(R.drawable.ic_attachment); break; } File file = new File(note_attachment); if (!file.exists()) { iv_attachment.setVisibility(View.GONE); } 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), note_title, note_content, "3", note_attachment, note_creation); setNotesList(); } else if (item == 1) { db.update(Integer.parseInt(_id), note_title, note_content, "2", note_attachment, note_creation); setNotesList(); } else if (item == 2) { db.update(Integer.parseInt(_id), note_title, note_content, "1", note_attachment, note_creation); setNotesList(); } } }).show(); } }); iv_attachment.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { helper_main.openAtt(getActivity(), lv, note_attachment); } }); return v; } }; //display data by filter final String note_search = sharedPref.getString("filter_noteBY", "note_title"); sharedPref.edit().putString("filter_noteBY", "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 note_title = row2.getString(row2.getColumnIndexOrThrow("note_title")); final String note_content = row2.getString(row2.getColumnIndexOrThrow("note_content")); final String note_icon = row2.getString(row2.getColumnIndexOrThrow("note_icon")); final String note_attachment = row2.getString(row2.getColumnIndexOrThrow("note_attachment")); final String note_creation = row2.getString(row2.getColumnIndexOrThrow("note_creation")); final Button attachment; final TextView textInput; LayoutInflater inflater = getActivity().getLayoutInflater(); final ViewGroup nullParent = null; final View dialogView = inflater.inflate(R.layout.dialog_note_show, nullParent); final String attName = note_attachment.substring(note_attachment.lastIndexOf("/") + 1); final String att = getString(R.string.app_att) + ": " + attName; attachment = (Button) dialogView.findViewById(R.id.button_att); if (attName.equals("")) { attachment.setVisibility(View.GONE); } else { attachment.setText(att); } textInput = (TextView) dialogView.findViewById(R.id.note_text_input); if (note_content.isEmpty()) { textInput.setVisibility(View.GONE); } else { textInput.setText(note_content); Linkify.addLinks(textInput, Linkify.WEB_URLS); } attachment.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { helper_main.openAtt(getActivity(), textInput, note_attachment); } }); final ImageView be = (ImageView) dialogView.findViewById(R.id.imageButtonPri); final ImageView attImage = (ImageView) dialogView.findViewById(R.id.attImage); File file2 = new File(note_attachment); if (!file2.exists()) { attachment.setVisibility(View.GONE); attImage.setVisibility(View.GONE); } else if (note_attachment.contains(".gif") || note_attachment.contains(".bmp") || note_attachment.contains(".tiff") || note_attachment.contains(".png") || note_attachment.contains(".jpg") || note_attachment.contains(".JPG") || note_attachment.contains(".jpeg") || note_attachment.contains(".mpeg") || note_attachment.contains(".mp4") || note_attachment.contains(".3gp") || note_attachment.contains(".3g2") || note_attachment.contains(".avi") || note_attachment.contains(".flv") || note_attachment.contains(".h261") || note_attachment.contains(".h263") || note_attachment.contains(".h264") || note_attachment.contains(".asf") || note_attachment.contains(".wmv")) { attImage.setVisibility(View.VISIBLE); try { Glide.with(getActivity()).load(note_attachment) // or URI/path .diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true).into(attImage); //imageView to set thumbnail to } catch (Exception e) { Log.w("HHS_Moodle", "Error load thumbnail", e); attImage.setVisibility(View.GONE); } attImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { helper_main.openAtt(getActivity(), attImage, note_attachment); } }); } switch (note_icon) { case "3": be.setImageResource(R.drawable.circle_green); break; case "2": be.setImageResource(R.drawable.circle_yellow); break; case "1": be.setImageResource(R.drawable.circle_red); break; } android.app.AlertDialog.Builder dialog = new android.app.AlertDialog.Builder(getActivity()) .setTitle(note_title).setView(dialogView) .setPositiveButton(R.string.toast_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }).setNegativeButton(R.string.note_edit, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { sharedPref.edit().putString("handleTextTitle", note_title) .putString("handleTextText", note_content) .putString("handleTextIcon", note_icon).putString("handleTextSeqno", _id) .putString("handleTextAttachment", note_attachment) .putString("handleTextCreate", note_creation).apply(); helper_main.switchToActivity(getActivity(), Activity_EditNote.class, false); } }); dialog.show(); } }); 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 note_title = row2.getString(row2.getColumnIndexOrThrow("note_title")); final String note_content = row2.getString(row2.getColumnIndexOrThrow("note_content")); final String note_icon = row2.getString(row2.getColumnIndexOrThrow("note_icon")); final String note_attachment = row2.getString(row2.getColumnIndexOrThrow("note_attachment")); final String note_creation = row2.getString(row2.getColumnIndexOrThrow("note_creation")); final CharSequence[] options = { getString(R.string.number_edit_entry), getString(R.string.bookmark_remove_bookmark), getString(R.string.todo_share), getString(R.string.todo_menu), 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))) { Notes_helper.newNote(getActivity(), note_title, note_content, note_icon, note_attachment, note_creation, _id); } if (options[item].equals(getString(R.string.todo_share))) { File attachment = new File(note_attachment); Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, note_title); sharingIntent.putExtra(Intent.EXTRA_TEXT, note_content); if (attachment.exists()) { Uri bmpUri = Uri.fromFile(attachment); sharingIntent.putExtra(Intent.EXTRA_STREAM, bmpUri); } startActivity(Intent.createChooser(sharingIntent, (getString(R.string.note_share_2)))); } if (options[item].equals(getString(R.string.todo_menu))) { Todo_helper.newTodo(getActivity(), note_title, note_content, getActivity().getString(R.string.note_content)); } if (options[item].equals(getString(R.string.count_create))) { Count_helper.newCount(getActivity(), note_title, note_content, getActivity().getString(R.string.note_content), false); } if (options[item].equals(getString(R.string.bookmark_createEvent))) { helper_main.createCalendarEvent(getActivity(), note_title, note_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)); setNotesList(); } }); snackbar.show(); } } }).show(); return true; } }); }
From source file:com.esri.android.mapsapp.MapFragment.java
/** * Shows the Routing result layout after successful routing * //www. j av a2s . c om * @param time * @param distance * */ private void showRoutingResultLayout(double distance, double time) { // Remove the layours mMapContainer.removeView(mSearchResult); mMapContainer.removeView(mSearchBox); // Inflate the new layout from the xml file mSearchResult = mInflater.inflate(R.layout.routing_result, null); mSearchResult.setLayoutParams(mlayoutParams); // Shorten the start and end location by finding the first comma if // present int index_from = mStartLocation.indexOf(","); int index_to = mEndLocation.indexOf(","); if (index_from != -1) mStartLocation = mStartLocation.substring(0, index_from); if (index_to != -1) mEndLocation = mEndLocation.substring(0, index_to); // Initialize the textvieww and display the text TextView tv_from = (TextView) mSearchResult.findViewById(R.id.tv_from); tv_from.setTypeface(null, Typeface.BOLD); tv_from.setText(" " + mStartLocation); TextView tv_to = (TextView) mSearchResult.findViewById(R.id.tv_to); tv_to.setTypeface(null, Typeface.BOLD); tv_to.setText(" " + mEndLocation); // Rounding off the values distance = Math.round(distance * 10.0) / 10.0; time = Math.round(time * 10.0) / 10.0; TextView tv_time = (TextView) mSearchResult.findViewById(R.id.tv_time); tv_time.setTypeface(null, Typeface.BOLD); tv_time.setText(time + " mins"); TextView tv_dist = (TextView) mSearchResult.findViewById(R.id.tv_dist); tv_dist.setTypeface(null, Typeface.BOLD); tv_dist.setText(" (" + distance + " miles)"); // Adding the layout mMapContainer.addView(mSearchResult); // Setup the listener for the "Cancel" icon ImageView iv_cancel = (ImageView) mSearchResult.findViewById(R.id.imageView3); iv_cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Remove the search result view mMapContainer.removeView(mSearchResult); // Add the default search box view showSearchBoxLayout(); // Remove all graphics from the map resetGraphicsLayers(); } }); // Set up the listener for the "Show Directions" icon ImageView iv_directions = (ImageView) mSearchResult.findViewById(R.id.imageView2); iv_directions.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showDirectionsDialogFragment(); } }); // Add the compass after getting the height of the layout mSearchResult.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { addCompass(mSearchResult.getHeight()); mSearchResult.getViewTreeObserver().removeGlobalOnLayoutListener(this); } }); }
From source file:de.baumann.hhsmoodle.popup.Popup_note.java
private void setNotesList() { //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[] { "note_title", "note_content", "note_creation" }; final String search = sharedPref.getString("filter_note_subject", ""); final Cursor row = db.fetchDataByFilter(search, "note_title"); SimpleCursorAdapter adapter = new SimpleCursorAdapter(Popup_note.this, layoutstyle, row, column, xml_id, 0) {//from w w w . j av a2 s .co m @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 note_title = row2.getString(row2.getColumnIndexOrThrow("note_title")); final String note_content = row2.getString(row2.getColumnIndexOrThrow("note_content")); final String note_icon = row2.getString(row2.getColumnIndexOrThrow("note_icon")); final String note_attachment = row2.getString(row2.getColumnIndexOrThrow("note_attachment")); final String note_creation = row2.getString(row2.getColumnIndexOrThrow("note_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); switch (note_icon) { case "3": iv_icon.setImageResource(R.drawable.circle_green); break; case "2": iv_icon.setImageResource(R.drawable.circle_yellow); break; case "1": iv_icon.setImageResource(R.drawable.circle_red); break; } switch (note_attachment) { case "": iv_attachment.setVisibility(View.GONE); break; default: iv_attachment.setVisibility(View.VISIBLE); iv_attachment.setImageResource(R.drawable.ic_attachment); break; } File file = new File(note_attachment); if (!file.exists()) { iv_attachment.setVisibility(View.GONE); } iv_icon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { final Item[] items = { new Item(getString(R.string.note_priority_0), R.drawable.circle_green), new Item(getString(R.string.note_priority_1), R.drawable.circle_yellow), new Item(getString(R.string.note_priority_2), R.drawable.circle_red), }; ListAdapter adapter = new ArrayAdapter<Item>(Popup_note.this, 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(Popup_note.this) .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), note_title, note_content, "3", note_attachment, note_creation); setNotesList(); } else if (item == 1) { db.update(Integer.parseInt(_id), note_title, note_content, "2", note_attachment, note_creation); setNotesList(); } else if (item == 2) { db.update(Integer.parseInt(_id), note_title, note_content, "1", note_attachment, note_creation); setNotesList(); } } }).show(); } }); iv_attachment.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { helper_main.openAtt(Popup_note.this, lv, note_attachment); } }); return v; } }; lv.setAdapter(adapter); //onClick function lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterview, View view, int position, long id) { Cursor row2 = (Cursor) lv.getItemAtPosition(position); final String _id = row2.getString(row2.getColumnIndexOrThrow("_id")); final String note_title = row2.getString(row2.getColumnIndexOrThrow("note_title")); final String note_content = row2.getString(row2.getColumnIndexOrThrow("note_content")); final String note_icon = row2.getString(row2.getColumnIndexOrThrow("note_icon")); final String note_attachment = row2.getString(row2.getColumnIndexOrThrow("note_attachment")); final String note_creation = row2.getString(row2.getColumnIndexOrThrow("note_creation")); final Button attachment2; final TextView textInput; LayoutInflater inflater = Popup_note.this.getLayoutInflater(); final ViewGroup nullParent = null; final View dialogView = inflater.inflate(R.layout.dialog_note_show, nullParent); final String attName = note_attachment.substring(note_attachment.lastIndexOf("/") + 1); final String att = getString(R.string.app_att) + ": " + attName; attachment2 = (Button) dialogView.findViewById(R.id.button_att); if (attName.equals("")) { attachment2.setVisibility(View.GONE); } else { attachment2.setText(att); } File file2 = new File(note_attachment); if (!file2.exists()) { attachment2.setVisibility(View.GONE); } textInput = (TextView) dialogView.findViewById(R.id.note_text_input); textInput.setText(note_content); Linkify.addLinks(textInput, Linkify.WEB_URLS); attachment2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { helper_main.openAtt(Popup_note.this, lv, note_attachment); } }); final ImageView be = (ImageView) dialogView.findViewById(R.id.imageButtonPri); switch (note_icon) { case "3": be.setImageResource(R.drawable.circle_green); break; case "2": be.setImageResource(R.drawable.circle_yellow); break; case "1": be.setImageResource(R.drawable.circle_red); break; } android.app.AlertDialog.Builder dialog = new android.app.AlertDialog.Builder(Popup_note.this) .setTitle(note_title).setView(dialogView) .setPositiveButton(R.string.toast_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }).setNegativeButton(R.string.note_edit, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { sharedPref.edit().putString("handleTextTitle", note_title) .putString("handleTextText", note_content) .putString("handleTextIcon", note_icon).putString("handleTextSeqno", _id) .putString("handleTextAttachment", note_attachment) .putString("handleTextCreate", note_creation).apply(); helper_main.switchToActivity(Popup_note.this, Activity_EditNote.class, false); } }); dialog.show(); } }); lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { Cursor row2 = (Cursor) lv.getItemAtPosition(position); final String _id = row2.getString(row2.getColumnIndexOrThrow("_id")); final String note_title = row2.getString(row2.getColumnIndexOrThrow("note_title")); final String note_content = row2.getString(row2.getColumnIndexOrThrow("note_content")); final String note_icon = row2.getString(row2.getColumnIndexOrThrow("note_icon")); final String note_attachment = row2.getString(row2.getColumnIndexOrThrow("note_attachment")); final String note_creation = row2.getString(row2.getColumnIndexOrThrow("note_creation")); final CharSequence[] options = { getString(R.string.note_edit), getString(R.string.note_share), getString(R.string.todo_menu), getString(R.string.bookmark_createEvent), getString(R.string.note_remove_note) }; new AlertDialog.Builder(Popup_note.this) .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.note_edit))) { sharedPref.edit().putString("handleTextTitle", note_title) .putString("handleTextText", note_content) .putString("handleTextIcon", note_icon) .putString("handleTextSeqno", _id) .putString("handleTextAttachment", note_attachment) .putString("handleTextCreate", note_creation).apply(); helper_main.switchToActivity(Popup_note.this, Activity_EditNote.class, false); } if (options[item].equals(getString(R.string.note_share))) { File attachment = new File(note_attachment); Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, note_title); sharingIntent.putExtra(Intent.EXTRA_TEXT, note_content); if (attachment.exists()) { Uri bmpUri = Uri.fromFile(attachment); sharingIntent.putExtra(Intent.EXTRA_STREAM, bmpUri); } startActivity(Intent.createChooser(sharingIntent, (getString(R.string.note_share_2)))); } if (options[item].equals(getString(R.string.todo_menu))) { Todo_DbAdapter db = new Todo_DbAdapter(Popup_note.this); db.open(); if (db.isExist(note_title)) { Snackbar.make(lv, getString(R.string.toast_newTitle), Snackbar.LENGTH_LONG) .show(); } else { db.insert(note_title, note_content, "3", "true", helper_main.createDate()); ViewPager viewPager = (ViewPager) Popup_note.this .findViewById(R.id.viewpager); viewPager.setCurrentItem(2); Popup_note.this.setTitle(R.string.todo_title); dialog.dismiss(); } } if (options[item].equals(getString(R.string.bookmark_createEvent))) { Intent calIntent = new Intent(Intent.ACTION_INSERT); calIntent.setType("vnd.android.cursor.item/event"); calIntent.putExtra(CalendarContract.Events.TITLE, note_title); calIntent.putExtra(CalendarContract.Events.DESCRIPTION, note_content); startActivity(calIntent); } if (options[item].equals(getString(R.string.note_remove_note))) { 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)); setNotesList(); } }); snackbar.show(); } } }).show(); return true; } }); if (lv.getAdapter().getCount() == 0) { new android.app.AlertDialog.Builder(this) .setMessage(helper_main.textSpannable(getString(R.string.toast_noEntry))) .setPositiveButton(this.getString(R.string.toast_yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); } }).show(); new Handler().postDelayed(new Runnable() { public void run() { finish(); } }, 2000); } }
From source file:cm.aptoide.pt.ApkInfo.java
/** * *//*from w w w. j av a2 s. c o m*/ private void checkDownloadStatus() { try { download = serviceDownloadManager.callGetAppDownloading(viewApk.hashCode()); } catch (RemoteException e1) { e1.printStackTrace(); } Log.d("Aptoide-ApkInfo", "getAppDownloading: " + download); if (download.getDownloadStatus().equals(EnumDownloadStatus.DOWNLOADING)) { ImageView manage = (ImageView) findViewById(R.id.icon_manage); // manage.setVisibility(View.GONE); manage.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { setupQuickActions(view); } }); try { serviceDownloadManager.callRegisterDownloadObserver(viewApk.hashCode(), serviceDownloadManagerCallback); } catch (RemoteException e) { e.printStackTrace(); } findViewById(R.id.download_progress).setVisibility(View.VISIBLE); // findViewById(R.id.icon_manage).setVisibility(View.VISIBLE); findViewById(R.id.downloading_name).setVisibility(View.INVISIBLE); ((ProgressBar) findViewById(R.id.downloading_progress)).setProgress(download.getProgress()); ((TextView) findViewById(R.id.speed)).setText(download.getSpeedInKBpsString(this)); ((TextView) findViewById(R.id.speed)).setTextColor(Color.WHITE); ((TextView) findViewById(R.id.progress)).setText(download.getProgressString()); ((TextView) findViewById(R.id.progress)).setTextColor(Color.WHITE); } }
From source file:dev.datvt.cloudtracks.sound_cloud.LocalTracksFragment.java
public void showChangeLangDialog() { final Dialog dialog = new Dialog(ctx); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(false);//from w w w. j a v a2 s . c o m dialog.setContentView(R.layout.dialog_create_playlist); final EditText edt = (EditText) dialog.findViewById(R.id.edtInput); final TextView btnCreate = (TextView) dialog.findViewById(R.id.btnCreate); final TextView btnCancel = (TextView) dialog.findViewById(R.id.btnCancel); final ImageView btnDel = (ImageView) dialog.findViewById(R.id.btnDel); btnCreate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ret = edt.getText().toString(); if (ret != null && !ret.isEmpty()) { try { ToolsHelper.createPlaylist(ctx, ret); setUpListPlaylist(); Log.d("CREATE_2", "COMPLETE"); } catch (Exception e) { e.printStackTrace(); } } else { ToolsHelper.toast(ctx, getString(R.string.info_not_name_playlist)); showChangeLangDialog(); } dialog.dismiss(); } }); btnCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ret = null; dialog.cancel(); } }); btnDel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { edt.setText(""); } }); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.show(); }
From source file:com.hichinaschool.flashcards.anki.CardEditor.java
@Override protected Dialog onCreateDialog(int id) { StyledDialog dialog = null;/*w w w. j a v a 2s.co m*/ Resources res = getResources(); StyledDialog.Builder builder = new StyledDialog.Builder(this); switch (id) { case DIALOG_TAGS_SELECT: builder.setTitle(R.string.card_details_tags); builder.setPositiveButton(res.getString(R.string.select), new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (mAddNote) { try { JSONArray ja = new JSONArray(); for (String t : selectedTags) { ja.put(t); } mCol.getModels().current().put("tags", ja); mCol.getModels().setChanged(); } catch (JSONException e) { throw new RuntimeException(e); } mEditorNote.setTags(selectedTags); } mCurrentTags = selectedTags; updateTags(); } }); builder.setNegativeButton(res.getString(R.string.cancel), null); mNewTagEditText = (EditText) new EditText(this); mNewTagEditText.setHint(R.string.add_new_tag); InputFilter filter = new InputFilter() { public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { for (int i = start; i < end; i++) { if (source.charAt(i) == ' ' || source.charAt(i) == ',') { return ""; } } return null; } }; mNewTagEditText.setFilters(new InputFilter[] { filter }); ImageView mAddTextButton = new ImageView(this); mAddTextButton.setImageResource(R.drawable.ic_addtag); mAddTextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String tag = mNewTagEditText.getText().toString(); if (tag.length() != 0) { if (mEditorNote.hasTag(tag)) { mNewTagEditText.setText(""); return; } selectedTags.add(tag); actualizeTagDialog(mTagsDialog); mNewTagEditText.setText(""); } } }); FrameLayout frame = new FrameLayout(this); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.RIGHT | Gravity.CENTER_VERTICAL); params.rightMargin = 10; mAddTextButton.setLayoutParams(params); frame.addView(mNewTagEditText); frame.addView(mAddTextButton); builder.setView(frame, false, true); dialog = builder.create(); mTagsDialog = dialog; break; case DIALOG_DECK_SELECT: ArrayList<CharSequence> dialogDeckItems = new ArrayList<CharSequence>(); // Use this array to know which ID is associated with each // Item(name) final ArrayList<Long> dialogDeckIds = new ArrayList<Long>(); ArrayList<JSONObject> decks = mCol.getDecks().all(); Collections.sort(decks, new JSONNameComparator()); builder.setTitle(R.string.deck); for (JSONObject d : decks) { try { if (d.getInt("dyn") == 0) { dialogDeckItems.add(d.getString("name")); dialogDeckIds.add(d.getLong("id")); } } catch (JSONException e) { throw new RuntimeException(e); } } // Convert to Array String[] items = new String[dialogDeckItems.size()]; dialogDeckItems.toArray(items); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { long newId = dialogDeckIds.get(item); if (mCurrentDid != newId) { if (mAddNote) { try { // TODO: mEditorNote.setDid(newId); mEditorNote.model().put("did", newId); mCol.getModels().setChanged(); } catch (JSONException e) { throw new RuntimeException(e); } } mCurrentDid = newId; updateDeck(); } } }); dialog = builder.create(); mDeckSelectDialog = dialog; break; case DIALOG_MODEL_SELECT: ArrayList<CharSequence> dialogItems = new ArrayList<CharSequence>(); // Use this array to know which ID is associated with each // Item(name) final ArrayList<Long> dialogIds = new ArrayList<Long>(); ArrayList<JSONObject> models = mCol.getModels().all(); Collections.sort(models, new JSONNameComparator()); builder.setTitle(R.string.note_type); for (JSONObject m : models) { try { dialogItems.add(m.getString("name")); dialogIds.add(m.getLong("id")); } catch (JSONException e) { throw new RuntimeException(e); } } // Convert to Array String[] items2 = new String[dialogItems.size()]; dialogItems.toArray(items2); builder.setItems(items2, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { long oldModelId; try { oldModelId = mCol.getModels().current().getLong("id"); } catch (JSONException e) { throw new RuntimeException(e); } long newId = dialogIds.get(item); if (oldModelId != newId) { mCol.getModels().setCurrent(mCol.getModels().get(newId)); JSONObject cdeck = mCol.getDecks().current(); try { cdeck.put("mid", newId); } catch (JSONException e) { throw new RuntimeException(e); } mCol.getDecks().save(cdeck); int size = mEditFields.size(); String[] oldValues = new String[size]; for (int i = 0; i < size; i++) { oldValues[i] = mEditFields.get(i).getText().toString(); } setNote(); resetEditFields(oldValues); mTimerHandler.removeCallbacks(checkDuplicatesRunnable); duplicateCheck(false); } } }); dialog = builder.create(); break; case DIALOG_RESET_CARD: builder.setTitle(res.getString(R.string.reset_card_dialog_title)); builder.setMessage(res.getString(R.string.reset_card_dialog_message)); builder.setPositiveButton(res.getString(R.string.yes), new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // for (long cardId : // mDeck.getCardsFromFactId(mEditorNote.getId())) { // mDeck.cardFromId(cardId).resetCard(); // } // mDeck.reset(); // setResult(Reviewer.RESULT_EDIT_CARD_RESET); // mCardReset = true; // Themes.showThemedToast(CardEditor.this, // getResources().getString( // R.string.reset_card_dialog_confirmation), true); } }); builder.setNegativeButton(res.getString(R.string.no), null); builder.setCancelable(true); dialog = builder.create(); break; case DIALOG_INTENT_INFORMATION: dialog = createDialogIntentInformation(builder, res); } return dialog; }
From source file:com.nextgis.mobile.MapFragment.java
protected void addMapButtons(RelativeLayout rl) { mivZoomIn = new ImageView(getActivity()); mivZoomIn.setImageResource(R.drawable.ic_plus); //mivZoomIn.setId(R.drawable.ic_plus); mivZoomOut = new ImageView(getActivity()); mivZoomOut.setImageResource(R.drawable.ic_minus); //mivZoomOut.setId(R.drawable.ic_minus); final ImageView ivMark = new ImageView(getActivity()); ivMark.setImageResource(R.drawable.ic_mark); //ivMark.setId(R.drawable.ic_mark); //show zoom level between plus and minus mivZoomLevel = new TextView(getActivity()); //ivZoomLevel.setAlpha(150); mivZoomLevel.setId(R.drawable.ic_zoomlevel); final float scale = getResources().getDisplayMetrics().density; int pixels = (int) (48 * scale + 0.5f); mivZoomLevel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30); //ivZoomLevel.setTextAppearance(this, android.R.attr.textAppearanceLarge); mivZoomLevel.setWidth(pixels);//from w w w. j a v a2 s. c om mivZoomLevel.setHeight(pixels); mivZoomLevel.setTextColor(Color.DKGRAY); mivZoomLevel.setBackgroundColor(Color.argb(50, 128, 128, 128)); //Color.LTGRAY R.drawable.ic_zoomlevel); mivZoomLevel.setGravity(Gravity.CENTER); mivZoomLevel.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); mivZoomLevel.setText("" + (int) Math.floor(mMap.getZoomLevel())); mivZoomIn.setOnClickListener(new OnClickListener() { public void onClick(View v) { mMap.zoomIn(); } }); mivZoomOut.setOnClickListener(new OnClickListener() { public void onClick(View v) { mMap.zoomOut(); } }); ivMark.setOnClickListener(new OnClickListener() { public void onClick(View v) { //TODO: onMark(); } }); final RelativeLayout.LayoutParams RightParams1 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); RightParams1.setMargins(mMargings + 5, mMargings - 5, mMargings + 5, mMargings - 5); RightParams1.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); RightParams1.addRule(RelativeLayout.CENTER_IN_PARENT);//ALIGN_PARENT_TOP rl.addView(mivZoomLevel, RightParams1); final RelativeLayout.LayoutParams RightParams4 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); RightParams4.setMargins(mMargings + 5, mMargings - 5, mMargings + 5, mMargings - 5); RightParams4.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); RightParams4.addRule(RelativeLayout.ABOVE, R.drawable.ic_zoomlevel);//ALIGN_PARENT_TOP rl.addView(mivZoomIn, RightParams4); final RelativeLayout.LayoutParams RightParams3 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); RightParams3.setMargins(mMargings + 5, mMargings - 5, mMargings + 5, mMargings - 5); RightParams3.addRule(RelativeLayout.ALIGN_PARENT_LEFT); RightParams3.addRule(RelativeLayout.CENTER_IN_PARENT);//ALIGN_PARENT_TOP rl.addView(ivMark, RightParams3); final RelativeLayout.LayoutParams RightParams2 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); RightParams2.setMargins(mMargings + 5, mMargings - 5, mMargings + 5, mMargings - 5); RightParams2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); RightParams2.addRule(RelativeLayout.BELOW, R.drawable.ic_zoomlevel);//R.drawable.ic_plus); rl.addView(mivZoomOut, RightParams2); setZoomInEnabled(mMap.canZoomIn()); setZoomOutEnabled(mMap.canZoomOut()); }
From source file:com.fanxin.app.main.fragment.MainActivity.java
/** * init views/* w ww. j a v a2 s. c o m*/ */ private void initView() { unreadLabel = (TextView) findViewById(R.id.unread_msg_number); unreadAddressLable = (TextView) findViewById(R.id.unread_address_number); mTabs = new Button[4]; mTabs[0] = (Button) findViewById(R.id.btn_conversation); mTabs[1] = (Button) findViewById(R.id.btn_address_list); mTabs[2] = (Button) findViewById(R.id.btn_find); mTabs[3] = (Button) findViewById(R.id.btn_profile); // select first tab mTabs[0].setSelected(true); final ImageView ivAdd = (ImageView) findViewById(R.id.iv_add); final FXPopWindow fxPopWindow = new FXPopWindow(this, R.layout.fx_popupwindow_add, new FXPopWindow.OnItemClickListener() { @Override public void onClick(int position) { switch (position) { //?? case 0: startActivity(new Intent(MainActivity.this, GroupAddMembersActivity.class)); break; //? case 1: startActivity(new Intent(MainActivity.this, AddFriendsPreActivity.class)); break; // case 2: startActivity(new Intent(MainActivity.this, ScanCaptureActivity.class)); break; //??? case 3: break; } } }); ivAdd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { fxPopWindow.showPopupWindow(ivAdd); } }); }
From source file:com.mishiranu.dashchan.ui.navigator.page.PostsPage.java
@Override protected void onCreate() { Activity activity = getActivity();/*from ww w. j a v a 2s . c o m*/ PullableListView listView = getListView(); PageHolder pageHolder = getPageHolder(); UiManager uiManager = getUiManager(); hidePerformer = new HidePerformer(); PostsExtra extra = getExtra(); listView.setDivider(ResourceUtils.getDrawable(activity, R.attr.postsDivider, 0)); ChanConfiguration.Board board = getChanConfiguration().safe().obtainBoard(pageHolder.boardName); if (board.allowPosting) { replyable = data -> getUiManager().navigator().navigatePosting(pageHolder.chanName, pageHolder.boardName, pageHolder.threadNumber, data); } PostsAdapter adapter = new PostsAdapter(activity, pageHolder.chanName, pageHolder.boardName, uiManager, replyable, hidePerformer, extra.userPostNumbers, listView); initAdapter(adapter, adapter); ImageLoader.getInstance().observable().register(this); listView.getWrapper().setPullSides(PullableWrapper.Side.BOTH); uiManager.observable().register(this); hidePerformer.setPostsProvider(adapter); Context darkStyledContext = new ContextThemeWrapper(activity, R.style.Theme_General_Main_Dark); searchController = new LinearLayout(darkStyledContext); searchController.setOrientation(LinearLayout.HORIZONTAL); searchController.setGravity(Gravity.CENTER_VERTICAL); float density = ResourceUtils.obtainDensity(getResources()); int padding = (int) (10f * density); searchTextResult = new Button(darkStyledContext, null, android.R.attr.borderlessButtonStyle); searchTextResult.setTextSize(11f); if (!C.API_LOLLIPOP) { searchTextResult.setTypeface(null, Typeface.BOLD); } searchTextResult.setPadding((int) (14f * density), 0, (int) (14f * density), 0); searchTextResult.setMinimumWidth(0); searchTextResult.setMinWidth(0); searchTextResult.setOnClickListener(v -> showSearchDialog()); searchController.addView(searchTextResult, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); ImageView backButtonView = new ImageView(darkStyledContext, null, android.R.attr.borderlessButtonStyle); backButtonView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); backButtonView.setImageResource(obtainIcon(R.attr.actionBack)); backButtonView.setPadding(padding, padding, padding, padding); backButtonView.setOnClickListener(v -> findBack()); searchController.addView(backButtonView, (int) (48f * density), (int) (48f * density)); ImageView forwardButtonView = new ImageView(darkStyledContext, null, android.R.attr.borderlessButtonStyle); forwardButtonView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); forwardButtonView.setImageResource(obtainIcon(R.attr.actionForward)); forwardButtonView.setPadding(padding, padding, padding, padding); forwardButtonView.setOnClickListener(v -> findForward()); searchController.addView(forwardButtonView, (int) (48f * density), (int) (48f * density)); if (C.API_LOLLIPOP) { for (int i = 0, last = searchController.getChildCount() - 1; i <= last; i++) { View view = searchController.getChildAt(i); LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) view.getLayoutParams(); if (i == 0) { layoutParams.leftMargin = (int) (-6f * density); } if (i == last) { layoutParams.rightMargin = (int) (6f * density); } else { layoutParams.rightMargin = (int) (-6f * density); } } } scrollToPostNumber = pageHolder.initialPostNumber; FavoritesStorage.getInstance().getObservable().register(this); LocalBroadcastManager.getInstance(activity).registerReceiver(galleryPagerReceiver, new IntentFilter(C.ACTION_GALLERY_NAVIGATE_POST)); boolean hasNewPostDatas = handleNewPostDatas(); extra.forceRefresh = hasNewPostDatas || !pageHolder.initialFromCache; if (extra.cachedPosts != null && extra.cachedPostItems.size() > 0) { onDeserializePostsCompleteInternal(true, extra.cachedPosts, new ArrayList<>(extra.cachedPostItems), true); } else { deserializeTask = new DeserializePostsTask(this, pageHolder.chanName, pageHolder.boardName, pageHolder.threadNumber, extra.cachedPosts); deserializeTask.executeOnExecutor(DeserializePostsTask.THREAD_POOL_EXECUTOR); getListView().getWrapper().startBusyState(PullableWrapper.Side.BOTH); switchView(ViewType.PROGRESS, null); } pageHolder.setInitialPostsData(false, null); }
From source file:com.mishiranu.dashchan.ui.navigator.DrawerForm.java
public DrawerForm(Context context, Context unstyledContext, Callback callback, WatcherService.Client watcherServiceClient) { this.context = context; this.unstyledContext = unstyledContext; this.callback = callback; this.watcherServiceClient = watcherServiceClient; float density = ResourceUtils.obtainDensity(context); LinearLayout linearLayout = new LinearLayout(context); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.setLayoutParams(new SortableListView.LayoutParams(SortableListView.LayoutParams.MATCH_PARENT, SortableListView.LayoutParams.WRAP_CONTENT)); LinearLayout editTextContainer = new LinearLayout(context); editTextContainer.setGravity(Gravity.CENTER_VERTICAL); linearLayout.addView(editTextContainer); searchEdit = new SafePasteEditText(context); searchEdit.setOnKeyListener((v, keyCode, event) -> { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { v.clearFocus();// w ww . j a v a 2s . c o m } return false; }); searchEdit.setHint(context.getString(R.string.text_code_number_address)); searchEdit.setOnEditorActionListener(this); searchEdit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); searchEdit.setImeOptions(EditorInfo.IME_ACTION_GO | EditorInfo.IME_FLAG_NO_EXTRACT_UI); ImageView searchIcon = new ImageView(context, null, android.R.attr.buttonBarButtonStyle); searchIcon.setImageResource(ResourceUtils.getResourceId(context, R.attr.buttonForward, 0)); searchIcon.setScaleType(ImageView.ScaleType.CENTER); searchIcon.setOnClickListener(this); editTextContainer.addView(searchEdit, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1)); editTextContainer.addView(searchIcon, (int) (40f * density), (int) (40f * density)); if (C.API_LOLLIPOP) { editTextContainer.setPadding((int) (12f * density), (int) (8f * density), (int) (8f * density), 0); } else { editTextContainer.setPadding(0, (int) (2f * density), (int) (4f * density), (int) (2f * density)); } LinearLayout selectorContainer = new LinearLayout(context); selectorContainer.setBackgroundResource( ResourceUtils.getResourceId(context, android.R.attr.selectableItemBackground, 0)); selectorContainer.setOrientation(LinearLayout.HORIZONTAL); selectorContainer.setGravity(Gravity.CENTER_VERTICAL); selectorContainer.setOnClickListener(v -> { hideKeyboard(); setChanSelectMode(!chanSelectMode); }); linearLayout.addView(selectorContainer); selectorContainer.setMinimumHeight((int) (40f * density)); if (C.API_LOLLIPOP) { selectorContainer.setPadding((int) (16f * density), 0, (int) (16f * density), 0); ((LinearLayout.LayoutParams) selectorContainer.getLayoutParams()).topMargin = (int) (4f * density); } else { selectorContainer.setPadding((int) (8f * density), 0, (int) (12f * density), 0); } chanNameView = new TextView(context, null, android.R.attr.textAppearanceListItem); chanNameView.setTextSize(TypedValue.COMPLEX_UNIT_SP, C.API_LOLLIPOP ? 14f : 16f); if (C.API_LOLLIPOP) { chanNameView.setTypeface(GraphicsUtils.TYPEFACE_MEDIUM); } else { chanNameView.setFilters(new InputFilter[] { new InputFilter.AllCaps() }); } selectorContainer.addView(chanNameView, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1)); chanSelectorIcon = new ImageView(context); chanSelectorIcon.setImageResource(ResourceUtils.getResourceId(context, R.attr.buttonDropDownDrawer, 0)); selectorContainer.addView(chanSelectorIcon, (int) (24f * density), (int) (24f * density)); ((LinearLayout.LayoutParams) chanSelectorIcon.getLayoutParams()).gravity = Gravity.CENTER_VERTICAL | Gravity.END; headerView = linearLayout; inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); chans.add(new ListItem(ListItem.ITEM_DIVIDER, 0, 0, null)); int color = ResourceUtils.getColor(context, R.attr.drawerIconColor); ChanManager manager = ChanManager.getInstance(); Collection<String> availableChans = manager.getAvailableChanNames(); for (String chanName : availableChans) { ChanConfiguration configuration = ChanConfiguration.get(chanName); if (configuration.getOption(ChanConfiguration.OPTION_READ_POSTS_COUNT)) { watcherSupportSet.add(chanName); } Drawable drawable = manager.getIcon(chanName, color); chanIcons.put(chanName, drawable); chans.add( new ListItem(ListItem.ITEM_CHAN, chanName, null, null, configuration.getTitle(), 0, drawable)); } if (availableChans.size() == 1) { selectorContainer.setVisibility(View.GONE); } }