List of usage examples for android.widget ImageView setRotation
public void setRotation(float rotation)
From source file:com.android.argb.edhlc.Utils.java
public static void expand(Context context, final CardView card, TextView title, ImageView selector, int minHeight, int maxHeight) { title.setTextColor(ContextCompat.getColor(context, R.color.accent_color_dark)); Animation rotation = AnimationUtils.loadAnimation(context, R.anim.rotate_180_anticlockwise); selector.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.arrow_up)); selector.setRotation(0); selector.startAnimation(rotation);/*ww w.j a v a 2s. c om*/ selector.setColorFilter(ContextCompat.getColor(context, R.color.accent_color_dark)); ValueAnimator anim = ValueAnimator.ofInt(minHeight, maxHeight); anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { int val = (Integer) valueAnimator.getAnimatedValue(); ViewGroup.LayoutParams layoutParams = card.getLayoutParams(); layoutParams.height = val; card.setLayoutParams(layoutParams); Utils.makeViewVisible(card); } }); anim.start(); }
From source file:com.crearo.gpslogger.ui.fragments.display.GpsSimpleViewFragment.java
public void displayLocationInfo(Location locationInfo) { showPreferencesSummary();//from w w w . j a v a 2 s. com NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(3); EditText txtLatitude = (EditText) rootView.findViewById(R.id.simple_lat_text); txtLatitude.setText(String.valueOf(nf.format(locationInfo.getLatitude())) + ", " + String.valueOf(nf.format(locationInfo.getLongitude()))); nf.setMaximumFractionDigits(3); ImageView imgAccuracy = (ImageView) rootView.findViewById(R.id.simpleview_imgAccuracy); clearColor(imgAccuracy); if (locationInfo.hasAccuracy()) { TextView txtAccuracy = (TextView) rootView.findViewById(R.id.simpleview_txtAccuracy); float accuracy = locationInfo.getAccuracy(); txtAccuracy.setText(Strings.getDistanceDisplay(getActivity(), accuracy, preferenceHelper.shouldDisplayImperialUnits())); if (accuracy > 500) { setColor(imgAccuracy, IconColorIndicator.Warning); } if (accuracy > 900) { setColor(imgAccuracy, IconColorIndicator.Bad); } else { setColor(imgAccuracy, IconColorIndicator.Good); } } ImageView imgAltitude = (ImageView) rootView.findViewById(R.id.simpleview_imgAltitude); clearColor(imgAltitude); if (locationInfo.hasAltitude()) { setColor(imgAltitude, IconColorIndicator.Good); TextView txtAltitude = (TextView) rootView.findViewById(R.id.simpleview_txtAltitude); txtAltitude.setText(Strings.getDistanceDisplay(getActivity(), locationInfo.getAltitude(), preferenceHelper.shouldDisplayImperialUnits())); } ImageView imgSpeed = (ImageView) rootView.findViewById(R.id.simpleview_imgSpeed); clearColor(imgSpeed); if (locationInfo.hasSpeed()) { setColor(imgSpeed, IconColorIndicator.Good); TextView txtSpeed = (TextView) rootView.findViewById(R.id.simpleview_txtSpeed); txtSpeed.setText(Strings.getSpeedDisplay(getActivity(), locationInfo.getSpeed(), preferenceHelper.shouldDisplayImperialUnits())); } ImageView imgDirection = (ImageView) rootView.findViewById(R.id.simpleview_imgDirection); clearColor(imgDirection); if (locationInfo.hasBearing()) { setColor(imgDirection, IconColorIndicator.Good); imgDirection.setRotation(locationInfo.getBearing()); TextView txtDirection = (TextView) rootView.findViewById(R.id.simpleview_txtDirection); txtDirection.setText( String.valueOf(Math.round(locationInfo.getBearing())) + getString(R.string.degree_symbol)); } TextView txtDuration = (TextView) rootView.findViewById(R.id.simpleview_txtDuration); long startTime = Session.getStartTimeStamp(); long currentTime = System.currentTimeMillis(); txtDuration.setText(Strings.getTimeDisplay(getActivity(), currentTime - startTime)); double distanceValue = Session.getTotalTravelled(); TextView txtPoints = (TextView) rootView.findViewById(R.id.simpleview_txtPoints); TextView txtTravelled = (TextView) rootView.findViewById(R.id.simpleview_txtDistance); txtTravelled.setText(Strings.getDistanceDisplay(getActivity(), distanceValue, preferenceHelper.shouldDisplayImperialUnits())); txtPoints.setText(Session.getNumLegs() + " " + getString(R.string.points)); String providerName = locationInfo.getProvider(); if (!providerName.equalsIgnoreCase(LocationManager.GPS_PROVIDER)) { setSatelliteCount(-1); } }
From source file:com.bitants.wally.views.swipeclearlayout.SwipeClearLayout.java
private View generateCircle(Context context, AttributeSet attrs, DisplayMetrics metrics) { ImageView view = new ImageView(context, attrs); GradientDrawable circle = (GradientDrawable) getResources().getDrawable(R.drawable.circle); circle.setColor(CIRCLE_DEFAULT_COLOR); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.setBackground(circle);//from ww w. ja va 2s . c o m } else { view.setBackgroundDrawable(circle); } int size = (int) (metrics.density * CIRCLE_SIZE); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(size, size); view.setLayoutParams(params); view.setImageResource(R.drawable.clip_random); view.setScaleType(ImageView.ScaleType.CENTER_INSIDE); view.setRotation(90.0f); return view; }
From source file:org.ff.armaconnect.WeatherActivity.java
private void updateWeatherUI(Weather w) { final Weather weather = w; this.findViewById(android.R.id.content).post(new Runnable() { @Override//from ww w.j av a2s .com public void run() { ImageView imageWeather = (ImageView) findViewById(R.id.imageWeather); TextView textWeather = (TextView) findViewById(R.id.textWeather); ImageView imageWind = (ImageView) findViewById(R.id.imageWind); TextView textWind = (TextView) findViewById(R.id.textWind); TextView textHumidity = (TextView) findViewById(R.id.textHumidity); TextView textFog = (TextView) findViewById(R.id.textFog); TextView textWaves = (TextView) findViewById(R.id.textWaves); if (weather.overcast > 0.3 && weather.lightning > 0.3) { imageWeather.setImageResource(R.drawable.weather_storm); textWeather.setText(getResources().getString(R.string.weather_Storms)); } else if (weather.overcast > 0.3 && weather.rain > 0.3) { imageWeather.setImageResource(R.drawable.weather_showers); textWeather.setText(getResources().getString(R.string.weather_Raining)); } else if (weather.overcast > 0.5) { imageWeather.setImageResource(R.drawable.weather_overcast); textWeather.setText(getResources().getString(R.string.weather_Cloudy)); } else if (weather.overcast > 0.15) { imageWeather.setImageResource(R.drawable.weather_few_clouds); textWeather.setText(getResources().getString(R.string.weather_PatchyClouds)); } else { imageWeather.setImageResource(R.drawable.weather_clear); textWeather.setText(getResources().getString(R.string.weather_Sunny)); } //TODO: check if this means the wind is "coming" or "going", do we need to add/subtract 180 or not...? imageWind.setRotation(weather.wind_direction_degrees); DecimalFormat df = new DecimalFormat("#.#"); String wind; if (SettingsActivity.metricUnits()) wind = df.format(weather.wind_speed) + " m/s"; else wind = df.format(weather.wind_speed * 2.23694) + " mph"; if (weather.wind_strength == 0) { wind = wind + " - calm"; } else if (weather.wind_strength < 0.3) { wind = wind + " - low strength"; } else if (weather.wind_strength < 0.7) { wind = wind + " - moderately strong"; } else { wind = wind + " - extremely strong"; } textWind.setText(wind); textHumidity.setText((Math.round(weather.humidity * 100)) + "%"); //TODO: convert Arma 0-1 value to a visibility distance (in meters) if (weather.fog == 0) { textFog.setText(getString(R.string.weather_Fog_0)); } else if (weather.fog < 0.3) { textFog.setText(getString(R.string.weather_Fog_0_3)); } else if (weather.fog < 0.7) { textFog.setText(getString(R.string.weather_Fog_0_7)); } else { textFog.setText(getString(R.string.weather_Fog_1_0)); } //TODO: can we convert Arma 0-1 value to a meter height? //then we could have a proper definition //https://en.wikipedia.org/wiki/Sea_state if (weather.waves == 0) { textWaves.setText(getString(R.string.weather_Waves_0)); } else if (weather.waves < 0.3) { textWaves.setText(getString(R.string.weather_Waves_0_3)); } else if (weather.waves < 0.7) { textWaves.setText(getString(R.string.weather_Waves_0_7)); } else { textWaves.setText(getString(R.string.weather_Waves_1_0)); } } }); }