Postingan

Animation bounce

ObjectAnimator anim = ObjectAnimator.ofFloat(textView, "ScaleY", 0, 1); anim.setInterpolator(new BounceInterpolator()); anim.setDuration(1000); anim.start();

Animation Colors

ObjectAnimator anim = ObjectAnimator.ofArgb(text, "TextColor", Color.MAGENTA, Color.BLUE, Color.CYAN, Color.GREEN); anim.setDuration(5000); ObjectAnimator animBgr = ObjectAnimator.ofArgb(text, "BackgroundColor", Color.CYAN, Color.GREEN, Color.MAGENTA, Color.BLUE); animBgr.setDuration(5000); AnimatorSet animSet = new AnimatorSet(); animSet.play(anim).with(animBgr); animSet.start();

Animation Fade

//IN final AlphaAnimation fadeIn = new AlphaAnimation(1.0f,0.0f); final AlphaAnimation fadeOut = new AlphaAnimation(0.0f,1.0f); text.startAnimation(fadeIn); text.startAnimation(fadeOut); fadeIn.setDuration(1200); fadeIn.setFillAfter(true); fadeOut.setDuration(1200); fadeOut.setFillAfter(true); fadeOut.setStartOffset(10+fadeIn.getStartOffset()); //OUT final AlphaAnimation fadeIn = new AlphaAnimation(0.0f,1.0f); final AlphaAnimation fadeOut = new AlphaAnimation(1.0f,0.0f); text.startAnimation(fadeIn); text.startAnimation(fadeOut); fadeIn.setDuration(1200); fadeIn.setFillAfter(true); fadeOut.setDuration(1200); fadeOut.setFillAfter(true); fadeOut.setStartOffset(10+fadeIn.getStartOffset());

Animation Fade With Alpha

//IN ObjectAnimator anim = ObjectAnimator.ofFloat(textView, "Alpha", 0, 1); anim.setDuration(5000); anim.start(); //Out ObjectAnimator anim = ObjectAnimator.ofFloat(textView, "Alpha", 1, 0); anim.setDuration(5000); anim.start();

Animation Move

TranslateAnimation translateAnimation = new TranslateAnimation (Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,.85f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0.65f); translateAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); translateAnimation.setDuration(1200); text.startAnimation(translateAnimation);

Animation Rotate

/Anti ClockWise RotateAnimation rotateAnimation = new RotateAnimation(360, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotateAnimation.setInterpolator(new AccelerateInterpolator()); rotateAnimation.setDuration(3000); text.startAnimation(rotateAnimation); //Default RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotateAnimation.setInterpolator(new LinearInterpolator()); rotateAnimation.setDuration(3000); text.startAnimation(rotateAnimation);

Animation Slide Down/Up

//Down ObjectAnimator anim = ObjectAnimator.ofFloat(text, "ScaleY", 0, 1); anim.setDuration(4000); anim.start(); //Up ObjectAnimator anim = ObjectAnimator.ofFloat(text, "ScaleY", 1, 0); anim.setDuration(2000); anim.start();

Animation Slide In/Out

//In ObjectAnimator anim = ObjectAnimator.ofFloat(text, "ScaleX", 1, 0); anim.setDuration(2000); anim.start(); //Out ObjectAnimator anim = ObjectAnimator.ofFloat(text, "ScaleX", 0, 1); anim.setDuration(2000); anim.start();

Animation Text Blink

Animation anim =new AlphaAnimation(0.0f,1.0f); anim.setDuration(50); anim.setStartOffset(20); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(Animation.INFINITE); text.startAnimation(anim);

Animation TranslateXY

//Animation From XML tranlate Animation animation = new TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta); animation.setDuration(1500); animation.setFillAfter(true); view.startAnimation(animation);

Animation Transtition Animation

/*this will go in button click, activity start, or whatever*/ android.transition.TransitionManager.beginDelayedTransition(linear1,makeFadeTransition()); toggleVisibility(imageview1,imageview2,imageview3,imageview4); android.transition.TransitionManager.beginDelayedTransition(linear1,makeSlideTransition()); toggleVisibility(imageview1,imageview2,imageview3,imageview4); android.transition.TransitionManager.beginDelayedTransition(linear1,makeExplodeTransition()); toggleVisibility(imageview1,imageview2,imageview3,imageview4); /*This stays at the bottom of all code in onCreate*/ } private android.transition.Fade makeFadeTransition(){ android.transition.Fade fade = new android.transition.Fade(); fade.setDuration(2000); fade.setInterpolator(new AnticipateInterpolator()); return fade; } private android.transition.Slide makeSlideTransition(){ android.transition.Slide slide = new android.transition.Slide(); slide.setSlideEdge(Gravity.TOP); slide.setInterpolator(new BounceInterpolator()); slide.s...

Animation ZoomIn/ZoomOut

//IN ScaleAnimation scaleAnimation = new ScaleAnimation(1f,4f,1f,4f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleAnimation.setInterpolator(new LinearInterpolator()); scaleAnimation.setDuration(1800); text.startAnimation(scaleAnimation); //Out ScaleAnimation scaleAnimation = new ScaleAnimation(1f,0.5f,1f,.50f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); scaleAnimation.setDuration(1800); text.startAnimation(scaleAnimation);

App list with icon (launch app)

Intent startupIntent = new Intent(Intent.ACTION_MAIN);  startupIntent.addCategory(Intent.CATEGORY_LAUNCHER);   final android.content.pm.PackageManager pm = getPackageManager();  List<android.content.pm.ResolveInfo> activities = pm.queryIntentActivities(startupIntent,0);    Collections.sort(activities, new Comparator<android.content.pm.ResolveInfo>() {   public int compare(android.content.pm.ResolveInfo a, android.content.pm.ResolveInfo b) {   android.content.pm.PackageManager pm = getPackageManager();   return String.CASE_INSENSITIVE_ORDER.compare(   a.loadLabel(pm).toString(),   b.loadLabel(pm).toString());   }   });    ArrayAdapter<android.content.pm.ResolveInfo> adapter = new ArrayAdapter<android.content.pm.ResolveInfo>(   this, android.R.layout.simple_list_item_1, activities) {   pub...

App list with icon (Uninstall app)

Intent startupIntent = new Intent(Intent.ACTION_MAIN);  startupIntent.addCategory(Intent.CATEGORY_LAUNCHER);   final android.content.pm.PackageManager pm = getPackageManager();  List<android.content.pm.ResolveInfo> activities = pm.queryIntentActivities(startupIntent,0);    Collections.sort(activities, new Comparator<android.content.pm.ResolveInfo>() {   public int compare(android.content.pm.ResolveInfo a, android.content.pm.ResolveInfo b) {   android.content.pm.PackageManager pm = getPackageManager();   return String.CASE_INSENSITIVE_ORDER.compare(   a.loadLabel(pm).toString(),   b.loadLabel(pm).toString());   }   });    ArrayAdapter<android.content.pm.ResolveInfo> adapter = new ArrayAdapter<android.content.pm.ResolveInfo>(   this, android.R.layout.simple_list_item_1, activities) {   pub...

App list without icon (launch app)

Intent startupIntent = new Intent(Intent.ACTION_MAIN);  startupIntent.addCategory(Intent.CATEGORY_LAUNCHER);   final android.content.pm.PackageManager pm = getPackageManager();  List<android.content.pm.ResolveInfo> activities = pm.queryIntentActivities(startupIntent,0);    Collections.sort(activities, new Comparator<android.content.pm.ResolveInfo>() {   public int compare(android.content.pm.ResolveInfo a, android.content.pm.ResolveInfo b) {   android.content.pm.PackageManager pm = getPackageManager();   return String.CASE_INSENSITIVE_ORDER.compare(   a.loadLabel(pm).toString(),   b.loadLabel(pm).toString());   }   });    ArrayAdapter<android.content.pm.ResolveInfo> adapter = new ArrayAdapter<android.content.pm.ResolveInfo>(   this, android.R.layout.simple_list_item_1, activities) {   pub...

App list without icon (Uninstall app)

Intent startupIntent = new Intent(Intent.ACTION_MAIN);  startupIntent.addCategory(Intent.CATEGORY_LAUNCHER);   final android.content.pm.PackageManager pm = getPackageManager();  List<android.content.pm.ResolveInfo> activities = pm.queryIntentActivities(startupIntent,0);    Collections.sort(activities, new Comparator<android.content.pm.ResolveInfo>() {   public int compare(android.content.pm.ResolveInfo a, android.content.pm.ResolveInfo b) {   android.content.pm.PackageManager pm = getPackageManager();   return String.CASE_INSENSITIVE_ORDER.compare(   a.loadLabel(pm).toString(),   b.loadLabel(pm).toString());   }   });    ArrayAdapter<android.content.pm.ResolveInfo> adapter = new ArrayAdapter<android.content.pm.ResolveInfo>(   this, android.R.layout.simple_list_item_1, activities) {   pub...

Background AutoColor

color1 = 0xffffffff; anim = ObjectAnimator.ofInt(linear1, "backgroundColor", color1); anim.setEvaluator(new ArgbEvaluator()); anim.setDuration(1000); new Thread() { public void run() { while(true) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } runOnUiThread(new Runnable() { public void run() { red2 = (int)(java.lang.Math.random() * 128 + 127); green2 = (int)(java.lang.Math.random() * 128 + 127); blue2 = (int)(java.lang.Math.random() * 128 + 127); color2 = 0xff << 24 | (red2 << 16) | (green2 << 8) | blue2; anim.setIntValues(color1, color2); anim.start(); color1 = color2; } }); } } }.start(); } public int color1, color2, red1, red2, blue1, blue2, green1, green2; ObjectAnimator anim; {

Background RGB Color

linear1.setBackgroundColor(Color.rgb(212,98,151));

Background HexColor

linear1.setBackgroundColor(Color.parseColor("#000000"));

Battery Level code

BatteryManager bm = (BatteryManager)getSystemService(BATTERY_SERVICE); int batLevel = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY); textview1.setText(Integer.toString(batLevel));

Cara pembuatan Apps paling Populer

Create Stopwatch App in Android using Sketchware

TextInputLayout in Sketchware

How to enable download in webview in Sketchware apps?

Create Stopwatch App in Android using Sketchware

Code for implementing Notifications in Sketchware

A Flash Light App in Sketchware

Codes for modifying Action Bar in Sketchware

How to integrate Admob Ads in Sketchware project using AIDE?

How to find and​ highlight a word in a text field in Sketchware?

Firebase Login/Register with email verification