p.java 源代码


package i;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import android.view.Window;
import cn.jzvd.Jzvd;
import com.mbridge.msdk.playercommon.exoplayer2.DefaultRenderersFactory;
import java.util.Formatter;
import java.util.Locale;

public class p {

    public static int f22842a;

    public static int a(Context context, float f6) {
        return (int) ((f6 * context.getResources().getDisplayMetrics().density) + 0.5f);
    }

    public static long b(Context context, Object obj) {
        if (!Jzvd.f320r0) {
            return 0L;
        }
        return context.getSharedPreferences("JZVD_PROGRESS", 0).getLong("newVersion:" + obj.toString(), 0L);
    }

    public static int c(Context context) {
        return context.getResources().getDisplayMetrics().widthPixels;
    }

    public static int d(Context context) {
        Resources resources = context.getResources();
        return resources.getDimensionPixelSize(resources.getIdentifier("status_bar_height", "dimen", "android"));
    }

    public static Window e(Context context) {
        if (j(context) != null) {
            return j(context).getWindow();
        }
        return j(context).getWindow();
    }

    @SuppressLint({"RestrictedApi"})
    public static void f(Context context) {
        if (Jzvd.f317o0) {
            e(context).setFlags(1024, 1024);
        }
    }

    @SuppressLint({"NewApi"})
    public static void g(Context context) {
        f22842a = e(context).getDecorView().getSystemUiVisibility();
        e(context).getDecorView().setSystemUiVisibility(5638);
    }

    public static boolean h(Context context) {
        NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
        if (activeNetworkInfo != null && activeNetworkInfo.getType() == 1) {
            return true;
        }
        return false;
    }

    public static void i(Context context, Object obj, long j6) {
        if (!Jzvd.f320r0) {
            return;
        }
        Log.i("JZVD", "saveProgress: " + j6);
        if (j6 < DefaultRenderersFactory.DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS) {
            j6 = 0;
        }
        context.getSharedPreferences("JZVD_PROGRESS", 0).edit().putLong("newVersion:" + obj.toString(), j6).apply();
    }

    public static Activity j(Context context) {
        if (context == null) {
            return null;
        }
        if (context instanceof Activity) {
            return (Activity) context;
        }
        if (!(context instanceof ContextWrapper)) {
            return null;
        }
        return j(((ContextWrapper) context).getBaseContext());
    }

    public static void k(Context context, int i6) {
        if (j(context) != null) {
            j(context).setRequestedOrientation(i6);
        } else {
            j(context).setRequestedOrientation(i6);
        }
    }

    @SuppressLint({"RestrictedApi"})
    public static void l(Context context) {
        if (Jzvd.f317o0) {
            e(context).clearFlags(1024);
        }
    }

    @SuppressLint({"NewApi"})
    public static void m(Context context) {
        e(context).getDecorView().setSystemUiVisibility(f22842a);
    }

    public static String n(long j6) {
        if (j6 > 0 && j6 < 86400000) {
            long j7 = j6 / 1000;
            int i6 = (int) (j7 % 60);
            int i7 = (int) ((j7 / 60) % 60);
            int i8 = (int) (j7 / com.anythink.expressad.b.a.b.f3156x);
            Formatter formatter = new Formatter(new StringBuilder(), Locale.getDefault());
            if (i8 > 0) {
                return formatter.format("%d:%02d:%02d", Integer.valueOf(i8), Integer.valueOf(i7), Integer.valueOf(i6)).toString();
            }
            return formatter.format("%02d:%02d", Integer.valueOf(i7), Integer.valueOf(i6)).toString();
        }
        return "00:00";
    }
}