导航菜单

页面标题

页面副标题

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

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

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


package com.showself.ui;

import android.content.Intent;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.mifeng.ui.R;
import com.showself.domain.CreateArmyParser;
import com.showself.domain.LoginResultInfo;
import com.showself.utils.Utils;
import com.showself.utils.r0;
import com.showself.utils.v;
import com.sina.weibo.sdk.auth.Oauth2AccessToken;
import java.io.File;
import java.lang.Character;
import java.util.HashMap;

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

    private String f2571e;

    private String f2572f;

    private LoginResultInfo f2573g;

    private String f2574h;

    private int f2575i;

    private TextView f2576j;

    private LinearLayout f2577k;
    private boolean l;
    private com.r.a.a m;

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

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

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

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

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

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

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

    public void D(HashMap<Object, Object> hashMap) {
        this.l = false;
        Utils.n(this);
        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) {
                Utils.Z0(this, str);
            } else {
                Utils.Z0(this, getResources().getString(R.string.change_success));
                finish();
            }
        }
    }

    private void F() {
        com.r.a.a aVar = new com.r.a.a(this);
        this.m = aVar;
        aVar.c(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, new c());
    }

    private void G() {
        if (this.l) {
            return;
        }
        Utils.U0(this);
        this.l = true;
        com.r.c.a aVar = new com.r.c.a();
        aVar.e("armyIconUrl", this.f2572f);
        aVar.b("armyGroupId", this.f2575i);
        aVar.e("armyGroupName", this.f2571e);
        aVar.e(Oauth2AccessToken.KEY_UID, this.f2573g.getUserId() + "");
        new com.r.c.c(com.showself.net.f.D0().Y0("armyservice11/armygroupinfo/updatearmygroupname.do"), aVar, new CreateArmyParser(), this).y(new a());
    }

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

    public boolean E(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.f2575i = getIntent().getIntExtra("jid", 0);
        this.f2573g = r0.y(getApplicationContext());
        this.a = (EditText) findViewById(R.id.editText_army_create_name);
        this.b = (Button) findViewById(R.id.button_army_create);
        this.f2576j = (TextView) findViewById(R.id.textView_army_title_center);
        this.d = (TextView) findViewById(R.id.textView_army_title_left);
        this.c = (ImageView) findViewById(R.id.imageView_army_create_icon);
        LinearLayout linearLayout = (LinearLayout) findViewById(R.id.layout_army_announcement);
        this.f2577k = linearLayout;
        linearLayout.setVisibility(8);
        this.f2576j.setText(getResources().getString(R.string.army_setinfo_title));
        this.b.setText(getResources().getString(R.string.army_setinfo_button));
        this.c.setOnClickListener(this);
        this.d.setOnClickListener(this);
        this.b.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 b());
                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.f2574h = sb.toString();
                this.c.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.f2574h = sb2.toString();
                this.c.setImageBitmap(BitmapFactory.decodeFile(Utils.C() + "/myPhoto/croptemp"));
            } else {
                Utils.Z0(this, getResources().getString(R.string.army_create_icon_fotmat_error));
                this.f2574h = null;
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id != 2131296547) {
            if (id == 2131296882) {
                F();
                return;
            } else {
                if (id != 2131298816) {
                    return;
                }
                finish();
                return;
            }
        }
        String obj = this.a.getText().toString();
        if (TextUtils.isEmpty(obj)) {
            Utils.Z0(this, getResources().getString(R.string.army_create_noname));
            return;
        }
        if (!C(obj)) {
            Utils.Z0(this, getResources().getString(R.string.army_create_notext));
            this.a.setText("");
            return;
        }
        String str = this.f2574h;
        if (str == null) {
            Utils.Z0(this, getResources().getString(R.string.army_create_noav));
            return;
        }
        this.f2571e = obj;
        this.f2572f = str;
        G();
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_army_create);
        this.l = false;
        init();
    }

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

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