List of usage examples for android.widget ImageView getVisibility
@ViewDebug.ExportedProperty(mapping = { @ViewDebug.IntToString(from = VISIBLE, to = "VISIBLE"), @ViewDebug.IntToString(from = INVISIBLE, to = "INVISIBLE"), @ViewDebug.IntToString(from = GONE, to = "GONE") }) @Visibility public int getVisibility()
From source file:es.uma.lcc.lockpic.MainActivity.java
/** * Overrides the back button functionality to behave in a more intuitive way. * When an encrypted/decrypted image is being displayed, pressing Back goes back to the menu * instead of closing the application.// w w w.ja v a2 s . c om */ @Override public void onBackPressed() { ImageView iv = ((ImageView) findViewById(R.id.imageView)); if (iv.getVisibility() == ImageView.VISIBLE) { findViewById(R.id.imageBlock).setVisibility(View.GONE); findViewById(R.id.encryptBlock).setVisibility(View.VISIBLE); findViewById(R.id.decryptBlock).setVisibility(View.VISIBLE); findViewById(R.id.myPicsBlock).setVisibility(View.VISIBLE); findViewById(R.id.accountBlock).setVisibility(View.VISIBLE); findViewById(R.id.filler1).setVisibility(View.VISIBLE); findViewById(R.id.filler2).setVisibility(View.VISIBLE); findViewById(R.id.filler3).setVisibility(View.VISIBLE); findViewById(R.id.filler4).setVisibility(View.VISIBLE); iv.setVisibility(ImageView.INVISIBLE); (findViewById(R.id.shareButton)).setVisibility(View.INVISIBLE); } else this.finish(); }
From source file:com.vuze.android.widget.SwipeRefreshLayoutExtra.java
private void layoutExtra(ImageView circleView) { if (mExtraView == null) { return;//from w w w. j ava2 s .c o m } final int width = getMeasuredWidth(); int tvHeight = mExtraView.getMeasuredHeight(); int circleHeight = circleView.getMeasuredHeight(); int offset = circleView.getTop(); int tvTop = offset + circleHeight; if (DEBUG_FOLLOW_THE_CIRLCE_HACK) { Log.d(TAG, "layoutExtra: " + tvTop + ";" + circleView.getVisibility()); } mExtraView.layout(0, tvTop, width, tvTop + tvHeight); int visibility = mExtraView.getVisibility(); int newVisibility = tvTop <= 0 ? View.GONE : View.VISIBLE; if (visibility != newVisibility) { if (DEBUG_FOLLOW_THE_CIRLCE_HACK) { Log.d(TAG, "layoutExtra: set " + (tvTop <= 0 ? "GONE" : "VISIBLE") + ";" + AndroidUtils.getCompressedStackTrace()); } mExtraView.setVisibility(newVisibility); if (listenerOnExtraViewVisiblityChange != null) { listenerOnExtraViewVisiblityChange.onExtraViewVisibilityChange(mExtraView, newVisibility); } } }
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;//from w ww . j a va 2 s .c om }
From source file:bucci.dev.freestyle.TimerActivity.java
private void showExtraRoundButton() { ImageView extraRoundButton = (ImageView) findViewById(R.id.extra_round_button); if (extraRoundButton.getVisibility() != View.VISIBLE) extraRoundButton.setVisibility(View.VISIBLE); isExtraButtonShown = true;//from w w w. ja va 2 s. c om }
From source file:se.droidgiro.scanner.CaptureActivity.java
public void handleDecode(final Invoice invoice, int fieldsFound, Bitmap debugBmp) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); ImageView debugImageView = (ImageView) findViewById(R.id.debug_image_view); if (prefs.getBoolean(PreferencesActivity.KEY_DEBUG_IMAGE, false) && (debugBmp != null)) { debugImageView.setVisibility(View.VISIBLE); debugImageView.setImageBitmap(debugBmp); } else if (debugImageView.getVisibility() != View.GONE) { debugImageView.setVisibility(View.GONE); }/* w w w .j av a2 s.c o m*/ int fieldsScanned = invoice.getLastFieldsDecoded(); if (fieldsScanned > 0) { boolean scanContainsNewData = false; /* * The following segment will copy data from scanned invoice object * into our currentInvoice and keep track of new data read. * Beep/Vibrate will only occur if scan contains new data. */ if ((fieldsScanned & Invoice.AMOUNT_FIELD) == Invoice.AMOUNT_FIELD) { if (!(currentInvoice.getAmount() == invoice.getAmount() && currentInvoice.getAmountFractional() == invoice.getAmountFractional())) { currentInvoice.setAmount(invoice.getAmount(), invoice.getAmountFractional()); scanContainsNewData = true; } } if ((fieldsScanned & Invoice.DOCUMENT_TYPE_FIELD) == Invoice.DOCUMENT_TYPE_FIELD) { if (currentInvoice.getInternalDocumentType() != invoice.getInternalDocumentType()) { currentInvoice.setDocumentType(invoice.getInternalDocumentType()); scanContainsNewData = true; } } if ((fieldsScanned & Invoice.GIRO_ACCOUNT_FIELD) == Invoice.GIRO_ACCOUNT_FIELD) { Log.v(TAG, "Giro accout scanned. Current account = " + currentInvoice.getGiroAccount() + ". New invoice giro account = " + invoice.getGiroAccount()); if (!invoice.getGiroAccount().equals(currentInvoice.getGiroAccount())) { currentInvoice.setRawGiroAccount(invoice.getRawGiroAccount()); Log.v(TAG, "Copied giro account = " + invoice.getGiroAccount()); scanContainsNewData = true; } } if ((fieldsScanned & Invoice.REFERENCE_FIELD) == Invoice.REFERENCE_FIELD) { if (!invoice.getReference().equals(currentInvoice.getReference())) { currentInvoice.setReference(invoice.getReference()); scanContainsNewData = true; } } if (scanContainsNewData) playBeepSoundAndVibrate(); } Log.v(TAG, "CurrentInvoice = " + currentInvoice); if (currentInvoice.isReferenceDefined()) resultListHandler.setReference(currentInvoice.getReference()); if (currentInvoice.isAmountDefined()) resultListHandler.setAmount(currentInvoice.getCompleteAmount()); if (currentInvoice.isGiroAccountDefined()) resultListHandler.setAccount(currentInvoice.getGiroAccount()); if (resultListHandler.hasNewData()) { resultListHandler.setNewData(false); } Log.v(TAG, "Got invoice " + invoice); /* If scan on every hit */ // int fieldsScanned = invoice.getLastFieldsDecoded(); // if (fieldsScanned > 0) { // playBeepSoundAndVibrate(); // final List<NameValuePair> params = new ArrayList<NameValuePair>(); // if ((fieldsScanned & Invoice.AMOUNT_FIELD) == Invoice.AMOUNT_FIELD) // params.add(new BasicNameValuePair("amount", invoice // .getCompleteAmount())); // if ((fieldsScanned & Invoice.DOCUMENT_TYPE_FIELD) == // Invoice.DOCUMENT_TYPE_FIELD) // params.add(new BasicNameValuePair("type", invoice.getType())); // if ((fieldsScanned & Invoice.GIRO_ACCOUNT_FIELD) == // Invoice.GIRO_ACCOUNT_FIELD) // params.add(new BasicNameValuePair("account", invoice // .getGiroAccount())); // if ((fieldsScanned & Invoice.REFERENCE_FIELD) == // Invoice.REFERENCE_FIELD) // params.add(new BasicNameValuePair("reference", invoice // .getReference())); // // sendFields(params); // // } // if (invoice.isComplete()) { // resultListHandler.setSent(true); // this.scanButton.setText(getString(R.string.scan_state_scan)); // onContentChanged(); // } else if (!paused) { handler.sendEmptyMessageDelayed(R.id.restart_preview, SCAN_DELAY_MS); } onContentChanged(); }
From source file:com.google.samples.apps.iosched.session.SessionDetailFragment.java
/** * Aligns the Twitter icon the parent bottom right. Aligns the G+ icon to the left of the * Twitter icon if it is present. Otherwise, aligns the G+ icon to the parent bottom right. *///w w w. ja v a 2s .c om private void determineSocialIconPlacement(ImageView plusOneIcon, ImageView twitterIcon) { if (plusOneIcon.getVisibility() == View.VISIBLE) { // Set the dimensions of the G+ button. int socialIconDimension = getResources().getDimensionPixelSize(R.dimen.social_icon_box_size); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(socialIconDimension, socialIconDimension); params.addRule(RelativeLayout.BELOW, R.id.speaker_abstract); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); if (twitterIcon.getVisibility() == View.VISIBLE) { params.addRule(RelativeLayout.LEFT_OF, R.id.twitter_icon_box); } else { params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); } plusOneIcon.setLayoutParams(params); } }
From source file:net.reichholf.dreamdroid.fragment.MediaPlayerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.dual_list_media_view, null, false); setAdapter(v);/* ww w . j a va 2s.c o m*/ // only if detail view is available the application should have // listeners for the buttons if (isDetailViewAvailable(v)) { ImageButton togglePlaylistButton = (ImageButton) v.findViewById(R.id.toggle_playlist); ListView playList = (ListView) v.findViewById(R.id.playlist); playList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View v, int position, long id) { ExtendedHashMap item = mPlaylist.get(position); playFile(item.getString(Mediaplayer.KEY_SERVICE_REFERENCE), PLAYLIST_AS_ROOT); } }); playList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { ExtendedHashMap item = mPlaylist.get(position); deleteFromPlaylist(item.getString(Mediaplayer.KEY_SERVICE_REFERENCE)); return true; } }); togglePlaylistButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ListView playList = (ListView) getView().findViewById(R.id.playlist); ImageView cover = (ImageView) getView().findViewById(R.id.cover); int vis = playList.getVisibility(); playList.setVisibility(cover.getVisibility()); cover.setVisibility(vis); } }); ImageButton playButton = (ImageButton) v.findViewById(R.id.imageButtonPlay); playButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { play(); } }); ImageButton stopButton = (ImageButton) v.findViewById(R.id.imageButtonStop); stopButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { stop(); } }); ImageButton previousButton = (ImageButton) v.findViewById(R.id.imageButtonPrevious); previousButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { previous(); } }); ImageButton nextbutton = (ImageButton) v.findViewById(R.id.imageButtonNext); nextbutton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { next(); } }); } SlidingPaneLayout spl = (SlidingPaneLayout) v.findViewById(R.id.sliding_pane); if (spl != null) { spl.setPanelSlideListener(new SlidingPaneLayout.PanelSlideListener() { @Override public void onPanelSlide(View view, float v) { return; } @Override public void onPanelOpened(View view) { getListView().setEnabled(true); getActionBarActivity().supportInvalidateOptionsMenu(); } @Override public void onPanelClosed(View view) { getListView().setEnabled(false); getActionBarActivity().supportInvalidateOptionsMenu(); } }); spl.openPane(); } reloadPlaylist(); reload(); return v; }
From source file:com.sim2dial.dialer.ChatFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { if (v.getId() == R.id.sendPicture) { menu.add(0, MENU_PICTURE_SMALL, 0, getString(R.string.share_picture_size_small)); menu.add(0, MENU_PICTURE_MEDIUM, 0, getString(R.string.share_picture_size_medium)); menu.add(0, MENU_PICTURE_LARGE, 0, getString(R.string.share_picture_size_large)); // Not a good idea, very big pictures cause Out of Memory // exceptions, slow display, ... // menu.add(0, MENU_PICTURE_REAL, 0, // getString(R.string.share_picture_size_real)); } else {/*from w ww. j a v a2 s . co m*/ menu.add(v.getId(), MENU_DELETE_MESSAGE, 0, getString(R.string.delete)); ImageView iv = (ImageView) v.findViewById(R.id.image); if (iv != null && iv.getVisibility() == View.VISIBLE) { menu.add(v.getId(), MENU_SAVE_PICTURE, 0, getString(R.string.save_picture)); } else { menu.add(v.getId(), MENU_COPY_TEXT, 0, getString(R.string.copy_text)); } } }
From source file:com.github.colorchief.colorchief.MainActivity.java
private boolean clickInImage(int x, int y, ImageView imageView) { //ImageView imageViewer = (ImageView) findViewById(R.id.imageView); if (imageView.getVisibility() != View.VISIBLE) { return false; }/*w w w . j a v a 2 s. c o m*/ int[] imageViewCoords = new int[2]; imageView.getLocationOnScreen(imageViewCoords); float[] imageViewMatrix = new float[9]; imageView.getImageMatrix().getValues(imageViewMatrix); float scaleX = imageViewMatrix[Matrix.MSCALE_X]; float scaleY = imageViewMatrix[Matrix.MSCALE_Y]; Bitmap bitmap = null; int bitmapWidth = 0; int bitmapHeight = 0; try { bitmap = ((BitmapDrawable) imageView.getDrawable()).getBitmap(); bitmapWidth = bitmap.getWidth(); bitmapHeight = bitmap.getHeight(); } catch (NullPointerException npe) { Log.e(TAG, "Failed to extract Bitmap from ImageView: " + npe); } //assuming Bitmap is centred in imageViewer int scaledBitmapWidth = Math.round(bitmapWidth * scaleX); int scaledBitmapHeight = Math.round(bitmapHeight * scaleY); int xOffsetBitmap2imageViewer = (imageView.getWidth() - scaledBitmapWidth) / 2; int yOffsetBitmap2imageViewer = (imageView.getHeight() - scaledBitmapHeight) / 2; // get total bitmap offset vs. screen origin int xTotalOffset = imageViewCoords[0] + xOffsetBitmap2imageViewer; int yTotalOffset = imageViewCoords[1] + yOffsetBitmap2imageViewer; if ((x >= xTotalOffset) && (x <= xTotalOffset + scaledBitmapWidth) && (y >= yTotalOffset) && (y <= yTotalOffset + scaledBitmapHeight)) { return true; } else { return false; } }
From source file:org.nativescript.widgets.TabLayout.java
private void setupItem(LinearLayout ll, TextView textView, ImageView imgView, TabItemSpec tabItem) { float density = getResources().getDisplayMetrics().density; if (tabItem.iconId != 0) { imgView.setImageResource(tabItem.iconId); imgView.setVisibility(VISIBLE);/*ww w . j a v a 2 s . co m*/ } else if (tabItem.iconDrawable != null) { imgView.setImageDrawable(tabItem.iconDrawable); imgView.setVisibility(VISIBLE); } else { imgView.setVisibility(GONE); } if (tabItem.title != null && !tabItem.title.isEmpty()) { textView.setText(tabItem.title); textView.setVisibility(VISIBLE); } else { textView.setVisibility(GONE); } if (imgView.getVisibility() == VISIBLE && textView.getVisibility() == VISIBLE) { ll.setMinimumHeight((int) (LARGE_MIN_HEIGHT * density)); } else { ll.setMinimumHeight((int) (SMALL_MIN_HEIGHT * density)); } if (mDistributeEvenly) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) ll.getLayoutParams(); lp.width = 0; lp.weight = 1; } }