本文整理汇总了Java中com.odoo.core.account.OdooUserAskPassword类的典型用法代码示例。如果您正苦于以下问题:Java OdooUserAskPassword类的具体用法?Java OdooUserAskPassword怎么用?Java OdooUserAskPassword使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OdooUserAskPassword类属于com.odoo.core.account包,在下文中一共展示了OdooUserAskPassword类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemClick
import com.odoo.core.account.OdooUserAskPassword; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final OUser user = mAdapter.getItem(position);
dialog.dismiss();
if (mIUserLoginSelectListener != null) {
// Ask for password of account
askPassword = OdooUserAskPassword.get(mContext, user);
askPassword.setOnUserPasswordValidateListener(new OdooUserAskPassword.OnUserPasswordValidateListener() {
@Override
public void onSuccess() {
mIUserLoginSelectListener.onUserSelected(user);
}
@Override
public void onCancel() {
mIUserLoginSelectListener.onRequestAccountSelect();
}
@Override
public void onFail() {
OAlert.showError(mContext, OResource.string(mContext,
R.string.error_invalid_password), new OAlert.OnAlertDismissListener() {
@Override
public void onAlertDismiss() {
onCancel();
}
});
}
});
askPassword.show();
}
}
示例2: populateAccountList
import com.odoo.core.account.OdooUserAskPassword; //导入依赖的package包/类
private void populateAccountList(OUser me, List<OUser> accounts) {
mDrawerAccountContainer.removeAllViews();
for (final OUser user : accounts) {
if (!user.getAndroidName().equals(me.getAndroidName())) {
View view = LayoutInflater.from(this).inflate(R.layout.base_drawer_account_item, mDrawerAccountContainer, false);
ImageView avatar = (ImageView) view.findViewById(R.id.profile_image);
if (!user.getAvatar().equals("false")) {
Bitmap img = BitmapUtils.getBitmapImage(this, user.getAvatar());
if (img != null)
avatar.setImageBitmap(img);
}
OControls.setText(view, R.id.profile_name_text, user.getName());
OControls.setText(view, R.id.profile_url_text, (user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
// Setting login event for other account
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
OdooUserAskPassword.get(OdooActivity.this, user)
.setOnUserPasswordValidateListener(
new OdooUserAskPassword.OnUserPasswordValidateListener() {
@Override
public void onSuccess() {
// Logging in to other account
OdooAccountManager.login(OdooActivity.this,
user.getAndroidName());
OModel.sqLite = null;
mAccountBoxExpanded = false;
accountBoxToggle();
mDrawerLayout.closeDrawer(GravityCompat.START);
// Restarting activity
restartActivity();
}
@Override
public void onCancel() {
}
@Override
public void onFail() {
OAlert.showError(OdooActivity.this,
OResource.string(OdooActivity.this,
R.string.error_invalid_password));
}
}).show();
}
});
mDrawerAccountContainer.addView(view);
}
}
accountListDefaultItems();
}