天津出行司机端 v6.9.3版本的 MD5 值为:b7a18e0f0e865860fd80aa9ed7cf4ae1
以下内容为反编译后的 ToolPanelAdapter.java 源代码,内容仅作参考
package com.didichuxing.doraemonkit.kit.toolpanel;
import android.os.Process;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import com.didichuxing.doraemonkit.BuildConfig;
import com.didichuxing.doraemonkit.DoKit;
import com.didichuxing.doraemonkit.R;
import com.didichuxing.doraemonkit.constant.SharedPrefsKey;
import com.didichuxing.doraemonkit.kit.AbstractKit;
import com.didichuxing.doraemonkit.util.AppUtils;
import com.didichuxing.doraemonkit.util.BarUtils;
import com.didichuxing.doraemonkit.util.DoKitCommUtil;
import com.didichuxing.doraemonkit.util.DoKitSPUtil;
import com.didichuxing.doraemonkit.widget.brvah.BaseMultiItemQuickAdapter;
import com.didichuxing.doraemonkit.widget.brvah.viewholder.BaseViewHolder;
import java.util.Arrays;
import java.util.List;
import kotlin.Metadata;
import kotlin.TypeCastException;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010!\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0003\u0018\u00002\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00030\u0001B\u0015\u0012\u000e\u0010\u0004\u001a\n\u0012\u0004\u0012\u00020\u0002\u0018\u00010\u0005¢\u0006\u0002\u0010\u0006J\u0018\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\u00032\u0006\u0010\n\u001a\u00020\u0002H\u0014¨\u0006\u000b"}, d2 = {"Lcom/didichuxing/doraemonkit/kit/toolpanel/ToolPanelAdapter;", "Lcom/didichuxing/doraemonkit/widget/brvah/BaseMultiItemQuickAdapter;", "Lcom/didichuxing/doraemonkit/kit/toolpanel/KitWrapItem;", "Lcom/didichuxing/doraemonkit/widget/brvah/viewholder/BaseViewHolder;", "kitViews", "", "(Ljava/util/List;)V", "convert", "", "holder", "item", "dokit_release"}, k = 1, mv = {1, 1, 16})
public final class ToolPanelAdapter extends BaseMultiItemQuickAdapter<KitWrapItem, BaseViewHolder> {
public ToolPanelAdapter(List<KitWrapItem> list) {
super(list);
addItemType(999, R.layout.dk_item_group_title);
addItemType(KitWrapItem.TYPE_KIT, R.layout.dk_item_kit);
addItemType(KitWrapItem.TYPE_MODE, R.layout.dk_item_group_mode);
addItemType(KitWrapItem.TYPE_EXIT, R.layout.dk_item_group_exit);
addItemType(KitWrapItem.TYPE_VERSION, R.layout.dk_item_group_version);
}
@Override
public void convert(BaseViewHolder holder, KitWrapItem item) {
Intrinsics.checkParameterIsNotNull(holder, "holder");
Intrinsics.checkParameterIsNotNull(item, "item");
switch (item.getItemType()) {
case KitWrapItem.TYPE_KIT:
AbstractKit it = item.getKit();
if (it != null) {
((TextView) holder.getView(R.id.name)).setText(it.getName());
((ImageView) holder.getView(R.id.icon)).setImageResource(it.getIcon());
return;
}
return;
case KitWrapItem.TYPE_MODE:
RadioGroup radioGroup = (RadioGroup) holder.getView(R.id.rb_group);
final RadioButton rbNormal = (RadioButton) holder.getView(R.id.rb_normal);
final RadioButton rbSystem = (RadioButton) holder.getView(R.id.rb_system);
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public final void onCheckedChanged(RadioGroup $noName_0, int checkedId) {
if (checkedId == R.id.rb_normal) {
DoKitSPUtil.putString(SharedPrefsKey.FLOAT_START_MODE, "normal");
} else {
DoKitSPUtil.putString(SharedPrefsKey.FLOAT_START_MODE, "system");
}
}
});
rbNormal.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View it2) {
rbNormal.postDelayed(new Runnable() {
@Override
public final void run() {
AppUtils.relaunchApp();
Process.killProcess(Process.myPid());
System.exit(1);
}
}, 500L);
}
});
rbSystem.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View it2) {
rbSystem.postDelayed(new Runnable() {
@Override
public final void run() {
AppUtils.relaunchApp();
Process.killProcess(Process.myPid());
System.exit(1);
}
}, 500L);
}
});
String floatMode = DoKitSPUtil.getString(SharedPrefsKey.FLOAT_START_MODE, "normal");
if (Intrinsics.areEqual(floatMode, "normal")) {
rbNormal.setChecked(true);
return;
} else {
rbSystem.setChecked(true);
return;
}
case KitWrapItem.TYPE_EXIT:
((TextView) holder.getView(R.id.close)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View it2) {
DoKit.hideToolPanel();
DoKit.hide();
}
});
return;
case KitWrapItem.TYPE_VERSION:
TextView name = (TextView) holder.getView(R.id.version);
if (name.getParent() != null) {
ViewParent parent = name.getParent();
if (parent == null) {
throw new TypeCastException("null cannot be cast to non-null type android.view.ViewGroup");
}
((ViewGroup) parent).setPadding(0, 0, 0, BarUtils.getNavBarHeight());
}
String version = DoKitCommUtil.getString(R.string.dk_kit_version);
Intrinsics.checkExpressionValueIsNotNull(version, "DoKitCommUtil.getString(R.string.dk_kit_version)");
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format(version, Arrays.copyOf(new Object[]{BuildConfig.DOKIT_VERSION}, 1));
Intrinsics.checkExpressionValueIsNotNull(format, "java.lang.String.format(format, *args)");
name.setText(format);
return;
case 999:
String it2 = item.getName();
if (Intrinsics.areEqual(it2, DoKitCommUtil.getString(R.string.dk_category_platform))) {
((TextView) holder.getView(R.id.tv_sub_title_name)).setVisibility(0);
((TextView) holder.getView(R.id.tv_sub_title_name)).setText("(www.dokit.cn)");
} else {
((TextView) holder.getView(R.id.tv_sub_title_name)).setVisibility(8);
}
((TextView) holder.getView(R.id.tv_title_name)).setText(it2);
return;
default:
return;
}
}
}