List of usage examples for android.widget ImageView setVisibility
@RemotableViewMethod @Override public void setVisibility(int visibility)
From source file:li.klass.fhem.adapter.devices.genericui.AvailableTargetStatesDialogUtil.java
public static <D extends FhemDevice<D>> void showSwitchOptionsMenu(final Context context, final D device, final TargetStateSelectedCallback callback) { AlertDialog.Builder contextMenu = new AlertDialog.Builder(context); contextMenu.setTitle(context.getResources().getString(R.string.switchDevice)); final List<String> setOptions = device.getSetList().getSortedKeys(); final String[] eventMapOptions = device.getAvailableTargetStatesEventMapTexts(); DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() { @Override/* w ww .j av a2 s.c o m*/ public void onClick(DialogInterface dialog, int position) { final String option = setOptions.get(position); if (handleSelectedOption(context, device, option, callback)) return; dialog.dismiss(); } }; ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, R.layout.list_item_with_arrow, eventMapOptions) { @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = View.inflate(context, R.layout.list_item_with_arrow, null); } TextView textView = (TextView) convertView.findViewById(R.id.text); ImageView imageView = (ImageView) convertView.findViewById(R.id.image); textView.setText(getItem(position)); String setOption = setOptions.get(position); SetList setList = device.getSetList(); final SetListValue setListValue = setList.get(setOption); imageView.setVisibility(setListValue instanceof SetListGroupValue ? VISIBLE : GONE); return convertView; } }; contextMenu.setAdapter(adapter, clickListener); contextMenu.show(); }
From source file:com.todoroo.astrid.notes.EditNoteActivity.java
private static void setupImagePopupForCommentView(View view, ImageView commentPictureView, final Uri updateBitmap, final Fragment fragment) { if (updateBitmap != null) { //$NON-NLS-1$ commentPictureView.setVisibility(View.VISIBLE); String path = getPathFromUri(fragment.getActivity(), updateBitmap); commentPictureView.setImageBitmap(sampleBitmap(path, commentPictureView.getLayoutParams().width, commentPictureView.getLayoutParams().height)); view.setOnClickListener(new OnClickListener() { @Override//from w w w . j av a2 s .c o m public void onClick(View v) { fragment.startActivity(new Intent(Intent.ACTION_VIEW) { { setDataAndType(updateBitmap, "image/*"); } }); } }); } else { commentPictureView.setVisibility(View.GONE); } }
From source file:edu.stanford.mobisocial.dungbeetle.model.DbObject.java
/** * @param v the view to bind/*from w w w . j ava 2s . co m*/ * @param context standard activity context * @param c the cursor source for the object in the db object table. * Must include _id in the projection. * * @param allowInteractions controls whether the bound view is * allowed to intercept touch events and do its own processing. */ public static void bindView(View v, final Context context, Cursor cursor, boolean allowInteractions) { TextView nameText = (TextView) v.findViewById(R.id.name_text); ViewGroup frame = (ViewGroup) v.findViewById(R.id.object_content); frame.removeAllViews(); // make sure we have all the columns we need Long objId = cursor.getLong(cursor.getColumnIndexOrThrow(DbObj.COL_ID)); String[] projection = null; String selection = DbObj.COL_ID + " = ?"; String[] selectionArgs = new String[] { Long.toString(objId) }; String sortOrder = null; Cursor c = context.getContentResolver().query(DbObj.OBJ_URI, projection, selection, selectionArgs, sortOrder); if (!c.moveToFirst()) { Log.w(TAG, "could not find obj " + objId); c.close(); return; } DbObj obj = App.instance().getMusubi().objForCursor(c); if (obj == null) { nameText.setText("Failed to access database."); Log.e("DbObject", "cursor was null for bindView of DbObject"); return; } DbUser sender = obj.getSender(); Long timestamp = c.getLong(c.getColumnIndexOrThrow(DbObj.COL_TIMESTAMP)); Long hash = obj.getHash(); short deleted = c.getShort(c.getColumnIndexOrThrow(DELETED)); String feedName = obj.getFeedName(); String type = obj.getType(); Date date = new Date(timestamp); c.close(); c = null; if (sender == null) { nameText.setText("Message from unknown contact."); return; } nameText.setText(sender.getName()); final ImageView icon = (ImageView) v.findViewById(R.id.icon); if (sViewProfileAction == null) { sViewProfileAction = new OnClickViewProfile((Activity) context); } icon.setTag(sender.getLocalId()); if (allowInteractions) { icon.setOnClickListener(sViewProfileAction); v.setTag(objId); } icon.setImageBitmap(sender.getPicture()); if (deleted == 1) { v.setBackgroundColor(sDeletedColor); } else { v.setBackgroundColor(Color.TRANSPARENT); } TextView timeText = (TextView) v.findViewById(R.id.time_text); timeText.setText(RelativeDate.getRelativeDate(date)); frame.setTag(objId); // TODO: error prone! This is database id frame.setTag(R.id.object_entry, cursor.getPosition()); // this is cursor id FeedRenderer renderer = DbObjects.getFeedRenderer(type); if (renderer != null) { renderer.render(context, frame, obj, allowInteractions); } if (!allowInteractions) { v.findViewById(R.id.obj_attachments_icon).setVisibility(View.GONE); v.findViewById(R.id.obj_attachments).setVisibility(View.GONE); } else { if (!MusubiBaseActivity.isDeveloperModeEnabled(context)) { v.findViewById(R.id.obj_attachments_icon).setVisibility(View.GONE); v.findViewById(R.id.obj_attachments).setVisibility(View.GONE); } else { ImageView attachmentCountButton = (ImageView) v.findViewById(R.id.obj_attachments_icon); TextView attachmentCountText = (TextView) v.findViewById(R.id.obj_attachments); attachmentCountButton.setVisibility(View.VISIBLE); if (hash == 0) { attachmentCountButton.setVisibility(View.GONE); } else { //int color = DbObject.colorFor(hash); boolean selfPost = false; DBHelper helper = new DBHelper(context); try { Cursor attachments = obj.getSubfeed().query("type=?", new String[] { LikeObj.TYPE }); try { attachmentCountText.setText("+" + attachments.getCount()); if (attachments.moveToFirst()) { while (!attachments.isAfterLast()) { if (attachments.getInt(attachments.getColumnIndex(CONTACT_ID)) == -666) { selfPost = true; break; } attachments.moveToNext(); } } } finally { attachments.close(); } } finally { helper.close(); } if (selfPost) { attachmentCountButton.setImageResource(R.drawable.ic_menu_love_red); } else { attachmentCountButton.setImageResource(R.drawable.ic_menu_love); } attachmentCountText.setTag(R.id.object_entry, hash); attachmentCountText.setTag(R.id.feed_label, Feed.uriForName(feedName)); attachmentCountText.setOnClickListener(LikeListener.getInstance(context)); } } } }
From source file:jahirfiquitiva.iconshowcase.fragments.WallpapersFragment.java
private static void hideStuff(ImageView noConnection) { if (mRecyclerView.getAdapter() != null) { fastScroller = (RecyclerFastScroller) layout.findViewById(R.id.rvFastScroller); fastScroller.attachRecyclerView(mRecyclerView); }/*from w w w .j a va 2s .co m*/ hideProgressBar(); if (noConnection != null) { noConnection.setVisibility(View.VISIBLE); } mRecyclerView.setVisibility(View.GONE); fastScroller.setVisibility(View.GONE); mSwipeRefreshLayout.setEnabled(false); mSwipeRefreshLayout.setRefreshing(false); }
From source file:com.mobicage.rogerthat.util.ui.UIUtils.java
public static boolean showHintWithImage(final Activity activity, final MainService mainService, final SafeRunnable onDismissHandler, final String hintCode, final FontAwesome.Icon hintIcon, final int hintResource, final Object... args) { final ConfigurationProvider configurationProvider = mainService.getConfigurationProvider(); final String configkey = "HINT_REPOSITORY"; final com.mobicage.rogerthat.config.Configuration config = configurationProvider .getConfiguration(configkey); if (config.get(hintCode, false)) return false; LayoutInflater inflater = activity.getLayoutInflater(); final View checkboxLayout = inflater.inflate(R.layout.hint, null); final TextView message = (TextView) checkboxLayout.findViewById(R.id.message); final CheckBox checkBox = (CheckBox) checkboxLayout.findViewById(R.id.checkBox); if (hintIcon != null) { final ImageView icon = (ImageView) checkboxLayout.findViewById(R.id.icon); icon.setImageDrawable(new IconicsDrawable(activity, hintIcon).color(Color.DKGRAY).sizeDp(30)); icon.setVisibility(View.VISIBLE); }/* ww w .j a v a 2 s. co m*/ Resources resources = activity.getResources(); message.setText(resources.getString(hintResource, args)); AlertDialog dialog = new AlertDialog.Builder(activity) .setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { if (onDismissHandler != null) { onDismissHandler.run(); } } }).setTitle(R.string.activity_hint).setView(checkboxLayout).setPositiveButton( resources.getString(R.string.activity_close_hint), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (checkBox.isChecked()) { config.put(hintCode, true); configurationProvider.updateConfigurationNow(configkey, config); } if (onDismissHandler != null) { onDismissHandler.run(); } } }) .create(); dialog.show(); int buttonId = mainService.getResources().getIdentifier("android:id/button1", null, null); ((Button) dialog.findViewById(buttonId)).setTextColor(LookAndFeelConstants.getPrimaryColor(activity)); return true; }
From source file:cw.kop.autobackground.tutorial.ImageFragment.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.tutorial_image_fragment, container, false); int colorFilterInt = AppSettings.getColorFilterInt(appContext); TextView titleText = (TextView) view.findViewById(R.id.title_text); titleText.setTextColor(colorFilterInt); titleText.setText("Wallpaper layout"); TextView tutorialText = (TextView) view.findViewById(R.id.tutorial_text); tutorialText.setTextColor(colorFilterInt); tutorialText.setText("Would you like to use a single image or double image layout?"); final ImageView deviceImage = (ImageView) view.findViewById(R.id.device_image); deviceImage.setVisibility(AppSettings.useDoubleImage() ? View.INVISIBLE : View.VISIBLE); final ImageView deviceDoubleImage = (ImageView) view.findViewById(R.id.device_double_image); deviceDoubleImage.setVisibility(AppSettings.useDoubleImage() ? View.VISIBLE : View.INVISIBLE); Button singleButton = (Button) view.findViewById(R.id.single_button); singleButton.setText("Single"); singleButton.setOnClickListener(new View.OnClickListener() { @Override//from w w w. j a va 2 s . c o m public void onClick(View v) { AppSettings.setUseDoubleImage(false); deviceImage.setVisibility(View.VISIBLE); deviceDoubleImage.setVisibility(View.INVISIBLE); } }); Button doubleButton = (Button) view.findViewById(R.id.double_button); doubleButton.setText("Double"); doubleButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AppSettings.setUseDoubleImage(true); deviceDoubleImage.setVisibility(View.VISIBLE); deviceImage.setVisibility(View.INVISIBLE); } }); return view; }
From source file:org.amahi.anywhere.tv.presenter.IconHeaderPresenter.java
@Override public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) { HeaderItem headerItem = ((ListRow) item).getHeaderItem(); View rootView = viewHolder.view; rootView.setFocusable(true);//from www . j a va2s . co m ImageView imageView = rootView.findViewById(R.id.header_icon); if (headerItem.getName().matches("Settings")) { imageView.setVisibility(View.VISIBLE); Drawable icon = ContextCompat.getDrawable(rootView.getContext(), R.drawable.ic_menu_settings); imageView.setImageDrawable(icon); } else { imageView.setVisibility(View.GONE); TextView label = rootView.findViewById(R.id.header_label); label.setTextColor(Color.WHITE); label.setText(headerItem.getName()); } }
From source file:com.ihandy.a2014011373.manage_category.ItemAdapter.java
@Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { final View view = LayoutInflater.from(parent.getContext()).inflate(mLayoutId, parent, false); ImageView image = (ImageView) view.findViewById(R.id.image); if (!isWatched) image.setVisibility(View.INVISIBLE); Button button = (Button) view.findViewById(R.id.button); button.setTag(getItemId(count));// w w w . j a va 2 s.c om count++; button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { CategoryTab categoryTab = (CategoryTab) removeItem(getPositionForItemId((long) v.getTag())); anotherAdapter.addItem(0, categoryTab); activity.fragmentChanged(); //Toast.makeText(v.getContext(), " " + v.getTag(), Toast.LENGTH_SHORT).show();getPositionForItemId((long) v.getTag()) } }); return new ViewHolder(view); }
From source file:net.line2soft.preambul.controllers.ExcursionInfoListener.java
@Override public void onPageSelected(int arg0) { //Change visibility of these buttons ImageView right = (ImageView) activity.findViewById(R.id.imageRight); ImageView left = (ImageView) activity.findViewById(R.id.imageLeft); left.setVisibility(View.VISIBLE); right.setVisibility(View.VISIBLE); int idPhoto = ((ViewPager) activity.findViewById(R.id.pager_images)).getCurrentItem(); int nbPhotos = activity.getImagesFile().length; if (idPhoto == 0) { left.setVisibility(View.INVISIBLE); }//from www. ja va 2 s . c o m if (idPhoto == nbPhotos - 1) { right.setVisibility(View.INVISIBLE); } }
From source file:com.freshdigitable.udonroad.ffab.ActionIndicatorView.java
public void onActionLeave(Direction direction) { if (direction == Direction.UNDEFINED) { return;//from w w w . ja va2 s . co m } if (direction.isOnAxis()) { resetViewTransforms(direction); } else { for (Direction d : direction.getBothNeighbor()) { resetViewTransforms(d); } } for (Direction d : icons.keySet()) { setDrawable(d, drawables.get(d)); } for (ImageView ic : icons.values()) { ic.setVisibility(VISIBLE); } }