导航菜单

页面标题

页面副标题

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

正在查看: 95爱播免登录版 v3.1.9 应用的 PictureAcitivityPreview.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.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.mifeng.ui.R;
import com.showself.provider.f;
import com.showself.utils.Utils;
import com.showself.utils.d1.a.b;
import com.showself.utils.l;
import com.showself.utils.p;
import com.xiaomi.mipush.sdk.Constants;
import java.util.Formatter;
import java.util.Locale;
import org.apache.commons.httpclient.cookie.CookieSpec;

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

    private ImageView f3300e;

    private ImageView f3301f;

    private ImageView f3302g;

    private String f3303h;

    private com.showself.utils.d1.a.b f3304i;

    private float f3305j;

    private long f3306k;
    private long l;
    private String m;
    private int p;
    private Bitmap q;
    private TextView s;
    private StringBuilder t;
    private Formatter u;
    private AnimationDrawable v;
    private int w;
    private boolean x;
    private int n = 300;
    private int o = -1;
    private boolean r = true;
    private Handler y = new a();

    class a extends Handler {
        a() {
        }

        @Override
        public void handleMessage(Message message) {
            PictureAcitivityPreview.this.f3305j = ((Float) message.obj).floatValue();
            int i2 = (int) PictureAcitivityPreview.this.f3305j;
            if (i2 != 9) {
                switch (i2) {
                    case 0:
                        PictureAcitivityPreview.this.f3300e.setImageResource(R.drawable.amp1);
                        break;
                    case 1:
                        PictureAcitivityPreview.this.f3300e.setImageResource(R.drawable.amp2);
                        break;
                    case 2:
                        PictureAcitivityPreview.this.f3300e.setImageResource(R.drawable.amp3);
                        break;
                    case 3:
                        PictureAcitivityPreview.this.f3300e.setImageResource(R.drawable.amp4);
                        break;
                    case 4:
                        PictureAcitivityPreview.this.f3300e.setImageResource(R.drawable.amp5);
                        break;
                    case 5:
                        PictureAcitivityPreview.this.f3300e.setImageResource(R.drawable.amp6);
                        break;
                    case 6:
                        PictureAcitivityPreview.this.f3300e.setImageResource(R.drawable.amp7);
                        break;
                }
            } else {
                PictureAcitivityPreview.this.f3300e.setImageResource(R.drawable.amp8);
            }
            super.handleMessage(message);
        }
    }

    class b implements l {
        b() {
        }

        @Override
        public void a(boolean z) {
            if (z) {
                if (PictureAcitivityPreview.this.w == 2) {
                    Intent intent = new Intent((Context) PictureAcitivityPreview.this, (Class<?>) TakePictureActivity.class);
                    intent.putExtra("classname", "ActvyPersonActivity");
                    PictureAcitivityPreview.this.startActivity(intent);
                } else if (PictureAcitivityPreview.this.w == 3) {
                    Intent intent2 = new Intent((Context) PictureAcitivityPreview.this, (Class<?>) TakePictureActivity.class);
                    intent2.putExtra("classname", "ApplyActivity");
                    PictureAcitivityPreview.this.startActivity(intent2);
                } else {
                    PictureAcitivityPreview.this.startActivity(new Intent((Context) PictureAcitivityPreview.this, (Class<?>) TakePictureActivity.class));
                }
                PictureAcitivityPreview.this.finish();
            }
        }
    }

    class c implements b.e {

        class a implements Runnable {

            class C0090a implements b.g {
                C0090a() {
                }

                @Override
                public void a(String str) {
                    PictureAcitivityPreview.this.m = str;
                    Intent intent = new Intent((Context) PictureAcitivityPreview.this, (Class<?>) PictrueUploadActivity.class);
                    Bundle bundle = new Bundle();
                    bundle.putString("audiopath", PictureAcitivityPreview.this.m);
                    bundle.putString("picPath", PictureAcitivityPreview.this.f3303h);
                    bundle.putInt("isPutvideo", PictureAcitivityPreview.this.w);
                    intent.putExtras(bundle);
                    PictureAcitivityPreview.this.startActivity(intent);
                    PictureAcitivityPreview.this.c.setVisibility(8);
                    PictureAcitivityPreview.this.s.setVisibility(8);
                    PictureAcitivityPreview.this.f3300e.setVisibility(8);
                    PictureAcitivityPreview.this.v.stop();
                    PictureAcitivityPreview.this.finish();
                }
            }

            a() {
            }

            @Override
            public void run() {
                TextView textView = PictureAcitivityPreview.this.s;
                StringBuilder sb = new StringBuilder();
                PictureAcitivityPreview pictureAcitivityPreview = PictureAcitivityPreview.this;
                sb.append(pictureAcitivityPreview.V(pictureAcitivityPreview.p));
                sb.append(Constants.COLON_SEPARATOR);
                PictureAcitivityPreview pictureAcitivityPreview2 = PictureAcitivityPreview.this;
                sb.append(pictureAcitivityPreview2.V(pictureAcitivityPreview2.o));
                sb.append(CookieSpec.PATH_DELIM);
                PictureAcitivityPreview pictureAcitivityPreview3 = PictureAcitivityPreview.this;
                sb.append(pictureAcitivityPreview3.U(pictureAcitivityPreview3.n));
                textView.setText(sb.toString());
                if (PictureAcitivityPreview.this.n - (PictureAcitivityPreview.this.o + (PictureAcitivityPreview.this.p * 60)) <= 0 || PictureAcitivityPreview.this.n - (PictureAcitivityPreview.this.o + (PictureAcitivityPreview.this.p * 60)) > 10) {
                    if (PictureAcitivityPreview.this.n - (PictureAcitivityPreview.this.o + (PictureAcitivityPreview.this.p * 60)) == 0) {
                        PictureAcitivityPreview.this.f3304i.q(new C0090a());
                        return;
                    }
                    return;
                }
                PictureAcitivityPreview.this.c.setVisibility(0);
                PictureAcitivityPreview.this.c.setText(PictureAcitivityPreview.this.getString(R.string.record_time_remain) + (PictureAcitivityPreview.this.n - (PictureAcitivityPreview.this.o + (PictureAcitivityPreview.this.p * 60))) + PictureAcitivityPreview.this.getString(R.string.record_time_remain2));
            }
        }

        c() {
        }

        @Override
        public void a(int i2, String str) {
            p.d("PictureAcitivityPreview", "second = Error");
        }

        @Override
        public void b(int i2) {
            PictureAcitivityPreview.this.R(i2);
            PictureAcitivityPreview.this.runOnUiThread(new a());
        }
    }

    class d implements b.d {
        d() {
        }

        @Override
        public void a(float f2) {
            Message obtainMessage = PictureAcitivityPreview.this.y.obtainMessage();
            obtainMessage.obj = Float.valueOf(f2);
            PictureAcitivityPreview.this.y.sendMessage(obtainMessage);
        }
    }

    class e implements b.g {
        e() {
        }

        @Override
        public void a(String str) {
            PictureAcitivityPreview.this.m = str;
            Intent intent = new Intent((Context) PictureAcitivityPreview.this, (Class<?>) PictrueUploadActivity.class);
            Bundle bundle = new Bundle();
            bundle.putString("audiopath", PictureAcitivityPreview.this.m);
            bundle.putString("picPath", PictureAcitivityPreview.this.f3303h);
            bundle.putInt("isPutvideo", PictureAcitivityPreview.this.w);
            intent.putExtras(bundle);
            PictureAcitivityPreview.this.startActivity(intent);
            PictureAcitivityPreview.this.c.setVisibility(8);
            PictureAcitivityPreview.this.s.setVisibility(8);
            PictureAcitivityPreview.this.f3300e.setVisibility(8);
            PictureAcitivityPreview.this.v.stop();
            PictureAcitivityPreview.this.finish();
        }
    }

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

    private void T() {
        this.f3304i.n(new c(), this.n * 1000, new d());
    }

    public String U(int i2) {
        int i3 = i2 % 60;
        int i4 = (i2 / 60) % 60;
        int i5 = i2 / 3600;
        this.t.setLength(0);
        return i5 > 0 ? this.u.format("%d:%02d:%02d", Integer.valueOf(i5), Integer.valueOf(i4), Integer.valueOf(i3)).toString() : this.u.format("%02d:%02d", Integer.valueOf(i4), Integer.valueOf(i3)).toString();
    }

    public String V(int i2) {
        if (i2 / 10 == 0) {
            return "0" + i2;
        }
        return i2 + "";
    }

    public Bitmap Q() {
        String str = this.f3303h;
        if (str == null) {
            return null;
        }
        Bitmap decodeFile = BitmapFactory.decodeFile(str);
        this.q = decodeFile;
        return decodeFile;
    }

    public void R(int i2) {
        int i3 = this.o + 1;
        this.o = i3;
        if (i3 > 60) {
            this.o = 0;
            this.p++;
        }
    }

    @Override
    public void init() {
        this.a = (Button) findViewById(R.id.btn_nav_left);
        TextView textView = (TextView) findViewById(R.id.tv_nav_title);
        this.b = textView;
        textView.setText(R.string.picture_preview_title);
        this.d = (ImageView) findViewById(R.id.iv_picture_preview);
        this.f3300e = (ImageView) findViewById(R.id.iv_audio_volume);
        this.f3301f = (ImageView) findViewById(R.id.iv_take_audio);
        this.f3302g = (ImageView) findViewById(R.id.iv_picture_skip);
        this.c = (TextView) findViewById(R.id.tv_audio_last_time);
        this.s = (TextView) findViewById(R.id.tv_startcorder_time);
        this.d.setImageBitmap(Q());
        this.a.setOnClickListener(this);
        this.f3301f.setOnClickListener(this);
        this.f3302g.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == 2131296486) {
            if (this.x) {
                finish();
                return;
            } else {
                S();
                return;
            }
        }
        if (id == 2131297340) {
            Intent intent = new Intent((Context) this, (Class<?>) PictrueUploadActivity.class);
            Bundle bundle = new Bundle();
            bundle.putString("picPath", this.f3303h);
            bundle.putInt("isPutvideo", this.w);
            bundle.putBoolean("isfinish", this.x);
            intent.putExtras(bundle);
            startActivity(intent);
            finish();
            return;
        }
        if (id != 2131297522) {
            return;
        }
        long currentTimeMillis = System.currentTimeMillis();
        this.f3306k = currentTimeMillis;
        if (!this.r) {
            if (currentTimeMillis - this.l > 2000) {
                this.f3304i.q(new e());
                return;
            }
            Toast.makeText((Context) this, R.string.time_so_short, 0).show();
            this.f3300e.setVisibility(0);
            this.f3302g.setVisibility(8);
            this.s.setVisibility(0);
            this.a.setEnabled(true);
            this.f3302g.setEnabled(true);
            return;
        }
        this.l = System.currentTimeMillis();
        this.r = false;
        T();
        this.f3301f.setImageResource(R.anim.audio_animation);
        AnimationDrawable animationDrawable = (AnimationDrawable) this.f3301f.getDrawable();
        this.v = animationDrawable;
        if (animationDrawable.isRunning()) {
            this.v.stop();
        }
        this.v.start();
        this.a.setEnabled(false);
        this.f3302g.setEnabled(false);
        this.f3302g.setVisibility(8);
        this.f3300e.setVisibility(0);
        this.s.setVisibility(0);
    }

    @Override
    protected void onCreate(Bundle bundle) {
        setContentView(R.layout.picture_audio_preview);
        Bundle extras = getIntent().getExtras();
        if (extras.containsKey("picPath")) {
            this.f3303h = extras.getString("picPath");
        }
        if (extras.containsKey("isPutvideo")) {
            this.w = extras.getInt("isPutvideo");
        }
        this.x = extras.getBoolean("isfinish", false);
        f h2 = f.h();
        if (TextUtils.isEmpty(h2.g(132, "max_duration"))) {
            this.n = 130;
        } else {
            this.n = Integer.parseInt(h2.g(132, "max_duration"));
        }
        if (!TextUtils.isEmpty(h2.g(132, "min_duration"))) {
            Integer.parseInt(h2.g(132, "min_duration"));
        }
        this.f3304i = new com.showself.utils.d1.a.b(this);
        this.t = new StringBuilder();
        this.u = new Formatter(this.t, Locale.getDefault());
        init();
        super.onCreate(bundle);
    }

    @Override
    protected void onDestroy() {
        Bitmap bitmap = this.q;
        if (bitmap != null) {
            bitmap.recycle();
            this.q = null;
        }
        this.d.setImageBitmap(null);
        super.onDestroy();
    }

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

    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

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