导航菜单

页面标题

页面副标题

Zepto v25.1.4 - Utils.java 源代码

正在查看: Zepto v25.1.4 应用的 Utils.java JAVA 源代码文件

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


package com.clevertap.android.pushtemplates;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;
import android.widget.RemoteViews;
import androidx.core.content.ContextCompat;
import com.clevertap.android.sdk.CleverTapAPI;
import com.clevertap.android.sdk.CleverTapInstanceConfig;
import com.clevertap.android.sdk.bitmap.BitmapDownloadRequest;
import com.clevertap.android.sdk.bitmap.HttpBitmapLoader;
import com.clevertap.android.sdk.network.DownloadedBitmap;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import org.json.JSONArray;
import org.json.JSONObject;

public class Utils {
    public static HashMap a(Bundle bundle) {
        bundle.remove("config");
        HashMap hashMap = new HashMap();
        for (String str : bundle.keySet()) {
            if (str.contains("wzrk_") || str.equals("pt_id")) {
                Object obj = bundle.get(str);
                if (obj instanceof Bundle) {
                    hashMap.putAll(a((Bundle) obj));
                } else {
                    hashMap.put(str, bundle.get(str));
                }
            }
        }
        return hashMap;
    }

    public static void b(Context context, Intent intent) {
        String stringExtra = intent.getStringExtra("wzrk_pid");
        File dir = new ContextWrapper(context.getApplicationContext()).getDir("pt_dir", 0);
        String absolutePath = dir.getAbsolutePath();
        String[] list = dir.list();
        if (list != null) {
            for (String str : list) {
                if (stringExtra != null && str.contains(stringExtra)) {
                    new File(android.support.v4.media.a.m(absolutePath, "/", str)).delete();
                } else if (stringExtra == null && str.contains("null")) {
                    new File(android.support.v4.media.a.m(absolutePath, "/", str)).delete();
                }
            }
        }
    }

    public static void c(Context context) {
        int i;
        NotificationChannel notificationChannel;
        NotificationChannel notificationChannel2;
        int importance;
        NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
        if (notificationManager != null && (i = Build.VERSION.SDK_INT) >= 26) {
            notificationChannel = notificationManager.getNotificationChannel("pt_silent_sound_channel");
            if (notificationChannel != null) {
                notificationChannel2 = notificationManager.getNotificationChannel("pt_silent_sound_channel");
                if (i < 26 || notificationChannel2 == null) {
                    return;
                }
                importance = notificationChannel2.getImportance();
                if (importance != 0) {
                    notificationManager.deleteNotificationChannel("pt_silent_sound_channel");
                }
            }
        }
    }

    public static Bitmap d(Drawable drawable) {
        Bitmap createBitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(createBitmap);
        drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        drawable.draw(canvas);
        return createBitmap;
    }

    public static Bundle e(JSONObject jSONObject) {
        Bundle bundle = new Bundle();
        Iterator<String> keys = jSONObject.keys();
        while (keys.hasNext()) {
            String next = keys.next();
            JSONArray optJSONArray = jSONObject.optJSONArray(next);
            String optString = jSONObject.optString(next);
            if (optJSONArray != null && optJSONArray.length() <= 0) {
                bundle.putStringArray(next, new String[0]);
            } else if (optJSONArray != null && optJSONArray.optString(0) != null) {
                String[] strArr = new String[optJSONArray.length()];
                for (int i = 0; i < optJSONArray.length(); i++) {
                    strArr[i] = optJSONArray.optString(i);
                }
                bundle.putStringArray(next, strArr);
            } else if (optString != null) {
                bundle.putString(next, optString);
            } else {
                System.err.println("unable to transform json to bundle " + next);
            }
        }
        return bundle;
    }

    public static String f(Context context) {
        ApplicationInfo applicationInfo = context.getApplicationInfo();
        int i = applicationInfo.labelRes;
        return i == 0 ? applicationInfo.nonLocalizedLabel.toString() : context.getString(i);
    }

    public static ArrayList g(Bundle bundle) {
        ArrayList arrayList = new ArrayList();
        for (String str : bundle.keySet()) {
            if (str.contains("pt_bt")) {
                arrayList.add(bundle.getString(str));
            }
        }
        return arrayList;
    }

    public static Bitmap h(Context context, String str) {
        DownloadedBitmap a2 = HttpBitmapLoader.a(HttpBitmapLoader.HttpBitmapOperation.c, new BitmapDownloadRequest(str, false, context, (CleverTapInstanceConfig) null, -1L, -1));
        DownloadedBitmap.Status status = a2.b;
        if (status == DownloadedBitmap.Status.c) {
            return a2.a;
        }
        Objects.toString(status);
        int i = CleverTapAPI.e;
        return null;
    }

    public static int i(String str, String str2) {
        try {
            return Color.parseColor(str);
        } catch (Exception unused) {
            return Color.parseColor(str2);
        }
    }

    public static ArrayList j(Bundle bundle) {
        ArrayList arrayList = new ArrayList();
        for (String str : bundle.keySet()) {
            if (str.contains("pt_dl")) {
                arrayList.add(bundle.getString(str));
            }
        }
        return arrayList;
    }

    public static String k(Bundle bundle) {
        String str = null;
        for (String str2 : bundle.keySet()) {
            if (str2.contains("pt_event_name")) {
                str = bundle.getString(str2);
            }
        }
        return str;
    }

    public static ArrayList l(Bundle bundle) {
        ArrayList arrayList = new ArrayList();
        for (String str : bundle.keySet()) {
            if (str.contains("pt_img")) {
                arrayList.add(bundle.getString(str));
            }
        }
        return arrayList;
    }

    public static Bitmap m(Context context, String str) {
        if (str.equals("")) {
            return null;
        }
        if (!str.startsWith("http")) {
            str = "http://static.wizrocket.com/android/ico//".concat(str);
        }
        Bitmap h = h(context, str);
        if (h != null) {
            return h;
        }
        return null;
    }

    public static Notification n(int i, Context context) {
        StatusBarNotification[] activeNotifications;
        activeNotifications = ((NotificationManager) context.getSystemService("notification")).getActiveNotifications();
        for (StatusBarNotification statusBarNotification : activeNotifications) {
            if (statusBarNotification.getId() == i) {
                return statusBarNotification.getNotification();
            }
        }
        return null;
    }

    public static ArrayList o(Bundle bundle) {
        ArrayList arrayList = new ArrayList();
        for (String str : bundle.keySet()) {
            if (str.contains("pt_price") && !str.contains("pt_price_list")) {
                arrayList.add(bundle.getString(str));
            }
        }
        return arrayList;
    }

    public static ArrayList p(Bundle bundle) {
        ArrayList arrayList = new ArrayList();
        for (String str : bundle.keySet()) {
            if (str.contains("pt_st")) {
                arrayList.add(bundle.getString(str));
            }
        }
        return arrayList;
    }

    public static void q(int i, String str, RemoteViews remoteViews, Context context) {
        System.currentTimeMillis();
        Bitmap h = h(context, str);
        PTConstants.f11428a = false;
        if (h == null) {
            PTConstants.f11428a = true;
        } else {
            remoteViews.setImageViewBitmap(i, h);
            System.currentTimeMillis();
        }
    }

    public static Bitmap r(Context context, int i, String str) {
        if (str == null || str.isEmpty()) {
            return null;
        }
        int i2 = i(str, "#A6A6A6");
        Drawable d = ContextCompat.d(context, i);
        Objects.requireNonNull(d);
        Drawable mutate = d.mutate();
        mutate.setColorFilter(new PorterDuffColorFilter(i2, PorterDuff.Mode.SRC_IN));
        return d(mutate);
    }

    public static void s(Context context, Intent intent) {
        List<ResolveInfo> queryIntentActivities = context.getPackageManager().queryIntentActivities(intent, 0);
        String packageName = context.getPackageName();
        Iterator<ResolveInfo> it = queryIntentActivities.iterator();
        while (it.hasNext()) {
            if (packageName.equals(it.next().activityInfo.packageName)) {
                intent.setPackage(packageName);
                return;
            }
        }
    }
}