use of android.support.annotation.UiThread in project FastHub by k0shk0sh.
the class AnimHelper method startBeatsAnimation.
@UiThread
public static void startBeatsAnimation(@NonNull View view) {
view.clearAnimation();
if (view.getAnimation() != null) {
view.getAnimation().cancel();
}
List<ObjectAnimator> animators = getBeats(view);
for (ObjectAnimator anim : animators) {
anim.setDuration(300).start();
anim.setInterpolator(interpolator);
}
}
use of android.support.annotation.UiThread in project androidApp by InspectorIncognito.
the class UserFragment method updateUI.
@UiThread
private void updateUI() {
final TranSappAccount account = TranSappAccountManager.getCurrentAccount();
if (!TranSappAccountManager.isLoggedIn()) {
getActivity().finish();
return;
}
progressImage.setProgressValues(account.getScore(), account.getLevelMinScore(), account.getLevelMaxScore());
progressImage.loadImage(account);
userName.setText(account.getName());
level.setText(String.format(Locale.getDefault(), "NIVEL %d", account.getLevelPosition()));
score.setText(String.format(Locale.getDefault(), "%s de %s ptos", account.getFormattedScore(), account.getFormattedLevelMaxScore()));
levelName.setText(account.getLevelName());
levelBackground.setImageResource(account.getLevelBackgroundImage());
rankingPosition.setText(String.format(Locale.getDefault(), "%d", account.currentUser.globalRankingPosition));
rankingFrame.setImageResource(account.getLevelSimpleFrame());
int id = account.getBusAvatarId();
userBusAvatarView.setAvatarId(id);
BusAvatar avatar = Avatar.getBusAvatarById(id);
userBusAvatarTitle.setText(getString(avatar.titleId));
rankingButton.setClickable(true);
rankingPosition.setVisibility(View.VISIBLE);
rankingProgressBar.setVisibility(View.GONE);
rankingButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
rankingButton.setClickable(false);
rankingPosition.setVisibility(View.GONE);
rankingProgressBar.setVisibility(View.VISIBLE);
RankingRequest request = new RankingRequest(new Request.RequestListener<Pair<ArrayList<TranSappUser>, ArrayList<TranSappUser>>>() {
@Override
public void onRequestError() {
if (getActivity() == null || getContext() == null) {
return;
}
Toast.makeText(getActivity(), "Ranking no disponible", Toast.LENGTH_SHORT).show();
rankingButton.setClickable(true);
rankingPosition.setVisibility(View.VISIBLE);
rankingProgressBar.setVisibility(View.GONE);
}
@Override
public void onRequestResult(@NonNull Pair<ArrayList<TranSappUser>, ArrayList<TranSappUser>> response) {
if (getActivity() == null || getContext() == null) {
return;
}
Intent intent = new Intent(getActivity(), RankingActivity.class);
intent.putParcelableArrayListExtra(RankingActivity.TOP_RANKING_KEY, response.first);
intent.putParcelableArrayListExtra(RankingActivity.USER_RANKING_KEY, response.second);
startActivityForResult(intent, RANKING_ACTIVITY_CODE);
}
}, account);
ServerController.sendRequest(request, null);
}
});
}
use of android.support.annotation.UiThread in project AndroidLife by CaMnter.
the class Utils method getTintedDrawable.
// Implicit synchronization for use of shared resource VALUE.
@UiThread
public static Drawable getTintedDrawable(Context context, @DrawableRes int id, @AttrRes int tintAttrId) {
boolean attributeFound = context.getTheme().resolveAttribute(tintAttrId, VALUE, true);
if (!attributeFound) {
throw new Resources.NotFoundException("Required tint color attribute with name " + context.getResources().getResourceEntryName(tintAttrId) + " and attribute ID " + tintAttrId + " was not found.");
}
Drawable drawable = ContextCompat.getDrawable(context, id);
drawable = DrawableCompat.wrap(drawable.mutate());
int color = ContextCompat.getColor(context, VALUE.resourceId);
DrawableCompat.setTint(drawable, color);
return drawable;
}
use of android.support.annotation.UiThread in project Osmand by osmandapp.
the class DownloadActivity method newDownloadIndexes.
@Override
@UiThread
public void newDownloadIndexes() {
visibleBanner.updateBannerInProgress();
for (WeakReference<Fragment> ref : fragSet) {
Fragment f = ref.get();
if (f instanceof DownloadEvents && f.isAdded()) {
((DownloadEvents) f).newDownloadIndexes();
}
}
downloadHasFinished();
}
use of android.support.annotation.UiThread in project XposedInstaller by rovo89.
the class StatusInstallerFragment method refreshZipViews.
@UiThread
private void refreshZipViews(View view) {
LinearLayout zips = (LinearLayout) view.findViewById(R.id.zips);
zips.removeAllViews();
TextView tvError = (TextView) view.findViewById(R.id.zips_load_error);
synchronized (FrameworkZips.class) {
boolean hasZips = false;
for (FrameworkZips.Type type : FrameworkZips.Type.values()) {
hasZips |= addZipViews(getActivity().getLayoutInflater(), zips, type);
}
if (!FrameworkZips.hasLoadedOnlineZips()) {
tvError.setText(R.string.framework_zip_load_failed);
tvError.setVisibility(View.VISIBLE);
} else if (!hasZips) {
tvError.setText(R.string.framework_no_zips);
tvError.setVisibility(View.VISIBLE);
} else {
tvError.setVisibility(View.GONE);
}
}
}
Aggregations