导航菜单

页面标题

页面副标题

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

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

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


package com.showself.ui.takepicture;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.mifeng.ui.R;
import com.r.b.a2;
import com.showself.domain.TagInfo;
import com.showself.provider.f;
import com.showself.service.UploadService;
import com.showself.utils.Utils;
import com.showself.utils.d1.a.b;
import com.showself.utils.g;
import com.showself.utils.l;
import com.showself.utils.p;
import com.showself.utils.r;
import com.showself.view.MyGridVeiw;
import com.xiaomi.mipush.sdk.Constants;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;

public class PictrueUploadActivity extends com.showself.ui.c implements View.OnClickListener {
    public static String J = "movableAction";
    private LinearLayout A;
    private RelativeLayout B;
    private RelativeLayout C;
    private int G;
    private a2 H;
    private boolean I;
    private ImageView a;
    private ImageView b;
    private EditText c;
    private TextView d;

    private TextView f3293e;

    private TextView f3294f;

    private RelativeLayout f3295g;

    private Button f3296h;

    private Button f3297i;

    private ArrayList<TagInfo> f3299k;
    private String m;
    private Bitmap n;
    private Bitmap o;
    private com.showself.utils.d1.a.b p;
    private int r;
    private long s;
    private long t;
    private int u;
    private MyGridVeiw v;
    private String w;
    private f x;
    private String[] y;
    private int z;

    private int f3298j = 50;
    private String l = null;
    private boolean q = true;

    class a implements b.f {
        a() {
        }

        @Override
        public void a() {
            PictrueUploadActivity.this.p.r();
            PictrueUploadActivity.this.f3294f.setText(PictrueUploadActivity.this.r + "\"");
            PictrueUploadActivity.this.q = true;
            PictrueUploadActivity.this.b.setVisibility(0);
            PictrueUploadActivity.this.b.setBackgroundResource(R.drawable.play);
        }
    }

    class b implements AdapterView.OnItemClickListener {
        b() {
        }

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i2, long j2) {
            Iterator it = PictrueUploadActivity.this.f3299k.iterator();
            while (it.hasNext()) {
                ((TagInfo) it.next()).isSelected = false;
            }
            ((TagInfo) PictrueUploadActivity.this.f3299k.get(i2)).isSelected = true;
            PictrueUploadActivity.this.H.notifyDataSetChanged();
        }
    }

    class c implements TextWatcher {
        private CharSequence a;
        private int b;
        private int c;

        c() {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            int length = PictrueUploadActivity.this.f3298j - editable.length();
            PictrueUploadActivity.this.d.setText("" + length);
            this.b = PictrueUploadActivity.this.c.getSelectionStart();
            this.c = PictrueUploadActivity.this.c.getSelectionEnd();
            if (this.a.length() > PictrueUploadActivity.this.f3298j) {
                editable.delete(this.b - 1, this.c);
                int i2 = this.c;
                PictrueUploadActivity.this.c.setText(editable);
                PictrueUploadActivity.this.c.setSelection(i2);
            }
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
            this.a = charSequence;
        }
    }

    class d implements b.e {
        d(PictrueUploadActivity pictrueUploadActivity) {
        }

        @Override
        public void a(int i2, String str) {
        }

        @Override
        public void b(int i2) {
        }
    }

    class e implements l {
        e() {
        }

        @Override
        public void a(boolean z) {
            if (z) {
                if (PictrueUploadActivity.this.G == 2 || PictrueUploadActivity.this.G == 3) {
                    Intent intent = new Intent((Context) PictrueUploadActivity.this, (Class<?>) PictureAcitivityPreview.class);
                    intent.putExtra("picPath", PictrueUploadActivity.this.m);
                    intent.putExtra("isPutvideo", PictrueUploadActivity.this.G);
                    intent.putExtra("isfinish", PictrueUploadActivity.this.I);
                    PictrueUploadActivity.this.startActivity(intent);
                } else {
                    Intent intent2 = new Intent((Context) PictrueUploadActivity.this, (Class<?>) PictureAcitivityPreview.class);
                    intent2.putExtra("picPath", PictrueUploadActivity.this.m);
                    intent2.putExtra("isfinish", PictrueUploadActivity.this.I);
                    PictrueUploadActivity.this.startActivity(intent2);
                }
                PictrueUploadActivity.this.finish();
            }
        }
    }

    private void M() {
        try {
            this.p.l(new d(this), this.l);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    private void N() {
        Utils.Q0(this, getString(R.string.prompt), getString(R.string.is_record_new), getString(R.string.not), getResources().getColor(2131099757), getString(R.string.right), getResources().getColor(2131099758), new e(), true);
    }

    private void O(String str, String str2, String str3, String str4, int i2) {
        Intent intent = new Intent((Context) this, (Class<?>) UploadService.class);
        intent.setAction("com.showself.upload.AUDIO");
        Bundle bundle = new Bundle();
        bundle.putInt("aid", this.u);
        bundle.putInt("duration", i2);
        bundle.putString("tags", str);
        bundle.putString("note", str2);
        bundle.putString("audiopath", str3);
        bundle.putString("phontPath", str4);
        intent.putExtras(bundle);
        startService(intent);
    }

    @Override
    public void init() {
        this.a = (ImageView) findViewById(R.id.iv_bitmap);
        this.c = (EditText) findViewById(R.id.et_video_discrible);
        this.d = (TextView) findViewById(R.id.tv_max_number);
        this.f3295g = (RelativeLayout) findViewById(R.id.tv_auido_play);
        this.f3294f = (TextView) findViewById(R.id.tv_audio_text);
        this.b = (ImageView) findViewById(R.id.picture_audio_bit);
        ((TextView) findViewById(R.id.tv_mannage_reminder)).setVisibility(8);
        this.f3296h = (Button) findViewById(R.id.btn_nav_left);
        TextView textView = (TextView) findViewById(R.id.tv_nav_title);
        this.f3293e = textView;
        textView.setText(R.string.picture_preview_title);
        Button button = (Button) findViewById(R.id.btn_nav_right);
        this.f3297i = button;
        button.setVisibility(0);
        this.f3297i.setText(R.string.publish);
        this.c.setHint(R.string.write_you_wang_say);
        findViewById(R.id.rl_tags).setVisibility(0);
        this.v = (MyGridVeiw) findViewById(R.id.gv_tag);
        this.A = (LinearLayout) findViewById(R.id.ll_putvideo_back);
        this.B = (RelativeLayout) findViewById(R.id.rl_small_bitmap);
        this.C = (RelativeLayout) findViewById(R.id.rl_describe_parent);
        this.z = getWindowManager().getDefaultDisplay().getWidth();
        this.A.getLayoutParams().height = (this.z + r.b(this, 120.0f)) / 2;
        String[] strArr = this.y;
        if (strArr == null || strArr.length == 0) {
            return;
        }
        this.f3299k = new ArrayList<>();
        for (int i2 = 0; i2 < this.y.length; i2++) {
            TagInfo tagInfo = new TagInfo();
            tagInfo.name = this.y[i2];
            tagInfo.isSelected = false;
            if (i2 == 0) {
                tagInfo.isSelected = true;
            }
            tagInfo.id = i2;
            this.f3299k.add(tagInfo);
        }
        a2 a2Var = new a2(this, this.f3299k);
        this.H = a2Var;
        this.v.setAdapter((ListAdapter) a2Var);
        this.v.setOnItemClickListener(new b());
        this.B.getLayoutParams().height = (this.z + r.b(this, 40.0f)) / 2;
        this.B.getLayoutParams().width = (this.z - r.b(this, 40.0f)) / 2;
        this.C.getLayoutParams().height = (this.z + r.b(this, 40.0f)) / 2;
        this.C.getLayoutParams().width = (this.z - r.b(this, 40.0f)) / 2;
        if (this.l != null && new File(this.l).exists()) {
            p.d("PictrueUploadActivity", "auidoPath = " + this.l + "picPath = " + this.m);
            com.showself.utils.d1.a.b bVar = this.p;
            StringBuilder sb = new StringBuilder();
            sb.append("file://");
            sb.append(this.l);
            this.r = bVar.d(this, Uri.parse(sb.toString()));
            this.f3295g.setVisibility(0);
            this.f3294f.setText(this.r + "\"");
            this.f3295g.setOnClickListener(this);
            this.b.setVisibility(0);
        }
        String str = this.m;
        if (str != null) {
            Bitmap decodeFile = BitmapFactory.decodeFile(str);
            this.n = decodeFile;
            if (decodeFile != null) {
                this.o = g.a(decodeFile);
            }
        }
        Bitmap bitmap = this.o;
        if (bitmap != null) {
            this.a.setImageBitmap(bitmap);
        }
        this.c.setOnClickListener(this);
        this.f3296h.setOnClickListener(this);
        this.f3297i.setOnClickListener(this);
        this.c.addTextChangedListener(new c());
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == 2131296486) {
            N();
            return;
        }
        if (id != 2131296490) {
            if (id != 2131298958) {
                return;
            }
            long currentTimeMillis = System.currentTimeMillis();
            this.s = currentTimeMillis;
            if (this.q && currentTimeMillis - this.t > 1000) {
                this.t = System.currentTimeMillis();
                M();
                this.b.setBackgroundResource(R.drawable.pause);
                this.q = false;
                return;
            }
            if (this.p.h()) {
                this.p.i();
                this.b.setBackgroundResource(R.drawable.play);
                return;
            } else {
                this.p.p();
                this.b.setBackgroundResource(R.drawable.pause);
                return;
            }
        }
        String str = this.m;
        if (str != null && this.l != null) {
            Iterator<TagInfo> it = this.f3299k.iterator();
            while (it.hasNext()) {
                TagInfo next = it.next();
                if (next.isSelected) {
                    this.w = next.name;
                }
            }
            int i2 = this.G;
            if (i2 == 2 || i2 == 3) {
                Intent intent = new Intent();
                intent.setAction(J);
                intent.putExtra("mTag", this.w);
                intent.putExtra("et_picture_discrible", this.c.getText().toString());
                intent.putExtra("auidoPath", this.l);
                intent.putExtra("picPath", this.m);
                intent.putExtra("allTime", this.r);
                sendBroadcast(intent);
            } else {
                O(this.w, this.c.getText().toString(), this.l, this.m, this.r);
                this.f3297i.setEnabled(false);
                if (this.u == 0) {
                    Utils.Y0(getApplicationContext(), R.string.photo_uploading);
                }
            }
            finish();
            return;
        }
        if (str == null) {
            if (this.u == 0) {
                Utils.Y0(getApplicationContext(), R.string.photo_upload_failed);
            }
            finish();
            return;
        }
        Iterator<TagInfo> it2 = this.f3299k.iterator();
        while (it2.hasNext()) {
            TagInfo next2 = it2.next();
            if (next2.isSelected) {
                this.w = next2.name;
            }
        }
        int i3 = this.G;
        if (i3 == 2 || i3 == 3) {
            Intent intent2 = new Intent();
            intent2.setAction(J);
            intent2.putExtra("mTag", this.w);
            intent2.putExtra("et_picture_discrible", this.c.getText().toString());
            intent2.putExtra("picPath", this.m);
            sendBroadcast(intent2);
        } else {
            O(this.w, this.c.getText().toString(), null, this.m, 0);
            this.f3297i.setEnabled(false);
            if (this.u == 0) {
                Utils.Y0(getApplicationContext(), R.string.photo_uploading);
            }
        }
        finish();
    }

    @Override
    protected void onCreate(Bundle bundle) {
        setContentView(R.layout.putvideo);
        Intent intent = getIntent();
        Bundle extras = intent.getExtras();
        if (extras.containsKey("audiopath")) {
            this.l = extras.getString("audiopath");
        }
        if (extras.containsKey("picPath")) {
            this.m = extras.getString("picPath");
        }
        if (extras.containsKey("isPutvideo")) {
            this.G = extras.getInt("isPutvideo");
        }
        this.I = extras.getBoolean("isfinish", false);
        int i2 = this.G;
        if (i2 == 3) {
            J = "applyAction";
        } else if (i2 == 2) {
            J = "movableAction";
        }
        this.u = intent.getIntExtra("aid", 0);
        this.p = new com.showself.utils.d1.a.b(this);
        f h2 = f.h();
        this.x = h2;
        int i3 = this.G;
        String r = (i3 == 3 || i3 == 2) ? h2.r(131, 0, 0, "act_photo_tag") : h2.r(131, 0, 0, "photo_tag");
        if (TextUtils.isEmpty(r)) {
            this.y = getResources().getStringArray(R.array.tags_array);
        } else {
            this.y = r.split(Constants.ACCEPT_TIME_SEPARATOR_SP);
        }
        this.p.m(new a());
        init();
        super.onCreate(bundle);
    }

    @Override
    protected void onDestroy() {
        Bitmap bitmap = this.o;
        if (bitmap != null) {
            bitmap.recycle();
            this.o = null;
        }
        com.showself.utils.d1.a.b bVar = this.p;
        if (bVar != null) {
            bVar.r();
            this.p = null;
        }
        super.onDestroy();
    }

    public boolean onKeyDown(int i2, KeyEvent keyEvent) {
        if (i2 == 4 && keyEvent.getRepeatCount() == 0) {
            N();
        }
        return super/*android.app.Activity*/.onKeyDown(i2, keyEvent);
    }

    @Override
    protected void onPause() {
        com.showself.utils.d1.a.b bVar = this.p;
        if (bVar != null) {
            bVar.r();
        }
        super.onPause();
    }

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