List of usage examples for android.widget ImageView getBackground
public Drawable getBackground()
From source file:com.forrestguice.suntimeswidget.LightMapDialog.java
private void colorizeImageView(ImageView view, int color) { if (view.getBackground() != null) { GradientDrawable d = (GradientDrawable) view.getBackground().mutate(); d.setColor(color);/* w w w .j a va 2 s. com*/ d.invalidateSelf(); } }
From source file:org.deviceconnect.android.deviceplugin.sphero.setting.fragment.WakeupFragment.java
@Override public void onResume() { super.onResume(); View root = getView();// www . j ava 2s .c o m if (root != null) { ImageView image = (ImageView) root.findViewById(R.id.animView001); AnimationDrawable anim = (AnimationDrawable) image.getBackground(); anim.start(); } }
From source file:org.deviceconnect.android.deviceplugin.sphero.setting.fragment.WakeupFragment.java
@Override public void onPause() { super.onPause(); View root = getView();/*from ww w.j a v a 2 s . c o m*/ if (root != null) { ImageView image = (ImageView) root.findViewById(R.id.animView001); AnimationDrawable anim = (AnimationDrawable) image.getBackground(); anim.stop(); } }
From source file:org.deviceconnect.android.deviceplugin.sphero.setting.fragment.PairingFragment.java
@Override public void onPause() { super.onPause(); View root = getView();/* w ww. j a va 2 s .c o m*/ if (root != null) { ImageView image = (ImageView) root.findViewById(R.id.animView); AnimationDrawable anim = (AnimationDrawable) image.getBackground(); anim.stop(); } }
From source file:org.deviceconnect.android.deviceplugin.sphero.setting.fragment.PairingFragment.java
@Override public void onResume() { super.onResume(); View root = getView();/*from www . j ava 2 s . c om*/ if (root != null) { ImageView image = (ImageView) root.findViewById(R.id.animView); AnimationDrawable anim = (AnimationDrawable) image.getBackground(); anim.start(); } if (mBlePermissionBtn != null) { if (BleUtils.isBLEPermission(getActivity())) { mBlePermissionBtn.setText(getString(R.string.bluetooth_settings_ble_permission_on)); mBlePermissionBtn.setBackgroundResource(R.drawable.button_red); } else { mBlePermissionBtn.setText(getString(R.string.bluetooth_settings_ble_permission_off)); mBlePermissionBtn.setBackgroundResource(R.drawable.button_blue); } } }
From source file:com.concentricsky.android.khanacademy.app.HomeActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.setDefaultLevel(Log.SUPPRESS);// w ww . j av a 2 s. c o m // If there is no intent scheduled, set a repeating alarm for library updates. setupRepeatingLibraryUpdateAlarm(); setContentView(R.layout.activity_home); // According to http://stackoverflow.com/a/2791816/931277, setting dither="true" on the shape tag in xml doesn't work. // However, using the debugger on the Nexus 7 (4.2), when it's set in xml it is in fact set on this Drawable, so this // *should* be unnecessary. It won't hurt, though. ImageView splash = (ImageView) findViewById(R.id.activity_home_imageview); Drawable background = splash.getBackground(); if (background instanceof GradientDrawable) { ((GradientDrawable) background).setDither(true); } }
From source file:libraries.caifudemo.widget.sdliding.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final OnClickListener tabClickListener = new TabClickListener(); frgCount = adapter.getCount();//from www .j a v a2s .c om for (int i = 0; i < adapter.getCount(); i++) { View tabView = null; TextView tabTitleView = null; if (mTabViewLayoutId != 0) { // If there is a custom tab view layout id set, try and inflate it tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); CharSequence pageTitle = adapter.getPageTitle(i); //? if ("".equals(pageTitle)) { tabView = LayoutInflater.from(getContext()).inflate(R.layout.gif_tab_layout, mTabStrip, false); ImageView hotimage = (ImageView) tabView.findViewById(R.id.hot_log); AnimationDrawable hotgif = (AnimationDrawable) hotimage.getBackground(); hotgif.start(); tabTitleView = (TextView) tabView.findViewById(R.id.gif_tv_tab); } } if (tabView == null) { tabView = createDefaultTabView(getContext()); } if (tabTitleView == null && TextView.class.isInstance(tabView)) { tabTitleView = (TextView) tabView; } if (mDistributeEvenly) { LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.width = 0; lp.weight = 1; tabView.setLayoutParams(lp); } tabTitleView.setText(adapter.getPageTitle(i)); tabView.setOnClickListener(tabClickListener); mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } textViewList.add(tabTitleView); } for (int i = 0; i < frgCount; i++) { textViewList.get(i).setTextColor(unselectedTitleTextColor); } textViewList.get(mViewPager.getCurrentItem()).setTextColor(selectedTitleTextColor); }
From source file:com.scoreloop.android.coreui.BaseActivity.java
@Override public void onWindowFocusChanged(final boolean hasFocus) { if (hasFocus) { final ImageView imageView = ((ImageView) getTopActivity().findViewById(R.id.progress_indicator)); if ((imageView != null) && (imageView.getVisibility() == View.VISIBLE)) { final AnimationDrawable frameAnimation = (AnimationDrawable) imageView.getBackground(); frameAnimation.start();//from w w w . j a v a 2 s . c om } } }
From source file:de.hackerspacebremen.fragments.StatusFragment.java
private void startAnimation() { final ImageView imgStatus = StatusViewHolder.get().imgStatus; StatusViewHolder.get().imgStatus.setBackgroundResource(R.anim.clock_animation); // Get the background, which has been compiled to an AnimationDrawable // object.//from www . ja v a 2 s . co m statusAnimation = (AnimationDrawable) imgStatus.getBackground(); // Start the animation (looped playback by default). imgStatus.post(new Runnable() { @Override public void run() { statusAnimation.start(); } }); }
From source file:metrocasas.projectsgt.MainActivity.java
public void upLoadFiles() { bandera = true;/*from ww w . j av a2 s. c o m*/ ImageView img = (ImageView) findViewById(R.id.image_load); assert img != null; img.setBackgroundResource(R.drawable.load_files); // Get the background, which has been compiled to an AnimationDrawable object. AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground(); // Start the animation (looped playback by default). frameAnimation.start(); if (!title.getText().toString().equals("")) { q.setVisibility(View.GONE); p.setVisibility(View.VISIBLE); if (audioFile != null) { archivos.add(audioFile); } else { audio = ""; } if (!archivos.isEmpty()) { try { for (File i : archivos) { AmazonS3 s3Client = new AmazonS3Client(amazonCognito()); TransferUtility transferUtility = new TransferUtility(s3Client, this); TransferObserver transferObserver = transferUtility.upload(BUCKET_NAME, "projects/" + i.getName(), i); transferObserver.setTransferListener(new TransferListener() { @Override public void onStateChanged(int id, TransferState state) { if (state == TransferState.COMPLETED) { if (bandera) { ingresarDatos(); limpiarCampos(); bandera = false; } } } @Override public void onProgressChanged(int id, long bytesCurrent, long bytesTotal) { } @Override public void onError(int id, Exception ex) { Toast.makeText(MainActivity.this, ex.toString(), Toast.LENGTH_SHORT).show(); } }); } } catch (Exception e) { ingresarDatos(); limpiarCampos(); } } else { ingresarDatos(); limpiarCampos(); } } else { Toast.makeText(this, "Debe ingresar por lo menos el ttulo", Toast.LENGTH_LONG).show(); q.scrollTo(0, 0); title.setFocusableInTouchMode(true); title.setFocusable(true); title.requestFocus(); } }