Android Open Source - ABTester A B Shared Prefs






From Project

Back to project page ABTester.

License

The source code is released under:

MIT License

If you think the Android project ABTester listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package ab.tester.prefs;
/*w  w  w. java  2s  .c  o  m*/
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;

public abstract class ABSharedPrefs {

  public static final String SEPARATOR = "___";
  protected SharedPreferences prefs;
  protected abstract String getPrefsName();
  
  public ABSharedPrefs(Context context) {
    this.prefs = context.getSharedPreferences(getPrefsName(), Context.MODE_PRIVATE);
  }
  
  @SuppressLint("NewApi")
  public void apply(SharedPreferences.Editor editor){
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD)
      editor.apply();
    else
      editor.commit();
  }
}




Java Source Code List

ab.tester.ABTest.java
ab.tester.ABTester.java
ab.tester.DefualtLogger.java
ab.tester.LoggerInterface.java
ab.tester.prefs.ABEventsSharedPrefs.java
ab.tester.prefs.ABGeneralSharedPrefs.java
ab.tester.prefs.ABSharedPrefs.java
ab.tester.prefs.ABTestsSharedPrefs.java
com.example.ab_sample.MainActivity.java
com.example.ab_sample.SplashActivity.java