analysis: full official-app reverse artifacts (jadx sources, ghidra libcxsdk decomp, authoritative protocol conclusions) + docs
This commit is contained in:
@@ -0,0 +1,149 @@
|
||||
package cn.com.magnity.magnitycx;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import cn.com.magnity.magnitycx.sdk.DelegateOptionSelected;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DialogOption extends DialogFragment {
|
||||
private static final String ARGUMENT_LIST = "ARGUMENT_LIST";
|
||||
private static final int[] LIST_ITEMS = {R.id.id_option_sel1, R.id.id_option_sel2, R.id.id_option_sel3, R.id.id_option_sel4, R.id.id_option_sel5};
|
||||
private int initSel_;
|
||||
private DelegateOptionSelected intf_;
|
||||
private int itemId_;
|
||||
private int[] listNames_;
|
||||
private int tipId_;
|
||||
private int titleId_;
|
||||
|
||||
public static DialogOption newInstance(int titleId, int itemId, int[] listNames, int initSel, DelegateOptionSelected intf, int tipId) {
|
||||
Bundle bundle = new Bundle();
|
||||
ArrayList bundlelist = new ArrayList();
|
||||
bundlelist.add(Integer.valueOf(titleId));
|
||||
bundlelist.add(Integer.valueOf(itemId));
|
||||
bundlelist.add(listNames);
|
||||
bundlelist.add(Integer.valueOf(initSel));
|
||||
bundlelist.add(intf);
|
||||
bundlelist.add(Integer.valueOf(tipId));
|
||||
bundle.putParcelableArrayList(ARGUMENT_LIST, bundlelist);
|
||||
DialogOption dlg = new DialogOption();
|
||||
dlg.setArguments(bundle);
|
||||
return dlg;
|
||||
}
|
||||
|
||||
@Override // android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Bundle bundle = getArguments();
|
||||
if (bundle != null) {
|
||||
ArrayList list = bundle.getParcelableArrayList(ARGUMENT_LIST);
|
||||
int i = 0 + 1;
|
||||
this.titleId_ = ((Integer) list.get(0)).intValue();
|
||||
int i2 = i + 1;
|
||||
this.itemId_ = ((Integer) list.get(i)).intValue();
|
||||
int i3 = i2 + 1;
|
||||
this.listNames_ = (int[]) list.get(i2);
|
||||
int i4 = i3 + 1;
|
||||
this.initSel_ = ((Integer) list.get(i3)).intValue();
|
||||
int i5 = i4 + 1;
|
||||
this.intf_ = (DelegateOptionSelected) list.get(i4);
|
||||
int i6 = i5 + 1;
|
||||
this.tipId_ = ((Integer) list.get(i5)).intValue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.support.v4.app.Fragment
|
||||
@Nullable
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
getDialog().requestWindowFeature(1);
|
||||
getDialog().setCanceledOnTouchOutside(true);
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override // android.support.v4.app.DialogFragment
|
||||
@NonNull
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View rootView = inflater.inflate(R.layout.dialog_fragment_option, (ViewGroup) null);
|
||||
MagClickListner magClickListner = new MagClickListner();
|
||||
int i = 0;
|
||||
View v = rootView.findViewById(R.id.id_option_title);
|
||||
((TextView) v).setText(this.titleId_);
|
||||
for (int id : this.listNames_) {
|
||||
View v2 = setText_(rootView, LIST_ITEMS[i], id, this.initSel_ == i);
|
||||
v2.setOnClickListener(magClickListner);
|
||||
i++;
|
||||
}
|
||||
for (int j = i; j < LIST_ITEMS.length; j++) {
|
||||
View v3 = rootView.findViewById(LIST_ITEMS[j]);
|
||||
v3.setVisibility(8);
|
||||
}
|
||||
if (this.tipId_ != 0) {
|
||||
View v4 = rootView.findViewById(R.id.id_text);
|
||||
v4.setVisibility(0);
|
||||
((TextView) v4).setText(this.tipId_);
|
||||
}
|
||||
View v5 = rootView.findViewById(R.id.id_btn_cancel);
|
||||
v5.setOnClickListener(magClickListner);
|
||||
builder.setView(rootView);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
private View setText_(View rootView, int itemId, int stringId, boolean isSelected) {
|
||||
View item = rootView.findViewById(itemId);
|
||||
TextView txtView = (TextView) item.findViewById(R.id.id_setting_item_text);
|
||||
txtView.setText(stringId);
|
||||
ImageView imgView = (ImageView) item.findViewById(R.id.id_setting_icon);
|
||||
if (isSelected) {
|
||||
imgView.setImageResource(R.mipmap.item_selected);
|
||||
} else {
|
||||
imgView.setImageResource(R.mipmap.item_unselected);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private class MagClickListner implements View.OnClickListener {
|
||||
private MagClickListner() {
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
switch (id) {
|
||||
case R.id.id_option_sel1 /* 2131624100 */:
|
||||
DialogOption.this.intf_.onOptionSelected(DialogOption.this.itemId_, 0);
|
||||
DialogOption.this.dismiss();
|
||||
break;
|
||||
case R.id.id_option_sel2 /* 2131624101 */:
|
||||
DialogOption.this.intf_.onOptionSelected(DialogOption.this.itemId_, 1);
|
||||
DialogOption.this.dismiss();
|
||||
break;
|
||||
case R.id.id_option_sel3 /* 2131624102 */:
|
||||
DialogOption.this.intf_.onOptionSelected(DialogOption.this.itemId_, 2);
|
||||
DialogOption.this.dismiss();
|
||||
break;
|
||||
case R.id.id_option_sel4 /* 2131624103 */:
|
||||
DialogOption.this.intf_.onOptionSelected(DialogOption.this.itemId_, 3);
|
||||
DialogOption.this.dismiss();
|
||||
break;
|
||||
case R.id.id_option_sel5 /* 2131624104 */:
|
||||
DialogOption.this.intf_.onOptionSelected(DialogOption.this.itemId_, 4);
|
||||
DialogOption.this.dismiss();
|
||||
break;
|
||||
case R.id.id_btn_cancel /* 2131624106 */:
|
||||
DialogOption.this.dismiss();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user