jimu-decompiled/sources/com/ubt/jimu/course/view/adapter/CourseFlowAdapter.java
2025-05-13 19:24:51 +02:00

178 lines
7.2 KiB
Java

package com.ubt.jimu.course.view.adapter;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import at.technikum.mti.fancycoverflow.FancyCoverFlow;
import at.technikum.mti.fancycoverflow.FancyCoverFlowAdapter;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import butterknife.internal.Utils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.load.Transformation;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.ubt.jimu.JimuApplication;
import com.ubt.jimu.R;
import com.ubt.jimu.course.repository.JimuCourse;
import com.ubtech.utils.DisplayUtil;
import java.util.List;
/* loaded from: classes.dex */
public class CourseFlowAdapter extends FancyCoverFlowAdapter {
private Context context;
private View convertView;
private List<JimuCourse> courseList;
private int fanFlowHeight;
private LayoutInflater inflater;
private boolean isShowFlag = false;
private boolean isTablet;
private final int logoHeight;
private FrameLayout.LayoutParams logoParams;
private FancyCoverFlow.LayoutParams params;
private FrameLayout.LayoutParams pgParams;
private ShowNoviceGuideListener showNoviceGuideListener;
private final int width;
public interface ShowNoviceGuideListener {
void onShowNoviceGuideListener(int i, int i2);
}
public class ViewHolder {
public FrameLayout fl_guide_logo_layout;
public ImageView imgCourseLogo;
public ImageView imglockLogo;
public ProgressBar pgCourse;
public TextView tvCourseLevel;
public ViewHolder(View view) {
ButterKnife.a(this, view);
view.setLayoutParams(CourseFlowAdapter.this.params);
this.imgCourseLogo.setLayoutParams(CourseFlowAdapter.this.logoParams);
this.pgCourse.setLayoutParams(CourseFlowAdapter.this.pgParams);
}
public void initViewHolder(int i, JimuCourse jimuCourse) {
if ("1".equals(jimuCourse.getIsAvailable())) {
RequestBuilder<Drawable> a = Glide.e(CourseFlowAdapter.this.context).a(jimuCourse.getImagePath());
a.a(RequestOptions.b((Transformation<Bitmap>) new RoundedCorners(DisplayUtil.a(CourseFlowAdapter.this.context, 10.0f))).a(R.drawable.community_img).a(CourseFlowAdapter.this.width, CourseFlowAdapter.this.logoHeight));
a.a(this.imgCourseLogo);
} else {
RequestBuilder<Drawable> a2 = Glide.e(CourseFlowAdapter.this.context).a(jimuCourse.getImagePathLock());
a2.a(RequestOptions.b((Transformation<Bitmap>) new RoundedCorners(DisplayUtil.a(CourseFlowAdapter.this.context, 10.0f))).a(CourseFlowAdapter.this.width, CourseFlowAdapter.this.logoHeight));
a2.a(this.imgCourseLogo);
}
this.tvCourseLevel.setText(jimuCourse.getName());
}
}
public class ViewHolder_ViewBinding implements Unbinder {
private ViewHolder target;
public ViewHolder_ViewBinding(ViewHolder viewHolder, View view) {
this.target = viewHolder;
viewHolder.imgCourseLogo = (ImageView) Utils.b(view, R.id.imgCourseLogo, "field 'imgCourseLogo'", ImageView.class);
viewHolder.imglockLogo = (ImageView) Utils.b(view, R.id.imgCourseLock, "field 'imglockLogo'", ImageView.class);
viewHolder.tvCourseLevel = (TextView) Utils.b(view, R.id.tvCourseLevel, "field 'tvCourseLevel'", TextView.class);
viewHolder.pgCourse = (ProgressBar) Utils.b(view, R.id.pgCourse, "field 'pgCourse'", ProgressBar.class);
viewHolder.fl_guide_logo_layout = (FrameLayout) Utils.b(view, R.id.fl_guide_logo_layout, "field 'fl_guide_logo_layout'", FrameLayout.class);
}
@Override // butterknife.Unbinder
public void unbind() {
ViewHolder viewHolder = this.target;
if (viewHolder == null) {
throw new IllegalStateException("Bindings already cleared.");
}
this.target = null;
viewHolder.imgCourseLogo = null;
viewHolder.imglockLogo = null;
viewHolder.tvCourseLevel = null;
viewHolder.pgCourse = null;
viewHolder.fl_guide_logo_layout = null;
}
}
public CourseFlowAdapter(Context context, List<JimuCourse> list, int i) {
this.isTablet = false;
this.context = context;
this.courseList = list;
this.inflater = LayoutInflater.from(context);
this.fanFlowHeight = i;
this.logoHeight = i - DisplayUtil.a(context, JimuApplication.l().i() ? 52.5f : 48.0f);
this.width = (int) (this.logoHeight * 0.735d);
this.isTablet = JimuApplication.l().i();
this.params = new FancyCoverFlow.LayoutParams(this.width, i);
this.logoParams = new FrameLayout.LayoutParams(this.width, this.logoHeight);
int a = this.width - DisplayUtil.a(context, 30.0f);
DisplayUtil.a(context, 12.0f);
int a2 = DisplayUtil.a(context, 8.0f);
this.pgParams = new FrameLayout.LayoutParams(a, -2);
FrameLayout.LayoutParams layoutParams = this.pgParams;
layoutParams.gravity = 81;
layoutParams.setMargins(a2, 0, a2, a2 * 2);
}
@Override // android.widget.Adapter
public int getCount() {
return this.courseList.size();
}
@Override // at.technikum.mti.fancycoverflow.FancyCoverFlowAdapter
public View getCoverFlowItem(int i, View view, ViewGroup viewGroup) {
ViewHolder viewHolder;
if (view == null) {
view = this.inflater.inflate(this.isTablet ? R.layout.flow_item_course : R.layout.flow_item_course_phone, viewGroup, false);
viewHolder = new ViewHolder(view);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) view.getTag();
}
viewHolder.initViewHolder(i, this.courseList.get(i));
ShowNoviceGuideListener showNoviceGuideListener = this.showNoviceGuideListener;
if (showNoviceGuideListener != null && i == 2 && !this.isShowFlag) {
showNoviceGuideListener.onShowNoviceGuideListener(this.width - DisplayUtil.a(this.context, 8.0f), this.logoHeight);
this.isShowFlag = true;
}
return view;
}
public View getFirstItem() {
return this.convertView;
}
@Override // android.widget.Adapter
public Object getItem(int i) {
List<JimuCourse> list = this.courseList;
if (list == null) {
return null;
}
return list.get(i);
}
public int getItemHeight() {
return this.fanFlowHeight;
}
@Override // android.widget.Adapter
public long getItemId(int i) {
return i;
}
public int getItemWidth() {
return this.width - DisplayUtil.a(this.context, 30.0f);
}
public void setShowNoviceGuideListener(ShowNoviceGuideListener showNoviceGuideListener) {
this.showNoviceGuideListener = showNoviceGuideListener;
}
}