当前位置: 首页>>代码示例>>Java>>正文


Java BitmapUtils类代码示例

本文整理汇总了Java中com.odoo.core.utils.BitmapUtils的典型用法代码示例。如果您正苦于以下问题:Java BitmapUtils类的具体用法?Java BitmapUtils怎么用?Java BitmapUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BitmapUtils类属于com.odoo.core.utils包,在下文中一共展示了BitmapUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleResult

import com.odoo.core.utils.BitmapUtils; //导入依赖的package包/类
public OValues handleResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK) {
        switch (requestCode) {
            case REQUEST_CAMERA:
                OValues values = getURIDetails(newImageUri);
                values.put("datas", BitmapUtils.uriToBase64(newImageUri,
                        mContext.getContentResolver(), true));
                return values;
            case REQUEST_IMAGE:
                values = getURIDetails(data.getData());
                values.put("datas", BitmapUtils.uriToBase64(data.getData(),
                        mContext.getContentResolver(), true));
                return values;
            case REQUEST_ALL_FILE:
            default:
                return getURIDetails(data.getData());
        }
    }
    return null;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:21,代码来源:OFileManager.java

示例2: bindProduct

import com.odoo.core.utils.BitmapUtils; //导入依赖的package包/类
private void bindProduct() {
    if (!productTemplate.getString("image").equals("false")) {
        OControls.setImage(getContainer(), R.id.productImage, BitmapUtils.getBitmapImage(getContext(),
                productTemplate.getString("image")));
    }
    OControls.setText(getContainer(), R.id.productName, productTemplate.getString("name"));
    if (productTemplate.getFloat("warranty") > 0) {
        OControls.setText(getContainer(), R.id.productWarranty, String.format(
                OResource.string(getContext(), R.string.product_warranty), productTemplate.getString("warranty")
        ));
    }

    calculatePrice();
    bindPaymentAndDelivery();
    toggleFavIcon(favouriteProducts.isFavourite(product_tmpl_id));
    findViewById(R.id.toggleFavorite).setOnClickListener(this);
    findViewById(R.id.addToCart).setOnClickListener(this);
    bindOptions();
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:20,代码来源:ProductDetail.java

示例3: setCustomerImage

import com.odoo.core.utils.BitmapUtils; //导入依赖的package包/类
private void setCustomerImage() {
    if (!record.getString("image_small").equals("false")) {
        userImage.setScaleType(ImageView.ScaleType.CENTER_CROP);
        userImage.setColorFilter(null);
        String base64 = newImage;
        if (newImage == null) {
            if (!record.getString("large_image").equals("false")) {
                base64 = record.getString("large_image");
            } else {
                base64 = record.getString("image_small");
            }
        }
        userImage.setImageBitmap(BitmapUtils.getBitmapImage(this, base64));
    } else {
        userImage.setColorFilter(Color.parseColor("#ffffff"));
    }
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:18,代码来源:CustomerDetails.java

示例4: 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);
    }

}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:22,代码来源:ProductSubCategories.java

示例5: 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);
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:24,代码来源:ManageAccounts.java

示例6: bindCategoryViews

import com.odoo.core.utils.BitmapUtils; //导入依赖的package包/类
private void bindCategoryViews(ViewGroup container) {
    View separator = LayoutInflater.from(this).inflate(R.layout.base_drawer_group_layout, container, false);
    OControls.setText(separator, R.id.group_title, R.string.label_shop_by_category);
    container.addView(separator);
    ProductPublicCategory categories = new ProductPublicCategory(this);
    for (ODataRow row : categories.select(null, "parent_id is NULL", new String[]{}, "sequence")) {
        View item = LayoutInflater.from(this).inflate(R.layout.base_drawer_category_item, container, false);
        if (row.getString("image_medium").equals("false")) {
            OControls.setImage(item, R.id.icon, R.drawable.ic_action_add);
        } else {
            OControls.setImage(item, R.id.icon, BitmapUtils.getBitmapImage(this,
                    row.getString("image_medium")));
        }
        OControls.setText(item, R.id.title, row.getString("name"));
        item.setTag(row);
        item.setOnClickListener(drawerCategoryItemClick);
        container.addView(item);
    }

}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:21,代码来源:OdooActivity.java

示例7: handleResult

import com.odoo.core.utils.BitmapUtils; //导入依赖的package包/类
public OValues handleResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK) {
        switch (requestCode) {
            case REQUEST_CAMERA:
                OValues values = getURIDetails(newImageUri);
                values.put("datas", BitmapUtils.uriToBase64(newImageUri,
                        mActivity.getContentResolver(), true));
                return values;
            case REQUEST_IMAGE:
                values = getURIDetails(data.getData());
                values.put("datas", BitmapUtils.uriToBase64(data.getData(),
                        mActivity.getContentResolver(), true));
                return values;
            case REQUEST_ALL_FILE:
            default:
                return getURIDetails(data.getData());
        }
    }
    return null;
}
 
开发者ID:Odoo-mobile,项目名称:hr,代码行数:21,代码来源:OFileManager.java

示例8: doInBackground

import com.odoo.core.utils.BitmapUtils; //导入依赖的package包/类
@Override
protected List<Integer> doInBackground(final List<OValues>... params) {
    try {
        List<Integer> ids = new ArrayList<>();
        for (final OValues value : params[0]) {
            boolean isImage = (value.getString("file_type").contains("image"));
            value.put("datas", BitmapUtils.uriToBase64(
                    Uri.parse(value.getString("file_uri"))
                    , getContentResolver(), isImage
            ));
            ORecordValues data = IrAttachment.valuesToData(irAttachment, value);
            if (data != null) {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        progressDialog.setProgress(params[0].indexOf(value) + 1);
                    }
                });
                int newId = irAttachment.getServerDataHelper().createOnServer(data);
                value.put("id", newId);
                irAttachment.createAttachment(value, mailMessage.getModelName(),
                        0);
                ids.add(newId);
            }
        }
        return ids;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:32,代码来源:MailChatterCompose.java

示例9: 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;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:38,代码来源:MailChatterView.java

示例10: 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);
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:37,代码来源:MailDetailDialog.java

示例11: 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;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:13,代码来源:OFileManager.java

示例12: onViewBind

import com.odoo.core.utils.BitmapUtils; //导入依赖的package包/类
@Override
public void onViewBind(View view, Cursor cursor, ODataRow row) {
    Bitmap img;
    if (row.getString("image_small").equals("false")) {
        img = BitmapUtils.getAlphabetImage(getActivity(), row.getString("name"));
    } else {
        img = BitmapUtils.getBitmapImage(getActivity(), row.getString("image_small"));
    }
    OControls.setImage(view, R.id.image_small, img);
    OControls.setText(view, R.id.name, row.getString("name"));
    OControls.setText(view, R.id.company_name, (row.getString("company_name").equals("false"))
            ? "" : row.getString("company_name"));
    OControls.setText(view, R.id.email, (row.getString("email").equals("false") ? " "
            : row.getString("email")));
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:16,代码来源:Customers.java

示例13: onActivityResult

import com.odoo.core.utils.BitmapUtils; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    OValues values = fileManager.handleResult(requestCode, resultCode, data);
    if (values != null && !values.contains("size_limit_exceed")) {
        newImage = values.getString("datas");
        userImage.setScaleType(ImageView.ScaleType.CENTER_CROP);
        userImage.setColorFilter(null);
        userImage.setImageBitmap(BitmapUtils.getBitmapImage(this, newImage));
    } else if (values != null) {
        Toast.makeText(this, R.string.toast_image_size_too_large, Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:14,代码来源:CustomerDetails.java

示例14: onViewBind

import com.odoo.core.utils.BitmapUtils; //导入依赖的package包/类
@Override
public void onViewBind(int position, View view, Object data) {
    ODataRow row = (ODataRow) data;
    String[] display_names = row.getString("name").split(" / ");
    OControls.setText(view, android.R.id.text1, display_names[display_names.length - 1]);
    view.findViewById(R.id.subCategoryPadding).setVisibility(
            row.getInt("parent_id") != category.getInt(OColumn.ROW_ID) ? View.VISIBLE : View.GONE);
    BezelImageView icon = (BezelImageView) view.findViewById(R.id.categoryIcon);
    if (row.getString("image_medium").equals("false")) {
        icon.setImageResource(R.drawable.ic_action_image_lens);
    } else {
        icon.setImageBitmap(BitmapUtils.getBitmapImage(getContext(), row.getString("image_medium")));
    }
    icon.setVisibility(row.getInt("parent_id") == category.getInt(OColumn.ROW_ID) ? View.VISIBLE : View.GONE);
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:16,代码来源:ProductSubCategories.java

示例15: generateView

import com.odoo.core.utils.BitmapUtils; //导入依赖的package包/类
private void generateView(int position, View view, OUser user) {
    BezelImageView imgView = (BezelImageView) view.findViewById(R.id.imgInstance);
    if (user.getAvatar().equals("false")) {
        imgView.setImageResource(R.drawable.avatar);
    } else {
        imgView.setImageBitmap(BitmapUtils.getBitmapImage(mContext, user.getAvatar()));
    }
    imgView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imgView.autoSetMaskDrawable();
    OControls.setText(view, R.id.txvInstanceName, user.getName());
    OControls.setText(view, R.id.txvInstanceUrl, (user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());

}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:14,代码来源:OdooUserLoginSelectorDialog.java


注:本文中的com.odoo.core.utils.BitmapUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。