正在查看: 050 IP Phone v2.3.0 应用的 SettingSkinActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 050 IP Phone v2.3.0 应用的 SettingSkinActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.ntt.voip.android.com050plus.setting;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RadioGroup;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.core.content.FileProvider;
import androidx.preference.PreferenceManager;
import com.ntt.voip.android.com050plus.setting.a;
import com.ntt.voip.android.com050plus.setting.b;
import g3.h;
import g3.i;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import t4.p;
import t4.q;
import t4.r;
import t4.z;
import y3.g;
public class SettingSkinActivity extends BasicOssActivity implements b.c, a.c {
private File A0;
private File B0;
private File C0;
private int D0;
private int E0;
private int F0;
private Bitmap G0;
private Bitmap H0;
private ImageView I0;
private Button J0;
private int L0;
private SharedPreferences M0;
private int u0;
private int v0;
private Uri w0;
private Uri x0;
private File y0;
private File f40z0;
private boolean K0 = false;
private boolean N0 = false;
private int O0 = -1;
private ActivityResultLauncher<Intent> P0 = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new b());
private ActivityResultLauncher<Intent> Q0 = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new c());
private byte[] R0 = new byte[256];
class a implements View.OnClickListener {
a() {
}
@Override
public void onClick(View view) {
p.s(SettingSkinActivity.this, 2131297218, null);
}
}
class b implements ActivityResultCallback<ActivityResult> {
b() {
}
public void onActivityResult(ActivityResult activityResult) {
SettingSkinActivity.this.g1(0, activityResult.getResultCode(), activityResult.getData());
}
}
class c implements ActivityResultCallback<ActivityResult> {
c() {
}
public void onActivityResult(ActivityResult activityResult) {
SettingSkinActivity.this.g1(1, activityResult.getResultCode(), activityResult.getData());
}
}
class d implements DialogInterface.OnClickListener {
d() {
}
@Override
public void onClick(DialogInterface dialogInterface, int i) {
SettingSkinActivity.this.n1();
}
}
class e implements View.OnClickListener {
e() {
}
@Override
public void onClick(View view) {
p.s(SettingSkinActivity.this, 2131296415, null);
}
}
class f implements View.OnClickListener {
f() {
}
@Override
public void onClick(View view) {
p.s(SettingSkinActivity.this, 2131296331, null);
}
}
class g implements View.OnClickListener {
g() {
}
@Override
public void onClick(View view) {
SettingSkinActivity.this.i1();
}
}
class h implements View.OnClickListener {
h() {
}
@Override
public void onClick(View view) {
SettingSkinActivity.this.j1();
}
}
class i implements RadioGroup.OnCheckedChangeListener {
i() {
}
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
switch (i) {
case 2131296700:
SettingSkinActivity.this.F0 = 0;
break;
case 2131296701:
SettingSkinActivity.this.F0 = 1;
break;
}
int i8 = SettingSkinActivity.this.F0;
if (i8 == 0) {
SettingSkinActivity settingSkinActivity = SettingSkinActivity.this;
settingSkinActivity.m1(settingSkinActivity.G0);
} else {
if (i8 != 1) {
return;
}
SettingSkinActivity settingSkinActivity2 = SettingSkinActivity.this;
settingSkinActivity2.m1(settingSkinActivity2.H0);
}
}
}
class j implements View.OnClickListener {
j() {
}
@Override
public void onClick(View view) {
if (SettingSkinActivity.this.o1()) {
SettingSkinActivity.this.finish();
} else {
SettingSkinActivity.this.L0 = 2131886780;
p.s(SettingSkinActivity.this, 2131296953, null);
}
}
}
private class k implements q.d {
Uri a;
File b;
class a implements Runnable {
a() {
}
@Override
public void run() {
p.l(SettingSkinActivity.this, 2131297466);
if (SettingSkinActivity.this.L0 > 0) {
SettingSkinActivity.this.I0(2131296953);
}
SettingSkinActivity.this.J0.setEnabled(SettingSkinActivity.this.f40z0.exists());
}
}
k(SettingSkinActivity settingSkinActivity, Uri uri, File file, b bVar) {
this(uri, file);
}
@Override
public void a() {
throw new UnsupportedOperationException("Method not decompiled: com.ntt.voip.android.com050plus.setting.SettingSkinActivity.k.a():void");
}
private k(Uri uri, File file) {
this.a = uri;
this.b = file;
}
}
public void I0(int i8) {
if (this.N0) {
p.s(this, i8, null);
if (i8 == this.O0) {
this.O0 = -1;
return;
}
return;
}
this.O0 = i8;
z.h("SettingSkinActivity", "App is in background. Pending showDialog id: " + this.O0);
}
private void c1(Uri uri, File file) {
I0(2131297466);
if (!this.A0.exists()) {
this.f40z0.renameTo(this.A0);
}
q.g(new k(this, uri, file, null));
}
private void d1() {
findViewById(2131296689).setOnClickListener(new e());
findViewById(2131296687).setOnClickListener(new f());
ImageView imageView = (ImageView) findViewById(2131296686);
this.I0 = imageView;
imageView.setBackgroundColor(-7829368);
this.I0.getLayoutParams().height = this.v0 / 3;
this.I0.getLayoutParams().width = this.u0 / 3;
File file = new File(getFilesDir(), "backgournd_long.jpg");
if (file.exists()) {
this.G0 = BitmapFactory.decodeFile(file.getPath());
}
File file2 = new File(getFilesDir(), "background_short.jpg");
if (file2.exists()) {
this.H0 = BitmapFactory.decodeFile(file2.getPath());
}
findViewById(2131296690).setOnClickListener(new g());
Button button = (Button) findViewById(2131296691);
this.J0 = button;
button.setEnabled(this.f40z0.exists());
this.J0.setOnClickListener(new h());
RadioGroup radioGroup = (RadioGroup) findViewById(2131296699);
radioGroup.setOnCheckedChangeListener(new i());
int i8 = this.F0;
if (i8 == 0) {
radioGroup.check(2131296700);
} else if (i8 != 1) {
radioGroup.check(2131296700);
this.F0 = 0;
} else {
radioGroup.check(2131296701);
}
findViewById(2131296695).setOnClickListener(new j());
findViewById(2131296693).setOnClickListener(new a());
}
private Bitmap e1(Bitmap bitmap) {
Bitmap createScaledBitmap;
if (bitmap.getWidth() / this.u0 < bitmap.getHeight() / this.v0) {
createScaledBitmap = Bitmap.createScaledBitmap(bitmap, Math.max((int) (bitmap.getWidth() * (this.v0 / bitmap.getHeight())), 1), this.v0, true);
} else {
createScaledBitmap = Bitmap.createScaledBitmap(bitmap, this.u0, Math.max((int) (bitmap.getHeight() * (this.u0 / bitmap.getWidth())), 1), true);
}
if (bitmap != createScaledBitmap) {
bitmap.recycle();
}
return createScaledBitmap;
}
private Bitmap f1(Bitmap bitmap) {
Bitmap createBitmap;
float width = bitmap.getWidth() / this.u0;
float height = bitmap.getHeight();
int i8 = this.v0;
if (width < height / i8) {
int max = Math.max((int) (this.v0 / (this.u0 / bitmap.getWidth())), 1);
createBitmap = Bitmap.createBitmap(bitmap, 0, Math.max((bitmap.getHeight() - max) / 2, 0), bitmap.getWidth(), max);
} else {
int max2 = Math.max((int) (this.u0 / (i8 / bitmap.getHeight())), 1);
createBitmap = Bitmap.createBitmap(bitmap, Math.max((bitmap.getWidth() - max2) / 2, 0), 0, max2, bitmap.getHeight());
}
if (bitmap != createBitmap) {
bitmap.recycle();
}
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(createBitmap, this.u0, this.v0, true);
if (createBitmap != null && createBitmap != createScaledBitmap) {
createBitmap.recycle();
}
return createScaledBitmap;
}
public void g1(int i8, int i9, Intent intent) {
if (i8 != 0) {
if (i8 != 1) {
return;
}
this.B0.renameTo(this.f40z0);
revokeUriPermission(this.x0, 3);
if (i9 == -1) {
if (p1(this.x0)) {
this.K0 = true;
return;
} else {
this.L0 = 2131886777;
p.s(this, 2131296953, null);
return;
}
}
return;
}
if (i9 == -1) {
if (p1(intent.getData())) {
Uri data = intent.getData();
this.w0 = data;
this.K0 = true;
c1(data, this.f40z0);
} else {
this.L0 = 2131886777;
p.s(this, 2131296953, null);
}
}
StringBuilder sb = new StringBuilder();
sb.append("REQUEST_GALLERY: ResultCode: ");
sb.append(i9 == -1 ? "RESULT_OK" : "RESULT_CANCELED");
z.n("SettingSkinActivity", sb.toString());
}
private void h1() {
this.I0.setImageDrawable(null);
Bitmap bitmap = this.G0;
if (bitmap != null && !bitmap.isRecycled()) {
this.G0.recycle();
}
this.G0 = null;
Bitmap bitmap2 = this.H0;
if (bitmap2 != null && !bitmap2.isRecycled()) {
this.H0.recycle();
}
this.H0 = null;
}
public void i1() {
r.d(this, t3.e.a(), this.P0);
}
public void j1() {
String valueOf = String.valueOf(System.currentTimeMillis());
this.B0 = new File(this.y0, valueOf + "_cache_src.jpg");
this.M0.edit().putString("pref_key_trim_file", this.B0.getAbsolutePath()).commit();
this.f40z0.renameTo(this.B0);
Uri uriForFile = FileProvider.getUriForFile(this, "com.ntt.voip.android.sdk050voip.FileProvider", this.B0);
this.x0 = FileProvider.getUriForFile(this, "com.ntt.voip.android.sdk050voip.FileProvider", this.C0);
z.n("SettingSkinActivity", "requestTrimming: " + uriForFile.getPath());
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(uriForFile, "image/*");
intent.addFlags(3);
List<ResolveInfo> o = t4.j.o(getPackageManager(), intent, 131072);
int i8 = 0;
if (o != null) {
for (ResolveInfo resolveInfo : o) {
if (resolveInfo != null) {
i8++;
grantUriPermission(resolveInfo.activityInfo.packageName, this.x0, 3);
}
}
}
if (i8 == 0) {
z.p("SettingSkinActivity", "Failed to trim. No trim-supported-activity found.");
}
intent.putExtra("scale", true);
intent.putExtra("noFaceDetection", true);
intent.putExtra("output", this.x0);
intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.name());
r.d(this, intent, this.Q0);
}
private Bitmap k1(Bitmap bitmap, int i8) {
Bitmap b8 = t3.a.b(bitmap, i8);
if (bitmap != null && bitmap != b8) {
bitmap.recycle();
}
return b8;
}
private void l1() {
this.I0.setBackground(null);
}
public void m1(Bitmap bitmap) {
if (bitmap != null) {
this.I0.setImageBitmap(bitmap.copy(Bitmap.Config.RGB_565, false));
} else {
this.I0.setImageDrawable(null);
}
}
public void n1() {
this.D0 = Integer.valueOf(com.oki_access.android.ims.settings.c.h(getString(com.oki_access.android.ims.call.d.e.Y7()))).intValue();
this.E0 = Integer.valueOf(com.oki_access.android.ims.settings.c.h(getString(com.oki_access.android.ims.call.d.e.S7()))).intValue();
this.w0 = null;
h1();
this.K0 = true;
this.J0.setEnabled(false);
}
public boolean o1() {
FileOutputStream fileOutputStream;
if (this.K0) {
if (this.w0 != null) {
FileOutputStream fileOutputStream2 = null;
try {
FileOutputStream fileOutputStream3 = new FileOutputStream(new File(getFilesDir(), "backgournd_long.jpg"));
try {
if (!this.G0.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream3)) {
try {
fileOutputStream3.close();
} catch (IOException unused) {
}
return false;
}
try {
fileOutputStream3.close();
} catch (IOException unused2) {
}
try {
fileOutputStream = new FileOutputStream(new File(getFilesDir(), "background_short.jpg"));
} catch (FileNotFoundException unused3) {
} catch (Throwable th) {
th = th;
}
try {
if (!this.H0.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream)) {
try {
fileOutputStream.close();
} catch (IOException unused4) {
}
return false;
}
try {
fileOutputStream.close();
} catch (IOException unused5) {
}
} catch (FileNotFoundException unused6) {
fileOutputStream3 = fileOutputStream;
try {
fileOutputStream3.close();
} catch (IOException unused7) {
}
return false;
} catch (Throwable th2) {
th = th2;
fileOutputStream3 = fileOutputStream;
try {
fileOutputStream3.close();
} catch (IOException unused8) {
}
throw th;
}
} catch (FileNotFoundException unused9) {
fileOutputStream2 = fileOutputStream3;
if (fileOutputStream2 != null) {
try {
fileOutputStream2.close();
} catch (IOException unused10) {
}
}
return false;
} catch (Throwable th3) {
th = th3;
fileOutputStream2 = fileOutputStream3;
if (fileOutputStream2 != null) {
try {
fileOutputStream2.close();
} catch (IOException unused11) {
}
}
throw th;
}
} catch (FileNotFoundException unused12) {
} catch (Throwable th4) {
th = th4;
}
} else {
File file = new File(getFilesDir(), "backgournd_long.jpg");
if (file.exists()) {
file.delete();
}
File file2 = new File(getFilesDir(), "background_short.jpg");
if (file2.exists()) {
file2.delete();
}
}
}
t3.d.e2(this, this.D0);
t3.d.b2(this, this.E0);
t3.d.f2(this, this.w0);
t3.d.d2(this, this.F0);
t3.d.D1(this, true);
this.A0.delete();
return true;
}
private boolean p1(android.net.Uri r13) {
throw new UnsupportedOperationException("Method not decompiled: com.ntt.voip.android.com050plus.setting.SettingSkinActivity.p1(android.net.Uri):boolean");
}
@Override
public void B(int i8, Dialog dialog, Bundle bundle, p pVar) {
switch (i8) {
case 2131296331:
com.ntt.voip.android.com050plus.setting.a aVar = (com.ntt.voip.android.com050plus.setting.a) dialog;
aVar.d(this.D0);
aVar.c(this.E0);
break;
case 2131296415:
com.ntt.voip.android.com050plus.setting.b bVar = (com.ntt.voip.android.com050plus.setting.b) dialog;
bVar.f(this.D0);
bVar.e(this.E0);
break;
case 2131296953:
((g3.h) dialog).b(this.L0);
break;
case 2131297218:
s3.d dVar = (s3.d) dialog;
dVar.e(this.D0);
dVar.b(this.E0);
int i9 = this.F0;
if (i9 == 0) {
dVar.d(this.G0);
break;
} else if (i9 == 1) {
dVar.d(this.H0);
break;
}
break;
default:
super.B(i8, dialog, bundle, pVar);
break;
}
if (i8 == 101) {
k4.i.c(this, dialog);
}
}
@Override
protected g.b P() {
return g.b.COM0609;
}
@Override
public void g(int i8) {
this.D0 = i8;
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(2131492947);
this.M0 = PreferenceManager.getDefaultSharedPreferences(this);
if (bundle != null) {
this.L0 = bundle.getInt("pref_key_setting_skin_error_message_id");
}
this.u0 = t3.d.Z(this);
this.v0 = t3.d.V(this);
this.D0 = t3.d.X(this);
this.E0 = t3.d.U(this);
this.w0 = t3.d.Y(this);
this.F0 = t3.d.W(this);
File externalCacheDir = getExternalCacheDir();
this.y0 = externalCacheDir;
if (!externalCacheDir.exists()) {
this.y0.mkdirs();
}
this.f40z0 = new File(this.y0, "cache_src.jpg");
this.A0 = new File(this.y0, "backup_cache_src.jpg");
this.C0 = new File(this.y0, "cache_dst.jpg");
z.n("SettingSkinActivity", "currentUri: " + this.w0);
if (this.w0 == null) {
this.f40z0.delete();
}
if (this.A0.exists()) {
this.A0.renameTo(this.f40z0);
}
String string = this.M0.getString("pref_key_trim_file", null);
if (string != null) {
new File(string).renameTo(this.f40z0);
}
j0();
l0();
d1();
}
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, 0, 0, 2131886782);
menu.add(0, 1, 0, 2131886783);
return true;
}
@Override
protected void onDestroy() {
super.onDestroy();
h1();
l1();
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
int itemId = menuItem.getItemId();
if (itemId == 0) {
p.s(this, 100, null);
} else {
if (itemId != 1) {
return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
}
p.s(this, 101, null);
}
return true;
}
@Override
protected void onPause() {
this.N0 = false;
super.onPause();
}
@Override
protected void onResume() {
this.N0 = true;
super.onResume();
int i8 = this.O0;
if (-1 != i8) {
I0(i8);
}
}
@Override
protected void onSaveInstanceState(Bundle bundle) {
bundle.putInt("pref_key_setting_skin_error_message_id", this.L0);
super.onSaveInstanceState(bundle);
}
@Override
public void w(int i8) {
this.E0 = i8;
}
@Override
public Dialog y(int i8, Bundle bundle, p pVar) {
switch (i8) {
case 100:
return new AlertDialog.Builder(this).setTitle(2131886782).setMessage(2131886784).setPositiveButton(com.oki_access.android.ims.call.d.e.H1(), new d()).setNegativeButton(com.oki_access.android.ims.call.d.e.E1(), (DialogInterface.OnClickListener) null).create();
case 101:
return new AlertDialog.Builder(this).setTitle(2131886783).setMessage(this.v0 + " x " + this.u0 + "(H x W)").setPositiveButton(com.oki_access.android.ims.call.d.e.H1(), (DialogInterface.OnClickListener) null).create();
case 2131296331:
com.ntt.voip.android.com050plus.setting.a aVar = new com.ntt.voip.android.com050plus.setting.a(this);
aVar.e(this);
return aVar;
case 2131296415:
com.ntt.voip.android.com050plus.setting.b bVar = new com.ntt.voip.android.com050plus.setting.b(this);
bVar.g(this);
return bVar;
case 2131296953:
return new h.a(this, pVar).a();
case 2131297218:
return new s3.d(this, this.u0, this.v0);
case 2131297466:
return new i.a(this, pVar).a();
default:
return super.y(i8, bundle, pVar);
}
}
}