翰林优商.apk(点击下载) / f.java


package com.sjm.sjmsdk.core;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;

public class f {
    private static f c;
    private Context a;
    private SharedPreferences b;

    private f(Context context) {
        this.a = context;
    }

    public static f a(Context context) {
        if (c == null) {
            c = new f(context);
        }
        return c;
    }

    private SharedPreferences b(Context context) {
        if (this.b == null && context != null) {
            try {
                this.b = context.getSharedPreferences("HZ_SJM_Config", 0);
            } catch (Exception unused) {
            }
        }
        return this.b;
    }

    public int a(String str) {
        try {
            return b(this.a).getInt(str, 0);
        } catch (Exception unused) {
            return 0;
        }
    }

    public void a(String str, int i) {
        if (str != null) {
            SharedPreferences.Editor edit = b(this.a).edit();
            edit.putInt(str, i);
            edit.commit();
        }
    }

    public void a(String str, long j) {
        if (str != null) {
            SharedPreferences.Editor edit = b(this.a).edit();
            edit.putLong(str, j);
            edit.commit();
        }
    }

    public void a(String str, String str2) {
        if (str != null) {
            SharedPreferences.Editor edit = b(this.a).edit();
            if (str2 == null) {
                str2 = "";
            }
            edit.putString(str, str2);
            edit.commit();
        }
    }

    public void a(String str, boolean z) {
        if (str != null) {
            SharedPreferences.Editor edit = b(this.a).edit();
            edit.putBoolean(str, z);
            edit.commit();
        }
    }

    public String b(String str) {
        try {
            return b(this.a).getString(str, "");
        } catch (Exception e) {
            Log.d("test", "getAdItemConfigLunXun.getValuekey.e=" + e.toString());
            return "";
        }
    }

    public boolean c(String str) {
        try {
            return b(this.a).getBoolean(str, false);
        } catch (Exception unused) {
            return false;
        }
    }

    public long d(String str) {
        try {
            return b(this.a).getLong(str, 0);
        } catch (Exception unused) {
            return 0;
        }
    }
}