package BWP.MobileSale.Util;

import BWP.MobileSale.Config.ConfigBase;
import BWP.MobileSale.Config.ServerConfig;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class ConfigUtil {
	public static <T extends ConfigBase> void Fill(T config) {
		SharedPreferences store = config.getStore();
		config.GetValues(store);
	}

	public static <T extends ConfigBase> void Save(T config) {
		SharedPreferences store = config.getStore();
		Editor editor = store.edit();
		editor.clear();
		config.SetValues(editor);
		editor.commit();
	}
	
	
	public static String getServerUri(Context context){
		ServerConfig config =new ServerConfig(context);
		Fill(config);
		return config.getServerUri();
	}
	
}
