本文整理汇总了Java中com.odoo.core.utils.BitmapUtils.getBitmapImage方法的典型用法代码示例。如果您正苦于以下问题:Java BitmapUtils.getBitmapImage方法的具体用法?Java BitmapUtils.getBitmapImage怎么用?Java BitmapUtils.getBitmapImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.odoo.core.utils.BitmapUtils
的用法示例。
在下文中一共展示了BitmapUtils.getBitmapImage方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTitle
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的package包/类
private void setTitle(Toolbar toolbar) {
CollapsingToolbarLayout collapsing_toolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsing_toolbar.setTitle(category.getString("name"));
toolbar.setTitle(category.getString("name"));
Bitmap cover;
if (category.getString("image_medium").equals("false")) {
cover = BitmapUtils.getAlphabetImage(getContext(), category.getString("name"));
} else {
cover = BitmapUtils.getBitmapImage(getContext(), category.getString("image_medium"));
}
Palette.Builder paletteBuilder = new Palette.Builder(cover);
Palette palette = paletteBuilder.generate();
ImageView imageView = (ImageView) findViewById(R.id.image);
imageView.setImageBitmap(cover);
if (palette != null) {
int color = palette.getDarkVibrantColor(_c(R.color.theme_secondary_dark));
imageView.setBackgroundColor(color);
}
}
示例2: generateView
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的package包/类
private void generateView(View view, OUser user) {
OControls.setText(view, R.id.accountName, user.getName());
OControls.setText(view, R.id.accountURL, (user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
OControls.setImage(view, R.id.profile_image, R.drawable.avatar);
if (!user.getAvatar().equals("false")) {
Bitmap bmp = BitmapUtils.getBitmapImage(this, user.getAvatar());
if (bmp != null)
OControls.setImage(view, R.id.profile_image, bmp);
}
if (user.isActive()) {
OControls.setVisible(view, R.id.btnLogout);
OControls.setGone(view, R.id.btnLogin);
} else {
OControls.setGone(view, R.id.btnLogout);
OControls.setVisible(view, R.id.btnLogin);
}
view.findViewById(R.id.btnLogin).setTag(user);
view.findViewById(R.id.btnLogout).setTag(user);
view.findViewById(R.id.btnRemoveAccount).setTag(user);
view.findViewById(R.id.btnLogout).setOnClickListener(this);
view.findViewById(R.id.btnLogin).setOnClickListener(this);
view.findViewById(R.id.btnRemoveAccount).setOnClickListener(this);
}
示例3: getView
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的package包/类
@Override
public View getView(int position, View view, ViewGroup parent) {
ODataRow row = (ODataRow) chatterItems.get(position);
if (row.getString("subtype_id").equals("false")) {
view.setBackgroundResource(R.color.base_chatter_view_note_background);
} else {
view.setBackgroundColor(Color.WHITE);
}
view.findViewById(R.id.imgAttachments).setVisibility(
(row.getBoolean("has_attachments")) ?
View.VISIBLE :
View.GONE
);
if (row.getString("subject").equals("false")) {
OControls.setGone(view, R.id.chatterSubject);
} else {
OControls.setVisible(view, R.id.chatterSubject);
OControls.setText(view, R.id.chatterSubject, row.getString("subject"));
}
String date = ODateUtils.convertToDefault(row.getString("date"),
ODateUtils.DEFAULT_FORMAT, "MMM dd hh:mm a");
OControls.setText(view, R.id.chatterDate, date);
OControls.setText(view, R.id.chatterBody, StringUtils.htmlToString(row.getString("body")));
OControls.setText(view, R.id.chatterAuthor, row.getString("author_name"));
String author_image = mailMessage.getAuthorImage(row.getInt(OColumn.ROW_ID));
if (!author_image.equals("false")) {
Bitmap author = BitmapUtils.getBitmapImage(mContext, author_image);
OControls.setImage(view, R.id.authorImage, author);
} else {
OControls.setImage(view, R.id.authorImage, R.drawable.avatar);
}
view.setTag(row);
view.setOnClickListener(this);
return view;
}
示例4: init
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的package包/类
private void init() {
recordName = (TextView) findViewById(R.id.recordName);
parent = (View) recordName.getParent();
ODataRow row = mailMessage.browse(extra.getInt(OColumn.ROW_ID));
attachments.addAll(row.getM2MRecord("attachment_ids").browseEach());
if (attachments.size() > 0) {
loadAttachments = new LoadAttachments();
loadAttachments.execute();
}
horizontalScrollView = (LinearLayout) findViewById(R.id.attachmentsList);
baseModel = OModel.get(this, row.getString("model"), mailMessage.getUser().getAndroidName());
ODataRow record = baseModel.browse(baseModel.selectRowId(row.getInt("res_id")));
String name = record.getString(baseModel.getDefaultNameColumn());
recordName.setText(name);
recordName.setBackgroundColor(OStringColorUtil.getStringColor(this, name));
if (!row.getString("subject").equals("false"))
OControls.setText(parent, R.id.messageSubject, row.getString("subject"));
else
OControls.setGone(parent, R.id.messageSubject);
WebView messageBody = (WebView) findViewById(R.id.messageBody);
messageBody.setBackgroundColor(Color.TRANSPARENT);
messageBody.loadData(row.getString("body"), "text/html; charset=UTF-8", "UTF-8");
Bitmap author_image = BitmapUtils.getAlphabetImage(this, row.getString("author_name"));
String author_img = mailMessage.getAuthorImage(row.getInt(OColumn.ROW_ID));
if (!author_img.equals("false")) {
author_image = BitmapUtils.getBitmapImage(this, author_img);
}
OControls.setImage(parent, R.id.author_image, author_image);
OControls.setText(parent, R.id.authorName, row.getString("author_name"));
String date = ODateUtils.convertToDefault(row.getString("date"),
ODateUtils.DEFAULT_FORMAT, "MMM dd, yyyy hh:mm a");
OControls.setText(parent, R.id.messageDate, date);
}
示例5: getBitmapFromURI
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的package包/类
public Bitmap getBitmapFromURI(Uri uri) {
Bitmap bitmap;
if (!fileExists(uri) && atLeastKitKat()) {
String path = getDocPath(uri);
bitmap = BitmapUtils.getBitmapImage(mContext,
BitmapUtils.uriToBase64(Uri.fromFile(new File(path)), mContext.getContentResolver()));
} else {
bitmap = BitmapUtils.getBitmapImage(mContext,
BitmapUtils.uriToBase64(uri, mContext.getContentResolver()));
}
return bitmap;
}
示例6: onCreate
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.base_profile);
OAppBarUtils.setAppBar(this, true);
OUser user = OUser.currentUser(this);
OForm form = (OForm) findViewById(R.id.profileDetails);
int color = OStringColorUtil.getStringColor(this, user.getName());
form.setIconTintColor(color);
ODataRow userData = new ODataRow();
userData.put("name", user.getName());
userData.put("user_login", user.getUsername());
userData.put("server_url", (user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
userData.put("database", (user.isOAuthLogin()) ? user.getInstanceDatabase() : user.getDatabase());
userData.put("version", user.getOdooVersion().getServerSerie());
userData.put("timezone", user.getTimezone());
form.initForm(userData);
CollapsingToolbarLayout collapsing_toolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsing_toolbar.setTitle(userData.getString("name"));
setTitle(userData.getString("name"));
Bitmap avatar;
if (user.getAvatar().equals("false")) {
avatar = BitmapUtils.getAlphabetImage(this, user.getName());
} else {
avatar = BitmapUtils.getBitmapImage(this, user.getAvatar());
}
ImageView imageView = (ImageView) findViewById(R.id.image);
imageView.setImageBitmap(avatar);
}
示例7: bindView
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的package包/类
private void bindView(View view) {
OUser user = OUser.currentUser(mContext);
String avatar = user.getAvatar();
if (!avatar.equals("false")) {
Bitmap img = BitmapUtils.getBitmapImage(mContext, avatar);
OControls.setImage(view, R.id.userAvatar, img);
}
OControls.setText(view, R.id.userName, "Hello " + user.getName());
}
示例8: updatePassword
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的package包/类
private void updatePassword() {
userAvatar = (ImageView) findViewById(R.id.userAvatar);
Bitmap userImage = BitmapUtils.getAlphabetImage(this, user.getName());
if (!user.getAvatar().equals("false")) {
userImage = BitmapUtils.getBitmapImage(this, user.getAvatar());
}
userAvatar.setImageBitmap(userImage);
txvName = (TextView) findViewById(R.id.userName);
txvName.setText(user.getName());
}
示例9: getView
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的package包/类
private View getView() {
View view = LayoutInflater.from(mContext)
.inflate(R.layout.base_account_ask_pass, null, false);
String avatar = mUser.getAvatar();
Bitmap bitmap;
if (avatar.equals("false")) {
bitmap = BitmapUtils.getAlphabetImage(mContext, mUser.getName());
} else {
bitmap = BitmapUtils.getBitmapImage(mContext, avatar);
}
OControls.setImage(view, R.id.userAvatar, bitmap);
OControls.setText(view, R.id.txvUsername, mUser.getName());
edtPassword = (EditText) view.findViewById(R.id.edtPassword);
return view;
}
示例10: getBitmapFromURI
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的package包/类
public Bitmap getBitmapFromURI(Uri uri) {
Bitmap bitmap;
if (!fileExists(uri) && atLeastKitKat()) {
String path = getDocPath(uri);
bitmap = BitmapUtils.getBitmapImage(mActivity,
BitmapUtils.uriToBase64(Uri.fromFile(new File(path)), mActivity.getContentResolver()));
} else {
bitmap = BitmapUtils.getBitmapImage(mActivity,
BitmapUtils.uriToBase64(uri, mActivity.getContentResolver()));
}
return bitmap;
}
示例11: onCreate
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.base_profile);
OAppBarUtils.setAppBar(this, true);
OUser user = OUser.current(this);
OForm form = (OForm) findViewById(R.id.profileDetails);
int color = OStringColorUtil.getStringColor(this, user.getName());
form.setIconTintColor(color);
ODataRow userData = new ODataRow();
userData.put("name", user.getName());
userData.put("user_login", user.getUsername());
userData.put("server_url", (user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
userData.put("database", (user.isOAuthLogin()) ? user.getInstanceDatabase() : user.getDatabase());
userData.put("version", user.getOdooVersion().getServerSerie());
userData.put("timezone", user.getTimezone());
form.initForm(userData);
CollapsingToolbarLayout collapsing_toolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsing_toolbar.setTitle(userData.getString("name"));
setTitle(userData.getString("name"));
Bitmap avatar;
if (user.getAvatar().equals("false")) {
avatar = BitmapUtils.getAlphabetImage(this, user.getName());
} else {
avatar = BitmapUtils.getBitmapImage(this, user.getAvatar());
}
ImageView imageView = (ImageView) findViewById(R.id.image);
imageView.setImageBitmap(avatar);
}
示例12: bindView
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的package包/类
private void bindView(View view) {
OUser user = OUser.current(mContext);
String avatar = user.getAvatar();
if (!avatar.equals("false")) {
Bitmap img = BitmapUtils.getBitmapImage(mContext, avatar);
OControls.setImage(view, R.id.userAvatar, img);
}
OControls.setText(view, R.id.userName, "Hello " + user.getName());
}
示例13: populateAccountList
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的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();
}
示例14: setupAccountBox
import com.odoo.core.utils.BitmapUtils; //导入方法依赖的package包/类
private void setupAccountBox() {
mDrawerAccountContainer = (LinearLayout) findViewById(R.id.accountList);
View chosenAccountView = findViewById(R.id.drawerAccountView);
OUser currentUser = OUser.current(this);
if (currentUser == null) {
chosenAccountView.setVisibility(View.GONE);
mDrawerAccountContainer.setVisibility(View.GONE);
return;
} else {
chosenAccountView.setVisibility(View.VISIBLE);
mDrawerAccountContainer.setVisibility(View.INVISIBLE);
}
ImageView avatar = (ImageView) chosenAccountView.findViewById(R.id.profile_image);
TextView name = (TextView) chosenAccountView.findViewById(R.id.profile_name_text);
TextView url = (TextView) chosenAccountView.findViewById(R.id.profile_url_text);
name.setText(currentUser.getName());
url.setText((currentUser.isOAuthLogin()) ? currentUser.getInstanceURL() : currentUser.getHost());
if (!currentUser.getAvatar().equals("false")) {
Bitmap bitmap = BitmapUtils.getBitmapImage(this, currentUser.getAvatar());
if (bitmap != null)
avatar.setImageBitmap(bitmap);
}
// Setting Accounts
List<OUser> accounts = OdooAccountManager.getAllAccounts(this);
if (accounts.size() > 0) {
chosenAccountView.setEnabled(true);
ImageView boxIndicator = (ImageView) findViewById(R.id.expand_account_box_indicator);
boxIndicator.setVisibility(View.VISIBLE);
chosenAccountView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mAccountBoxExpanded = !mAccountBoxExpanded;
accountBoxToggle();
}
});
populateAccountList(currentUser, accounts);
}
}