正在查看: Mantra Counter v25.01 应用的 GodImage.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Mantra Counter v25.01 应用的 GodImage.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.sweetedge.mantracounter.multimedia;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.google.logging.type.LogSeverity;
import com.soundcloud.android.crop.Crop;
import com.sweetedge.mantracounter.LoadAdClass2;
import com.sweetedge.mantracounter.PermissionClass;
import com.sweetedge.mantracounter.R;
import com.sweetedge.mantracounter.Suggest;
import com.yalantis.ucrop.UCrop;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
import save_data.iUtils;
import sweetedge.extra.PLog;
import sweetedge.popup.PDialog;
import sweetedge.preference.PSharedPreference;
import sweetedge.screen.PScreen;
public class GodImage extends AppCompatActivity {
static RecyclerView God_img_list;
static GodAdapter adapter;
ImageView addPhoto;
String despath;
ImageView hidden_Suggest;
static ArrayList<String> LinkList = new ArrayList<>();
public static boolean isOnlySelect = false;
boolean storage = false;
ActivityResultLauncher<String> LauncherStorage = registerForActivityResult(new ActivityResultContracts.RequestPermission(), new ActivityResultCallback<Boolean>() {
public void onActivityResult(Boolean bool) {
if (bool.booleanValue()) {
GodImage.this.storage = true;
return;
}
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (i == -1) {
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.setData(Uri.fromParts("package", GodImage.this.getPackageName(), null));
GodImage.this.startActivity(intent);
}
}
};
?? r1 = GodImage.this;
PDialog.showSimple((Context) r1, onClickListener, "Read Image Permission Denied", "Mantra Counter needs you to allow this permission in order to Save Images, Will you allow it ?", r1.getResources().getString(R.string.Yes), GodImage.this.getResources().getString(R.string.later));
GodImage.this.storage = false;
}
});
public boolean isNetwork() {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) getSystemService("connectivity")).getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting();
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == R.id.idea) {
Suggest.subject = "Photo Suggestion";
new Suggest(this, this.hidden_Suggest, true, "Let me know which God Photo You Looking For");
}
return super.onOptionsItemSelected(menuItem);
}
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.suggest_menu, menu);
return super.onCreateOptionsMenu(menu);
}
private Bitmap loadBitmapFromUri(Uri uri) throws IOException {
return BitmapFactory.decodeStream(getContentResolver().openInputStream(uri));
}
protected void onActivityResult(int i, int i2, Intent intent) {
Uri data;
super.onActivityResult(i, i2, intent);
if (i == 69) {
if (i2 == -1) {
LinkList.add(this.despath);
adapter.notifyDataSetChanged();
PSharedPreference.setString(this, "IMG_PHOTO", this.despath);
LoadAdClass2.showIAd(this);
finish();
return;
}
return;
}
if (i == 96) {
Toast.makeText((Context) this, (CharSequence) ("Error Onactivity Result " + UCrop.getError(intent).getMessage()), 0).show();
return;
}
if (i != 9162 || i2 != -1 || (data = intent.getData()) == null) {
return;
}
FileOutputStream fileOutputStream = null;
try {
try {
Bitmap loadBitmapFromUri = loadBitmapFromUri(data);
if (loadBitmapFromUri != null) {
PSharedPreference.setLong(this, "NAME", System.currentTimeMillis());
this.despath = Environment.getExternalStorageDirectory() + "/Download/.MantraCounter/" + PSharedPreference.getLong(this, "NAME", System.currentTimeMillis());
StringBuilder sb = new StringBuilder("File = ");
sb.append(this.despath);
PLog.print(sb.toString());
FileOutputStream fileOutputStream2 = new FileOutputStream(new File(this.despath));
try {
loadBitmapFromUri.compress(Bitmap.CompressFormat.JPEG, 80, fileOutputStream2);
fileOutputStream2.flush();
fileOutputStream2.close();
fileOutputStream = fileOutputStream2;
} catch (FileNotFoundException e) {
e = e;
throw new RuntimeException(e);
} catch (IOException e2) {
e = e2;
PLog.print("IO ");
throw new RuntimeException(e);
} catch (Throwable th) {
th = th;
fileOutputStream = fileOutputStream2;
if (fileOutputStream != null) {
try {
PLog.print("Here Done");
if (getResources().getConfiguration().orientation == 2) {
UCrop.of(intent.getData(), Uri.fromFile(new File(this.despath))).withAspectRatio(PScreen.getHeight(this), (PScreen.getWidth(this) / 8) * 4).withMaxResultSize(500, LogSeverity.EMERGENCY_VALUE).start(this);
} else {
UCrop.of(intent.getData(), Uri.fromFile(new File(this.despath))).withAspectRatio(PScreen.getWidth(this), (PScreen.getHeight(this) / 8) * 4).withMaxResultSize(LogSeverity.EMERGENCY_VALUE, 500).start(this);
}
fileOutputStream.close();
} catch (IOException e3) {
Log.e("GodImageActivity", "Error closing output stream: " + e3.getMessage());
}
}
throw th;
}
}
if (fileOutputStream != null) {
try {
PLog.print("Here Done");
if (getResources().getConfiguration().orientation == 2) {
UCrop.of(intent.getData(), Uri.fromFile(new File(this.despath))).withAspectRatio(PScreen.getHeight(this), (PScreen.getWidth(this) / 8) * 4).withMaxResultSize(500, LogSeverity.EMERGENCY_VALUE).start(this);
} else {
UCrop.of(intent.getData(), Uri.fromFile(new File(this.despath))).withAspectRatio(PScreen.getWidth(this), (PScreen.getHeight(this) / 8) * 4).withMaxResultSize(LogSeverity.EMERGENCY_VALUE, 500).start(this);
}
fileOutputStream.close();
} catch (IOException e4) {
Log.e("GodImageActivity", "Error closing output stream: " + e4.getMessage());
}
}
} catch (Throwable th2) {
th = th2;
}
} catch (FileNotFoundException e5) {
e = e5;
} catch (IOException e6) {
e = e6;
}
}
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_god_image);
this.hidden_Suggest = (ImageView) findViewById(R.id.hidden_suggest);
this.addPhoto = (ImageView) findViewById(R.id.add_photo);
God_img_list = findViewById(R.id.god_img_list);
if (isNetwork()) {
getchImage(this);
God_img_list.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) {
return false;
}
public void onRequestDisallowInterceptTouchEvent(boolean z) {
}
public void onTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) {
}
});
} else {
LinkList.clear();
LinkList.add("none");
God_img_list.setLayoutManager(new GridLayoutManager(this, 2));
GodAdapter godAdapter = new GodAdapter(LinkList, this, isOnlySelect);
adapter = godAdapter;
God_img_list.setAdapter(godAdapter);
}
if (isOnlySelect) {
this.addPhoto.setVisibility(8);
}
this.addPhoto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
PLog.print("Open Gallery Chooser");
LoadAdClass2.LoadIAd(GodImage.this);
GodImage.this.GalleryChooserMethod();
}
});
}
public void GalleryChooserMethod() {
if (PermissionClass.checkForImageStorage(this.LauncherStorage, this)) {
PLog.print("Permission Granted");
iUtils.checkFolder("/Download/.MantraCounter/");
Crop.pickImage(this);
}
}
public static void getchImage(final Context context) {
Volley.newRequestQueue(context).add(new StringRequest(1, "https://davdapranav.com/app_images/God/get_godimg.php", new Response.Listener<String>() {
public void onResponse(String str) {
Log.e("Response", str);
GodImage.FilterValue(context, str);
}
}, new Response.ErrorListener() {
public void onErrorResponse(VolleyError volleyError) {
}
}) {
protected Map<String, String> getParams() {
return new HashMap();
}
});
}
public static void FilterValue(Context context, String str) {
File[] listFiles;
try {
LinkList.clear();
JSONArray jSONArray = new JSONObject(str).getJSONArray("json");
for (int i = 0; i < jSONArray.length(); i++) {
PLog.print("Images = " + jSONArray.get(i).toString());
LinkList.add(jSONArray.get(i).toString());
}
File file = new File(Environment.getExternalStorageDirectory() + "/Download/.MantraCounter/");
if (file.exists() && (listFiles = file.listFiles()) != null) {
PLog.print("Folder itesms = " + listFiles.length);
for (int i2 = 0; i2 < listFiles.length; i2++) {
if (listFiles[i2].getName() != null && !listFiles[i2].getName().contains(".")) {
LinkList.add(Environment.getExternalStorageDirectory() + "/Download/.MantraCounter//" + listFiles[i2].getName());
}
}
}
God_img_list.setLayoutManager(new GridLayoutManager(context, 2));
GodAdapter godAdapter = new GodAdapter(LinkList, context, isOnlySelect);
adapter = godAdapter;
God_img_list.setAdapter(godAdapter);
} catch (Exception unused) {
}
}
}