List of usage examples for android.widget ImageView setVisibility
@RemotableViewMethod @Override public void setVisibility(int visibility)
From source file:com.ftinc.kit.attributr.ui.widget.StickyRecyclerHeadersElevationDecoration.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override/*from w w w. j a v a2s. c o m*/ public void onDrawOver(Canvas canvas, RecyclerView parent, RecyclerView.State state) { super.onDrawOver(canvas, parent, state); int orientation = getOrientation(parent); mHeaderRects.clear(); if (parent.getChildCount() > 0 && mAdapter.getItemCount() > 0) { // draw the first visible child's header at the top of the view View firstView = parent.getChildAt(0); int firstPosition = parent.getChildPosition(firstView); if (mAdapter.getHeaderId(firstPosition) > -1) { View firstHeader = getHeaderView(parent, firstPosition); View nextView = getNextView(parent); int translationX = Math.max(parent.getChildAt(0).getLeft() - firstHeader.getWidth(), 0); int translationY = Math.max(parent.getChildAt(0).getTop() - firstHeader.getHeight(), 0); int nextPosition = parent.getChildPosition(nextView); if (nextPosition > 0 && hasNewHeader(nextPosition)) { View secondHeader = getHeaderView(parent, nextPosition); //Translate the topmost header so the next header takes its place, if applicable if (orientation == LinearLayoutManager.VERTICAL && nextView.getTop() - secondHeader.getHeight() - firstHeader.getHeight() < 0) { translationY += nextView.getTop() - secondHeader.getHeight() - firstHeader.getHeight(); } else if (orientation == LinearLayoutManager.HORIZONTAL && nextView.getLeft() - secondHeader.getWidth() - firstHeader.getWidth() < 0) { translationX += nextView.getLeft() - secondHeader.getWidth() - firstHeader.getWidth(); } } boolean shouldDrawShadow = true; if (firstPosition == 0 && (firstView.getTop() == firstHeader.getHeight())) { shouldDrawShadow = false; } if (translationY == 0 && shouldDrawShadow) { ImageView shadow = ButterKnife.findById(firstHeader, R.id.shadow); shadow.setVisibility(View.VISIBLE); } else { ImageView shadow = ButterKnife.findById(firstHeader, R.id.shadow); shadow.setVisibility(View.GONE); } canvas.save(); canvas.translate(translationX, translationY); firstHeader.draw(canvas); canvas.restore(); mHeaderRects.put(firstPosition, new Rect(translationX, translationY, translationX + firstHeader.getWidth(), translationY + firstHeader.getHeight())); } if (parent.getChildCount() > 1 && mAdapter.getItemCount() > 1) { for (int i = 1; i < parent.getChildCount(); i++) { int position = parent.getChildPosition(parent.getChildAt(i)); if (hasNewHeader(position)) { // this header is different than the previous, it must be drawn in the correct place int translationX = 0; int translationY = 0; View header = getHeaderView(parent, position); if (orientation == LinearLayoutManager.VERTICAL) { translationY = parent.getChildAt(i).getTop() - header.getHeight(); } else { translationX = parent.getChildAt(i).getLeft() - header.getWidth(); } // don't render shadow ImageView shadow = ButterKnife.findById(header, R.id.shadow); shadow.setVisibility(View.GONE); canvas.save(); canvas.translate(translationX, translationY); header.draw(canvas); canvas.restore(); mHeaderRects.put(position, new Rect(translationX, translationY, translationX + header.getWidth(), translationY + header.getHeight())); } } } } }
From source file:org.secuso.privacyfriendlynetmonitor.Activities.MainActivity.java
private void setSwipeInfo(boolean b) { final ImageView icon = (ImageView) findViewById(R.id.report_empty_icon); final TextView text = (TextView) findViewById(R.id.report_empty_text); if (b) {/*ww w. j ava2 s. c o m*/ icon.setVisibility(View.GONE); text.setVisibility(View.GONE); } else { icon.setVisibility(View.VISIBLE); text.setVisibility(View.VISIBLE); } }
From source file:com.carver.paul.truesight.Ui.MainActivity.java
private void setTopImage(Bitmap photoBitmap) { ImageView topImage = (ImageView) findViewById(R.id.image_top); topImage.setVisibility(View.VISIBLE); topImage.setImageBitmap(photoBitmap); }
From source file:es.uma.lcc.tasks.EncryptionUploaderTask.java
private void displayEncryptedImage(String path) { ImageView imageView = (ImageView) mMainActivity.findViewById(R.id.imageView); imageView.setVisibility(ImageView.VISIBLE); BitmapFactory.Options options = new BitmapFactory.Options(); Bitmap bmp = BitmapFactory.decodeFile(path, options); int w = options.outWidth; int h = options.outHeight; if (w >= 2048 || h >= 2048) { double factor = (w > h ? 2048.0 / w : 2048.0 / h); imageView.setImageBitmap(Bitmap.createScaledBitmap(bmp, (int) (factor * w), (int) (factor * h), false)); } else {// ww w . j a va 2 s . c om imageView.setImageBitmap(bmp); } }
From source file:de.uni_weimar.m18.anatomiederstadt.SplashActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); final PathView pathView = (PathView) findViewById(R.id.pathView); pathView.useNaturalColors();/*ww w. j a va2 s .c o m*/ int pathDelay = 1000; int pathDuration = 2500; final Animation a = new AlphaAnimation(0.00f, 1.00f); a.setStartOffset(3500); a.setDuration(1000); //pathView.setSvgResource(R.raw.vitruvian_man_weimar_kk3); pathView.getPathAnimator().delay(pathDelay).duration(pathDuration) .interpolator(new AccelerateDecelerateInterpolator()).start(); final ImageView logoImage = (ImageView) findViewById(R.id.logoImage); a.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { logoImage.setVisibility(View.VISIBLE); new Handler().postDelayed(new Runnable() { @Override public void run() { launchMainActivity(); } }, 1500); } @Override public void onAnimationRepeat(Animation animation) { } }); logoImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { launchMainActivity(); } }); logoImage.startAnimation(a); }
From source file:org.sickstache.fragments.ShowsFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); showAdapter = new SafeArrayAdapter<Show>(this.getActivity(), R.layout.show_banner_item) { @Override//from ww w.j a v a 2 s .c o m public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { row = layoutInflater.inflate(R.layout.show_banner_item, null); } Show item = getItem(position); TextView tv = (TextView) row.findViewById(R.id.show); tv.setText(item.showName); DefaultImageView image = (DefaultImageView) row.findViewById(R.id.showImage); image.defaultResource = R.drawable.default_banner; image.setBanner(item.id); ImageView overlay = (ImageView) row.findViewById(R.id.showSelectedOverlay); if (selected.contains(position)) { overlay.setVisibility(View.VISIBLE); } else { overlay.setVisibility(View.INVISIBLE); } return row; } }; }
From source file:nl.hnogames.domoticz.app.DomoticzCardFragment.java
private void setMessage(String message) { RelativeLayout errorLayout = (RelativeLayout) root.findViewById(R.id.errorLayout); if (errorLayout != null) { errorLayout.setVisibility(View.VISIBLE); ImageView errorImage = (ImageView) root.findViewById(R.id.errorImage); errorImage.setImageResource(R.drawable.empty); errorImage.setAlpha(0.5f);//from ww w. j a v a 2s.c o m errorImage.setVisibility(View.VISIBLE); TextView errorTextWrong = (TextView) root.findViewById(R.id.errorTextWrong); errorTextWrong.setVisibility(View.GONE); TextView errorTextMessage = (TextView) root.findViewById(R.id.errorTextMessage); errorTextMessage.setText(message); } else throw new RuntimeException("Layout should have a RelativeLayout defined with the ID of errorLayout"); }
From source file:net.yoching.android.MainActivity.java
public void flipCoins(View view) { final List<Integer> outcomes = new ArrayList<Integer>(3); for (int i = 0; i < 3; i++) { int j = Math.random() > .5 ? 1 : 2; outcomes.add(new Integer(j)); animatedCoins[i].setHeadsOrTails(j); }// w w w . j a v a 2 s .co m int heads = Collections.frequency(outcomes, new Integer(1)); Bitmap lineRender = null; if (heads >= 2) { lineRender = strongLine; outcomeBuffer.append("1"); } else { lineRender = splitLine; outcomeBuffer.append("2"); } Log.d(TAG, "wrexagram outcome buffer : " + outcomeBuffer.toString()); if (!imageViewStack.isEmpty()) { List<Long> list = new ArrayList<Long>(); for (int i = 2; i < 6; i++) { list.add(new Long(i * 100)); // list contains: [2,3,4,5] } Collections.shuffle(list); handler.postDelayed(animatedCoins[0], list.get(0)); handler.postDelayed(animatedCoins[1], list.get(1)); handler.postDelayed(animatedCoins[2], list.get(2)); final ImageView wrexaLine = imageViewStack.pop(); wrexaLine.setImageBitmap(lineRender); wrexaLine.setVisibility(View.INVISIBLE); wrexaLine.postDelayed(new Runnable() { @Override public void run() { wrexaLine.setVisibility(View.VISIBLE); } }, 2300); } Intent intent = new Intent(MainActivity.this, ViewWrexagramActivity.class); TossListener tossListener = new TossListener(intent, outcomeBuffer); handler.postDelayed(tossListener, 2000); }
From source file:com.dexin.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().getDecorView().setBackground(getResources().getDrawable(R.drawable.map)); setContentView(R.layout.activity_main); findViewById(R.id.loadingPanel).setVisibility(View.INVISIBLE); ImageView viewImage = (ImageView) findViewById(R.id.main_image); viewImage.setVisibility(View.INVISIBLE); /*SupportMapFragment mapFragment = null; while (mapFragment == null)/*from w w w . j av a 2 s . com*/ mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); mapFragment.getMapAsync(this);*/ FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setImageDrawable(getResources().getDrawable(R.drawable.buttonphoto2)); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setMessage(R.string.dialog_select_prompt) .setPositiveButton(R.string.dialog_select_gallery, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { startGalleryChooser(); } }).setNegativeButton(R.string.dialog_select_camera, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { startCamera(); } }); builder.create().show(); } }); mImageDetails = (TextView) findViewById(R.id.image_details); mMainImage = (ImageView) findViewById(R.id.main_image); }
From source file:com.mb.kids_mind.Adapter.SimilarListAdapter2.java
public void requestMyImage(final ImageView loading, final LinearLayout loadinglinear, ImageView image, String userImagePath) {/* w ww. ja v a 2s . com*/ AQuery aq = new AQuery(image); loading.setVisibility(View.VISIBLE); loadinglinear.setVisibility(View.VISIBLE); loadingViewAnim.start(); if (userImagePath.equals("")) { // aq.id(R.id.my_image).image(R.drawable.photo1); } else { String url = Const.IMAGE_LOAD_URL + "/" + userImagePath; url = url.trim(); aq.image(url, false, false, 0, 0, new BitmapAjaxCallback() { // my_image <== ImageView @Override public void callback(String url, ImageView iv, Bitmap bm, AjaxStatus status) { if (bm != null) { loading.setVisibility(View.GONE); loadinglinear.setVisibility(View.GONE); loadingViewAnim.stop(); iv.setImageBitmap(bm); } } }); } }