本文整理汇总了Java中com.odoo.core.auth.OdooAccountManager类的典型用法代码示例。如果您正苦于以下问题:Java OdooAccountManager类的具体用法?Java OdooAccountManager怎么用?Java OdooAccountManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OdooAccountManager类属于com.odoo.core.auth包,在下文中一共展示了OdooAccountManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: OdooUserLoginSelectorDialog
import com.odoo.core.auth.OdooAccountManager; //导入依赖的package包/类
public OdooUserLoginSelectorDialog(Context context) {
mContext = context;
AbsListView.LayoutParams params = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,
AbsListView.LayoutParams.WRAP_CONTENT);
mGrid = new ExpandableHeightGridView(mContext);
mGrid.setLayoutParams(params);
List<OUser> accounts = OdooAccountManager.getAllAccounts(mContext);
mAdapter = new ArrayAdapter<OUser>(mContext, R.layout.base_instance_item, accounts) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null)
convertView = LayoutInflater.from(mContext).inflate(R.layout.base_instance_item, parent, false);
generateView(position, convertView, getItem(position));
return convertView;
}
};
int padding = OResource.dimen(mContext, R.dimen.activity_horizontal_margin);
mGrid.setPadding(padding, padding, padding, padding);
if (accounts.size() > 1)
mGrid.setNumColumns(2);
mGrid.setAdapter(mAdapter);
mGrid.setOnItemClickListener(this);
}
示例2: onCreate
import com.odoo.core.auth.OdooAccountManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.base_login);
mApp = (App) getApplicationContext();
Bundle extras = getIntent().getExtras();
if (extras != null) {
if (extras.containsKey(OdooAuthenticator.KEY_NEW_ACCOUNT_REQUEST))
mCreateAccountRequest = true;
if (extras.containsKey(OdooActivity.KEY_ACCOUNT_REQUEST)) {
mRequestedForAccount = true;
setResult(RESULT_CANCELED);
}
}
if (!mCreateAccountRequest) {
if (OdooAccountManager.anyActiveUser(this)) {
startOdooActivity();
return;
} else if (OdooAccountManager.hasAnyAccount(this)) {
onRequestAccountSelect();
}
}
init();
}
示例3: doInBackground
import com.odoo.core.auth.OdooAccountManager; //导入依赖的package包/类
@Override
protected Boolean doInBackground(OUser... params) {
mUser = params[0];
if (OdooAccountManager.createAccount(OdooLogin.this, mUser)) {
mUser = OdooAccountManager.getDetails(OdooLogin.this, mUser.getAndroidName());
OdooAccountManager.login(OdooLogin.this, mUser.getAndroidName());
FirstLaunchConfig.onFirstLaunch(OdooLogin.this, mUser);
try {
// Syncing company details
ODataRow company_details = new ODataRow();
company_details.put("id", mUser.getCompanyId());
ResCompany company = new ResCompany(OdooLogin.this);
company.quickCreateRecord(company_details);
Thread.sleep(500);
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
return false;
}
示例4: doInBackground
import com.odoo.core.auth.OdooAccountManager; //导入依赖的package包/类
@Override
protected Boolean doInBackground(OUser... params) {
OUser user = params[0];
Odoo odoo = Odoo.createInstance(mContext, (user.isOAuthLogin())
? user.getInstanceURL() : user.getHost());
odoo.helper.OUser mUser = odoo.authenticate(user.getUsername(), user.getPassword(),
(user.isOAuthLogin()) ? user.getInstanceDatabase() :
user.getDatabase());
if (mUser != null) {
OUser updatedUser = new OUser();
updatedUser.setFromBundle(mUser.getAsBundle());
OdooAccountManager.updateUserData(mContext, user, updatedUser);
try {
Thread.sleep(1500);
} catch (Exception e) {
}
return true;
}
return false;
}
示例5: onCreate
import com.odoo.core.auth.OdooAccountManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.base_account_quick_manage);
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
getSupportActionBar().hide();
action = getIntent().getAction();
mApp = (App) getApplicationContext();
// Removing notification
ONotificationBuilder.cancelNotification(this, OSyncAdapter.REQUEST_SIGN_IN_ERROR);
user = OdooAccountManager.getDetails(this, getIntent().getStringExtra("android_name"));
if (action.equals("remove_account")) {
findViewById(R.id.layoutSavePassword).setVisibility(View.GONE);
removeAccount();
} else if (action.equals("reset_password")) {
updatePassword();
findViewById(R.id.cancel).setOnClickListener(this);
findViewById(R.id.save_password).setOnClickListener(this);
}
}
示例6: onPostExecute
import com.odoo.core.auth.OdooAccountManager; //导入依赖的package包/类
@Override
protected void onPostExecute(OUser oUser) {
super.onPostExecute(oUser);
progressDialog.dismiss();
if (oUser != null) {
OdooAccountManager.updateUserData(OdooAccountQuickManage.this,
(com.odoo.core.support.OUser) user);
mApp.setOdoo(null, user);
finish();
Intent intent = new Intent(OdooAccountQuickManage.this, OdooActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);
} else {
edtPassword.setText("");
edtPassword.setError("Password required");
}
}
示例7: get
import com.odoo.core.auth.OdooAccountManager; //导入依赖的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;
}
示例8: onActivityResult
import com.odoo.core.auth.OdooAccountManager; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (mIOnActivityResultListener != null) {
mIOnActivityResultListener.onOdooActivityResult(requestCode, resultCode, data);
}
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_ACCOUNT_CREATE) {
if (mDrawerLayout != null) {
mDrawerLayout.closeDrawer(GravityCompat.START);
accountBoxToggle();
}
OdooAccountManager.login(this, data.getStringExtra(KEY_NEW_USER_NAME));
OModel.sqLite = null;
restartActivity();
}
if (requestCode == REQUEST_ACCOUNTS_MANAGE) {
startActivity(new Intent(this, OdooLogin.class));
finish();
}
if (requestCode == REQUEST_GOOGLE_ACCOUNT) {
setupAccountBox();
Toast.makeText(this, "Welcome " + OUser.getUser(this).getName(), Toast.LENGTH_LONG).show();
}
}
}
示例9: onPerformSync
import com.odoo.core.auth.OdooAccountManager; //导入依赖的package包/类
@Override
public void onPerformSync(Account account, Bundle extras, String authority,
ContentProviderClient provider, SyncResult syncResult) {
// Creating model Object
mModel = new OModel(mContext, null, OdooAccountManager.getDetails(mContext, account.name))
.createInstance(mModelClass);
mUser = mModel.getUser();
if (OdooAccountManager.isValidUserObj(mContext, mUser)) {
// Creating Odoo instance
mOdoo = createOdooInstance(mContext, mUser);
Log.i(TAG, "User : " + mModel.getUser().getAndroidName());
Log.i(TAG, "Model : " + mModel.getModelName());
Log.i(TAG, "Database : " + mModel.getDatabaseName());
Log.i(TAG, "Odoo Version: " + mUser.getOdooVersion().getServerSerie());
// Calling service callback
if (mService != null)
mService.performDataSync(this, extras, mUser);
//Creating domain
ODomain domain = (mDomain.containsKey(mModel.getModelName())) ?
mDomain.get(mModel.getModelName()) : null;
// Ready for sync data from server
syncData(mModel, mUser, domain, syncResult, true, true);
}
}
示例10: doInBackground
import com.odoo.core.auth.OdooAccountManager; //导入依赖的package包/类
@Override
protected Boolean doInBackground(OUser... params) {
mUser = params[0];
if (OdooAccountManager.createAccount(OdooLogin.this, mUser)) {
mUser = OdooAccountManager.getDetails(OdooLogin.this, mUser.getAndroidName());
OdooAccountManager.login(OdooLogin.this, mUser.getAndroidName());
FirstLaunchConfig.onFirstLaunch(OdooLogin.this, mUser);
try {
// Syncing company details
ODataRow company_details = new ODataRow();
company_details.put("id", mUser.getCompanyId());
ResCompany company = new ResCompany(OdooLogin.this, mUser);
company.quickCreateRecord(company_details);
Thread.sleep(500);
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
return false;
}
示例11: get
import com.odoo.core.auth.OdooAccountManager; //导入依赖的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;
}
示例12: validateUserObject
import com.odoo.core.auth.OdooAccountManager; //导入依赖的package包/类
private void validateUserObject() {
if (OdooAccountManager.anyActiveUser(this)) {
OUser user = OUser.current(this);
if (!OdooAccountManager.isValidUserObj(this, user)
&& app.inNetwork()) {
OdooUserObjectUpdater.showUpdater(this, new OdooUserObjectUpdater.OnUpdateFinish() {
@Override
public void userObjectUpdateFinished() {
startActivity(new Intent(OdooActivity.this, OdooLogin.class));
finish();
}
@Override
public void userObjectUpdateFail() {
Toast.makeText(OdooActivity.this, OResource.string(OdooActivity.this,
R.string.toast_something_gone_wrong), Toast.LENGTH_LONG).show();
finish();
}
});
}
}
}
示例13: onActivityResult
import com.odoo.core.auth.OdooAccountManager; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (mIOnActivityResultListener != null) {
mIOnActivityResultListener.onOdooActivityResult(requestCode, resultCode, data);
}
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_ACCOUNT_CREATE) {
if (mDrawerLayout != null) {
mDrawerLayout.closeDrawer(GravityCompat.START);
accountBoxToggle();
}
OdooAccountManager.login(this, data.getStringExtra(KEY_NEW_USER_NAME));
OModel.sqLite = null;
restartActivity();
}
if (requestCode == REQUEST_ACCOUNTS_MANAGE) {
startActivity(new Intent(this, OdooLogin.class));
finish();
}
}
}
示例14: onPerformSync
import com.odoo.core.auth.OdooAccountManager; //导入依赖的package包/类
@Override
public void onPerformSync(Account account, Bundle extras, String authority,
ContentProviderClient provider, SyncResult syncResult) {
// Creating model Object
mModel = new OModel(mContext, null)
.createInstance(mModelClass);
mUser = mModel.getUser();
if (OdooAccountManager.isValidUserObj(mContext, mUser)) {
// Creating Odoo instance
mOdoo = createOdooInstance(mContext, mUser);
Log.i(TAG, "User : " + mModel.getUser().getAndroidName());
Log.i(TAG, "Model : " + mModel.getModelName());
Log.i(TAG, "Database : " + mModel.getDatabaseName());
Log.i(TAG, "Odoo Version: " + mUser.getOdooVersion().getServerSerie());
// Calling service callback
if (mService != null)
mService.performDataSync(this, extras, mUser);
//Creating domain
ODomain domain = (mDomain.containsKey(mModel.getModelName())) ?
mDomain.get(mModel.getModelName()) : null;
// Ready for sync data from server
syncData(mModel, mUser, domain, syncResult, true, true);
}
}
示例15: onCreate
import com.odoo.core.auth.OdooAccountManager; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.base_manage_accounts);
setTitle(R.string.label_accounts);
OAppBarUtils.setAppBar(this, true);
setResult(RESULT_CANCELED);
accounts.clear();
accounts.addAll(OdooAccountManager.getAllAccounts(this));
mList = (ExpandableListControl) findViewById(R.id.accountList);
mAdapter = mList.getAdapter(R.layout.base_account_item, accounts, this);
mAdapter.notifyDataSetChanged(accounts);
}