當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。