Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Generated by smali2java 1.0.0.558
- * Copyright (C) 2013 Hensence.com
- */
- package com.nubee.platform.config;
- import android.graphics.drawable.Drawable;
- import android.content.Context;
- import android.content.SharedPreferences;
- import com.nubee.platform.NubeePlatform;
- import android.content.res.Resources;
- import android.graphics.drawable.BitmapDrawable;
- import android.content.pm.PackageManager;
- import android.content.pm.PackageInfo;
- import android.os.Build;
- import com.nubee.platform.NPLog;
- public class NPConfig {
- private static final String COMMON_SERVER_URL_DEVELOPMENT = "http://nbpf-stg-common.s3.amazonaws.com/public/";
- private static final String COMMON_SERVER_URL_LIVE = "http://d2tio84stn3klc.cloudfront.net/public/";
- private static final String COMMON_SERVER_URL_STAGING = "http://nbpf-stg-common.s3.amazonaws.com/public/";
- private static final String FAQ_SERVER_URL_DEVELOPMENT = "http://nbpf-stg-faq.nbpf.nubee.com/public/";
- private static final String FAQ_SERVER_URL_LIVE = "http://nbpf-pro-faq.nbpf.nubee.com/public/";
- private static final String FAQ_SERVER_URL_STAGING = "http://nbpf-stg-faq.nbpf.nubee.com/public/";
- public static final String FAQ_VERSION = "001";
- public static final String GAME_LIST_VERSION = "001";
- private static final String NEW_SERVER_URL_DEVELOPMENT = "https://st-%s-connect.nubee.com/";
- private static final String NEW_SERVER_URL_LIVE = "https://%s-connect.nubee.com/";
- private static final String NEW_SERVER_URL_STAGING = "https://st-%s-connect.nubee.com/";
- private static final String OLD_SERVER_URL_DEVELOPMENT = "https://dev-nbpf.nubee.com/";
- private static final String OLD_SERVER_URL_LIVE = "https://connect.nubee.com/";
- private static final String OLD_SERVER_URL_STAGING = "https://st-nbpf.nubee.com/";
- private static final String PARAM_NAME_APP_ID = "APP_ID";
- private static final String PARAM_NAME_BACKGROUND_DRAWABLE_ID = "BACKGROUND_DRAWABLE_ID";
- private static final String PARAM_NAME_GCM_ACTIVITY_CLASS_NAME = "GCM_ACTIVITY_CLASS_NAME";
- private static final String PARAM_NAME_GCM_LARGE_ICON_ID = "GCM_LARGE_ICON_ID";
- private static final String PARAM_NAME_GCM_SENDER_ID = "GCM_SENDER_ID";
- private static final String PARAM_NAME_GCM_SMALL_ICON_ID = "GCM_ICON_ID";
- private static final String PARAM_NAME_GCM_TITLE_ID = "GCM_TITLE_ID";
- private static final String PARAM_NAME_HASHSALT = "HASHSALT";
- private static final String PARAM_NAME_IS_DEBUG = "IS_DEBUG";
- private static final String PARAM_NAME_LOGGING_LEVEL = "LOGGING_LEVEL";
- private static final String PARAM_NAME_LOG_TAG = "LOG_TAG";
- private static final String PREF_FILE_NAME = "CONFIG";
- public static final String SDK_VERSION = "2.1.5";
- private String mServerUrlDevelopment;
- private String mServerUrlLive;
- private String mServerUrlStaging;
- public final String getServerUrl(int serverType) {
- switch(serverType) {
- case 0:
- {
- return mServerUrlDevelopment;
- }
- case 1:
- {
- return mServerUrlStaging;
- }
- case 2:
- {
- return mServerUrlLive;
- }
- }
- return mServerUrlLive;
- }
- private void setupServerUrl() {
- if(mUseOldServerUrl) {
- mServerUrlDevelopment = "https://dev-nbpf.nubee.com/";
- mServerUrlStaging = "https://st-nbpf.nubee.com/";
- mServerUrlLive = "https://connect.nubee.com/";
- return;
- }
- mServerUrlDevelopment = String.format("https://st-%s-connect.nubee.com/", mAppId);
- mServerUrlStaging = String.format("https://st-%s-connect.nubee.com/", mAppId, mAppId);
- mServerUrlLive = String.format("https://%s-connect.nubee.com/", mAppId, mAppId, mAppId);
- }
- public final String getFaqServerUrl(int serverType) {
- switch(serverType) {
- case 0:
- {
- return "http://nbpf-stg-faq.nbpf.nubee.com/public/";
- }
- case 1:
- {
- return "http://nbpf-stg-faq.nbpf.nubee.com/public/";
- }
- case 2:
- {
- return "http://nbpf-pro-faq.nbpf.nubee.com/public/";
- }
- }
- return "http://nbpf-pro-faq.nbpf.nubee.com/public/";
- }
- public final String getCommonServerUrl(int serverType) {
- switch(serverType) {
- case 0:
- {
- return "http://nbpf-stg-common.s3.amazonaws.com/public/";
- }
- case 1:
- {
- return "http://nbpf-stg-common.s3.amazonaws.com/public/";
- }
- case 2:
- {
- return "http://d2tio84stn3klc.cloudfront.net/public/";
- }
- }
- return "http://nbpf-pro-faq.nbpf.nubee.com/public/";
- }
- protected String mAppId = 0x0;
- protected String mHashSalt = 0x0;
- protected int mBackgroundDrawableId = 0x0;
- protected Drawable mBackgroundDrawable = 0x0;
- private static String mUserAgent = 0x0;
- private boolean mUseOldServerUrl = false;
- public NPConfig(String appId, String hashSalt) {
- mAppId = appId;
- mHashSalt = hashSalt;
- setupServerUrl();
- }
- public NPConfig(String appId, String hashSalt, boolean useOldServerUrl) {
- mAppId = appId;
- mHashSalt = hashSalt;
- mUseOldServerUrl = useOldServerUrl;
- setupServerUrl();
- }
- public String getAppId() {
- return mAppId;
- }
- public String getHashSalt() {
- return mHashSalt;
- }
- public NPConfig setBackgroundDrawable(Drawable drawable) {
- mBackgroundDrawable = drawable;
- return this;
- }
- public NPConfig setBackgroundDrawableId(int drawableId) {
- mBackgroundDrawableId = drawableId;
- return this;
- }
- public Drawable getBackgroundDrawable(Context context) {
- if(mBackgroundDrawable != null) {
- return mBackgroundDrawable;
- }
- if(mBackgroundDrawableId > 0) {
- return (BitmapDrawable)context.getResources().getDrawable(mBackgroundDrawableId);
- }
- return null;
- }
- public final NPConst.StoreType getStoreType() {
- return NPConstStore.STORE_TYPE;
- }
- public final String getUserAgent(Context context) {
- // :( Parsing error. Please contact me.
- }
- public final String getUserAgent() {
- return mUserAgent;
- }
- protected String mBase64EncodedPublicKey = 0x0;
- public NPConfig setupInAppBilling(String base64EncodedPublickey) {
- mBase64EncodedPublicKey = base64EncodedPublickey;
- return this;
- }
- public String getBase64EncodedPublicKey() {
- return mBase64EncodedPublicKey;
- }
- protected String mGcmSenderId = 0x0;
- public NPConfig setupGCM(String senderId, String activityClassName, int iconId, int titleId) {
- mGcmSenderId = senderId;
- mNotificationActivityClassName = activityClassName;
- mNotificationSmallIconId = iconId;
- mNotificationLargeIconId = 0x0;
- mNotificationTitleId = titleId;
- return this;
- }
- public NPConfig setupGCM(String senderId, String activityClassName, int smallIconId, int largeIconId, int titleId) {
- mGcmSenderId = senderId;
- mNotificationActivityClassName = activityClassName;
- mNotificationSmallIconId = smallIconId;
- mNotificationLargeIconId = largeIconId;
- mNotificationTitleId = titleId;
- return this;
- }
- public String getGcmSenderId() {
- return mGcmSenderId;
- }
- protected boolean mEnableGameList = false;
- public NPConfig setEnableGameList(boolean enableGameList) {
- mEnableGameList = enableGameList;
- return this;
- }
- public boolean isEnableGameList() {
- return mEnableGameList;
- }
- protected boolean mEnableFaqCommon = true;
- public NPConfig setEnableFaqCommon(boolean enableFaqCommon) {
- mEnableFaqCommon = enableFaqCommon;
- return this;
- }
- public boolean isEnableFaqCommon() {
- return mEnableFaqCommon;
- }
- protected String mNotificationActivityClassName = 0x0;
- protected int mNotificationSmallIconId = 0x0;
- protected int mNotificationLargeIconId = 0x0;
- protected int mNotificationTitleId = 0x0;
- public NPConfig setupNotification(String activityClassName, int iconId, int titleId) {
- mNotificationActivityClassName = activityClassName;
- mNotificationSmallIconId = iconId;
- mNotificationLargeIconId = 0x0;
- mNotificationTitleId = titleId;
- return this;
- }
- public NPConfig setupNotification(String activityClassName, int smallIconId, int largeIconId, int titleId) {
- mNotificationActivityClassName = activityClassName;
- mNotificationSmallIconId = smallIconId;
- mNotificationLargeIconId = largeIconId;
- mNotificationTitleId = titleId;
- return this;
- }
- public String getNotificationActivityClassName() {
- return mNotificationActivityClassName;
- }
- public int getNotificationSmallIcon() {
- return mNotificationSmallIconId;
- }
- public int getNotificationLargeIcon() {
- return mNotificationLargeIconId;
- }
- public String getNotificationTitle(Context context) {
- if(mNotificationTitleId > 0) {
- return context.getString(mNotificationTitleId);
- }
- return null;
- }
- protected String mLogTag = "Platform";
- protected boolean mIsDebug = false;
- protected NPConfig.ELOGGING_LEVEL mLoggingLevel = NPConfig.ELOGGING_LEVEL.ELOGGING_NONE;
- protected NPConfig.ELOGGING_LEVEL mCustomLoggingLevel = 0x0;
- public NPConfig setLoggingLevel(NPConfig.ELOGGING_LEVEL loggingLevel) {
- mCustomLoggingLevel = loggingLevel;
- mLoggingLevel = mCustomLoggingLevel;
- return this;
- }
- public NPConfig.ELOGGING_LEVEL getLoggingLevel() {
- return mLoggingLevel;
- }
- public NPConfig setLogTag(String tag) {
- mLogTag = tag;
- return this;
- }
- public String getLogTag() {
- return mLogTag;
- }
- public NPConfig setDebug(boolean debug) {
- mIsDebug = debug;
- if(mCustomLoggingLevel == null) {
- if(mIsDebug) {
- mLoggingLevel = NPConfig.ELOGGING_LEVEL.ELOGGING_VERBOSE;
- return this;
- }
- mLoggingLevel = NPConfig.ELOGGING_LEVEL.ELOGGING_NONE;
- }
- return this;
- }
- public boolean isDebug() {
- return mIsDebug;
- }
- public void saveToPreference(Context context) {
- SharedPreferences pref = context.getSharedPreferences("CONFIG", 0x0);
- SharedPreferences.Editor editor = pref.edit();
- editor.putString("GCM_ACTIVITY_CLASS_NAME", mNotificationActivityClassName);
- editor.putInt("GCM_ICON_ID", mNotificationSmallIconId);
- editor.putInt("GCM_LARGE_ICON_ID", mNotificationLargeIconId);
- editor.putInt("GCM_TITLE_ID", mNotificationTitleId);
- editor.commit();
- NPLog.d("Platform", "NPConfig.saveToPreference");
- }
- public static NPConfig createNPConfigFromPreference(Context context) {
- // :( Parsing error. Please contact me.
- }
- public static NPConfig sharedInstanceForService(Context context) {
- NPConfig config = NubeePlatform.getConfig();
- if(config == null) {
- config = createNPConfigFromPreference(context);
- }
- return config;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement