what-the-bank/sources/com/scb/phone/view/custom/common/ProgressStateBar.java

84 lines
3.6 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.custom.common;
import android.content.Context;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.scb.phone.R;
import java.util.List;
/* loaded from: classes5.dex */
public class ProgressStateBar extends LinearLayout {
private List<String> a;
@BindView
LinearLayout viewProgressState;
public ProgressStateBar(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
((LayoutInflater) context.getSystemService("layout_inflater")).inflate(R.layout.2131559305, (ViewGroup) this, true);
ButterKnife.c(this);
}
public void setCurrentState(int i) {
this.viewProgressState.removeAllViews();
List<String> list = this.a;
if (list == null || list.isEmpty()) {
return;
}
LayoutInflater layoutInflater = (LayoutInflater) getContext().getSystemService("layout_inflater");
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
for (int i2 = 0; i2 < this.a.size(); i2++) {
LinearLayout linearLayout = (LinearLayout) layoutInflater.inflate(R.layout.2131559306, (ViewGroup) null, false);
TextView textView = (TextView) linearLayout.findViewById(R.id.text_state_number);
TextView textView2 = (TextView) linearLayout.findViewById(R.id.text_state_label);
View findViewById = linearLayout.findViewById(R.id.view_left_line);
View findViewById2 = linearLayout.findViewById(R.id.view_right_line);
textView2.setText(this.a.get(i2));
if (i == i2) {
StringBuilder sb = new StringBuilder("");
sb.append(i2 + 1);
textView.setText(sb.toString());
textView.setBackgroundResource(R.drawable.progress_state_current);
} else {
textView.setText("");
if (i2 < i) {
textView.setBackgroundResource(R.drawable.progress_state_previous);
} else {
textView.setBackgroundResource(R.drawable.progress_state_next);
}
}
if (i2 == 0) {
findViewById.setVisibility(4);
}
if (i2 == this.a.size() - 1) {
findViewById2.setVisibility(4);
}
this.viewProgressState.addView(linearLayout);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) linearLayout.getLayoutParams();
layoutParams.weight = 1.0f;
((ViewGroup.LayoutParams) layoutParams).width = 0;
linearLayout.setLayoutParams(layoutParams);
LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) textView.getLayoutParams();
if (i == i2) {
((ViewGroup.LayoutParams) layoutParams2).width = (int) (displayMetrics.density * 30.0f);
((ViewGroup.LayoutParams) layoutParams2).height = (int) (displayMetrics.density * 30.0f);
} else {
((ViewGroup.LayoutParams) layoutParams2).width = (int) (displayMetrics.density * 10.0f);
((ViewGroup.LayoutParams) layoutParams2).height = (int) (displayMetrics.density * 10.0f);
}
textView.setLayoutParams(layoutParams2);
}
}
public void setStates(List<String> list) {
this.a = list;
}
}