导航菜单

页面标题

页面副标题

95爱播免登录版 v3.1.9 - ArmyCreateActivity.java 源代码

正在查看: 95爱播免登录版 v3.1.9 应用的 ArmyCreateActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.showself.ui;

import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.mifeng.ui.R;
import com.showself.domain.CreateArmyMoneyParser;
import com.showself.domain.CreateArmyParser;
import com.showself.domain.LoginResultInfo;
import com.showself.show.bean.ArmyCreateBean;
import com.showself.utils.Utils;
import com.showself.utils.l;
import com.showself.utils.r0;
import com.showself.utils.u0;
import com.showself.utils.v;
import com.showself.view.ImmersiveStatusBar;
import java.io.File;
import java.lang.Character;
import java.util.HashMap;

public class ArmyCreateActivity extends com.showself.ui.c implements View.OnClickListener {
    private EditText a;
    private EditText b;
    private Button c;
    private ImageView d;

    private TextView f2564e;

    private ImmersiveStatusBar f2565f;

    private String f2566g;

    private String f2567h;

    private String f2568i;

    private LoginResultInfo f2569j;

    private String f2570k;
    private boolean l;
    private TextView m;
    private Handler n = new a();
    private com.r.a.a o;

    class a extends Handler {
        a() {
        }

        @Override
        public void handleMessage(Message message) {
            if (ArmyCreateActivity.this.n == null) {
                return;
            }
            ArmyCreateActivity.this.refresh(Integer.valueOf(message.what), message.obj, Integer.valueOf(message.arg1));
        }
    }

    class b implements com.r.c.d {
        b() {
        }

        @Override
        public void onRequestFinish(com.r.c.c cVar, Object obj) {
            ArmyCreateActivity.this.K((HashMap) obj);
        }
    }

    class c implements com.r.c.d {
        c() {
        }

        @Override
        public void onRequestFinish(com.r.c.c cVar, Object obj) {
            ArmyCreateActivity.this.L((HashMap) obj);
        }
    }

    class d implements com.r.a.b {
        d() {
        }

        @Override
        public void a() {
            Utils.e1(ArmyCreateActivity.this, 1);
        }

        @Override
        public void b(String str) {
        }
    }

    class e implements com.r.d.a {
        e() {
        }

        @Override
        public void a(File file) {
            try {
                if (file.getName().endsWith("jpg")) {
                    ArmyCreateActivity.this.f2570k = "data:image/jpg;" + com.showself.utils.e.b(file.getPath());
                    ArmyCreateActivity.this.d.setImageBitmap(BitmapFactory.decodeFile(file.getPath()));
                } else if (file.getName().endsWith("png")) {
                    ArmyCreateActivity.this.f2570k = "data:image/png;" + com.showself.utils.e.b(file.getPath());
                    ArmyCreateActivity.this.d.setImageBitmap(BitmapFactory.decodeFile(file.getPath()));
                } else {
                    androidx.fragment.app.b bVar = ArmyCreateActivity.this;
                    Utils.Z0(bVar, bVar.getResources().getString(R.string.army_create_icon_fotmat_error));
                    ArmyCreateActivity.this.f2570k = null;
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }

    class f implements l {
        f() {
        }

        @Override
        public void a(boolean z) {
            if (!z || Utils.o0()) {
                return;
            }
            com.showself.utils.c1.e.a(ArmyCreateActivity.this);
        }
    }

    class g implements l {
        g() {
        }

        @Override
        public void a(boolean z) {
            if (z) {
                ArmyCreateActivity.this.H();
            }
        }
    }

    private void G() {
        Utils.U0(this);
        if (this.l) {
            return;
        }
        this.l = true;
        com.r.c.a aVar = new com.r.c.a();
        aVar.e("announcement", this.f2568i);
        aVar.e("armyIconUrl", this.f2567h);
        aVar.e("armyName", this.f2566g);
        aVar.e("createUid", this.f2569j.getUserId() + "");
        new com.r.c.c(com.showself.net.f.D0().Y0("armyservice11/armygroupinfo/saveCustArmyGroupInfo.do"), aVar, new CreateArmyParser(), this).y(new c());
    }

    public void H() {
        String obj = this.a.getText().toString();
        String obj2 = this.b.getText().toString();
        if (TextUtils.isEmpty(obj)) {
            Utils.Z0(this, getResources().getString(R.string.army_create_noname));
            return;
        }
        if (!F(obj) || obj.length() != 2) {
            Utils.Z0(this, getResources().getString(R.string.army_create_notext));
            this.a.setText("");
            return;
        }
        String str = this.f2570k;
        if (str == null) {
            Utils.Z0(this, getResources().getString(R.string.army_create_noav));
            return;
        }
        this.f2566g = obj;
        this.f2568i = obj2;
        this.f2567h = str;
        G();
    }

    private void I(int i2) {
        if (i2 == 0) {
            H();
        } else {
            Utils.Q0(this, null, String.format(getString(R.string.army_create_prompt), Integer.valueOf(i2)), getString(R.string.negative), getResources().getColor(2131099757), getString(R.string.army_create), getResources().getColor(2131099758), new g(), true);
        }
    }

    private void J() {
        Utils.U0(this);
        if (this.l) {
            return;
        }
        this.l = true;
        new com.r.c.c(com.showself.net.f.D0().Y0("armyservice11/armygroupinfo/config"), new com.r.c.a(), new CreateArmyMoneyParser(), this).v(new b());
    }

    public void K(HashMap<Object, Object> hashMap) {
        Utils.n(this);
        this.l = false;
        if (hashMap != null) {
            int intValue = ((Integer) hashMap.get(com.showself.net.e.n1)).intValue();
            String str = (String) hashMap.get(com.showself.net.e.o1);
            if (intValue == com.showself.net.e.m1) {
                I(((Integer) hashMap.get("createArmyCoin")).intValue());
            } else {
                Utils.Z0(this, str);
            }
        }
    }

    public void L(HashMap<Object, Object> hashMap) {
        Utils.n(this);
        this.l = false;
        if (hashMap != null) {
            int intValue = ((Integer) hashMap.get(com.showself.net.e.n1)).intValue();
            String str = (String) hashMap.get(com.showself.net.e.o1);
            if (intValue != com.showself.net.e.m1) {
                if (intValue == -300 || intValue == -310) {
                    N(str);
                    return;
                } else {
                    Utils.Z0(this, str);
                    return;
                }
            }
            ArmyCreateBean armyCreateBean = (ArmyCreateBean) hashMap.get("armycreate");
            if (armyCreateBean != null) {
                int armyGroupId = armyCreateBean.getArmyGroupId();
                Intent intent = new Intent((Context) this, (Class<?>) TeamPersonActivity.class);
                intent.putExtra("jid", armyGroupId);
                startActivity(intent);
            }
            Utils.Z0(this, getResources().getString(R.string.army_create_succeed));
            finish();
        }
    }

    private void N(String str) {
        Utils.Q0(this, null, getString(R.string.army_money_shortage_prompt), getString(R.string.negative), getResources().getColor(2131099757), getString(R.string.get_money_free), getResources().getColor(2131099758), new f(), true);
    }

    private void O() {
        if (this.o == null) {
            this.o = new com.r.a.a(this);
        }
        this.o.c(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, new d());
    }

    public boolean F(String str) {
        char[] charArray = str.toCharArray();
        for (int i2 = 0; i2 < str.length(); i2++) {
            if (!M(charArray[i2])) {
                return false;
            }
        }
        return true;
    }

    public boolean M(char c2) {
        Character.UnicodeBlock of = Character.UnicodeBlock.of(c2);
        return of == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || of == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS || of == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A || of == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS;
    }

    @Override
    public void init() {
        this.f2569j = r0.y(getApplicationContext());
        this.a = (EditText) findViewById(R.id.editText_army_create_name);
        this.b = (EditText) findViewById(R.id.editText_army_notic);
        this.c = (Button) findViewById(R.id.button_army_create);
        this.m = (TextView) findViewById(R.id.textView_army_title_center);
        this.f2564e = (TextView) findViewById(R.id.textView_army_title_left);
        this.d = (ImageView) findViewById(R.id.imageView_army_create_icon);
        this.f2565f = (ImmersiveStatusBar) findViewById(2131298726);
        this.m.setText(getResources().getString(R.string.army_create_title));
        this.c.setText(getResources().getString(R.string.army_create_button));
        this.d.setOnClickListener(this);
        this.f2564e.setOnClickListener(this);
        this.c.setOnClickListener(this);
        getWindowManager().getDefaultDisplay().getWidth();
    }

    @Override
    protected void onActivityResult(int i2, int i3, Intent intent) {
        if (i3 == -1 && i2 == 1) {
            Uri data = intent.getData();
            if (data == null) {
                Utils.Y0(this, R.string.network_get_photo_fail);
                return;
            } else {
                Utils.N0(this, v.h(this, data), new e());
                return;
            }
        }
        if (i3 != -1 || i2 != 111) {
            super.onActivityResult(i2, i3, intent);
            return;
        }
        try {
            File a2 = v.a(this, Utils.C() + "/myPhoto/croptemp", -1);
            if (a2.getName().endsWith("jpg")) {
                StringBuilder sb = new StringBuilder();
                sb.append("data:image/jpg;");
                sb.append(com.showself.utils.e.b(Utils.C() + "/myPhoto/croptemp"));
                this.f2570k = sb.toString();
                this.d.setImageBitmap(BitmapFactory.decodeFile(Utils.C() + "/myPhoto/croptemp"));
            } else if (a2.getName().endsWith("png")) {
                StringBuilder sb2 = new StringBuilder();
                sb2.append("data:image/png;");
                sb2.append(com.showself.utils.e.b(Utils.C() + "/myPhoto/croptemp"));
                this.f2570k = sb2.toString();
                this.d.setImageBitmap(BitmapFactory.decodeFile(Utils.C() + "/myPhoto/croptemp"));
            } else {
                Utils.Z0(this, getResources().getString(R.string.army_create_icon_fotmat_error));
                this.f2570k = null;
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == 2131296547) {
            J();
        } else if (id == 2131296882) {
            O();
        } else {
            if (id != 2131298816) {
                return;
            }
            finish();
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_army_create);
        u0.q(this, null);
        this.l = false;
        init();
        u0.i(this, this.f2565f, R.color.navigationbar_bg, true);
    }

    @Override
    public void onRequestPermissionsResult(int i2, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i2, strArr, iArr);
        if (this.o.e(i2, strArr, iArr)) {
        }
    }

    @Override
    public void refresh(Object... objArr) {
    }
}