Snap v8.10.4版本的 MD5 值为:3f7a8892a522fef17767953dff16af57
以下内容为反编译后的 FilterShowActivity.java 源代码,内容仅作参考
package com.marginz.snap.filtershow;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.app.ActionBar;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.ComponentName;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.print.PrintAttributes;
import android.print.PrintManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewParent;
import android.view.ViewPropertyAnimator;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.PopupMenu;
import android.widget.ShareActionProvider;
import android.widget.Toast;
import androidx.fragment.app.FragmentActivity;
import b.j.a;
import c.f.b.e.g0;
import c.f.b.f.j;
import c.f.b.g.i.c;
import c.f.b.g.j.a0;
import c.f.b.g.j.b0;
import c.f.b.g.j.c0;
import c.f.b.g.j.d0;
import c.f.b.g.j.e0;
import c.f.b.g.j.f0;
import c.f.b.g.j.m;
import c.f.b.g.j.o;
import c.f.b.g.j.p;
import c.f.b.g.j.u;
import c.f.b.g.j.v;
import c.f.b.g.j.x;
import c.f.b.g.j.z;
import c.f.b.g.k.k;
import c.f.b.g.k.t;
import c.f.b.g.k.w;
import c.f.b.g.k.y;
import c.f.b.g.m.n;
import c.f.b.g.m.r;
import c.f.b.g.o.q;
import c.f.b.g.r.e;
import com.coremedia.iso.boxes.sampleentry.SubtitleSampleEntry;
import com.marginz.snap.R;
import com.marginz.snap.filtershow.category.CategorySelected;
import com.marginz.snap.filtershow.filters.ImageFilter;
import com.marginz.snap.filtershow.imageshow.ImageShow;
import com.marginz.snap.filtershow.pipeline.ProcessingService;
import com.marginz.snap.filtershow.provider.SharedImageProvider;
import com.marginz.snap.filtershow.ui.FramedTextButton;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
public class FilterShowActivity extends FragmentActivity implements AdapterView.OnItemClickListener, ShareActionProvider.OnShareTargetSelectedListener, DialogInterface.OnShowListener, DialogInterface.OnDismissListener, PopupMenu.OnDismissListener {
public ProcessingService Q;
public Menu S;
public ShareActionProvider s;
public WeakReference<ProgressDialog> v;
public f w;
public String j = SubtitleSampleEntry.TYPE_ENCRYPTED;
public n k = null;
public ImageShow l = null;
public View m = null;
public c.f.b.g.a n = new c.f.b.g.a(this);
public c.f.b.g.j.b o = null;
public boolean p = false;
public boolean q = false;
public final Vector<ImageShow> r = new Vector<>();
public File t = null;
public boolean u = false;
public Uri x = null;
public c.f.b.g.o.g y = null;
public Uri z = null;
public ArrayList<c.f.b.g.e.a> A = new ArrayList<>();
public c.f.b.g.i.c B = null;
public c.f.b.g.p.b C = null;
public c.f.b.g.e.b D = null;
public c.f.b.g.e.b E = null;
public c.f.b.g.e.b F = null;
public c.f.b.g.e.b G = null;
public c.f.b.g.e.b H = null;
public int I = 0;
public Vector<y> J = new Vector<>();
public int K = 0;
public boolean L = false;
public View M = null;
public float N = 0.0f;
public float O = 0.0f;
public float P = 0.0f;
public boolean R = false;
public DialogInterface T = null;
public PopupMenu U = null;
public boolean V = true;
public ServiceConnection W = new a();
public Point X = new Point();
public class a implements ServiceConnection {
public a() {
}
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
FilterShowActivity filterShowActivity = FilterShowActivity.this;
ProcessingService processingService = ProcessingService.this;
filterShowActivity.Q = processingService;
processingService.j = filterShowActivity;
processingService.l = true;
if (processingService.k) {
return;
}
filterShowActivity.F();
}
@Override
public void onServiceDisconnected(ComponentName componentName) {
FilterShowActivity.this.Q = null;
}
}
public class b implements View.OnClickListener {
public b() {
}
@Override
public void onClick(View view) {
FilterShowActivity.this.v();
}
}
public class c implements DialogInterface.OnClickListener {
public c() {
}
@Override
public void onClick(DialogInterface dialogInterface, int i) {
FilterShowActivity.this.v();
}
}
public class d implements DialogInterface.OnClickListener {
public d() {
}
@Override
public void onClick(DialogInterface dialogInterface, int i) {
FilterShowActivity.this.l();
}
}
public class e implements Runnable {
public final CategorySelected f1987a;
public e(CategorySelected categorySelected) {
this.f1987a = categorySelected;
}
@Override
public void run() {
this.f1987a.setVisibility(4);
this.f1987a.setScaleX(1.0f);
this.f1987a.setScaleY(1.0f);
this.f1987a.setAlpha(1.0f);
}
}
public class f extends AsyncTask<Uri, Boolean, Boolean> {
public int f1989a;
public f() {
this.f1989a = FilterShowActivity.i(FilterShowActivity.this);
}
@Override
public Boolean doInBackground(Uri[] uriArr) {
List<j> list;
Bitmap m0;
boolean z;
boolean z2;
c.a.a.d G;
n f = n.f();
Uri uri = uriArr[0];
int i = this.f1989a;
f.q = uri;
String S = a.a.a.a.g.j.S(f.I, uri);
InputStream inputStream = null;
if (S != null && "image/jpeg".equals(a.a.a.a.g.j.U(Uri.parse(S)))) {
try {
c.f.b.f.d dVar = new c.f.b.f.d();
dVar.s(S);
list = dVar.f1140a.b();
} catch (IOException e) {
Log.w("ImageLoader", "Failed to read EXIF tags", e);
}
f.R = list;
f.n = a.a.a.a.g.j.T(f.I, uri);
Rect rect = new Rect();
m0 = a.a.a.a.g.j.m0(uri, f.I, Math.min(900, i), f.n, rect);
f.k = m0;
f.o = rect;
if (m0 != null) {
z = false;
} else {
f.j = Bitmap.createScaledBitmap(f.k, 160, (int) ((160 * m0.getHeight()) / f.k.getWidth()), true);
f.r = f.n;
f.w();
z = true;
}
if (z) {
return Boolean.FALSE;
}
Boolean[] boolArr = new Boolean[1];
try {
inputStream = n.f().I.getContentResolver().openInputStream(n.f().q);
G = a.a.a.a.g.j.G(inputStream);
} catch (c.a.a.c | FileNotFoundException unused) {
} catch (Throwable th) {
c.f.b.d.j.i(inputStream);
throw th;
}
if (G != null && G.a("http://ns.google.com/photos/1.0/panorama/", "GPano:CroppedAreaImageWidthPixels") && G.a("http://ns.google.com/photos/1.0/panorama/", "GPano:FullPanoWidthPixels")) {
Integer e2 = G.e("http://ns.google.com/photos/1.0/panorama/", "GPano:CroppedAreaImageWidthPixels");
Integer e3 = G.e("http://ns.google.com/photos/1.0/panorama/", "GPano:FullPanoWidthPixels");
if (e2 != null && e3 != null) {
z2 = e2.equals(e3);
c.f.b.d.j.i(inputStream);
boolArr[0] = Boolean.valueOf(z2);
publishProgress(boolArr);
return Boolean.TRUE;
}
}
c.f.b.d.j.i(inputStream);
z2 = false;
boolArr[0] = Boolean.valueOf(z2);
publishProgress(boolArr);
return Boolean.TRUE;
}
list = null;
f.R = list;
f.n = a.a.a.a.g.j.T(f.I, uri);
Rect rect2 = new Rect();
m0 = a.a.a.a.g.j.m0(uri, f.I, Math.min(900, i), f.n, rect2);
f.k = m0;
f.o = rect2;
if (m0 != null) {
}
if (z) {
}
}
@Override
public void onPostExecute(Boolean bool) {
t tVar;
Boolean bool2 = bool;
n.U = FilterShowActivity.this.k;
if (isCancelled()) {
return;
}
if (!bool2.booleanValue()) {
FilterShowActivity filterShowActivity = FilterShowActivity.this;
Uri uri = filterShowActivity.x;
if (uri == null || uri.equals(filterShowActivity.z)) {
FilterShowActivity filterShowActivity2 = FilterShowActivity.this;
if (filterShowActivity2 == null) {
throw null;
}
Toast.makeText(filterShowActivity2, (int) R.string.cannot_load_image, 0).show();
filterShowActivity2.finish();
return;
}
FilterShowActivity filterShowActivity3 = FilterShowActivity.this;
filterShowActivity3.x = filterShowActivity3.z;
filterShowActivity3.y = null;
Toast.makeText(filterShowActivity3, (int) R.string.cannot_edit_original, 0).show();
FilterShowActivity filterShowActivity4 = FilterShowActivity.this;
filterShowActivity4.B(filterShowActivity4.x);
return;
}
FilterShowActivity.this.findViewById(R.id.imageShow).setVisibility(0);
Bitmap bitmap = n.f().k;
ProcessingService processingService = FilterShowActivity.this.Q;
q qVar = processingService.e;
if (qVar != null) {
qVar.e.g(bitmap);
qVar.g = true;
processingService.f.e.g(bitmap);
c.f.b.g.o.e eVar = processingService.g;
eVar.e.g(bitmap);
eVar.f = true;
c.f.b.g.o.n nVar = processingService.h;
nVar.e.g(bitmap);
nVar.f = true;
}
float width = bitmap.getWidth() / n.f().o.width();
ProcessingService processingService2 = FilterShowActivity.this.Q;
processingService2.f.e.g = width;
processingService2.g.e.g = width;
processingService2.h.e.g = width;
FilterShowActivity filterShowActivity5 = FilterShowActivity.this;
if (!filterShowActivity5.p) {
filterShowActivity5.G.f();
}
FilterShowActivity.this.D.notifyDataSetChanged();
FilterShowActivity.this.E.notifyDataSetChanged();
FilterShowActivity.this.F.notifyDataSetChanged();
FilterShowActivity.this.G.notifyDataSetChanged();
FilterShowActivity.this.w = null;
n.f().w();
FilterShowActivity filterShowActivity6 = FilterShowActivity.this;
for (int i = 0; i < filterShowActivity6.A.size(); i++) {
filterShowActivity6.A.get(i).c(new Rect(0, 0, 96, 96));
}
FilterShowActivity filterShowActivity7 = FilterShowActivity.this;
if (filterShowActivity7.y != null) {
n.f().e = FilterShowActivity.this.y;
n f = n.f();
c.f.b.g.o.g gVar = FilterShowActivity.this.y;
f.t(gVar, gVar.l(), true);
FilterShowActivity.this.y = null;
} else {
c.f.b.g.o.g gVar2 = new c.f.b.g.o.g();
filterShowActivity7.k.t(gVar2, gVar2.l(), true);
}
n.f().s(true);
FilterShowActivity filterShowActivity8 = FilterShowActivity.this;
if (filterShowActivity8.j == "com.android.camera.action.TINY_PLANET") {
c.f.b.g.e.b bVar = filterShowActivity8.G;
int i2 = 0;
while (true) {
if (i2 >= bVar.getCount()) {
tVar = null;
break;
}
tVar = bVar.getItem(i2).f1178a;
if (tVar != null && (tVar instanceof w)) {
break;
}
i2++;
}
filterShowActivity8.z(tVar);
}
new g(null).execute(new Void[0]);
n.f().w();
super.onPostExecute(bool2);
}
@Override
public void onProgressUpdate(Boolean[] boolArr) {
Boolean[] boolArr2 = boolArr;
super.onProgressUpdate(boolArr2);
if (!isCancelled() && boolArr2[0].booleanValue()) {
FilterShowActivity.this.p = true;
}
}
}
public class g extends AsyncTask<Void, Void, Boolean> {
public g(a aVar) {
}
@Override
public Boolean doInBackground(Void[] voidArr) {
n f = n.f();
Rect rect = f.o;
if (f.f1384b) {
int width = f.k.getWidth() * 2;
if (width > rect.width()) {
width = rect.width();
}
Rect rect2 = new Rect();
Bitmap m0 = a.a.a.a.g.j.m0(f.q, f.I, width, f.n, rect2);
f.o = rect2;
f.l = m0;
FilterShowActivity.this.Q.f.f = true;
f.w();
}
return Boolean.TRUE;
}
@Override
public void onPostExecute(Boolean bool) {
Bitmap g = n.f().g();
if (g != null) {
FilterShowActivity.this.Q.f.e.h = g.getWidth() / n.f().o.width();
}
n.f().w();
}
}
public static int i(FilterShowActivity filterShowActivity) {
if (filterShowActivity != null) {
DisplayMetrics displayMetrics = new DisplayMetrics();
filterShowActivity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
return Math.max(displayMetrics.heightPixels, displayMetrics.widthPixels);
}
throw null;
}
public final void A(String str) {
ProgressDialog progressDialog;
WeakReference<ProgressDialog> weakReference = this.v;
if (weakReference == null || (progressDialog = weakReference.get()) == null) {
this.v = new WeakReference<>(ProgressDialog.show(this, SubtitleSampleEntry.TYPE_ENCRYPTED, str == null ? getString(R.string.saving_image) : getString(R.string.filtershow_saving_image, new Object[]{str}), true, false));
} else {
progressDialog.show();
}
}
public final void B(Uri uri) {
findViewById(R.id.imageShow).setVisibility(4);
View findViewById = findViewById(R.id.loading);
this.V = true;
findViewById.setVisibility(0);
this.p = false;
f fVar = new f();
this.w = fVar;
fVar.execute(uri);
}
@TargetApi(16)
public void C(View view, float f2, float f3) {
CategorySelected categorySelected = (CategorySelected) findViewById(R.id.categorySelectedIndicator);
int[] iArr = new int[2];
view.getLocationOnScreen(iArr);
Point point = this.X;
point.x = (int) (iArr[0] + f2);
point.y = (int) (iArr[1] + f3);
int[] iArr2 = new int[2];
((View) categorySelected.getParent()).getLocationOnScreen(iArr2);
categorySelected.setTranslationX((iArr[0] - iArr2[0]) + ((int) (f2 - (categorySelected.getWidth() / 2))));
categorySelected.setTranslationY((iArr[1] - iArr2[1]) + ((int) (f3 - (categorySelected.getHeight() / 2))));
categorySelected.setVisibility(0);
if (Build.VERSION.SDK_INT >= 16) {
categorySelected.animate().scaleX(2.0f).scaleY(2.0f).alpha(0.0f).withEndAction(new e(categorySelected));
return;
}
categorySelected.setVisibility(4);
categorySelected.setScaleX(1.0f);
categorySelected.setScaleY(1.0f);
categorySelected.setAlpha(1.0f);
}
public void D() {
findViewById(R.id.loading).setVisibility(8);
this.V = false;
}
public void E() {
n nVar = this.k;
if (nVar == null) {
return;
}
c.f.b.g.o.g h = nVar.h();
this.D.d(h);
this.E.d(h);
}
public void F() {
n.U = this.k;
ImageFilter.f2037c = this;
this.B = new c.f.b.g.i.c(this);
this.C = new c.f.b.g.p.b(this);
c.f.b.g.l.b bVar = new c.f.b.g.l.b();
c.f.b.g.q.b bVar2 = new c.f.b.g.q.b(this, 0);
n.U = null;
n f2 = n.f();
this.k = f2;
f2.G = bVar;
f2.H = bVar2;
f2.I = this;
int i = (Runtime.getRuntime().maxMemory() > 134217728L ? 1 : (Runtime.getRuntime().maxMemory() == 134217728L ? 0 : -1));
n nVar = this.k;
if (i > 0) {
nVar.f1384b = true;
} else {
nVar.f1384b = false;
}
y();
w();
c.f.b.g.a aVar = this.n;
c.f.b.g.j.d dVar = new c.f.b.g.j.d();
aVar.f1172c.put(Integer.valueOf(dVar.h), dVar);
c.f.b.g.a aVar2 = this.n;
u uVar = new u();
aVar2.f1172c.put(Integer.valueOf(uVar.h), uVar);
c.f.b.g.a aVar3 = this.n;
c0 c0Var = new c0();
aVar3.f1172c.put(Integer.valueOf(c0Var.h), c0Var);
c.f.b.g.a aVar4 = this.n;
c.f.b.g.j.c cVar = new c.f.b.g.j.c();
aVar4.f1172c.put(Integer.valueOf(cVar.h), cVar);
c.f.b.g.a aVar5 = this.n;
p pVar = new p();
aVar5.f1172c.put(Integer.valueOf(pVar.h), pVar);
c.f.b.g.a aVar6 = this.n;
v vVar = new v();
aVar6.f1172c.put(Integer.valueOf(vVar.h), vVar);
c.f.b.g.a aVar7 = this.n;
c.f.b.g.j.q qVar = new c.f.b.g.j.q();
aVar7.f1172c.put(Integer.valueOf(qVar.h), qVar);
c.f.b.g.a aVar8 = this.n;
c.f.b.g.j.e eVar = new c.f.b.g.j.e();
aVar8.f1172c.put(Integer.valueOf(eVar.h), eVar);
c.f.b.g.a aVar9 = this.n;
c.f.b.g.j.a aVar10 = new c.f.b.g.j.a();
aVar9.f1172c.put(Integer.valueOf(aVar10.h), aVar10);
c.f.b.g.a aVar11 = this.n;
f0 f0Var = new f0();
aVar11.f1172c.put(Integer.valueOf(f0Var.h), f0Var);
c.f.b.g.a aVar12 = this.n;
b0 b0Var = new b0();
aVar12.f1172c.put(Integer.valueOf(b0Var.h), b0Var);
c.f.b.g.a aVar13 = this.n;
c.f.b.g.j.y yVar = new c.f.b.g.j.y();
aVar13.f1172c.put(Integer.valueOf(yVar.h), yVar);
c.f.b.g.a aVar14 = this.n;
m mVar = new m();
aVar14.f1172c.put(Integer.valueOf(mVar.h), mVar);
c.f.b.g.a aVar15 = this.n;
c.f.b.g.j.w wVar = new c.f.b.g.j.w();
aVar15.f1172c.put(Integer.valueOf(wVar.h), wVar);
c.f.b.g.a aVar16 = this.n;
z zVar = new z();
aVar16.f1172c.put(Integer.valueOf(zVar.h), zVar);
c.f.b.g.a aVar17 = this.n;
a0 a0Var = new a0();
aVar17.f1172c.put(Integer.valueOf(a0Var.h), a0Var);
getWindow().setBackgroundDrawable(new ColorDrawable(0));
s();
m();
r();
e.a a2 = c.f.b.g.r.e.a(getBaseContext(), getIntent().getData());
if (a2 != null) {
this.x = a2.f1463b;
this.y = a2.f1462a;
}
Intent intent = getIntent();
if (intent.getBooleanExtra("launch-fullscreen", false)) {
getWindow().addFlags(1024);
}
this.j = intent.getAction();
Uri data = intent.getData();
this.z = data;
Uri uri = this.x;
if (uri != null) {
data = uri;
}
if (data != null) {
B(data);
return;
}
Intent intent2 = new Intent();
intent2.setType("image/*");
intent2.setAction("android.intent.action.GET_CONTENT");
startActivityForResult(Intent.createChooser(intent2, getString(R.string.select_image)), 1);
}
public void G(c.f.b.g.p.b bVar) {
Iterator<y> it = bVar.f1442c.iterator();
while (it.hasNext()) {
int i = it.next().n;
c.f.b.g.i.c cVar = this.B;
Message obtainMessage = cVar.f1254c.obtainMessage(4);
obtainMessage.arg1 = i;
cVar.f1254c.sendMessage(obtainMessage);
}
Iterator<y> it2 = bVar.d.iterator();
while (it2.hasNext()) {
y next = it2.next();
c.f.b.g.i.c cVar2 = this.B;
Message obtainMessage2 = cVar2.f1254c.obtainMessage(5);
c.C0039c c0039c = new c.C0039c();
c0039c.f1258a = next.n;
c0039c.f1259b = next.f1348a;
obtainMessage2.obj = c0039c;
cVar2.f1254c.sendMessage(obtainMessage2);
}
bVar.f1442c.clear();
bVar.d.clear();
c.f.b.g.i.c cVar3 = this.B;
cVar3.f1254c.sendMessage(cVar3.f1254c.obtainMessage(1));
H();
}
public void H() {
ArrayList<y> arrayList = this.B.e;
if (arrayList == null) {
return;
}
if (this.D != null) {
n();
}
if (arrayList.size() > 0) {
this.D.a(new c.f.b.g.e.a(this, 3));
}
this.C.clear();
for (int i = 0; i < arrayList.size(); i++) {
y yVar = arrayList.get(i);
this.D.a(new c.f.b.g.e.a(this, yVar, 0, true));
c.f.b.g.p.b bVar = this.C;
c.f.b.g.e.a aVar = new c.f.b.g.e.a(this, 0);
aVar.f1178a = yVar;
aVar.f1179b = yVar.f1348a;
bVar.a(aVar);
}
if (arrayList.size() > 0) {
this.D.a(new c.f.b.g.e.a(this, 2));
}
this.D.notifyDataSetChanged();
this.D.notifyDataSetInvalidated();
}
public void I() {
this.H.clear();
y yVar = new y(getString(R.string.filtershow_version_original), new c.f.b.g.o.g(), -1);
c.f.b.g.e.b bVar = this.H;
c.f.b.g.e.a aVar = new c.f.b.g.e.a(this, 0);
aVar.f1178a = yVar;
aVar.f1179b = yVar.f1348a;
bVar.a(aVar);
y yVar2 = new y(getString(R.string.filtershow_version_current), new c.f.b.g.o.g(n.f().h()), -1);
c.f.b.g.e.b bVar2 = this.H;
c.f.b.g.e.a aVar2 = new c.f.b.g.e.a(this, 0);
aVar2.f1178a = yVar2;
aVar2.f1179b = yVar2.f1348a;
bVar2.a(aVar2);
if (this.J.size() > 0) {
this.H.a(new c.f.b.g.e.a(this, 3));
}
Iterator<y> it = this.J.iterator();
while (it.hasNext()) {
this.H.a(new c.f.b.g.e.a(this, it.next(), 0, true));
}
this.H.notifyDataSetInvalidated();
}
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
if (this.L) {
View view = this.M;
int orientation = view instanceof c.f.b.g.e.d ? ((c.f.b.g.e.d) view).getOrientation() : 1;
if (motionEvent.getActionMasked() == 2) {
float y = motionEvent.getY() - this.P;
float height = this.M.getHeight();
if (orientation == 0) {
y = motionEvent.getX() - this.O;
this.M.setTranslationX(y);
height = this.M.getWidth();
} else {
this.M.setTranslationY(y);
}
float abs = Math.abs(y);
this.M.setAlpha(1.0f - Math.min(1.0f, abs / height));
this.N = abs;
}
if (motionEvent.getActionMasked() == 3 || motionEvent.getActionMasked() == 1) {
this.M.setTranslationX(0.0f);
this.M.setTranslationY(0.0f);
this.M.setAlpha(1.0f);
this.L = false;
float height2 = this.M.getHeight();
if (orientation == 0) {
height2 = this.M.getWidth();
}
if (this.N > height2) {
((c.f.b.g.e.g) this.M).a();
}
}
return true;
}
return super.dispatchTouchEvent(motionEvent);
}
public void j() {
if (e().b("MainPanel") instanceof c.f.b.g.e.e) {
return;
}
r();
FrameLayout frameLayout = this.n.f1171b;
if (frameLayout != null) {
frameLayout.setVisibility(8);
}
this.l.setVisibility(0);
n.f().f1385c = null;
n.f().K = null;
}
public void k(Uri uri) {
ProgressDialog progressDialog;
File file;
if (this.u && (file = this.t) != null) {
Uri withAppendedPath = Uri.withAppendedPath(SharedImageProvider.f2063b, Uri.encode(file.getAbsolutePath()));
ContentValues contentValues = new ContentValues();
contentValues.put("prepare", Boolean.FALSE);
getContentResolver().insert(withAppendedPath, contentValues);
}
setResult(-1, new Intent().setData(uri));
WeakReference<ProgressDialog> weakReference = this.v;
if (weakReference != null && (progressDialog = weakReference.get()) != null) {
progressDialog.dismiss();
}
finish();
}
public void l() {
ProgressDialog progressDialog;
WeakReference<ProgressDialog> weakReference = this.v;
if (weakReference != null && (progressDialog = weakReference.get()) != null) {
progressDialog.dismiss();
}
f fVar = this.w;
if (fVar != null) {
fVar.cancel(false);
}
finish();
}
public void m() {
n();
c.f.b.g.i.c cVar = this.B;
cVar.f1254c.sendMessage(cVar.f1254c.obtainMessage(1));
H();
ArrayList<t> arrayList = c.f.b.g.k.a0.i().d;
boolean z = false;
if (arrayList.size() > 0) {
arrayList.get(0).e = R.string.none;
}
c.f.b.g.e.b bVar = this.E;
if (bVar != null) {
bVar.clear();
}
this.E = new c.f.b.g.e.b(this);
Iterator<t> it = arrayList.iterator();
while (it.hasNext()) {
t next = it.next();
next.f1348a = getString(next.C() != 0 ? next.C() : R.string.borders);
c.f.b.g.e.b bVar2 = this.E;
c.f.b.g.e.a aVar = new c.f.b.g.e.a(this, 0);
aVar.f1178a = next;
aVar.f1179b = next.f1348a;
bVar2.a(aVar);
}
ArrayList<t> arrayList2 = c.f.b.g.k.a0.i().e;
c.f.b.g.e.b bVar3 = this.F;
if (bVar3 != null) {
bVar3.clear();
}
this.F = new c.f.b.g.e.b(this);
Iterator<t> it2 = arrayList2.iterator();
while (it2.hasNext()) {
t next2 = it2.next();
c.f.b.g.e.b bVar4 = this.F;
c.f.b.g.e.a aVar2 = new c.f.b.g.e.a(this, 1);
aVar2.f1178a = next2;
aVar2.f1179b = next2.f1348a;
bVar4.a(aVar2);
if (next2 instanceof k) {
z = true;
}
}
if (!z) {
k kVar = new k();
c.f.b.g.e.a aVar3 = new c.f.b.g.e.a(this, 1);
aVar3.f1178a = kVar;
aVar3.f1179b = kVar.f1348a;
aVar3.k = true;
this.F.a(aVar3);
}
ArrayList<t> arrayList3 = c.f.b.g.k.a0.i().f;
c.f.b.g.e.b bVar5 = this.G;
if (bVar5 != null) {
bVar5.clear();
}
this.G = new c.f.b.g.e.b(this);
Iterator<t> it3 = arrayList3.iterator();
while (it3.hasNext()) {
t next3 = it3.next();
if (next3.C() != 0) {
next3.f1348a = getString(next3.C());
}
c.f.b.g.e.b bVar6 = this.G;
c.f.b.g.e.a aVar4 = new c.f.b.g.e.a(this, 1);
aVar4.f1178a = next3;
aVar4.f1179b = next3.f1348a;
bVar6.a(aVar4);
}
c.f.b.g.e.b bVar7 = this.H;
if (bVar7 != null) {
bVar7.clear();
}
c.f.b.g.e.b bVar8 = new c.f.b.g.e.b(this);
this.H = bVar8;
bVar8.g = true;
}
public final void n() {
ArrayList<t> arrayList = c.f.b.g.k.a0.i().f1331c;
c.f.b.g.e.b bVar = this.D;
if (bVar != null) {
bVar.clear();
}
this.D = new c.f.b.g.e.b(this);
this.D.f1181a = (int) getResources().getDimension(R.dimen.action_item_height);
Iterator<t> it = arrayList.iterator();
while (it.hasNext()) {
t next = it.next();
c.f.b.g.e.b bVar2 = this.D;
c.f.b.g.e.a aVar = new c.f.b.g.e.a(this, 0);
aVar.f1178a = next;
aVar.f1179b = next.f1348a;
bVar2.a(aVar);
}
ArrayList<y> arrayList2 = this.B.e;
if (arrayList2 == null || arrayList2.size() == 0) {
this.D.a(new c.f.b.g.e.a(this, 2));
}
b.f.a.e b2 = e().b("MainPanel");
if (b2 == null || !(b2 instanceof c.f.b.g.e.e)) {
return;
}
((c.f.b.g.e.e) b2).Y(true);
}
public float o(float f2) {
return TypedValue.applyDimension(1, f2, getResources().getDisplayMetrics());
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
if (i2 == -1 && i == 1) {
B(intent.getData());
}
}
@Override
public void onBackPressed() {
if (!(e().b("MainPanel") instanceof c.f.b.g.e.e)) {
j();
} else if (this.l == null) {
throw null;
} else {
if (!n.f().j()) {
l();
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.unsaved).setTitle(R.string.save_before_exit);
builder.setPositiveButton(R.string.save_and_exit, new c());
builder.setNegativeButton(R.string.exit, new d());
builder.show();
}
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
w();
if (this.k == null) {
return;
}
s();
m();
r();
PopupMenu popupMenu = this.U;
if (popupMenu != null) {
popupMenu.dismiss();
this.U = null;
}
DialogInterface dialogInterface = this.T;
if (dialogInterface != null) {
dialogInterface.dismiss();
this.T = null;
}
if (!this.p && this.w == null) {
this.G.f();
}
D();
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (getResources().getBoolean(R.bool.only_use_portrait)) {
setRequestedOrientation(1);
}
new c.f.b.g.c(this).execute(new Void[0]);
bindService(new Intent(this, ProcessingService.class), this.W, 1);
this.R = true;
getWindow().setBackgroundDrawable(new ColorDrawable(-7829368));
setContentView(R.layout.filtershow_splashscreen);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.filtershow_activity_menu, menu);
menu.findItem(R.id.showImageStateButton).setTitle(this.q ? R.string.hide_imagestate_panel : R.string.show_imagestate_panel);
ShareActionProvider shareActionProvider = (ShareActionProvider) menu.findItem(R.id.menu_share).getActionProvider();
this.s = shareActionProvider;
Intent intent = new Intent("android.intent.action.SEND");
intent.addFlags(524288);
intent.addFlags(1);
intent.setType("image/jpeg");
File f2 = c.f.b.g.r.c.f(this, n.f().q);
this.t = f2;
intent.putExtra("android.intent.extra.STREAM", Uri.withAppendedPath(SharedImageProvider.f2063b, Uri.encode(f2.getAbsolutePath())));
shareActionProvider.setShareIntent(intent);
this.s.setOnShareTargetSelectedListener(this);
this.S = menu;
y();
return true;
}
@Override
public void onDestroy() {
f fVar = this.w;
if (fVar != null) {
fVar.cancel(false);
}
c.f.b.g.i.c cVar = this.B;
c.f.b.g.i.b bVar = cVar.d;
bVar.f1250a = null;
bVar.f1251b.close();
cVar.f1253b.quit();
if (this.R) {
unbindService(this.W);
this.R = false;
}
super.onDestroy();
}
@Override
public void onDismiss(DialogInterface dialogInterface) {
this.T = null;
}
@Override
public void onDismiss(PopupMenu popupMenu) {
PopupMenu popupMenu2 = this.U;
if (popupMenu2 == null) {
return;
}
popupMenu2.setOnDismissListener(null);
this.U = null;
}
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
this.k.q(i);
p();
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
int itemId = menuItem.getItemId();
if (itemId == R.id.undoButton) {
this.k.q(this.k.G.e());
j();
} else {
if (itemId != R.id.redoButton) {
if (itemId == R.id.resetHistoryButton) {
u();
return true;
} else if (itemId == R.id.showImageStateButton) {
invalidateOptionsMenu();
this.q = !this.q;
b.f.a.e b2 = e().b("MainPanel");
if (b2 != null) {
if (b2 instanceof x) {
((x) b2).X(this.q);
} else if (b2 instanceof c.f.b.g.e.e) {
((c.f.b.g.e.e) b2).b0(this.q);
}
}
return true;
} else if (itemId == R.id.exportFlattenButton) {
new c.f.b.g.s.a().Y(e(), "ExportDialogFragment");
return true;
} else if (itemId == 16908332) {
v();
return true;
} else if (itemId == R.id.manageUserPresets) {
new c.f.b.g.p.a().Y(e(), "NoticeDialogFragment");
return true;
} else if (itemId != R.id.showInfoPanel) {
if (itemId == R.id.printButton) {
Bitmap e2 = n.f().e();
b.j.a aVar = new b.j.a(this);
if (Build.VERSION.SDK_INT >= 19 && e2 != null) {
((PrintManager) aVar.f287a.getSystemService("print")).print("ImagePrint", new a.c("ImagePrint", aVar.d, e2, null), new PrintAttributes.Builder().setMediaSize(e2.getWidth() <= e2.getHeight() ? PrintAttributes.MediaSize.UNKNOWN_PORTRAIT : PrintAttributes.MediaSize.UNKNOWN_LANDSCAPE).setColorMode(aVar.e).build());
}
return true;
}
return false;
} else {
b.f.a.j jVar = (b.f.a.j) e();
if (jVar != null) {
b.f.a.a aVar2 = new b.f.a.a(jVar);
aVar2.f(R.anim.slide_in_right, R.anim.slide_out_left);
c.f.b.g.n.a aVar3 = new c.f.b.g.n.a();
aVar3.f0 = false;
aVar3.g0 = true;
aVar2.j(0, aVar3, "InfoPanel", 1);
aVar3.e0 = false;
aVar3.c0 = aVar2.b();
return true;
}
throw null;
}
}
c.f.b.g.l.b bVar = this.k.G;
int i = bVar.f1357b - 1;
bVar.f1357b = i;
if (i < 0) {
bVar.f1357b = 0;
}
bVar.f();
this.k.q(bVar.f1357b);
}
p();
return true;
}
@Override
public void onPause() {
super.onPause();
ShareActionProvider shareActionProvider = this.s;
if (shareActionProvider != null) {
shareActionProvider.setOnShareTargetSelectedListener(null);
}
}
@Override
public void onResume() {
super.onResume();
ShareActionProvider shareActionProvider = this.s;
if (shareActionProvider != null) {
shareActionProvider.setOnShareTargetSelectedListener(this);
}
}
@Override
public boolean onShareTargetSelected(ShareActionProvider shareActionProvider, Intent intent) {
Uri withAppendedPath = Uri.withAppendedPath(SharedImageProvider.f2063b, Uri.encode(this.t.getAbsolutePath()));
ContentValues contentValues = new ContentValues();
contentValues.put("prepare", Boolean.TRUE);
getContentResolver().insert(withAppendedPath, contentValues);
this.u = true;
A(null);
this.l.l(this, this.t);
return true;
}
@Override
public void onShow(DialogInterface dialogInterface) {
this.T = dialogInterface;
}
public void p() {
Iterator<ImageShow> it = this.r.iterator();
while (it.hasNext()) {
it.next().invalidate();
}
}
public boolean q() {
return !"action_snap_edit".equalsIgnoreCase(this.j);
}
public void r() {
if (findViewById(R.id.main_panel_container) == null) {
return;
}
c.f.b.g.e.e eVar = new c.f.b.g.e.e();
b.f.a.j jVar = (b.f.a.j) e();
if (jVar == null) {
throw null;
}
b.f.a.a aVar = new b.f.a.a(jVar);
aVar.e(R.id.main_panel_container, eVar, "MainPanel");
aVar.c();
}
public final void s() {
setContentView(R.layout.filtershow_activity);
ActionBar actionBar = getActionBar();
actionBar.setDisplayOptions(16);
actionBar.setCustomView(R.layout.filtershow_actionbar);
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.background_screen)));
View customView = actionBar.getCustomView();
this.m = customView;
customView.setOnClickListener(new b());
ImageShow imageShow = (ImageShow) findViewById(R.id.imageShow);
this.l = imageShow;
this.r.add(imageShow);
this.n.f1171b = (FrameLayout) findViewById(R.id.editorContainer);
c.f.b.g.a aVar = this.n;
v vVar = new v();
aVar.f1172c.put(Integer.valueOf(vVar.h), vVar);
c.f.b.g.j.d dVar = new c.f.b.g.j.d();
aVar.f1172c.put(Integer.valueOf(dVar.h), dVar);
e0 e0Var = new e0();
aVar.f1172c.put(Integer.valueOf(e0Var.h), e0Var);
o oVar = new o();
aVar.f1172c.put(Integer.valueOf(oVar.h), oVar);
b0 b0Var = new b0();
aVar.f1172c.put(Integer.valueOf(b0Var.h), b0Var);
c.f.b.g.j.q qVar = new c.f.b.g.j.q();
aVar.f1172c.put(Integer.valueOf(qVar.h), qVar);
d0 d0Var = new d0();
aVar.f1172c.put(Integer.valueOf(d0Var.h), d0Var);
c.f.b.g.j.e eVar = new c.f.b.g.j.e();
aVar.f1172c.put(Integer.valueOf(eVar.h), eVar);
c.f.b.g.j.w wVar = new c.f.b.g.j.w();
aVar.f1172c.put(Integer.valueOf(wVar.h), wVar);
z zVar = new z();
aVar.f1172c.put(Integer.valueOf(zVar.h), zVar);
a0 a0Var = new a0();
aVar.f1172c.put(Integer.valueOf(a0Var.h), a0Var);
m mVar = new m();
aVar.f1172c.put(Integer.valueOf(mVar.h), mVar);
u uVar = new u();
aVar.f1172c.put(Integer.valueOf(uVar.h), uVar);
c0 c0Var = new c0();
aVar.f1172c.put(Integer.valueOf(c0Var.h), c0Var);
c.f.b.g.j.c cVar = new c.f.b.g.j.c();
aVar.f1172c.put(Integer.valueOf(cVar.h), cVar);
p pVar = new p();
aVar.f1172c.put(Integer.valueOf(pVar.h), pVar);
c.f.b.g.a aVar2 = this.n;
aVar2.d = this.r;
FrameLayout frameLayout = aVar2.f1171b;
if (frameLayout != null) {
frameLayout.setVisibility(8);
}
this.l.b();
n.f().G = this.k.G;
}
public void t(t tVar) {
if (tVar == null) {
return;
}
c.f.b.g.o.g gVar = new c.f.b.g.o.g(n.f().h());
gVar.s(tVar);
n.f().t(gVar, gVar.l(), true);
if (n.f().K == tVar) {
n.f().K = gVar.l();
}
}
public void u() {
c.f.b.g.l.b bVar = this.k.G;
if (bVar.b() != 0) {
bVar.f1356a.clear();
bVar.f();
}
c.f.b.g.l.a c2 = bVar.c(0);
this.k.t(new c.f.b.g.o.g(), c2 != null ? c2.f1355b : null, true);
p();
j();
}
public void v() {
if (this.l == null) {
throw null;
}
if (!n.f().j()) {
l();
return;
}
A(g0.G(getResources(), c.f.b.j.d.g(c.f.b.g.r.c.c(this, this.z).getPath()), null));
this.l.l(this, null);
}
public final void w() {
Resources resources = getResources();
FramedTextButton.setTextSize((int) o(14.0f));
FramedTextButton.setTrianglePadding((int) o(4.0f));
FramedTextButton.setTriangleSize((int) o(10.0f));
r.d = resources.getDrawable(R.drawable.camera_crop);
r.e = (int) resources.getDimension(R.dimen.crop_indicator_size);
r.f = (int) o(3.0f);
this.x = null;
}
public void x(View view, float f2, float f3) {
this.L = true;
this.M = view;
int[] iArr = new int[2];
view.getLocationInWindow(iArr);
this.O = iArr[0] + f2;
this.P = iArr[1] + f3;
}
public final void y() {
Menu menu = this.S;
if (menu == null || this.k == null) {
return;
}
MenuItem findItem = menu.findItem(R.id.undoButton);
MenuItem findItem2 = this.S.findItem(R.id.redoButton);
MenuItem findItem3 = this.S.findItem(R.id.resetHistoryButton);
MenuItem findItem4 = this.S.findItem(R.id.printButton);
if (!b.j.a.e()) {
findItem4.setVisible(false);
}
c.f.b.g.l.b bVar = this.k.G;
bVar.f1358c = findItem;
bVar.d = findItem2;
bVar.e = findItem3;
bVar.f();
}
public void z(t tVar) {
t tVar2;
if (tVar == null) {
return;
}
boolean z = tVar instanceof c.f.b.g.k.u;
if (z) {
((c.f.b.g.k.u) tVar).J();
}
boolean z2 = tVar instanceof c.f.b.g.k.p;
if (z2) {
((c.f.b.g.k.p) tVar).I();
}
c.f.b.g.j.b bVar = null;
boolean z3 = true;
if (tVar.k) {
c.f.b.g.o.g h = n.f().h();
if (h.o(tVar) != null) {
c.f.b.g.o.g gVar = new c.f.b.g.o.g(h);
gVar.s(tVar);
n.f().t(gVar, tVar.x(), true);
n.f().K = null;
return;
}
}
if (z || z2 || n.f().K != tVar) {
boolean z4 = tVar instanceof y;
if (z4 || z || z2) {
n f2 = n.f();
if (f2.d() != null) {
ValueAnimator valueAnimator = f2.z;
if (valueAnimator != null) {
valueAnimator.cancel();
if (f2.F == 2) {
f2.D += 90.0f;
}
} else {
f2.S.a(f2.w);
f2.w = null;
f2.w = f2.S.c(f2.d(), 2);
}
if (z4) {
f2.F = 1;
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
f2.z = ofFloat;
ofFloat.setDuration(650L);
}
if (z) {
f2.F = 2;
ValueAnimator ofFloat2 = ValueAnimator.ofFloat(0.0f, 90.0f);
f2.z = ofFloat2;
ofFloat2.setDuration(500L);
}
if (z2) {
f2.F = 3;
ValueAnimator ofFloat3 = ValueAnimator.ofFloat(1.0f, 0.0f, -1.0f);
f2.z = ofFloat3;
ofFloat3.setDuration(500L);
}
f2.z.addUpdateListener(new c.f.b.g.m.o(f2));
f2.z.addListener(new c.f.b.g.m.p(f2));
f2.z.start();
f2.p();
}
}
c.f.b.g.o.g gVar2 = new c.f.b.g.o.g(n.f().h());
t o = gVar2.o(tVar);
if (o == null) {
tVar2 = tVar.x();
} else if (!tVar.w() || o.B(tVar)) {
tVar2 = tVar;
n.f().t(gVar2, tVar2, true);
n.f().K = tVar2;
} else {
gVar2.s(o);
tVar2 = tVar;
}
gVar2.a(tVar2);
n.f().t(gVar2, tVar2, true);
n.f().K = tVar2;
}
c.f.b.g.j.b bVar2 = this.o;
if (bVar2 != null) {
bVar2.o();
}
c.f.b.g.a aVar = this.n;
c.f.b.g.j.b bVar3 = aVar.f1172c.get(Integer.valueOf(tVar.f));
if (bVar3 != null) {
bVar3.n(aVar.f1170a, aVar.f1171b);
bVar3.f1262c.b();
aVar.f1171b.setVisibility(0);
aVar.f1171b.removeAllViews();
View view = bVar3.f1261b;
ViewParent parent = view.getParent();
if (parent != null && (parent instanceof FrameLayout)) {
((FrameLayout) parent).removeAllViews();
}
aVar.f1171b.addView(view);
Iterator<ImageShow> it = aVar.d.iterator();
while (it.hasNext()) {
it.next().setVisibility(8);
}
bVar3.f1261b.setVisibility(0);
bVar = bVar3;
}
this.o = bVar;
if (tVar.f == R.id.imageOnlyEditor) {
bVar.A();
return;
}
c.f.b.g.b bVar4 = new c.f.b.g.b(this, bVar.h);
b.f.a.e b2 = e().b("MainPanel");
if (!((this.q && getResources().getConfiguration().orientation == 1) ? false : false) || b2 == null || !(b2 instanceof c.f.b.g.e.e)) {
bVar4.run();
return;
}
c.f.b.g.e.e eVar = (c.f.b.g.e.e) b2;
View findViewById = eVar.I.findViewById(R.id.category_panel_container);
View findViewById2 = eVar.I.findViewById(R.id.bottom_panel);
int height = findViewById.getHeight();
ViewPropertyAnimator animate = eVar.I.animate();
animate.translationY(findViewById2.getHeight() + height).start();
new Handler().postDelayed(bVar4, animate.getDuration());
}
}