當前位置: 首頁>>代碼示例>>Java>>正文


Java OPreferenceManager類代碼示例

本文整理匯總了Java中com.odoo.core.utils.OPreferenceManager的典型用法代碼示例。如果您正苦於以下問題:Java OPreferenceManager類的具體用法?Java OPreferenceManager怎麽用?Java OPreferenceManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OPreferenceManager類屬於com.odoo.core.utils包,在下文中一共展示了OPreferenceManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: baseSettingsItems

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
public static List<ODrawerItem> baseSettingsItems(Context context) {
        String key = "base.settings";
        OPreferenceManager pref = new OPreferenceManager(context);
        List<ODrawerItem> settings = new ArrayList<>();
        settings.add(new ODrawerItem(key).setTitle(OResource.string(context, R.string.label_settings))
                .setGroupTitle());
        settings.add(new ODrawerItem(key).setTitle(OResource.string(context, R.string.title_profile))
                .setInstance(Profile.class).setIcon(R.drawable.ic_action_user));
        settings.add(new ODrawerItem(key).setTitle(OResource.string(context, R.string.label_settings))
                .setIcon(R.drawable.ic_action_settings)
                .setInstance(SettingsActivity.class));
//        if (pref.getBoolean(Profile.CONNECT_WITH_ODOO, false))
//            settings.add(new ODrawerItem(key).setTitle(OResource.string(context, R.string.label_access_odoo_mobile))
//                    .setInstance(OdooMobileQRReader.class).setIcon(R.drawable.ic_action_qrcode)
//                    .setExtra(OUser.current(context).getAsBundle()));
//        OdooNews news = new OdooNews(context, null);
//        if (!news.isEmptyTable()) {
//            settings.add(new ODrawerItem(key).setTitle("Odoo News")
//                            .setInstance(new News()).setIcon(R.drawable.ic_odoo_o)
//            );
//        }
        return settings;
    }
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:24,代碼來源:DrawerUtils.java

示例2: get

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
public static OModel get(Context context, String model_name, String username) {
    OModel model = modelRegistry.getModel(model_name, username);
    OUser user = OdooAccountManager.getDetails(context, username);
    if (model == null) {
        try {
            OPreferenceManager pfManager = new OPreferenceManager(context);
            Class<?> model_class = Class.forName(pfManager.getString(model_name, null));
            if (model_class != null) {
                model = new OModel(context, model_name).createInstance(model_class);
                if (model != null) {
                    modelRegistry.register(model);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return model;
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:20,代碼來源:OModel.java

示例3: baseSettingsItems

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
public static List<ODrawerItem> baseSettingsItems(Context context) {
        String key = "base.settings";
        OPreferenceManager pref = new OPreferenceManager(context);
        List<ODrawerItem> settings = new ArrayList<>();
        settings.add(new ODrawerItem(key).setTitle(OResource.string(context, R.string.label_settings))
                .setGroupTitle());
        settings.add(new ODrawerItem(key).setTitle(OResource.string(context, R.string.title_profile))
                .setInstance(Profile.class).setIcon(R.drawable.ic_action_user));
        settings.add(new ODrawerItem(key).setTitle(OResource.string(context, R.string.label_settings))
                .setIcon(R.drawable.ic_action_settings)
                .setInstance(SettingsActivity.class));
//        if (pref.getBoolean(Profile.CONNECT_WITH_ODOO, false))
//            settings.add(new ODrawerItem(key).setTitle(OResource.string(context, R.string.label_access_odoo_mobile))
//                    .setInstance(OdooMobileQRReader.class).setIcon(R.drawable.ic_action_qrcode)
//                    .setExtra(OUser.current(context).getAsBundle()));
        OdooNews news = new OdooNews(context, null);
        if (!news.isEmptyTable()) {
            settings.add(new ODrawerItem(key).setTitle("Odoo News")
                            .setInstance(new News()).setIcon(R.drawable.ic_odoo_o)
            );
        }
        return settings;
    }
 
開發者ID:Odoo-mobile,項目名稱:hr,代碼行數:24,代碼來源:DrawerUtils.java

示例4: get

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
public static OModel get(Context context, String model_name, String username) {
    OModel model = modelRegistry.getModel(model_name, username);
    OUser user = OdooAccountManager.getDetails(context, username);
    if (model == null) {
        try {
            OPreferenceManager pfManager = new OPreferenceManager(context);
            Class<?> model_class = Class.forName(pfManager.getString(model_name, null));
            if (model_class != null) {
                model = new OModel(context, model_name, user).createInstance(model_class);
                if (model != null) {
                    modelRegistry.register(model);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return model;
}
 
開發者ID:Odoo-mobile,項目名稱:hr,代碼行數:20,代碼來源:OModel.java

示例5: startApp

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
private void startApp(Bundle savedInstanceState) {
    OPreferenceManager preferenceManager = new OPreferenceManager(this);
    if (!preferenceManager.getBoolean(KEY_FRESH_LOGIN, false)) {
        preferenceManager.setBoolean(KEY_FRESH_LOGIN, true);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                startActivity(new Intent(OdooActivity.this, AppIntro.class));
            }
        }, 1000);
    }
    setContentView(R.layout.odoo_activity);
    OAppBarUtils.setAppBar(this, true);
    setupDrawer();
    // Validating user object
    validateUserObject();
}
 
開發者ID:Odoo-mobile,項目名稱:hr,代碼行數:18,代碼來源:OdooActivity.java

示例6: createAccount

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
/**
 * Creates Odoo account for app
 *
 * @param context
 * @param user    user instance (OUser)
 * @return true, if account created successfully
 */

public static boolean createAccount(Context context, OUser user) {
    AccountManager accountManager = AccountManager.get(context);
    Account account = new Account(user.getAndroidName(), KEY_ACCOUNT_TYPE);
    if (accountManager.addAccountExplicitly(account, String.valueOf(user.getPassword()),
            user.getAsBundle())) {
        OPreferenceManager pref = new OPreferenceManager(context);
        if (pref.getInt(userObjectKEY(user), 0) != OUser.USER_ACCOUNT_VERSION) {
            pref.putInt(userObjectKEY(user), OUser.USER_ACCOUNT_VERSION);
        }
        return true;
    }
    return false;
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:22,代碼來源:OdooAccountManager.java

示例7: updateUserData

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
public static OUser updateUserData(Context context, OUser user, OUser newData) {
    if (user != null) {
        AccountManager accountManager = AccountManager.get(context);
        for (String key : newData.getAsBundle().keySet()) {
            accountManager.setUserData(user.getAccount(), key, newData.getAsBundle().get(key) + "");
        }
        OPreferenceManager pref = new OPreferenceManager(context);
        if (pref.getInt(userObjectKEY(user), 0) != OUser.USER_ACCOUNT_VERSION) {
            pref.putInt(userObjectKEY(user), OUser.USER_ACCOUNT_VERSION);
        }
    }
    return getDetails(context, newData.getAndroidName());
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:14,代碼來源:OdooAccountManager.java

示例8: init

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
private void init(Context context, Class<? extends OModel> model, OSyncService service) {
    mContext = context;
    mModelClass = model;
    mService = service;
    preferenceManager = new OPreferenceManager(mContext);
    app = (App) context.getApplicationContext();
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:8,代碼來源:OSyncAdapter.java

示例9: onCreateOptionsMenu

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_about, menu);
    OPreferenceManager pref = new OPreferenceManager(this);
    if (pref.getBoolean(DEVELOPER_MODE, false)) {
        menu.findItem(R.id.menu_developer_mode).setVisible(true);
    }
    return true;
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:10,代碼來源:About.java

示例10: OSQLite

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
public OSQLite(Context context, OUser user) {
    super(context, OConstants.DATABASE_NAME, null, OConstants.DATABASE_VERSION);
    mContext = context;
    mAddons = new Addons();
    mUser = (user != null) ? user : OUser.currentUser(context);
    mPref = new OPreferenceManager(mContext);
    synchronized (this) {
        if (!mPref.getBoolean(KEY_MODEL_CLASS_REGISTER, false)) {
            mPref.setBoolean(KEY_MODEL_CLASS_REGISTER, true);
            // Registering model class paths
            registerModelsClassPath();
        }
    }
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:15,代碼來源:OSQLite.java

示例11: registerModels

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
private void registerModels(List<String> models) {
    OPreferenceManager mPref = new OPreferenceManager(mContext);
    if (mPref.putStringSet("models", models)) {
        Log.i(TAG, models.size() + " Models registered.");
    } else {
        Log.e(TAG, "Unable to register models");
    }
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:9,代碼來源:OSQLite.java

示例12: startApp

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
private void startApp() {
    if (app.inNetwork() || ProductPublicCategory.hasCategories(this)) {
        findViewById(R.id.noNetwork).setVisibility(View.GONE);
        findViewById(R.id.splashScreen).setVisibility(View.VISIBLE);
        new ProductCategoryLoader(this, new ProductCategoryLoader.OnCategoryLoadListener() {
            @Override
            public void categoryLoaded() {
                findViewById(R.id.drawer_layout).setVisibility(View.VISIBLE);
                findViewById(R.id.splashScreen).setVisibility(View.GONE);
                OPreferenceManager preferenceManager = new OPreferenceManager(OdooActivity.this);
                if (!preferenceManager.getBoolean(KEY_FRESH_LOGIN, false)) {
                    preferenceManager.setBoolean(KEY_FRESH_LOGIN, true);
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            startActivity(new Intent(OdooActivity.this, AppIntro.class));
                        }
                    }, 1000);
                }
                Intent productSyncIntent = new Intent(Intent.ACTION_SYNC, null, OdooActivity.this,
                        ProductSyncService.class);
                startService(productSyncIntent);
                setupDrawerBox();
                onPostCreate(null);
                mDrawerToggle.syncState();
            }
        }).execute();
    } else {
        findViewById(R.id.noNetwork).setVisibility(View.VISIBLE);
        findViewById(R.id.splashScreen).setVisibility(View.GONE);
        findViewById(R.id.btnRetryToConnect).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startApp();
            }
        });
    }
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:39,代碼來源:OdooActivity.java

示例13: isValidUserObj

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
public static boolean isValidUserObj(Context context, OUser user) {
    OPreferenceManager pref = new OPreferenceManager(context);
    int version = pref.getInt(userObjectKEY(user), 0);
    if (version == 0) {
        updateUserData(context, user, user);
        version = OUser.USER_ACCOUNT_VERSION;
    }
    return (version == OUser.USER_ACCOUNT_VERSION);
}
 
開發者ID:Odoo-mobile,項目名稱:hr,代碼行數:10,代碼來源:OdooAccountManager.java

示例14: OSQLite

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
public OSQLite(Context context, OUser user) {
    super(context, (user != null) ? user.getDBName() : OUser.current(context).getDBName(), null
            , OConstants.DATABASE_VERSION);
    mContext = context;
    mAddons = new Addons();
    mUser = (user != null) ? user : OUser.current(context);
    mPref = new OPreferenceManager(mContext);
    synchronized (this) {
        if (!mPref.getBoolean(KEY_MODEL_CLASS_REGISTER, false)) {
            mPref.setBoolean(KEY_MODEL_CLASS_REGISTER, true);
            // Registering model class paths
            registerModelsClassPath();
        }
    }
}
 
開發者ID:Odoo-mobile,項目名稱:hr,代碼行數:16,代碼來源:OSQLite.java

示例15: getUser

import com.odoo.core.utils.OPreferenceManager; //導入依賴的package包/類
public static OUser getUser(Context context) {
    OPreferenceManager pref = new OPreferenceManager(context);
    return pref.getUserValues();
}
 
開發者ID:dpr-odoo,項目名稱:trainee-om-shop,代碼行數:5,代碼來源:OUser.java


注:本文中的com.odoo.core.utils.OPreferenceManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。