导航菜单

页面标题

页面副标题

Mantra Counter v25.01 - GodVideo.java 源代码

正在查看: Mantra Counter v25.01 应用的 GodVideo.java JAVA 源代码文件

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


package com.sweetedge.mantracounter.multimedia;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.activity.result.ActivityResult;
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.sweetedge.mantracounter.PermissionClass;
import com.sweetedge.mantracounter.R;
import com.sweetedge.mantracounter.Suggest;
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;

public class GodVideo extends AppCompatActivity {
    static RecyclerView God_video_list;
    static TextView Video_add_desc;
    static GodAdapterVideo adapter_video;
    ImageView addVideo;
    ImageView hidden_Suggest;
    static ArrayList<String> LinkListVideo = new ArrayList<>();
    public static boolean isOnlySelectVideo = false;
    boolean storage = false;
    ActivityResultLauncher<Intent> videoPicker = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
        public void onActivityResult(ActivityResult activityResult) {
            PLog.print("Activity");
            if (activityResult.getResultCode() == -1) {
                Intent data = activityResult.getData();
                PLog.print("Result = " + data.getData());
                String realPathFromURI = GodVideo.this.getRealPathFromURI(data.getData());
                if (realPathFromURI == null) {
                    GodVideo.this.finish();
                    return;
                }
                PLog.print("Video Path = " + realPathFromURI);
                GodVideoDB godVideoDB = new GodVideoDB(GodVideo.this);
                godVideoDB.open();
                if (godVideoDB.isExistVideo(realPathFromURI.trim()) == 0) {
                    godVideoDB.insert_data(realPathFromURI.trim(), System.currentTimeMillis() + "");
                }
                godVideoDB.close();
                GodVideo.LinkListVideo.add(realPathFromURI.trim());
                GodVideo.adapter_video.notifyDataSetChanged();
                if (GodVideo.LinkListVideo.size() == 0) {
                    GodVideo.Video_add_desc.setVisibility(0);
                } else {
                    GodVideo.Video_add_desc.setVisibility(8);
                }
            }
        }
    });
    ActivityResultLauncher<String> LauncherStorage = registerForActivityResult(new ActivityResultContracts.RequestPermission(), new ActivityResultCallback<Boolean>() {
        public void onActivityResult(Boolean bool) {
            if (bool.booleanValue()) {
                GodVideo.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", GodVideo.this.getPackageName(), null));
                        GodVideo.this.startActivity(intent);
                    }
                }
            };
            ?? r1 = GodVideo.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), GodVideo.this.getResources().getString(R.string.later));
            GodVideo.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 = "Video Suggestion";
            new Suggest(this, this.hidden_Suggest, true, "Which God Video You Looking For");
        }
        return super.onOptionsItemSelected(menuItem);
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.suggest_menu, menu);
        return super.onCreateOptionsMenu(menu);
    }

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_god_video);
        this.hidden_Suggest = (ImageView) findViewById(R.id.hidden_suggest_video);
        this.addVideo = (ImageView) findViewById(R.id.add_video);
        God_video_list = findViewById(R.id.god_video_list);
        Video_add_desc = (TextView) findViewById(R.id.video_add_desc);
        if (isNetwork()) {
            getchVideo(this);
            God_video_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 {
            LinkListVideo.clear();
            addLocalVideos(LinkListVideo, this);
            God_video_list.setLayoutManager(new GridLayoutManager(this, 2));
            GodAdapterVideo godAdapterVideo = new GodAdapterVideo(LinkListVideo, this, isOnlySelectVideo);
            adapter_video = godAdapterVideo;
            God_video_list.setAdapter(godAdapterVideo);
            if (LinkListVideo.size() == 0) {
                Video_add_desc.setVisibility(0);
            } else {
                Video_add_desc.setVisibility(8);
            }
        }
        if (isOnlySelectVideo) {
            this.addVideo.setVisibility(8);
        }
        this.addVideo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                PLog.print("Open Gallery Chooser");
                GodVideo.this.GalleryVideoChooserMethod();
            }
        });
    }

    static void addLocalVideos(ArrayList<String> arrayList, Context context) {
        GodVideoDB godVideoDB = new GodVideoDB(context);
        godVideoDB.open();
        Cursor allVideo = godVideoDB.getAllVideo();
        if (allVideo != null && allVideo.getCount() > 0 && allVideo.moveToFirst()) {
            do {
                arrayList.add(allVideo.getString(0));
            } while (allVideo.moveToNext());
        }
        godVideoDB.close();
    }

    public String getRealPathFromURI(Uri uri) {
        Cursor query = getContentResolver().query(uri, new String[]{"_data"}, null, null, null);
        String string = query.moveToFirst() ? query.getString(query.getColumnIndexOrThrow("_data")) : null;
        query.close();
        return string;
    }

    public void GalleryVideoChooserMethod() {
        if (PermissionClass.checkForVideoStorage(this.LauncherStorage, this)) {
            PLog.print("Permission Granted");
            iUtils.checkFolder("/Download/.MantraCounter/");
            Intent intent = new Intent("android.intent.action.PICK", MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
            intent.setType("video/*");
            this.videoPicker.launch(intent);
        }
    }

    public static void getchVideo(final Context context) {
        Volley.newRequestQueue(context).add(new StringRequest(1, "https://davdapranav.com/app_images/GodVideo/get_godvideo.php", new Response.Listener<String>() {
            public void onResponse(String str) {
                PLog.print("GetVideo Image = " + str);
                GodVideo.FilterValue(context, str);
                GodVideo.addLocalVideos(GodVideo.LinkListVideo, context);
                if (GodVideo.LinkListVideo.size() == 0) {
                    GodVideo.Video_add_desc.setVisibility(0);
                } else {
                    GodVideo.Video_add_desc.setVisibility(8);
                }
                GodVideo.God_video_list.setLayoutManager(new GridLayoutManager(context, 2));
                GodVideo.adapter_video = new GodAdapterVideo(GodVideo.LinkListVideo, context, GodVideo.isOnlySelectVideo);
                GodVideo.God_video_list.setAdapter(GodVideo.adapter_video);
            }
        }, new Response.ErrorListener() {
            public void onErrorResponse(VolleyError volleyError) {
                PLog.print("Errror");
                GodVideo.FilterValue(context, "");
            }
        }) {
            protected Map<String, String> getParams() {
                return new HashMap();
            }
        });
    }

    public static void FilterValue(Context context, String str) {
        try {
            LinkListVideo.clear();
            JSONObject jSONObject = new JSONObject(str);
            if (jSONObject.has("jsonV")) {
                JSONArray jSONArray = jSONObject.getJSONArray("jsonV");
                PLog.print("Jarray = " + jSONArray);
                if (jSONArray != null) {
                    for (int i = 0; i < jSONArray.length(); i++) {
                        PLog.print("Videos = " + jSONArray.get(i).toString());
                        LinkListVideo.add(jSONArray.get(i).toString());
                    }
                }
            }
        } catch (Exception unused) {
            PLog.print("Error while Exception");
        }
    }
}