use of android.view.animation.RotateAnimation in project LoadingView by ldoublem.
the class LVChromeLogo method initPaint.
private void initPaint() {
evaluator = new ArgbEvaluator();
mPaintRed = new Paint();
mPaintRed.setAntiAlias(true);
mPaintRed.setStyle(Paint.Style.FILL);
mPaintRed.setColor(Color.rgb(211, 57, 53));
mPaintYellow = new Paint();
mPaintYellow.setAntiAlias(true);
mPaintYellow.setStyle(Paint.Style.FILL);
mPaintYellow.setColor(Color.rgb(253, 197, 53));
mPaintGreen = new Paint();
mPaintGreen.setAntiAlias(true);
mPaintGreen.setStyle(Paint.Style.FILL);
mPaintGreen.setColor(Color.rgb(27, 147, 76));
mPaintBulue = new Paint();
mPaintBulue.setAntiAlias(true);
mPaintBulue.setStyle(Paint.Style.FILL);
mPaintBulue.setColor(Color.rgb(61, 117, 242));
mPaintWhite = new Paint();
mPaintWhite.setAntiAlias(true);
mPaintWhite.setStyle(Paint.Style.FILL);
mPaintWhite.setColor(Color.WHITE);
mPaintLine = new Paint();
mPaintLine.setAntiAlias(true);
mPaintLine.setStyle(Paint.Style.FILL);
mPaintLine.setColor(Color.argb(30, 0, 0, 0));
mProgerssRotateAnim = new RotateAnimation(0f, 360f, android.view.animation.Animation.RELATIVE_TO_SELF, 0.5f, android.view.animation.Animation.RELATIVE_TO_SELF, 0.5f);
mProgerssRotateAnim.setRepeatCount(-1);
// 不停顿
mProgerssRotateAnim.setInterpolator(new LinearInterpolator());
// 停在最后
mProgerssRotateAnim.setFillAfter(true);
}
use of android.view.animation.RotateAnimation in project chefly_android by chef-ly.
the class RecipeDetailActivity method setRecipeInfo.
private void setRecipeInfo() {
final Context c = getApplicationContext();
TextView author = (TextView) findViewById(R.id.recipeAuthor);
// TextView description = (TextView) findViewById(R.id.recipeDescription);
TextView serves = (TextView) findViewById(R.id.recipeServings);
TextView time = (TextView) findViewById(R.id.recipeTime);
String recipeName;
Step[] directions;
if (recipeDetail == null) {
recipeTitle.setText(R.string.recipeNotFound);
} else {
recipeName = recipeDetail.getTitle();
recipeTitle.setText(recipeName);
author.setText(recipeDetail.getCreditText());
int servings = recipeDetail.getServings();
Log.d(TAG, "Serves -> " + servings);
if (servings <= 0) {
serves.setText(R.string.unknown);
} else {
serves.setText(String.valueOf(servings));
}
int cookTime = recipeDetail.getReadyInMinutes();
int hour = 0;
while (cookTime >= 60) {
hour++;
cookTime = cookTime - 60;
}
String newTime;
if (hour < 2) {
newTime = (hour != 0) ? hour + " hr " : "";
} else {
newTime = (hour != 0) ? hour + " hrs " : "";
}
newTime += ((cookTime > 0) ? cookTime + " min" : "");
if (newTime.isEmpty()) {
time.setText(R.string.unknown);
} else {
time.setText(newTime);
}
new AsyncTask<RequestMethod, Integer, Long>() {
Bitmap image = null;
@Override
protected Long doInBackground(RequestMethod... params) {
try {
URL url = new URL(recipeDetail.getImage());
image = BitmapFactory.decodeStream(url.openConnection().getInputStream());
} catch (IOException e) {
Log.d(TAG, "IOException on load image");
Log.d(TAG, e.getMessage());
}
return 1L;
}
@Override
protected void onPostExecute(Long aLong) {
if (image != null) {
imageView.setImageBitmap(image);
}
}
}.execute();
ingredients = recipeDetail.getExtendedIngredients();
if (recipeDetail.getAnalyzedInstructions().length > 0) {
directions = recipeDetail.getAnalyzedInstructions()[0].getSteps();
} else {
directions = new Step[] { new Step(recipeDetail.getInstructions()) };
}
// checkBoxes = new CheckBox[ingredients.length];
// int states[][] = {{android.R.attr.state_checked}, {}};
TableLayout table = (TableLayout) findViewById(R.id.ingredientGroup);
TableLayout.LayoutParams tableRowParams = new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT);
int leftMargin = 30;
int topMargin = 1;
int rightMargin = 30;
int bottomMargin = 1;
tableRowParams.setMargins(leftMargin, topMargin, rightMargin, bottomMargin);
int color1 = getColor(c, R.color.table_color1);
int color2 = getColor(c, R.color.table_color2);
int count = 0;
for (ExtendedIngredient s : ingredients) {
final TableRow row = new TableRow(c);
row.setLayoutParams(tableRowParams);
row.setBackgroundColor(count % 2 == 0 ? color1 : color2);
row.setPadding(10, 5, 10, 5);
TextView text = new TextView(c);
text.setText(s.getOriginalString());
text.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.black));
text.setTextSize((getResources().getDimension(R.dimen.text_small) / getResources().getDisplayMetrics().density));
text.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT, 1f));
text.setPadding(10, 5, 10, 5);
text.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ImageView image = (ImageView) row.getChildAt(1);
String text = String.valueOf(((TextView) row.getChildAt(0)).getText());
if (row.getChildAt(1).getVisibility() == View.GONE) {
image.setVisibility(View.VISIBLE);
shoppingList.add(new ShoppingListItem(text, false));
Toast.makeText(c, text + " added to shopping list", Toast.LENGTH_SHORT).show();
} else {
image.setVisibility(View.GONE);
shoppingList.remove(new ShoppingListItem(text, false));
Toast.makeText(c, text + " removed from shopping list", Toast.LENGTH_SHORT).show();
}
}
});
row.addView(text);
ImageView check = new ImageView(c);
check.setImageResource(R.drawable.shoppinglist);
check.setLayoutParams(new TableRow.LayoutParams(60, 60, 0.1f));
if (shoppingList.contains(new ShoppingListItem(s.getOriginalString(), false))) {
check.setVisibility(View.VISIBLE);
} else {
check.setVisibility(View.GONE);
}
row.addView(check);
table.addView(row);
count++;
}
//
final TableLayout tableDirec = (TableLayout) findViewById(R.id.directionGroup);
tableDirec.setColumnShrinkable(0, true);
tableDirec.setVisibility(View.GONE);
directionsForCooking = new String[directions.length];
count = 1;
for (Step s : directions) {
String step = count + ") " + s.getStep();
TableRow row = new TableRow(c);
row.setLayoutParams(tableRowParams);
row.setBackgroundColor(count % 2 == 0 ? color1 : color2);
TextView text = new TextView(c);
text.setText(step);
text.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.black));
text.setTextSize((getResources().getDimension(R.dimen.text_small) / getResources().getDisplayMetrics().density));
text.setPadding(15, 1, 15, 1);
text.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT, 1f));
row.addView(text);
tableDirec.addView(row);
directionsForCooking[count - 1] = s.getStep();
count++;
}
final ScrollView sv = (ScrollView) findViewById(R.id.scrollView);
final ImageButton dropdown = (ImageButton) findViewById(R.id.directionsDropdown);
final RotateAnimation rotatedown = new RotateAnimation(0, 180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotatedown.setDuration(250);
rotatedown.setFillAfter(true);
final RotateAnimation rotateup = new RotateAnimation(180, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotateup.setDuration(250);
rotateup.setFillAfter(true);
dropdown.setOnClickListener(new View.OnClickListener() {
private boolean isClicked = false;
@Override
public void onClick(View v) {
if (!isClicked) {
tableDirec.setVisibility(View.VISIBLE);
dropdown.startAnimation(rotatedown);
isClicked = true;
sv.post(new Runnable() {
@Override
public void run() {
// sv.fullScroll(ScrollView.FOCUS_DOWN);
sv.smoothScrollBy(0, 500);
}
});
} else {
dropdown.startAnimation(rotateup);
tableDirec.setVisibility(View.GONE);
isClicked = false;
// sv.fullScroll(ScrollView.FOCUS_DOWN);
}
}
});
}
}
use of android.view.animation.RotateAnimation in project android-satellite-menu by siyamed.
the class SatelliteAnimationCreator method createItemOutAnimation.
public static Animation createItemOutAnimation(Context context, int index, long expandDuration, int x, int y) {
AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
long alphaDuration = 60;
if (expandDuration < 60) {
alphaDuration = expandDuration / 4;
}
alphaAnimation.setDuration(alphaDuration);
alphaAnimation.setStartOffset(0);
TranslateAnimation translate = new TranslateAnimation(0, x, 0, y);
translate.setStartOffset(0);
translate.setDuration(expandDuration);
translate.setInterpolator(context, R.anim.sat_item_overshoot_interpolator);
RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setInterpolator(context, R.anim.sat_item_out_rotate_interpolator);
long duration = 100;
if (expandDuration <= 150) {
duration = expandDuration / 3;
}
rotate.setDuration(expandDuration - duration);
rotate.setStartOffset(duration);
AnimationSet animationSet = new AnimationSet(false);
animationSet.setFillAfter(false);
animationSet.setFillBefore(true);
animationSet.setFillEnabled(true);
// animationSet.addAnimation(alphaAnimation);
// animationSet.addAnimation(rotate);
animationSet.addAnimation(translate);
animationSet.setStartOffset(30 * index);
return animationSet;
}
use of android.view.animation.RotateAnimation in project android_packages_apps_DUI by DirtyUnicorns.
the class FlingLogoController method getSpinAnimation.
public static AnimationSet getSpinAnimation(int mode) {
final boolean makeHidden = mode == LOGO_ANIMATE_HIDE;
final float from = makeHidden ? 1.0f : 0.0f;
final float to = makeHidden ? 0.0f : 1.0f;
final float fromDeg = makeHidden ? 0.0f : 360.0f;
final float toDeg = makeHidden ? 360.0f : 0.0f;
Animation scale = new ScaleAnimation(from, to, from, to, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
RotateAnimation rotate = new RotateAnimation(fromDeg, toDeg, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
AnimationSet animSet = new AnimationSet(true);
animSet.setInterpolator(new LinearInterpolator());
animSet.setDuration(150);
animSet.setFillAfter(true);
animSet.addAnimation(scale);
animSet.addAnimation(rotate);
return animSet;
}
use of android.view.animation.RotateAnimation in project ETSMobile-Android2 by ApplETS.
the class CustomProgressDialog method show.
@Override
public void show() {
super.show();
RotateAnimation anim = new RotateAnimation(0.0f, 359.0f, Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f);
anim.setInterpolator(new LinearInterpolator());
anim.setRepeatCount(Animation.INFINITE);
anim.setDuration(3000);
rotatingImageView.setAnimation(anim);
rotatingImageView.startAnimation(anim);
}
Aggregations