Java Code Examples for android.widget.ImageView#startAnimation()
The following examples show how to use
android.widget.ImageView#startAnimation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CaptureActivity.java From ScanZbar with Apache License 2.0 | 6 votes |
private void initView() { scanPreview = (SurfaceView) findViewById(R.id.capture_preview); scanContainer = (RelativeLayout) findViewById(R.id.capture_container); scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view); scanLine = (ImageView) findViewById(R.id.capture_scan_line); findViewById(R.id.capture_imageview_back).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); isHasSurface = false; beepManager = new BeepManager(this); TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation .RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.9f); animation.setDuration(3000); animation.setRepeatCount(-1); animation.setRepeatMode(Animation.RESTART); scanLine.startAnimation(animation); }
Example 2
Source File: MainActivity.java From logmein-android with GNU General Public License v3.0 | 6 votes |
/** * Start all the animations */ private void startAnimation() { ImageView centerWheel = (ImageView)findViewById(org.developfreedom.logmein.R.id.center_wheel); View infoView = findViewById(org.developfreedom.logmein.R.id.info); Animation rotation = AnimationUtils.loadAnimation(this, org.developfreedom.logmein.R.anim.rotation_start); centerWheel.startAnimation(rotation); Animation slideLeft = AnimationUtils.loadAnimation(this, org.developfreedom.logmein.R.anim.slide_in_left); mButtonLogout.startAnimation(slideLeft); Animation slideRight = AnimationUtils.loadAnimation(this, org.developfreedom.logmein.R.anim.slide_in_right); mButtonWeb.startAnimation(slideRight); Animation slideTop = AnimationUtils.loadAnimation(this, org.developfreedom.logmein.R.anim.slide_in_top); infoView.startAnimation(slideTop); mButtonLogin.startAnimation(slideTop); Animation slideBottom = AnimationUtils.loadAnimation(this, org.developfreedom.logmein.R.anim.slide_in_bottom); }
Example 3
Source File: ProgressDialogUtils.java From QiQuYing with Apache License 2.0 | 6 votes |
public static void showProgressDialog(Context context, String text) { LayoutInflater inflater = LayoutInflater.from(context); View v = inflater.inflate(R.layout.ct_progressdialog, null); TextView content = (TextView) v.findViewById(R.id.dialog_content); content.setText(text); ImageView spaceshipImage = (ImageView) v.findViewById(R.id.dialog_img); // 加载动画 Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(context, R.anim.progress_anim); // 使用ImageView显示动画 spaceshipImage.startAnimation(hyperspaceJumpAnimation); dialog = new Dialog(context, R.style.CustomDialog); dialog.setCanceledOnTouchOutside(false); //触摸外面不消失 dialog.setContentView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); dialog.getWindow().setWindowAnimations(R.style.dialogAnim); dialog.show(); /*//设置progressdilog的高度和宽度 int sreenWidth = DensityUtil.getWidthInPx(context); dialog.getWindow().setLayout(sreenWidth - 64, DensityUtil.dip2px(context, 48));*/ }
Example 4
Source File: CaptureActivity.java From ZXingProject with MIT License | 6 votes |
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_capture); scanPreview = (SurfaceView) findViewById(R.id.capture_preview); scanContainer = (RelativeLayout) findViewById(R.id.capture_container); scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view); scanLine = (ImageView) findViewById(R.id.capture_scan_line); inactivityTimer = new InactivityTimer(this); beepManager = new BeepManager(this); TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.9f); animation.setDuration(4500); animation.setRepeatCount(-1); animation.setRepeatMode(Animation.RESTART); scanLine.startAnimation(animation); }
Example 5
Source File: AntivirusActivity.java From MobileGuard with MIT License | 6 votes |
/** * 1 */ @Override protected void initView() { setContentView(R.layout.activity_antivirus); // bind view ivScan = (ImageView) findViewById(R.id.iv_scan); tvUseTime = (TextView) findViewById(R.id.tv_use_time); llLog = (LinearLayout) findViewById(R.id.ll_log); pbProgress = (ProgressBar) findViewById(R.id.pb_progress); // start a rotate animation Animation rotateAnimation = AnimationUtils.loadAnimation(this, R.anim.rotate_forever); rotateAnimation.setDuration(2000); ivScan.startAnimation(rotateAnimation); }
Example 6
Source File: CaptureActivity.java From myapplication with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_capture); scanPreview = (SurfaceView) findViewById(R.id.capture_preview); scanContainer = (RelativeLayout) findViewById(R.id.capture_container); scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view); scanLine = (ImageView) findViewById(R.id.capture_scan_line); inactivityTimer = new InactivityTimer(this); TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation .RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.9f); animation.setDuration(4500); animation.setRepeatCount(-1); animation.setRepeatMode(Animation.RESTART); scanLine.startAnimation(animation); initButton(); }
Example 7
Source File: AnimationTranslateActivity.java From GPT with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.an_translate); imgv0 = (ImageView) findViewById(R.id.img0); alphaAnimation0 = AnimationUtils.loadAnimation(this, R.anim.translate0); imgv0.startAnimation(alphaAnimation0); imgv1 = (ImageView) findViewById(R.id.img1); alphaAnimation1 = AnimationUtils.loadAnimation(this, R.anim.translate1); imgv1.startAnimation(alphaAnimation1); imgv2 = (ImageView) findViewById(R.id.img2); alphaAnimation2 = AnimationUtils.loadAnimation(this, R.anim.translate2); imgv2.startAnimation(alphaAnimation2); imgv3 = (ImageView) findViewById(R.id.img3); alphaAnimation3 = AnimationUtils.loadAnimation(this, R.anim.translate3); imgv3.startAnimation(alphaAnimation3); imgv4 = (ImageView) findViewById(R.id.img4); alphaAnimation4 = AnimationUtils.loadAnimation(this, R.anim.translate4); imgv4.startAnimation(alphaAnimation4); imgv5 = (ImageView) findViewById(R.id.img5); alphaAnimation5 = AnimationUtils.loadAnimation(this, R.anim.translate5); imgv5.startAnimation(alphaAnimation5); }
Example 8
Source File: OverTheTopLayer.java From ZeroGravityAnimation with MIT License | 5 votes |
/** * Applies the animation to the image view present in OTT. * @param animation */ public void applyAnimation(Animation animation) { if(mCreatedOttLayer != null) { ImageView drawnImageView = (ImageView) mCreatedOttLayer.getChildAt(0); drawnImageView.startAnimation(animation); } }
Example 9
Source File: SyncCapableCommCareActivity.java From commcare-android with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void addAnimationToMenuItem(MenuItem menuItem, @LayoutRes int layoutResource, @AnimRes int animationId) { LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); ImageView iv = (ImageView)inflater.inflate(layoutResource, null); Animation animation = AnimationUtils.loadAnimation(this, animationId); iv.startAnimation(animation); menuItem.setActionView(iv); }
Example 10
Source File: ImageUtil.java From Huochexing12306 with Apache License 2.0 | 5 votes |
/** * 将图片旋转一圈 * @param context * @param ivSwap */ public static void rotateImageOnce(Context context, ImageView ivSwap) { Animation operatingAnim = AnimationUtils.loadAnimation(context, R.anim.image_rotate_once); LinearInterpolator lin = new LinearInterpolator(); operatingAnim.setInterpolator(lin); if (operatingAnim != null) { ivSwap.startAnimation(operatingAnim); } }
Example 11
Source File: ArRecordActivity.java From PLDroidShortVideo with Apache License 2.0 | 5 votes |
private void initview() { final ViewGroup previewGroup = (ViewGroup) findViewById(R.id.preview); imageView = new ImageView(this); imageView.setVisibility(View.GONE); previewGroup.addView(scene, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); previewGroup.addView(imageView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); btn_record = (Button) findViewById(R.id.ar_record); btn_record.setOnClickListener(this); center = (ImageButton) findViewById(R.id.center); center.setOnClickListener(this); ivAnim = (ImageView) findViewById(R.id.iv_anim); rlAnim = (RelativeLayout) findViewById(R.id.rl_anim); tvLoading = (TextView) findViewById(R.id.tv_loading); Animation animation = AnimationUtils.loadAnimation(ArRecordActivity.this, R.anim.anim); animation.setInterpolator(new LinearInterpolator()); ivAnim.startAnimation(animation); progressText = (TextView) findViewById(R.id.progress_text); loadScene("scene.js"); if(TextUtils.isEmpty(appKey)&&TextUtils.isEmpty(appSecret)&&TextUtils.isEmpty(arid)){ Toast.makeText(this, "数据KEY为空,无法加载", Toast.LENGTH_SHORT).show(); }else{ loadARID(arid); } }
Example 12
Source File: AnimationScaleActivity.java From GPT with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.an_scale); ImageView imgv = (ImageView) findViewById(R.id.img); Animation alphaAnimation = AnimationUtils.loadAnimation(this, R.anim.scale); imgv.startAnimation(alphaAnimation); Intent intent = new Intent(); intent.putExtra("rs", "success"); setResult(2, intent); }
Example 13
Source File: CompassActivity.java From MuslimMateAndroid with GNU General Public License v3.0 | 5 votes |
/** * Function to init compass activity */ private void init() { countryName = (TextView) findViewById(R.id.textView11); if (MainActivity.locationInfo != null) countryName.setText(getResources().getConfiguration() .locale.getDisplayLanguage().equals("العربية") ? ConfigPreferences.getLocationConfig(this).name_english : ConfigPreferences.getLocationConfig(this).name); //init compass activity views Quibladegree = (TextView) findViewById(R.id.textView12); Quibladegree.setText(getString(R.string.qibla_direction) + " " + ConfigPreferences.getQuibla(this)); indicator = (ImageView) findViewById(R.id.imageView2); compass = (RelativeLayout) findViewById(R.id.compassContainer); compassMapContainer = (RelativeLayout) findViewById(R.id.compassMapContainer); compassMain = (RelativeLayout) findViewById(R.id.compassMain); smallCircleLevel = (ImageView) findViewById(R.id.smallCircle); innerPosition = (RelativeLayout) findViewById(R.id.innerplace); pointerIndicatorInner = (ImageView) findViewById(R.id.poinerInner); redCircle = (ImageView) findViewById(R.id.red_circle); errorImage = (ImageView) findViewById(R.id.error); //init sensor services mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); mMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); compassLevel = (ImageView) findViewById(R.id.compassLevel); //animate compass pointer RotateAnimation ra = new RotateAnimation(currentDegree, MainActivity.quiblaDegree, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); ra.setDuration(400); ra.setFillAfter(true); indicator.startAnimation(ra); pointerIndicatorInner.startAnimation(ra); }
Example 14
Source File: FileListAdapter.java From GreenDamFileExploere with Apache License 2.0 | 5 votes |
public void handleMessage(Message msg) { if (msg.what == MSG_TYPE_DISPLAY_IMAGE) { Holder holder = (Holder) msg.obj; ImageView imageView = (ImageView) mListView.findViewWithTag(holder.url); if (imageView != null && holder.bitmap != null) { imageView.setImageBitmap(holder.bitmap); Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.alpha_action_long); imageView.startAnimation(anim); } } }
Example 15
Source File: ImageUtil.java From Huochexing12306 with Apache License 2.0 | 5 votes |
public static void rotateImageForever(Context context, ImageView ivSwap, int id) { Animation operatingAnim = AnimationUtils.loadAnimation(context,id); LinearInterpolator lin = new LinearInterpolator(); operatingAnim.setInterpolator(lin); if (operatingAnim != null) { ivSwap.startAnimation(operatingAnim); } }
Example 16
Source File: BalancesFragment.java From smartcoins-wallet with MIT License | 4 votes |
private void rotateReceiveButton() { ImageView rcvBtn = (ImageView) getActivity().findViewById(R.id.receivebtn); final Animation rotAnim = AnimationUtils.loadAnimation(getContext(), R.anim.rotate360); rcvBtn.startAnimation(rotAnim); }
Example 17
Source File: AboutFragment.java From Deadline with GNU General Public License v3.0 | 4 votes |
private void setupIconAnim() { ImageView icon = getView().findViewById(R.id.about_icon); Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.icon_anim); icon.startAnimation(animation); }
Example 18
Source File: CaptureActivity.java From gokit-android with MIT License | 4 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /** * 设置为竖屏 */ if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_gos_capture); scanPreview = (SurfaceView) findViewById(R.id.capture_preview); scanContainer = (RelativeLayout) findViewById(R.id.capture_container); scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view); scanLine = (ImageView) findViewById(R.id.capture_scan_line); inactivityTimer = new InactivityTimer(this); TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f); animation.setDuration(4500); animation.setRepeatCount(-1); animation.setRepeatMode(Animation.RESTART); scanLine.startAnimation(animation); btnCancel = (Button) findViewById(R.id.btn_cancel); ivReturn = (ImageView) findViewById(R.id.iv_return); OnClickListener myClick = new OnClickListener() { @Override public void onClick(View arg0) { CaptureActivity.this.finish(); } }; btnCancel.setOnClickListener(myClick); ivReturn.setOnClickListener(myClick); }
Example 19
Source File: Main.java From iZhihu with GNU General Public License v2.0 | 4 votes |
@Override public void handleMessage(Message msg) { switch (msg.what) { case MESSAGE_UPDATE_LOADING: if (isFirstRun()) { progressDialog = ProgressDialog.show( Main.this, getString(R.string.app_name), getString(R.string.loading), false, false); } Animation rotation = AnimationUtils.loadAnimation(context, R.anim.refresh_rotate); RelativeLayout layout = new RelativeLayout(context); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); ImageView imageView = new ImageView(context); imageView.setLayoutParams(params); layout.setGravity(Gravity.CENTER_VERTICAL | Gravity.TOP); layout.addView(imageView); imageView.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_refersh)); imageView.startAnimation(rotation); if (mMenuRefersh != null) { mMenuRefersh.setActionView(layout); } break; case MESSAGE_UPDATE_COMPLETE: try { Fragment fragment = mScrollTabsFragment.getCurrentFragment(); if (fragment instanceof QuestionsListFragment) { ((QuestionsListFragment) fragment).updateQuestionsFromDatabase(); } } catch (NullPointerException e) { e.printStackTrace(); } finally { mScrollTabsFragment.notifyDatasetChanged(); } if (mMenuRefersh != null) { View v = mMenuRefersh.getActionView(); if (v != null) { v.clearAnimation(); } mMenuRefersh.setActionView(null); } if (progressDialog != null) { progressDialog.dismiss(); } if (mFetchQuestionsTask.hasError()) { Helper.showShortToast(context, mFetchQuestionsTask.getErrorMessage()); } break; case MESSAGE_UPDATE_SHOW_RESULT: if (mFetchQuestionsTask != null) { String message = getString(R.string.no_newer_questions); if (mFetchQuestionsTask.getAffectedRows() > 0) { message = String.format(getString(R.string.affectRows), mFetchQuestionsTask.getAffectedRows()); } Helper.showShortToast(context, message); } break; } }
Example 20
Source File: MainActivity.java From DualSIMCard with Apache License 2.0 | 4 votes |
public void clockwise(View view) { ImageView image = (ImageView) findViewById(R.id.dualSIMimageView); Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.clockwise); image.startAnimation(animation); readSims(); }