List of usage examples for android.widget ImageView bringToFront
public void bringToFront()
From source file:com.yahala.ui.IntroActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.intro_layout); if (LocaleController.isRTL) { icons = new int[] { // R.drawable.intro7, // R.drawable.intro6, // R.drawable.intro5, // R.drawable.intro4, // R.drawable.intro3, //R.drawable.intro2, R.drawable.intro1 };//from ww w . j a va 2 s . c om titles = new int[] { // R.string.Page7Title, // R.string.Page6Title, // R.string.Page5Title, // R.string.Page4Title, // R.string.Page3Title, // R.string.Page2Title, R.string.Page1Title }; messages = new int[] { // R.string.Page7Message, // R.string.Page6Message, // R.string.Page5Message, // R.string.Page4Message, // R.string.Page3Message, // R.string.Page2Message, R.string.Page1Message }; } else { icons = new int[] { R.drawable.intro1, // R.drawable.intro2, // R.drawable.intro3, // R.drawable.intro4, // R.drawable.intro5, // R.drawable.intro6, // R.drawable.intro7 }; titles = new int[] { R.string.Page1Title, // R.string.Page2Title, // R.string.Page3Title, // R.string.Page4Title, // R.string.Page5Title, // R.string.Page6Title, // R.string.Page7Title }; messages = new int[] { R.string.Page1Message, // R.string.Page2Message, // R.string.Page3Message, // R.string.Page4Message, // R.string.Page5Message, // R.string.Page6Message, // R.string.Page7Message }; } viewPager = (ViewPager) findViewById(R.id.intro_view_pager); TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button); startMessagingButton.setText(LocaleController.getString("StartMessaging", R.string.StartMessaging)); topImage1 = (ImageView) findViewById(R.id.icon_image1); topImage2 = (ImageView) findViewById(R.id.icon_image2); bottomPages = (ViewGroup) findViewById(R.id.bottom_pages); topImage2.setVisibility(View.GONE); viewPager.setAdapter(new IntroAdapter()); viewPager.setPageMargin(0); viewPager.setOffscreenPageLimit(1); viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int i) { } @Override public void onPageScrollStateChanged(int i) { if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) { if (lastPage != viewPager.getCurrentItem()) { lastPage = viewPager.getCurrentItem(); final ImageView fadeoutImage; final ImageView fadeinImage; if (topImage1.getVisibility() == View.VISIBLE) { fadeoutImage = topImage1; fadeinImage = topImage2; } else { fadeoutImage = topImage2; fadeinImage = topImage1; } fadeinImage.bringToFront(); fadeinImage.setImageResource(icons[lastPage]); fadeinImage.clearAnimation(); fadeoutImage.clearAnimation(); Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_out); outAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { fadeoutImage.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_in); inAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { fadeinImage.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); fadeoutImage.startAnimation(outAnimation); fadeinImage.startAnimation(inAnimation); } } } }); startMessagingButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (startPressed) { return; } startPressed = true; Intent intent2 = new Intent(IntroActivity.this, LoginActivity.class); startActivity(intent2); finish(); } }); justCreated = true; // getSupportActionBar().hide(); }
From source file:net.bluehack.ui.IntroActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_TMessages);/*from ww w. j a v a2 s .co m*/ super.onCreate(savedInstanceState); Theme.loadRecources(this); requestWindowFeature(Window.FEATURE_NO_TITLE); if (AndroidUtilities.isTablet()) { setContentView(R.layout.intro_layout_tablet); View imageView = findViewById(R.id.background_image_intro); BitmapDrawable drawable = (BitmapDrawable) getResources().getDrawable(R.drawable.catstile); drawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); imageView.setBackgroundDrawable(drawable); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.intro_layout); } if (LocaleController.isRTL) { icons = new int[] { R.drawable.intro7, R.drawable.intro6, R.drawable.intro5, R.drawable.intro4, R.drawable.intro3, R.drawable.intro2, R.drawable.intro1 }; titles = new int[] { R.string.Page7Title, R.string.Page6Title, R.string.Page5Title, R.string.Page4Title, R.string.Page3Title, R.string.Page2Title, R.string.Page1Title }; messages = new int[] { R.string.Page7Message, R.string.Page6Message, R.string.Page5Message, R.string.Page4Message, R.string.Page3Message, R.string.Page2Message, R.string.Page1Message }; } else { icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4, R.drawable.intro5, R.drawable.intro6, R.drawable.intro7 }; titles = new int[] { R.string.Page1Title, R.string.Page2Title, R.string.Page3Title, R.string.Page4Title, R.string.Page5Title, R.string.Page6Title, R.string.Page7Title }; messages = new int[] { R.string.Page1Message, R.string.Page2Message, R.string.Page3Message, R.string.Page4Message, R.string.Page5Message, R.string.Page6Message, R.string.Page7Message }; } viewPager = (ViewPager) findViewById(R.id.intro_view_pager); TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button); startMessagingButton .setText(LocaleController.getString("StartMessaging", R.string.StartMessaging).toUpperCase()); if (Build.VERSION.SDK_INT >= 21) { StateListAnimator animator = new StateListAnimator(); animator.addState(new int[] { android.R.attr.state_pressed }, ObjectAnimator .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4)) .setDuration(200)); animator.addState(new int[] {}, ObjectAnimator .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2)) .setDuration(200)); startMessagingButton.setStateListAnimator(animator); } topImage1 = (ImageView) findViewById(R.id.icon_image1); topImage2 = (ImageView) findViewById(R.id.icon_image2); bottomPages = (ViewGroup) findViewById(R.id.bottom_pages); topImage2.setVisibility(View.GONE); viewPager.setAdapter(new IntroAdapter()); viewPager.setPageMargin(0); viewPager.setOffscreenPageLimit(1); viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int i) { } @Override public void onPageScrollStateChanged(int i) { if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) { if (lastPage != viewPager.getCurrentItem()) { lastPage = viewPager.getCurrentItem(); final ImageView fadeoutImage; final ImageView fadeinImage; if (topImage1.getVisibility() == View.VISIBLE) { fadeoutImage = topImage1; fadeinImage = topImage2; } else { fadeoutImage = topImage2; fadeinImage = topImage1; } fadeinImage.bringToFront(); fadeinImage.setImageResource(icons[lastPage]); fadeinImage.clearAnimation(); fadeoutImage.clearAnimation(); Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_out); outAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { fadeoutImage.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this, R.anim.icon_anim_fade_in); inAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { fadeinImage.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); fadeoutImage.startAnimation(outAnimation); fadeinImage.startAnimation(inAnimation); } } } }); startMessagingButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (startPressed) { return; } startPressed = true; Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class); intent2.putExtra("fromIntro", true); startActivity(intent2); finish(); } }); if (BuildVars.DEBUG_VERSION) { startMessagingButton.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { ConnectionsManager.getInstance().switchBackend(); return true; } }); } justCreated = true; }
From source file:com.lastorder.pushnotifications.data.ImageDownloader.java
/** * Download the specified image from the Internet and binds it to the provided ImageView. The * binding is immediate if the image is found in the cache and will be done asynchronously * otherwise. A null bitmap will be associated to the ImageView if an error occurs. * * @param url The URL of the image to download. * @param imageView The ImageView to bind the downloaded image to. *///from w ww . j a va2s . c o m public void download(String url, ImageView imageView, Context context, ProgressBar bar) { resetPurgeTimer(); Bitmap bitmap = getBitmapFromCache(url); myWeakContext = new WeakReference<Context>(context); if (bitmap == null) { bar.setVisibility(0); imageView.setVisibility(8); forceDownload(url, imageView, bar); } else { bar.setVisibility(8); cancelPotentialDownload(url, imageView); imageView.setImageBitmap(bitmap); imageView.setVisibility(0); imageView.bringToFront(); } }
From source file:com.example.admin.parkingappfinal.MainActivity.java
public void update() { ImageView a1on = (ImageView) findViewById(R.id.imageView); ImageView a1off = (ImageView) findViewById(R.id.A1off); ImageView a2on = (ImageView) findViewById(R.id.A2on); ImageView a2off = (ImageView) findViewById(R.id.A2off); ImageView b1on = (ImageView) findViewById(R.id.B1on); ImageView b1off = (ImageView) findViewById(R.id.B1off); try {/* w w w .j av a 2 s. co m*/ StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection(url, user, pass); String result = "Database connection success\n"; System.out.println("We made it here"); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("select * from Lot1"); ResultSetMetaData rsmd = rs.getMetaData(); //System.out.println(rs.getString(1)); //System.out.println(rs.getString(2)); //System.out.println(rs.getString(3)); while (rs.next()) { //System.out.println(rs.getString(1)); //System.out.println(rs.getString(2)); //System.out.println(rs.getString(3)); //result += rsmd.getColumnName(1) + ": " + rs.getString(1) + "\n"; result += rsmd.getColumnName(2) + ":" + rs.getString(2); result += rsmd.getColumnName(3) + ":" + rs.getString(3); } //System.out.println(result); for (int i = 0; i < 3; i++) { spaces[i] = result.substring(result.indexOf(":") + 1, result.indexOf(":") + 3); String newResult = result.substring(result.indexOf(":") + 3); System.out.println(newResult); filled[i] = Integer .parseInt(newResult.substring(newResult.indexOf(":") + 1, newResult.indexOf(":") + 2)); result = newResult.substring(newResult.indexOf(":") + 2); } System.out.println(Arrays.toString(spaces)); System.out.println(Arrays.toString(filled)); //tv.setText(result); if (filled[0] == 1) { a1on.bringToFront(); } if (filled[0] == 0) { a1off.bringToFront(); } if (filled[1] == 1) { a2on.bringToFront(); } if (filled[1] == 0) { a2off.bringToFront(); } if (filled[2] == 1) { b1on.bringToFront(); } if (filled[2] == 0) { b1off.bringToFront(); } } catch (Exception e) { e.printStackTrace(); //tv.setText(e.toString()); } }