package com.baidu.techain.h; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.text.TextUtils; import com.baidu.techain.i.c; import com.baidu.techain.i.u; import java.util.Set; /* compiled from: SharedPreferencesEditorWarpper */ public final class b implements SharedPreferences.Editor { private SharedPreferences.Editor a; private Context b; private int c; private String d; private boolean e; private String f; public b(Context context, SharedPreferences.Editor editor, String str, boolean z, int i) { this(context, editor, str, z, i, (byte) 0); } private b(Context context, SharedPreferences.Editor editor, String str, boolean z, int i, byte b2) { this.b = context; this.a = editor; this.c = i; this.d = str; this.e = z; this.f = null; } public final SharedPreferences.Editor putString(String str, String str2) { try { if (this.c != 1 || (this.e && !TextUtils.isEmpty(this.f))) { Bundle bundle = new Bundle(); bundle.putString("operation", "putString"); bundle.putString("key", str); bundle.putString("value", str2); a(bundle); return this; } if (!(this.a == null || this.a == null)) { this.a.putString(str, str2); } return this; } catch (Throwable unused) { c.a(); } } @Override // android.content.SharedPreferences.Editor public final SharedPreferences.Editor putStringSet(String str, Set<String> set) { throw new RuntimeException("This editor not allow to call putStringSet."); } public final SharedPreferences.Editor putInt(String str, int i) { try { if (this.c != 1 || (this.e && !TextUtils.isEmpty(this.f))) { Bundle bundle = new Bundle(); bundle.putString("operation", "putInt"); bundle.putString("key", str); bundle.putInt("value", i); a(bundle); return this; } if (!(this.a == null || this.a == null)) { this.a.putInt(str, i); } return this; } catch (Throwable unused) { c.a(); } } public final SharedPreferences.Editor putLong(String str, long j) { try { if (this.c != 1 || (this.e && !TextUtils.isEmpty(this.f))) { Bundle bundle = new Bundle(); bundle.putString("operation", "putLong"); bundle.putString("key", str); bundle.putLong("value", j); a(bundle); return this; } if (!(this.a == null || this.a == null)) { this.a.putLong(str, j); } return this; } catch (Throwable unused) { c.a(); } } public final SharedPreferences.Editor putFloat(String str, float f2) { try { if (this.c != 1 || (this.e && !TextUtils.isEmpty(this.f))) { Bundle bundle = new Bundle(); bundle.putString("operation", "putFloat"); bundle.putString("key", str); bundle.putFloat("value", f2); a(bundle); return this; } if (!(this.a == null || this.a == null)) { this.a.putFloat(str, f2); } return this; } catch (Throwable unused) { c.a(); } } public final SharedPreferences.Editor putBoolean(String str, boolean z) { try { if (this.c != 1 || (this.e && !TextUtils.isEmpty(this.f))) { Bundle bundle = new Bundle(); bundle.putString("operation", "putBoolean"); bundle.putString("key", str); bundle.putBoolean("value", z); a(bundle); return this; } if (!(this.a == null || this.a == null)) { this.a.putBoolean(str, z); } return this; } catch (Throwable unused) { c.a(); } } public final SharedPreferences.Editor remove(String str) { throw new RuntimeException("This editor not allow to call remove."); } public final SharedPreferences.Editor clear() { throw new RuntimeException("This editor not allow to call clear."); } public final boolean commit() { SharedPreferences.Editor editor; if (this.c != 1 || ((this.e && !TextUtils.isEmpty(this.f)) || (editor = this.a) == null)) { return true; } return editor.commit(); } public final void apply() { SharedPreferences.Editor editor; if (this.c != 1) { return; } if ((!this.e || TextUtils.isEmpty(this.f)) && (editor = this.a) != null) { editor.apply(); } } private Bundle a(Bundle bundle) { try { bundle.putString("pref_name", this.d); if (!this.e) { return u.a(this.b, "CallPreferences", bundle); } if (TextUtils.isEmpty(this.f)) { return u.a(this.b, "CallPreferences", bundle); } return u.a(this.b, "CallPreferences", bundle, this.f); } catch (Throwable unused) { c.a(); return null; } } }