139 lines
4.2 KiB
Java
139 lines
4.2 KiB
Java
package com.ubt.jimu.widgets;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.util.AttributeSet;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ImageView;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.TextView;
|
|
import com.ubt.jimu.R;
|
|
import com.ubt.jimu.base.UbtActivityStack;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class TitleDiyView extends RelativeLayout {
|
|
private LayoutInflater a;
|
|
private Context b;
|
|
private ImageView c;
|
|
private TextView d;
|
|
private TextView e;
|
|
private TextView f;
|
|
private RelativeLayout g;
|
|
private RightOnClickListener h;
|
|
private PreRightOnClickListener i;
|
|
private ReturnOnClickListener j;
|
|
|
|
public interface PreRightOnClickListener {
|
|
void onClick();
|
|
}
|
|
|
|
public interface ReturnOnClickListener {
|
|
void onClick();
|
|
}
|
|
|
|
public interface RightOnClickListener {
|
|
void onClick();
|
|
}
|
|
|
|
public TitleDiyView(Context context) {
|
|
super(context, null);
|
|
a(context);
|
|
}
|
|
|
|
public void setDiyPreRightResource(int i) {
|
|
if (i == 0) {
|
|
this.f.setVisibility(8);
|
|
} else {
|
|
this.f.setVisibility(0);
|
|
this.f.setBackgroundResource(i);
|
|
}
|
|
}
|
|
|
|
public void setDiyRightResource(int i) {
|
|
if (i == 0) {
|
|
this.e.setVisibility(8);
|
|
} else {
|
|
this.e.setVisibility(0);
|
|
this.e.setBackgroundResource(i);
|
|
}
|
|
}
|
|
|
|
public void setDiyTitle(String str) {
|
|
this.d.setText(str);
|
|
}
|
|
|
|
public void setPreRightListener(PreRightOnClickListener preRightOnClickListener) {
|
|
this.i = preRightOnClickListener;
|
|
}
|
|
|
|
public void setReturnListener(ReturnOnClickListener returnOnClickListener) {
|
|
this.j = returnOnClickListener;
|
|
}
|
|
|
|
public void setRightListener(RightOnClickListener rightOnClickListener) {
|
|
this.h = rightOnClickListener;
|
|
}
|
|
|
|
public void setTitleBackground(Drawable drawable) {
|
|
this.g.setBackground(drawable);
|
|
}
|
|
|
|
private void a(Context context) {
|
|
this.a = LayoutInflater.from(context);
|
|
this.b = context;
|
|
View inflate = this.a.inflate(R.layout.title_bar_diy, (ViewGroup) this, false);
|
|
addView(inflate);
|
|
a(inflate);
|
|
a();
|
|
}
|
|
|
|
public TitleDiyView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
a(context);
|
|
}
|
|
|
|
public TitleDiyView(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet);
|
|
a(context);
|
|
}
|
|
|
|
private void a(View view) {
|
|
this.c = (ImageView) view.findViewById(R.id.diy_return);
|
|
this.d = (TextView) view.findViewById(R.id.diy_title);
|
|
this.e = (TextView) view.findViewById(R.id.diy_right);
|
|
this.f = (TextView) view.findViewById(R.id.diy_pre_right);
|
|
this.g = (RelativeLayout) view.findViewById(R.id.diy);
|
|
}
|
|
|
|
private void a() {
|
|
this.c.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.TitleDiyView.1
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
if (TitleDiyView.this.j == null) {
|
|
UbtActivityStack.getInstance().returnPreActivity(TitleDiyView.this.b);
|
|
} else {
|
|
TitleDiyView.this.j.onClick();
|
|
}
|
|
}
|
|
});
|
|
this.e.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.TitleDiyView.2
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
if (TitleDiyView.this.h != null) {
|
|
TitleDiyView.this.h.onClick();
|
|
}
|
|
}
|
|
});
|
|
this.f.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.TitleDiyView.3
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
if (TitleDiyView.this.i != null) {
|
|
TitleDiyView.this.i.onClick();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|