package com.kuaishou.weapon.p0; import android.content.Context; import android.content.SharedPreferences; import android.text.TextUtils; public class i { public static final String d = "re_po_rt"; public static i e; public SharedPreferences a; public SharedPreferences.Editor b; public Context c; public i(Context context) { try { this.c = context; SharedPreferences sharedPreferences = context.getSharedPreferences("re_po_rt", 4); this.a = sharedPreferences; this.b = sharedPreferences.edit(); } catch (Throwable unused) { } } public i(Context context, String str) { try { this.c = context; SharedPreferences sharedPreferences = context.getSharedPreferences(str, 4); this.a = sharedPreferences; this.b = sharedPreferences.edit(); } catch (Throwable unused) { } } public static synchronized i a(Context context, String str) { i iVar; synchronized (i.class) { if (e == null) { synchronized (i.class) { if (e == null) { e = new i(context, str); } } } iVar = e; } return iVar; } public static i c() { return e; } public int a(String str) { try { return this.a.getInt(str, 0); } catch (Exception unused) { return 0; } } public int a(String str, int i) { try { return this.a.getInt(str, i); } catch (Exception unused) { return i; } } public long a(String str, long j) { return this.a.getLong(str, j); } public String a(String str, String str2) { return this.a.getString(str, str2); } public String a(String str, String str2, boolean z) { String a2 = a(str, ""); return !TextUtils.isEmpty(a2) ? z ? d.b(a2, 2) : a2 : str2; } public void a() { try { this.b.apply(); } catch (Throwable unused) { } } public void a(Context context) { this.c = context; } public void a(String str, int i, boolean z) { try { this.b.putInt(str, i); if (z) { this.b.apply(); } } catch (Throwable unused) { } } public void a(String str, Boolean bool) { this.b.putBoolean(str, bool.booleanValue()); this.b.apply(); } public int b(String str, int i) { try { return this.a.getInt(str, i); } catch (Exception unused) { return i; } } public Context b() { return this.c; } public void b(String str, long j) { this.b.putLong(str, j); this.b.apply(); } public void b(String str, String str2) { try { this.b.putString(str, str2); this.b.apply(); } catch (Exception unused) { } } public void b(String str, String str2, boolean z) { try { if (!TextUtils.isEmpty(str2)) { if (z) { str2 = d.c(str2.getBytes(), 2); } this.b.putString(str, str2); this.b.apply(); } } catch (Throwable unused) { } } public boolean b(String str) { return this.a.getBoolean(str, false); } public int c(String str) { try { return this.a.getInt(str, 0); } catch (Exception unused) { return 0; } } public void c(String str, int i) { try { this.b.putInt(str, i); this.b.apply(); } catch (Throwable unused) { } } public void c(String str, String str2) { try { if (!TextUtils.isEmpty(str2)) { this.b.putString(str, str2); this.b.apply(); } } catch (Throwable unused) { } } public void c(String str, String str2, boolean z) { try { if (!TextUtils.isEmpty(str2)) { this.b.putString(str, str2); if (z) { this.b.apply(); } } } catch (Throwable unused) { } } public long d(String str) { return this.a.getLong(str, 0); } public void d(String str, int i) { this.b.putInt(str, i); this.b.apply(); } public String e(String str) { return this.a.getString(str, ""); } }