List of usage examples for android.widget ImageView setVisibility
@RemotableViewMethod @Override public void setVisibility(int visibility)
From source file:com.aapbd.utils.image.CacheImageDownloader.java
/** * Same as download but the image is always downloaded and the cache is not * used. Kept private at the moment as its interest is not clear. *//*from ww w .ja v a 2s .c om*/ private void forceDownload(final String url, final ImageView imageView, final String cookie) { // State sanity: url is guaranteed to never be null in // DownloadedDrawable and cache keys. if (url == null) { imageView.setImageDrawable(null); imageView.setVisibility(View.GONE); return; } if (cancelPotentialDownload(url, imageView)) { final BitmapDownloaderTask task = new BitmapDownloaderTask(imageView); final DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task); imageView.setImageDrawable(downloadedDrawable); task.execute(url, cookie); } }
From source file:com.example.rartonne.appftur.HomeActivity.java
public void setPastilles() { //on affiche ou non les pastilles if (checkJob == false) { ImageView imgView = (ImageView) findViewById(R.id.pastille_ok_job); imgView.setVisibility(View.INVISIBLE); } else {//from w ww.j av a 2 s .com ImageView imgView = (ImageView) findViewById(R.id.pastille_ok_job); imgView.setVisibility(View.VISIBLE); } if (checkInstallation == false) { ImageView imgView = (ImageView) findViewById(R.id.pastille_ok_installation); imgView.setVisibility(View.INVISIBLE); } else { ImageView imgView = (ImageView) findViewById(R.id.pastille_ok_installation); imgView.setVisibility(View.VISIBLE); } if (checkGeo == false) { ImageView imgView = (ImageView) findViewById(R.id.pastille_ok_gps); imgView.setVisibility(View.INVISIBLE); } else { ImageView imgView = (ImageView) findViewById(R.id.pastille_ok_gps); imgView.setVisibility(View.VISIBLE); } if (checkWelding == false) { ImageView imgView = (ImageView) findViewById(R.id.pastille_ok_welding); imgView.setVisibility(View.INVISIBLE); } else { ImageView imgView = (ImageView) findViewById(R.id.pastille_ok_welding); imgView.setVisibility(View.VISIBLE); } if (checkPictures == false) { ImageView imgView = (ImageView) findViewById(R.id.pastille_ok_picture); imgView.setVisibility(View.INVISIBLE); } else { ImageView imgView = (ImageView) findViewById(R.id.pastille_ok_picture); imgView.setVisibility(View.VISIBLE); } if (checkComment == false) { ImageView imgView = (ImageView) findViewById(R.id.pastille_ok_comment); imgView.setVisibility(View.INVISIBLE); } else { ImageView imgView = (ImageView) findViewById(R.id.pastille_ok_comment); imgView.setVisibility(View.VISIBLE); } }
From source file:com.odoo.OdooActivity.java
private void setupAccountBox() { mDrawerAccountContainer = (LinearLayout) findViewById(R.id.accountList); View chosenAccountView = findViewById(R.id.drawerAccountView); OUser currentUser = OUser.current(this); if (currentUser == null) { chosenAccountView.setVisibility(View.GONE); mDrawerAccountContainer.setVisibility(View.GONE); return;//from w w w.j a v a 2s . co m } else { chosenAccountView.setVisibility(View.VISIBLE); mDrawerAccountContainer.setVisibility(View.INVISIBLE); } ImageView avatar = (ImageView) chosenAccountView.findViewById(R.id.profile_image); TextView name = (TextView) chosenAccountView.findViewById(R.id.profile_name_text); TextView url = (TextView) chosenAccountView.findViewById(R.id.profile_url_text); name.setText(currentUser.getName()); url.setText((currentUser.isOAuthLogin()) ? currentUser.getInstanceURL() : currentUser.getHost()); if (!currentUser.getAvatar().equals("false")) { Bitmap bitmap = BitmapUtils.getBitmapImage(this, currentUser.getAvatar()); if (bitmap != null) avatar.setImageBitmap(bitmap); } // Setting Accounts List<OUser> accounts = OdooAccountManager.getAllAccounts(this); if (accounts.size() > 0) { chosenAccountView.setEnabled(true); ImageView boxIndicator = (ImageView) findViewById(R.id.expand_account_box_indicator); boxIndicator.setVisibility(View.VISIBLE); chosenAccountView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mAccountBoxExpanded = !mAccountBoxExpanded; accountBoxToggle(); } }); populateAccountList(currentUser, accounts); } }
From source file:com.odoo.addons.notes.Notes.java
private void bindRowControls(final View view, final ODataRow row) { ImageView imgMove = (ImageView) view.findViewById(R.id.note_move); if (mCurrentKey != Type.Notes) imgMove.setVisibility(View.GONE); imgMove.setOnClickListener(new View.OnClickListener() { @Override/* ww w . j a v a 2s.c o m*/ public void onClick(View v) { moveTo(row.getInt(OColumn.ROW_ID), row); } }); }
From source file:org.weyoung.xianbicycle.BaseActivity.java
private View makeNavDrawerItem(final int itemId, ViewGroup container) { boolean selected = getCurrentNavDrawerItem() == itemId; int layoutToInflate; if (itemId == NAVDRAWER_ITEM_SEPARATOR) { layoutToInflate = R.layout.navdrawer_separator; } else {/* w w w . j a v a 2s. c o m*/ layoutToInflate = R.layout.navdrawer_item; } View view = getLayoutInflater().inflate(layoutToInflate, container, false); if (itemId == NAVDRAWER_ITEM_SEPARATOR) { // we are done return view; } ImageView iconView = (ImageView) view.findViewById(R.id.icon); TextView titleView = (TextView) view.findViewById(R.id.title); int iconId = itemId >= 0 && itemId < NAVDRAWER_ICON_RES_ID.length ? NAVDRAWER_ICON_RES_ID[itemId] : 0; int titleId = itemId >= 0 && itemId < NAVDRAWER_TITLE_RES_ID.length ? NAVDRAWER_TITLE_RES_ID[itemId] : 0; // set icon and text iconView.setVisibility(iconId > 0 ? View.VISIBLE : View.GONE); if (iconId > 0) { iconView.setImageResource(iconId); } titleView.setText(getString(titleId)); formatNavDrawerItem(view, itemId, selected); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onNavDrawerItemClicked(itemId); } }); return view; }
From source file:com.layer.atlas.messenger.AtlasMessagesScreen.java
private void prepareActionBar() { ImageView menuBtn = (ImageView) findViewById(R.id.atlas_actionbar_left_btn); menuBtn.setImageResource(R.drawable.atlas_ctl_btn_back); menuBtn.setVisibility(View.VISIBLE); menuBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { finish();//w ww.j a v a 2 s. c o m } }); ((TextView) findViewById(R.id.atlas_actionbar_title_text)).setText("Messages"); ((TextView) findViewById(R.id.atlas_actionbar_title_text)).setOnClickListener(new OnClickListener() { public void onClick(View v) { messagesList.requestRefreshValues(true, false); } }); ImageView settingsBtn = (ImageView) findViewById(R.id.atlas_actionbar_right_btn); settingsBtn.setImageResource(R.drawable.atlas_ctl_btn_detail); settingsBtn.setVisibility(View.VISIBLE); settingsBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (conv == null) return; AtlasConversationSettingsScreen.conv = conv; Intent intent = new Intent(v.getContext(), AtlasConversationSettingsScreen.class); startActivityForResult(intent, REQUEST_CODE_SETTINGS); } }); Tools.setStatusBarColor(getWindow(), getResources().getColor(R.color.atlas_background_blue_dark)); }
From source file:de.baumann.hhsmoodle.data_random.Random_Fragment.java
private void setRandomList() { if (isFABOpen) { closeFABMenu();//from w w w .j a v a 2s. 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[] { "random_title", "random_content", "random_creation" }; final Cursor row = db.fetchAllData(); SimpleCursorAdapter adapter = new SimpleCursorAdapter(getActivity(), layoutstyle, row, column, xml_id, 0) { @Override public View getView(final int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); ImageView iv_icon = (ImageView) v.findViewById(R.id.icon_notes); iv_icon.setVisibility(View.GONE); return v; } }; 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 random_content = row2.getString(row2.getColumnIndexOrThrow("random_content")); final String random_title = row2.getString(row2.getColumnIndexOrThrow("random_title")); if (random_content.isEmpty()) { Snackbar.make(lv, getActivity().getString(R.string.number_enterData), Snackbar.LENGTH_LONG) .show(); } else { getActivity().setTitle(random_title); lv.setVisibility(View.GONE); lvItems.setVisibility(View.VISIBLE); try { FileOutputStream fOut = new FileOutputStream(newFile()); OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut); myOutWriter.append(random_content); myOutWriter.close(); fOut.flush(); fOut.close(); } catch (IOException e) { Log.e("Exception", "File write failed: " + e.toString()); } items = new ArrayList<>(); readItems(); setAdapter(1000); fab.setVisibility(View.GONE); fab_dice.setVisibility(View.VISIBLE); } } }); 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 random_title = row2.getString(row2.getColumnIndexOrThrow("random_title")); final String random_content = row2.getString(row2.getColumnIndexOrThrow("random_content")); final String random_icon = row2.getString(row2.getColumnIndexOrThrow("random_icon")); final String random_attachment = row2.getString(row2.getColumnIndexOrThrow("random_attachment")); final String random_creation = row2.getString(row2.getColumnIndexOrThrow("random_creation")); final CharSequence[] options = { getString(R.string.number_edit_entry), getString(R.string.bookmark_remove_bookmark) }; new android.app.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))) { android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder( getActivity()); View dialogView = View.inflate(getActivity(), R.layout.dialog_edit_entry, null); final EditText edit_title = (EditText) dialogView .findViewById(R.id.note_title_input); edit_title.setHint(R.string.title_hint); edit_title.setText(random_title); final EditText edit_cont = (EditText) dialogView .findViewById(R.id.note_text_input); edit_cont.setHint(R.string.text_hint); edit_cont.setText(random_content); builder.setView(dialogView); builder.setTitle(R.string.number_edit_entry); builder.setPositiveButton(R.string.toast_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String inputTitle = edit_title.getText().toString().trim(); String inputCont = edit_cont.getText().toString().trim(); db.update(Integer.parseInt(_id), inputTitle, inputCont, random_icon, random_attachment, random_creation); setRandomList(); 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 android.app.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.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)); setRandomList(); } }); snackbar.show(); } } }).show(); return true; } }); }
From source file:com.example.fan.horizontalscrollview.PagerSlidingTabStrip.java
private void addCmTab(final int position, String title, int resId) { RelativeLayout tab = (RelativeLayout) inflate(getContext(), R.layout.cm_pst__tab, null); ImageView iv = (ImageView) tab.findViewById(R.id.pst_iv_tab); iv.setImageResource(resId);//from w w w . j a v a 2 s . co m iv.setVisibility(View.VISIBLE); TextView tv = (TextView) tab.findViewById(R.id.pst_tv_tab); tv.setText(title); tv.setGravity(Gravity.CENTER); tv.setSingleLine(); tab.setFocusable(true); tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (null != mOnPageClickedLisener) { mOnPageClickedLisener.onPageClicked(position); } pager.setCurrentItem(position); } }); tabsContainer.addView(tab); }
From source file:de.enlightened.peris.MessageActivity.java
private void renderMessage(final Message message) { final Context context = this.getApplicationContext(); final SharedPreferences appPreferences = context.getSharedPreferences("prefs", 0); final boolean useShading = appPreferences.getBoolean("use_shading", false); final boolean useOpenSans = appPreferences.getBoolean("use_opensans", false); final int fontSize = appPreferences.getInt("font_size", DEFAULT_FONT_SIZE); final boolean currentAvatarSetting = appPreferences.getBoolean("show_images", true); final Typeface opensans = Typeface.createFromAsset(context.getAssets(), "fonts/opensans.ttf"); final View view = this.findViewById(R.id.message_layout); final TextView poAuthor = (TextView) view.findViewById(R.id.message_author); final TextView poTimestamp = (TextView) view.findViewById(R.id.message_timestamp); final TextView tvOnline = (TextView) view.findViewById(R.id.message_online_status); final LinearLayout llBorderBackground = (LinearLayout) view.findViewById(R.id.ll_border_background); final LinearLayout llColorBackground = (LinearLayout) view.findViewById(R.id.ll_color_background); String textColor = context.getString(R.string.default_text_color); if (this.application.getSession().getServer().serverTextColor.contains("#")) { textColor = this.application.getSession().getServer().serverTextColor; }// w ww .j a va 2 s . c om String boxColor = context.getString(R.string.default_element_background); if (this.application.getSession().getServer().serverBoxColor != null) { boxColor = this.application.getSession().getServer().serverBoxColor; } if (boxColor.contains("#")) { llColorBackground.setBackgroundColor(Color.parseColor(boxColor)); } else { llColorBackground.setBackgroundColor(Color.TRANSPARENT); } //TODO: remove border? String boxBorder = context.getString(R.string.default_element_border); if (this.application.getSession().getServer().serverBoxBorder != null) { boxBorder = this.application.getSession().getServer().serverBoxBorder; } if (boxBorder.contentEquals("1")) { llBorderBackground.setBackgroundResource(R.drawable.element_border); } else { llBorderBackground.setBackgroundColor(Color.TRANSPARENT); } if (useOpenSans) { poAuthor.setTypeface(opensans); poTimestamp.setTypeface(opensans); tvOnline.setTypeface(opensans); } if (useShading) { poAuthor.setShadowLayer(2, 0, 0, Color.parseColor("#66000000")); tvOnline.setShadowLayer(2, 0, 0, Color.parseColor("#66000000")); } final LinearLayout llPostBodyHolder = (LinearLayout) view.findViewById(R.id.message_body_holder); llPostBodyHolder.removeAllViews(); final ImageView poAvatar = (ImageView) view.findViewById(R.id.message_avatar); if (boxColor != null && boxColor.contains("#") && boxColor.length() == 7) { final ImageView postAvatarFrame = (ImageView) view.findViewById(R.id.message_avatar_frame); postAvatarFrame.setColorFilter(Color.parseColor(boxColor)); } else { final ImageView postAvatarFrame = (ImageView) view.findViewById(R.id.message_avatar_frame); postAvatarFrame.setVisibility(View.GONE); } if (message.isAuthorOnline()) { tvOnline.setText("ONLINE"); tvOnline.setVisibility(View.VISIBLE); } else { tvOnline.setVisibility(View.GONE); } poAuthor.setText(message.getAuthor()); poTimestamp.setText(DateTimeUtils.getTimeAgo(message.getTimestamp())); final String postContent = message.getBody(); // TODO: add attachments BBCodeParser.parseCode(context, llPostBodyHolder, postContent, opensans, useOpenSans, useShading, new ArrayList<PostAttachment>(), fontSize, true, textColor, this.application); poAuthor.setTextColor(Color.parseColor(textColor)); poTimestamp.setTextColor(Color.parseColor(textColor)); if (currentAvatarSetting) { if (Net.isUrl(message.getAuthorAvatar())) { final String imageUrl = message.getAuthorAvatar(); ImageLoader.getInstance().displayImage(imageUrl, poAvatar); } else { poAvatar.setImageResource(R.drawable.no_avatar); } } else { poAvatar.setVisibility(View.GONE); } }
From source file:bucci.dev.freestyle.TimerActivity.java
private void hideExtraRoundButton() { ImageView button = (ImageView) findViewById(R.id.extra_round_button); if (button.getVisibility() != View.GONE) button.setVisibility(View.GONE); isExtraButtonShown = false;/* ww w . j a va 2s . co m*/ }