Notify v1.3版本的 MD5 值为:895e81227cabff93166e4db568124d5d

以下内容为反编译后的 SendNotificationActivity.java 源代码,内容仅作参考


package com.notify.app;

import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Bundle;
import android.util.SparseBooleanArray;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.core.app.NotificationCompat;
import androidx.exifinterface.media.ExifInterface;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.notify.app.RequestNetwork;
import de.hdodenhof.circleimageview.CircleImageView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import org.apache.http.auth.AUTH;
import org.apache.http.protocol.HTTP;
public class SendNotificationActivity extends AppCompatActivity {
    private RequestNetwork.RequestListener _requestNetwork_request_listener;
    private CardView cardview1;
    private CircleImageView circleimageview1;
    private ProgressDialog coreprog;
    private SharedPreferences data;
    private SharedPreferences data2;
    private EditText edittext5;
    private EditText edittext6;
    private EditText edittextEXTRAVALUE;
    private EditText edittextMessage;
    private EditText edittextURL;
    private EditText edittexttitle;
    private LinearLayout linear1;
    private LinearLayout linear16;
    private LinearLayout linearButtion;
    private LinearLayout linearFour;
    private LinearLayout linearOne;
    private LinearLayout linearThree;
    private LinearLayout linearTwo;
    private RequestNetwork requestNetwork;
    private TimerTask t;
    private TextView textview1;
    private TextView textview2;
    private TextView textview6;
    private ScrollView vscroll1;
    private Timer _timer = new Timer();
    private HashMap<String, Object> HEADERS = new HashMap<>();
    private String ServerKey = "";
    private HashMap<String, Object> NOTIFICATION_EXTRA_DATA = new HashMap<>();
    private String extraData = "";
    private HashMap<String, Object> NOTIFICATION_EXTRA_DATA_VALUE = new HashMap<>();
    private String extraDataType = "";
    private HashMap<String, Object> Notification_BODY = new HashMap<>();
    private String ImageUrl = "";
    private HashMap<String, Object> MAIN_BODY = new HashMap<>();
    private String key = "";
    private String fontName = "";
    private String typeace = "";
    private HashMap<String, Object> map = new HashMap<>();
    private ArrayList<HashMap<String, Object>> listmap = new ArrayList<>();

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.send_notification);
        initialize(bundle);
        initializeLogic();
    }

    private void initialize(Bundle bundle) {
        this.vscroll1 = (ScrollView) findViewById(R.id.vscroll1);
        this.linear1 = (LinearLayout) findViewById(R.id.linear1);
        this.linear16 = (LinearLayout) findViewById(R.id.linear16);
        this.linearOne = (LinearLayout) findViewById(R.id.linearOne);
        this.linearTwo = (LinearLayout) findViewById(R.id.linearTwo);
        this.linearThree = (LinearLayout) findViewById(R.id.linearThree);
        this.linearFour = (LinearLayout) findViewById(R.id.linearFour);
        this.edittext6 = (EditText) findViewById(R.id.edittext6);
        this.edittext5 = (EditText) findViewById(R.id.edittext5);
        this.linearButtion = (LinearLayout) findViewById(R.id.linearButtion);
        this.textview1 = (TextView) findViewById(R.id.textview1);
        this.cardview1 = (CardView) findViewById(R.id.cardview1);
        this.textview2 = (TextView) findViewById(R.id.textview2);
        this.circleimageview1 = (CircleImageView) findViewById(R.id.circleimageview1);
        this.edittexttitle = (EditText) findViewById(R.id.edittexttitle);
        this.edittextMessage = (EditText) findViewById(R.id.edittextMessage);
        this.edittextURL = (EditText) findViewById(R.id.edittextURL);
        this.edittextEXTRAVALUE = (EditText) findViewById(R.id.edittextEXTRAVALUE);
        this.textview6 = (TextView) findViewById(R.id.textview6);
        this.requestNetwork = new RequestNetwork(this);
        this.data = getSharedPreferences("data", 0);
        this.data2 = getSharedPreferences("data2", 0);
        this.linearButtion.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SendNotificationActivity.this.ServerKey = SendNotificationActivity.this.key;
                if (!SendNotificationActivity.this.edittexttitle.getText().toString().equals("")) {
                    if (!SendNotificationActivity.this.edittextMessage.getText().toString().equals("")) {
                        if (SendNotificationActivity.this.edittextURL.getText().toString().equals("")) {
                            SendNotificationActivity.this.ImageUrl = "null";
                        } else {
                            SendNotificationActivity.this.ImageUrl = SendNotificationActivity.this.edittextURL.getText().toString();
                        }
                        if (SendNotificationActivity.this.edittextEXTRAVALUE.getText().toString().equals("")) {
                            SendNotificationActivity.this.extraData = "";
                        } else {
                            SendNotificationActivity.this.extraData = SendNotificationActivity.this.edittextEXTRAVALUE.getText().toString();
                        }
                        if (SendNotificationActivity.this.edittext6.getText().toString().equals("")) {
                            SendNotificationActivity.this.extraDataType = "";
                        } else {
                            SendNotificationActivity.this.extraDataType = SendNotificationActivity.this.edittext6.getText().toString();
                        }
                        SendNotificationActivity.this._SendNotification();
                        SendNotificationActivity.this._Custom_Loading(true);
                        return;
                    }
                    SketchwareUtil.showMessage(SendNotificationActivity.this.getApplicationContext(), "Enter notification massage");
                    return;
                }
                SketchwareUtil.showMessage(SendNotificationActivity.this.getApplicationContext(), "Enter notification title");
            }
        });
        this._requestNetwork_request_listener = new AnonymousClass2();
    }

    public class AnonymousClass2 implements RequestNetwork.RequestListener {
        AnonymousClass2() {
        }

        @Override
        public void onResponse(String str, final String str2, HashMap<String, Object> hashMap) {
            if (str2.contains("INVALID_KEY")) {
                SendNotificationActivity.this.t = new TimerTask() {
                    @Override
                    public void run() {
                        SendNotificationActivity sendNotificationActivity = SendNotificationActivity.this;
                        final String str3 = str2;
                        sendNotificationActivity.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                SendNotificationActivity.this._MaterialDialog("Invalid Key", "App ".concat(SendNotificationActivity.this.getIntent().getStringExtra("app").concat("\" Response Message is \"".concat(str3.concat("\"")))), "Cancel", "Done");
                                SendNotificationActivity.this._Custom_Loading(false);
                                SendNotificationActivity.this.map.put("title", SendNotificationActivity.this.edittexttitle.getText().toString());
                                SendNotificationActivity.this.map.put("message", SendNotificationActivity.this.edittextMessage.getText().toString());
                                if (SendNotificationActivity.this.edittextURL.getText().toString().equals("")) {
                                    SendNotificationActivity.this.map.put("image", "null");
                                } else {
                                    SendNotificationActivity.this.map.put("image", SendNotificationActivity.this.edittextURL.getText().toString().trim());
                                }
                                SendNotificationActivity.this.map.put("extra_value", SendNotificationActivity.this.edittextEXTRAVALUE.getText().toString().trim());
                                SendNotificationActivity.this.map.put(NotificationCompat.CATEGORY_STATUS, "INVALID_KEY");
                                SendNotificationActivity.this.map.put("key2", SendNotificationActivity.this.getIntent().getStringExtra("key"));
                                SendNotificationActivity.this.map.put("app", SendNotificationActivity.this.getIntent().getStringExtra("app"));
                                SendNotificationActivity.this.map.put("package", SendNotificationActivity.this.getIntent().getStringExtra("package"));
                                SendNotificationActivity.this.map.put("key", SendNotificationActivity.this.getIntent().getStringExtra("key"));
                                SendNotificationActivity.this.listmap.add(SendNotificationActivity.this.map);
                                SendNotificationActivity.this.data2.edit().putString("notification_history", new Gson().toJson(SendNotificationActivity.this.listmap)).commit();
                            }
                        });
                    }
                };
                SendNotificationActivity.this._timer.schedule(SendNotificationActivity.this.t, 500L);
                return;
            }
            SendNotificationActivity.this.t = new TimerTask() {
                @Override
                public void run() {
                    SendNotificationActivity sendNotificationActivity = SendNotificationActivity.this;
                    final String str3 = str2;
                    sendNotificationActivity.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            SendNotificationActivity.this._MaterialDialog("Notification Has Been Sended", "Your Notification Has Been Sended To Your Application \"".concat(SendNotificationActivity.this.getIntent().getStringExtra("app").concat("\" Response Message is \"".concat(str3.concat("\"")))), "Cancel", "Done");
                            SendNotificationActivity.this._Custom_Loading(false);
                            SendNotificationActivity.this.map.put("title", SendNotificationActivity.this.edittexttitle.getText().toString());
                            SendNotificationActivity.this.map.put("message", SendNotificationActivity.this.edittextMessage.getText().toString());
                            if (SendNotificationActivity.this.edittextURL.getText().toString().equals("")) {
                                SendNotificationActivity.this.map.put("image", "null");
                            } else {
                                SendNotificationActivity.this.map.put("image", SendNotificationActivity.this.edittextURL.getText().toString().trim());
                            }
                            SendNotificationActivity.this.map.put("extra_value", SendNotificationActivity.this.edittextEXTRAVALUE.getText().toString().trim());
                            SendNotificationActivity.this.map.put(NotificationCompat.CATEGORY_STATUS, "SUCCESSFULL");
                            SendNotificationActivity.this.map.put("key2", SendNotificationActivity.this.getIntent().getStringExtra("key"));
                            SendNotificationActivity.this.map.put("app", SendNotificationActivity.this.getIntent().getStringExtra("app"));
                            SendNotificationActivity.this.map.put("package", SendNotificationActivity.this.getIntent().getStringExtra("package"));
                            SendNotificationActivity.this.map.put("key", SendNotificationActivity.this.getIntent().getStringExtra("key"));
                            SendNotificationActivity.this.listmap.add(SendNotificationActivity.this.map);
                            SendNotificationActivity.this.data2.edit().putString("notification_history", new Gson().toJson(SendNotificationActivity.this.listmap)).commit();
                        }
                    });
                }
            };
            SendNotificationActivity.this._timer.schedule(SendNotificationActivity.this.t, 500L);
        }

        @Override
        public void onErrorResponse(String str, final String str2) {
            SendNotificationActivity.this.t = new TimerTask() {
                @Override
                public void run() {
                    SendNotificationActivity sendNotificationActivity = SendNotificationActivity.this;
                    final String str3 = str2;
                    sendNotificationActivity.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            SendNotificationActivity.this._MaterialDialog("Error", "Error in you \"".concat(SendNotificationActivity.this.getIntent().getStringExtra("app").concat("\" Error Message is \"".concat(str3.concat("\"")))), "Cancel", "Done");
                            SendNotificationActivity.this._Custom_Loading(false);
                            SendNotificationActivity.this.map.put("title", SendNotificationActivity.this.edittexttitle.getText().toString());
                            SendNotificationActivity.this.map.put("message", SendNotificationActivity.this.edittextMessage.getText().toString());
                            if (SendNotificationActivity.this.edittextURL.getText().toString().equals("")) {
                                SendNotificationActivity.this.map.put("image", "null");
                            } else {
                                SendNotificationActivity.this.map.put("image", SendNotificationActivity.this.edittextURL.getText().toString().trim());
                            }
                            SendNotificationActivity.this.map.put("extra_value", SendNotificationActivity.this.edittextEXTRAVALUE.getText().toString().trim());
                            SendNotificationActivity.this.map.put(NotificationCompat.CATEGORY_STATUS, "FAILED_UNKNOWN_NETWORK_ERROR");
                            SendNotificationActivity.this.map.put("key2", SendNotificationActivity.this.data.getString("key", ""));
                            SendNotificationActivity.this.map.put("app", SendNotificationActivity.this.getIntent().getStringExtra("app"));
                            SendNotificationActivity.this.map.put("package", SendNotificationActivity.this.getIntent().getStringExtra("package"));
                            SendNotificationActivity.this.map.put("key", SendNotificationActivity.this.getIntent().getStringExtra("key"));
                            SendNotificationActivity.this.listmap.add(SendNotificationActivity.this.map);
                            SendNotificationActivity.this.data2.edit().putString("notification_history", new Gson().toJson(SendNotificationActivity.this.listmap)).commit();
                        }
                    });
                }
            };
            SendNotificationActivity.this._timer.schedule(SendNotificationActivity.this.t, 500L);
        }
    }

    private void initializeLogic() {
        getWindow().getDecorView().setSystemUiVisibility(8192);
        getWindow().setStatusBarColor(-1);
        this.key = getIntent().getStringExtra("key");
        this.textview2.setText(getIntent().getStringExtra("app"));
        this.textview2.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/productsansbold.ttf"), 0);
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setColor(-1);
        gradientDrawable.setCornerRadius(getDip(8));
        gradientDrawable.setStroke((int) getDip(1), -14575885);
        this.linearOne.setElevation(getDip(2));
        this.linearOne.setBackground(new RippleDrawable(new ColorStateList(new int[][]{new int[0]}, new int[]{-1}), gradientDrawable, null));
        GradientDrawable gradientDrawable2 = new GradientDrawable();
        gradientDrawable2.setColor(-1);
        gradientDrawable2.setCornerRadius(getDip(8));
        gradientDrawable2.setStroke((int) getDip(1), -14575885);
        this.linearTwo.setElevation(getDip(2));
        this.linearTwo.setBackground(new RippleDrawable(new ColorStateList(new int[][]{new int[0]}, new int[]{-1}), gradientDrawable2, null));
        GradientDrawable gradientDrawable3 = new GradientDrawable();
        gradientDrawable3.setColor(-1);
        gradientDrawable3.setCornerRadius(getDip(8));
        gradientDrawable3.setStroke((int) getDip(1), -14575885);
        this.linearThree.setElevation(getDip(2));
        this.linearThree.setBackground(new RippleDrawable(new ColorStateList(new int[][]{new int[0]}, new int[]{-1}), gradientDrawable3, null));
        GradientDrawable gradientDrawable4 = new GradientDrawable();
        gradientDrawable4.setColor(-1);
        gradientDrawable4.setCornerRadius(getDip(8));
        gradientDrawable4.setStroke((int) getDip(1), -14575885);
        this.linearFour.setElevation(getDip(2));
        this.linearFour.setBackground(new RippleDrawable(new ColorStateList(new int[][]{new int[0]}, new int[]{-1}), gradientDrawable4, null));
        GradientDrawable gradientDrawable5 = new GradientDrawable();
        gradientDrawable5.setColor(-14575885);
        gradientDrawable5.setCornerRadius(getDip(8));
        this.linearButtion.setElevation(getDip(0));
        this.linearButtion.setBackground(new RippleDrawable(new ColorStateList(new int[][]{new int[0]}, new int[]{-1}), gradientDrawable5, null));
        _changeActivityFont("hrs2");
        this.linear1.setNestedScrollingEnabled(true);
        this.vscroll1.setFillViewport(true);
        if (!this.data2.getString("notification_history", "").equals("")) {
            this.listmap = (ArrayList) new Gson().fromJson(this.data2.getString("notification_history", ""), new TypeToken<ArrayList<HashMap<String, Object>>>() {
            }.getType());
        }
    }

    public void _SendNotification() {
        if (SketchwareUtil.isConnected(getApplicationContext())) {
            this.HEADERS = new HashMap<>();
            this.HEADERS.put(AUTH.WWW_AUTH_RESP, "key=".concat(this.ServerKey.trim()));
            this.HEADERS.put(HTTP.CONTENT_TYPE, "application/json");
            this.NOTIFICATION_EXTRA_DATA = new HashMap<>();
            this.NOTIFICATION_EXTRA_DATA.put("extradata", this.extraData);
            this.NOTIFICATION_EXTRA_DATA_VALUE.put("extradataValue", this.extraDataType);
            this.Notification_BODY = new HashMap<>();
            this.Notification_BODY.put("body", this.edittextMessage.getText().toString());
            this.Notification_BODY.put("title", this.edittexttitle.getText().toString());
            this.Notification_BODY.put("image", this.ImageUrl);
            this.Notification_BODY.put("icon", this.edittext5.getText().toString());
            this.MAIN_BODY = new HashMap<>();
            this.MAIN_BODY.put(TypedValues.Transition.S_TO, "/topics/".concat("all"));
            this.MAIN_BODY.put("notification", this.Notification_BODY);
            this.MAIN_BODY.put("data", this.NOTIFICATION_EXTRA_DATA);
            this.MAIN_BODY.put("data2", this.NOTIFICATION_EXTRA_DATA_VALUE);
            this.requestNetwork.setHeaders(this.HEADERS);
            this.requestNetwork.setParams(this.MAIN_BODY, 1);
            this.requestNetwork.startRequestNetwork("POST", "https://fcm.googleapis.com/fcm/send", ExifInterface.GPS_MEASUREMENT_IN_PROGRESS, this._requestNetwork_request_listener);
            return;
        }
        SketchwareUtil.showMessage(getApplicationContext(), "No Internet");
    }

    public void _changeActivityFont(String str) {
        this.fontName = "fonts/".concat(str.concat(".ttf"));
        overrideFonts(this, getWindow().getDecorView());
    }

    private void overrideFonts(Context context, View view) {
        try {
            Typeface createFromAsset = Typeface.createFromAsset(getAssets(), this.fontName);
            if (view instanceof ViewGroup) {
                ViewGroup viewGroup = (ViewGroup) view;
                for (int i = 0; i < viewGroup.getChildCount(); i++) {
                    overrideFonts(context, viewGroup.getChildAt(i));
                }
            } else if (view instanceof TextView) {
                ((TextView) view).setTypeface(createFromAsset);
            } else if (view instanceof EditText) {
                ((EditText) view).setTypeface(createFromAsset);
            } else if (view instanceof Button) {
                ((Button) view).setTypeface(createFromAsset);
            }
        } catch (Exception e) {
            SketchwareUtil.showMessage(getApplicationContext(), "Error Loading Font");
        }
    }

    public void _Custom_Loading(boolean z) {
        if (z) {
            if (this.coreprog == null) {
                this.coreprog = new ProgressDialog(this);
                this.coreprog.setCancelable(false);
                this.coreprog.setCanceledOnTouchOutside(false);
                this.coreprog.requestWindowFeature(1);
                this.coreprog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
            }
            this.coreprog.setMessage(null);
            this.coreprog.show();
            View inflate = getLayoutInflater().inflate(R.layout.custom_dialog, (ViewGroup) null);
            GradientDrawable gradientDrawable = new GradientDrawable();
            gradientDrawable.setColor(Color.parseColor("#FFFFFF"));
            gradientDrawable.setCornerRadius(100.0f);
            ((LinearLayout) inflate.findViewById(R.id.linear_base)).setBackground(gradientDrawable);
            this.coreprog.setContentView(inflate);
        } else if (this.coreprog != null) {
            this.coreprog.dismiss();
        }
    }

    public void _rippleRoundStroke(View view, String str, String str2, double d, double d2, String str3) {
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setColor(Color.parseColor(str));
        gradientDrawable.setCornerRadius((float) d);
        gradientDrawable.setStroke((int) d2, Color.parseColor("#" + str3.replace("#", "")));
        view.setBackground(new RippleDrawable(new ColorStateList(new int[][]{new int[0]}, new int[]{Color.parseColor(str2)}), gradientDrawable, null));
    }

    public void _MaterialDialog(String str, String str2, String str3, String str4) {
        final AlertDialog create = new AlertDialog.Builder(this).create();
        View inflate = getLayoutInflater().inflate(R.layout.material_dialog, (ViewGroup) null);
        create.getWindow().setBackgroundDrawableResource(17170445);
        create.setView(inflate);
        TextView textView = (TextView) inflate.findViewById(R.id.t1);
        TextView textView2 = (TextView) inflate.findViewById(R.id.t2);
        TextView textView3 = (TextView) inflate.findViewById(R.id.b1);
        TextView textView4 = (TextView) inflate.findViewById(R.id.b2);
        LinearLayout linearLayout = (LinearLayout) inflate.findViewById(R.id.linear3);
        textView.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/google_sans.ttf"), 1);
        textView2.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/google_sans.ttf"), 0);
        textView3.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/google_sans.ttf"), 1);
        textView4.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/google_sans.ttf"), 1);
        textView.setText(str);
        textView2.setText(str2);
        textView3.setText(str3);
        textView4.setText(str4);
        _rippleRoundStroke((LinearLayout) inflate.findViewById(R.id.bg), "#FFFFFF", "#000000", 15.0d, 0.0d, "#000000");
        textView3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                create.dismiss();
            }
        });
        textView4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                create.dismiss();
            }
        });
        create.setCancelable(true);
        create.show();
    }

    @Deprecated
    public void showMessage(String str) {
        Toast.makeText(getApplicationContext(), str, 0).show();
    }

    @Deprecated
    public int getLocationX(View view) {
        int[] iArr = new int[2];
        view.getLocationInWindow(iArr);
        return iArr[0];
    }

    @Deprecated
    public int getLocationY(View view) {
        int[] iArr = new int[2];
        view.getLocationInWindow(iArr);
        return iArr[1];
    }

    @Deprecated
    public int getRandom(int i, int i2) {
        return new Random().nextInt((i2 - i) + 1) + i;
    }

    @Deprecated
    public ArrayList<Double> getCheckedItemPositionsToArray(ListView listView) {
        ArrayList<Double> arrayList = new ArrayList<>();
        SparseBooleanArray checkedItemPositions = listView.getCheckedItemPositions();
        for (int i = 0; i < checkedItemPositions.size(); i++) {
            if (checkedItemPositions.valueAt(i)) {
                arrayList.add(Double.valueOf(checkedItemPositions.keyAt(i)));
            }
        }
        return arrayList;
    }

    @Deprecated
    public float getDip(int i) {
        return TypedValue.applyDimension(1, i, getResources().getDisplayMetrics());
    }

    @Deprecated
    public int getDisplayWidthPixels() {
        return getResources().getDisplayMetrics().widthPixels;
    }

    @Deprecated
    public int getDisplayHeightPixels() {
        return getResources().getDisplayMetrics().heightPixels;
    }
}