use of com.github.yeriomin.yalpstore.task.LoadImageTask in project YalpStore by yeriomin.
the class AppBadge method drawIcon.
private void drawIcon(ImageView imageView) {
String tag = (String) imageView.getTag();
if (!TextUtils.isEmpty(tag) && tag.equals(app.getPackageName())) {
return;
}
imageView.setTag(app.getPackageName());
LoadImageTask task = new LoadImageTask(imageView);
LoadImageTask previousTask = tasks.get(imageView.hashCode());
if (null != previousTask) {
previousTask.cancel(true);
}
tasks.put(imageView.hashCode(), task);
task.execute(app.getIconInfo());
}
use of com.github.yeriomin.yalpstore.task.LoadImageTask in project YalpStore by yeriomin.
the class GeneralDetails method drawCategoryBadge.
private void drawCategoryBadge() {
Badge categoryBadge = activity.findViewById(R.id.category_badge);
new LoadImageTask(categoryBadge.getIconView()).setPlaceholder(false).setImageSource(new ImageSource(app.getCategoryIconUrl())).executeOnExecutorIfPossible();
CategoryManager manager = new CategoryManager(activity);
String categoryId = app.getCategoryId();
String categoryLabel = manager.getCategoryName(categoryId);
if (categoryLabel.equals(categoryId)) {
getCategoryTask(manager, categoryId).execute();
} else {
categoryBadge.setLabel(categoryLabel);
}
categoryBadge.setLabel(categoryLabel);
categoryBadge.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CategoryAppsActivity.start(activity, app.getCategoryId());
}
});
ViewGroup.LayoutParams iconParams = categoryBadge.getIconView().getLayoutParams();
int categoryIconSize = Util.getPx(activity, 64);
iconParams.width = categoryIconSize;
iconParams.height = categoryIconSize;
}
use of com.github.yeriomin.yalpstore.task.LoadImageTask in project YalpStore by yeriomin.
the class GeneralDetails method drawAppBadge.
private void drawAppBadge(App app) {
TextView packageNameView = activity.findViewById(R.id.packageName);
String oldPackageName = (null == packageNameView || TextUtils.isEmpty(packageNameView.getText())) ? "" : packageNameView.getText().toString();
if (!oldPackageName.equals(app.getPackageName())) {
new LoadImageTask((ImageView) activity.findViewById(R.id.icon)).setPlaceholder(false).setImageSource(app.getIconInfo()).executeOnExecutorIfPossible();
}
setText(R.id.displayName, app.getDisplayName());
setText(R.id.packageName, app.getPackageName());
drawVersion((TextView) activity.findViewById(R.id.versionString), app);
}
use of com.github.yeriomin.yalpstore.task.LoadImageTask in project YalpStore by yeriomin.
the class UserProfileTask method onPostExecute.
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
if (success()) {
PreferenceManager.getDefaultSharedPreferences(imageView.getContext()).edit().putString(PREFERENCE_AVATAR_URL, result).apply();
}
new LoadImageTask(imageView).setFadeInMillis(200).execute(new ImageSource(result));
}
use of com.github.yeriomin.yalpstore.task.LoadImageTask in project YalpStore by yeriomin.
the class Background method draw.
@Override
public void draw() {
View background = activity.findViewById(R.id.background);
CollapsingToolbarLayout collapsingToolbarLayout = activity.findViewById(R.id.collapsing_toolbar_layout);
collapsingToolbarLayout.setExpandedTitleColor(activity.getResources().getColor(android.R.color.transparent));
if (!NetworkUtil.isNetworkAvailable(activity) || (!app.isInPlayStore() && !TextUtils.isEmpty(app.getDeveloperName()) && null == app.getPageBackgroundImage())) {
collapsingToolbarLayout.setTitleEnabled(false);
collapsingToolbarLayout.getLayoutParams().height = CollapsingToolbarLayout.LayoutParams.MATCH_PARENT;
background.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
background.setVisibility(View.GONE);
} else {
int height = DEFAULT_HEIGHT * smallerDimension / DEFAULT_WIDTH;
collapsingToolbarLayout.setTitleEnabled(true);
collapsingToolbarLayout.getLayoutParams().height = height;
background.getLayoutParams().height = height;
background.setVisibility(View.VISIBLE);
if (null != app.getPageBackgroundImage()) {
new LoadImageTask((ImageView) background).setPlaceholder(false).setFadeInMillis(500).setImageSource(app.getPageBackgroundImage()).executeOnExecutorIfPossible();
}
}
}
Aggregations