102 lines
2.8 KiB
Java
102 lines
2.8 KiB
Java
package com.ubt.jimu.widgets;
|
|
|
|
import android.content.Context;
|
|
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 TitleView extends RelativeLayout {
|
|
private LayoutInflater a;
|
|
private Context b;
|
|
RelativeLayout c;
|
|
ImageView d;
|
|
TextView e;
|
|
ImageView f;
|
|
private OnRightListener g;
|
|
|
|
public interface OnRightListener {
|
|
void a();
|
|
}
|
|
|
|
public TitleView(Context context) {
|
|
super(context, null);
|
|
a(context);
|
|
}
|
|
|
|
private void a(Context context) {
|
|
this.a = LayoutInflater.from(context);
|
|
this.b = context;
|
|
View inflate = this.a.inflate(R.layout.title_bar, (ViewGroup) this, false);
|
|
addView(inflate);
|
|
c(inflate);
|
|
a();
|
|
}
|
|
|
|
private void c(View view) {
|
|
this.c = (RelativeLayout) view.findViewById(R.id.title_background);
|
|
this.d = (ImageView) view.findViewById(R.id.tv_return);
|
|
this.e = (TextView) view.findViewById(R.id.tv_title);
|
|
this.f = (ImageView) view.findViewById(R.id.img_right);
|
|
}
|
|
|
|
public /* synthetic */ void b(View view) {
|
|
OnRightListener onRightListener = this.g;
|
|
if (onRightListener != null) {
|
|
onRightListener.a();
|
|
}
|
|
}
|
|
|
|
public void setOnRightListner(OnRightListener onRightListener) {
|
|
this.g = onRightListener;
|
|
}
|
|
|
|
public void setTitleBackgroundColor(int i) {
|
|
this.c.setBackgroundColor(i);
|
|
}
|
|
|
|
public void setTitleRight(int i) {
|
|
this.f.setVisibility(0);
|
|
this.f.setImageResource(i);
|
|
}
|
|
|
|
public void setTitleText(String str) {
|
|
this.e.setText(str);
|
|
}
|
|
|
|
public TitleView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
a(context);
|
|
}
|
|
|
|
public TitleView(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet);
|
|
a(context);
|
|
}
|
|
|
|
private void a() {
|
|
this.d.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.i
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
TitleView.this.a(view);
|
|
}
|
|
});
|
|
this.f.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.j
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
TitleView.this.b(view);
|
|
}
|
|
});
|
|
}
|
|
|
|
public /* synthetic */ void a(View view) {
|
|
UbtActivityStack.getInstance().returnPreActivity(this.b);
|
|
}
|
|
}
|