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


Java OControls类代码示例

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


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

示例1: init

import com.odoo.core.utils.OControls; //导入依赖的package包/类
private void init() {
    TextView recordName = (TextView) findViewById(R.id.recordName);
    parent = (View) recordName.getParent().getParent();
    ODataRow record = mModel.browse(mModel.selectRowId(server_id));
    String name = record.getString(mModel.getDefaultNameColumn());
    findViewById(R.id.dialogHeader)
            .setBackgroundColor(OStringColorUtil.getStringColor(this, name));
    if (mType == MessageType.Message) {
        edtSubject.setText("Re: " + name);
        recordName.setText(String.format(OResource.string(this, R.string.message_to), name));
    } else {
        recordName.setText(R.string.add_internal_note);
        edtSubject.setVisibility(View.GONE);
        edtBody.setHint(R.string.internal_note_hint);
        OControls.setText(parent, R.id.btnSend, R.string.label_log_note);
    }
    edtBody.requestFocus();
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:19,代码来源:MailChatterCompose.java

示例2: addAttachment

import com.odoo.core.utils.OControls; //导入依赖的package包/类
private void addAttachment(ODataRow values) {
    View attachmentView = LayoutInflater.from(this)
            .inflate(R.layout.base_attachment_item, horizontalScrollView, false);
    String fileName = values.getString("name");
    String type = values.getString("file_type");
    ImageView imgPreview = (ImageView) attachmentView.findViewById(R.id.attachmentPreview);
    if (type.contains("image")) {
        if (!values.getString("file_uri").equals("false")) {
            Uri uri = Uri.parse(values.getString("file_uri"));
            imgPreview.setImageBitmap(fileManager.getBitmapFromURI(uri));
        } else
            imgPreview.setImageResource(R.drawable.image);
    } else if (type.contains("audio")) {
        imgPreview.setImageResource(R.drawable.audio);
    } else if (type.contains("video")) {
        imgPreview.setImageResource(R.drawable.video);
    } else {
        imgPreview.setImageResource(R.drawable.file);
    }
    OControls.setText(attachmentView, R.id.attachmentFileName, fileName);
    attachmentView.setTag(values);
    attachmentView.findViewById(R.id.btnRemoveAttachment).setVisibility(View.GONE);
    attachmentView.setOnClickListener(this);
    horizontalScrollView.addView(attachmentView);
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:26,代码来源:MailDetailDialog.java

示例3: bindProduct

import com.odoo.core.utils.OControls; //导入依赖的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

示例4: calculatePrice

import com.odoo.core.utils.OControls; //导入依赖的package包/类
private void calculatePrice() {
    float price_extra = 0;
    for (String key : price_extra_list.keySet()) {
        price_extra += price_extra_list.get(key);
    }
    float discountPrice = productTemplate.getFloat("price");
    double list_price = Float.parseFloat(productTemplate.getString("list_price"));
    if (discountPrice != productTemplate.getFloat("list_price")) {
        findViewById(R.id.layoutDiscount).setVisibility(View.VISIBLE);
        OControls.setTextViewStrikeThrough(getContainer(), R.id.productOriginalPrice);
        OControls.setText(getContainer(), R.id.productOriginalPrice, getPriceWithCurrency((list_price + price_extra) + ""));
        double percent = Math.ceil(100 - (discountPrice / productTemplate.getFloat("list_price") * 100));
        OControls.setText(getContainer(), R.id.productDiscount, percent + "% OFF");
        double discount = ((list_price + price_extra) * percent) / 100;
        list_price = (list_price + price_extra) - discount;
        OControls.setVisible(getContainer(), R.id.productSavedPrice);
        OControls.setText(getContainer(), R.id.productSavedPrice,
                String.format(OResource.string(getContext(), R.string.you_saved), getPriceWithCurrency(discount + ""))
        );
    }
    OControls.setText(getContainer(), R.id.finalProductPrice, getPriceWithCurrency((list_price) + ""));
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:23,代码来源:ProductDetail.java

示例5: bindPaymentAndDelivery

import com.odoo.core.utils.OControls; //导入依赖的package包/类
private void bindPaymentAndDelivery() {
    deliveryAndPaymentOptions = (ExpandableListControl) findViewById(R.id.deliveryAndPaymentOptions);
    final List<Object> items = new ArrayList<>();
    ExpandableListControl.ExpandableListAdapter adapter = deliveryAndPaymentOptions.getAdapter(R.layout.shop_payment_delivery_item, items,
            new ExpandableListControl.ExpandableListAdapterGetViewListener() {
                @Override
                public View getView(int position, View view, ViewGroup parent) {
                    OControls.setText(view, android.R.id.title, items.get(position));
                    return view;
                }
            });
    items.add("Cash On Delivery Available");
    items.add("30-day money-back guarantee");
    items.add("Free Shipping in India");
    adapter.notifyDataSetChanged(items);
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:17,代码来源:ProductDetail.java

示例6: onPostExecute

import com.odoo.core.utils.OControls; //导入依赖的package包/类
@Override
protected void onPostExecute(Void aVoid) {
    super.onPostExecute(aVoid);
    OControls.setGone(getContainer(), R.id.productLoadingLayout);
    OControls.setVisible(getContainer(), R.id.productLayout);
    new AsyncTask<Void, Void, Void>() {

        @Override
        protected Void doInBackground(Void... params) {
            getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    bindProduct();
                }
            });
            return null;
        }
    }.execute();
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:20,代码来源:ProductDetail.java

示例7: generateView

import com.odoo.core.utils.OControls; //导入依赖的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

示例8: bindCategoryViews

import com.odoo.core.utils.OControls; //导入依赖的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

示例9: addAttachment

import com.odoo.core.utils.OControls; //导入依赖的package包/类
private void addAttachment(ODataRow values) {
    View attachmentView = LayoutInflater.from(this)
            .inflate(R.layout.base_attachment_item, horizontalScrollView, false);
    String fileName = values.getString("name");
    String type = values.getString("file_type");
    ImageView imgPreview = (ImageView) attachmentView.findViewById(R.id.attachmentPreview);
    if (type.contains("image")) {
        if (!values.getString("file_uri").equals("false")) {
            Uri uri = Uri.parse(new File(values.getString("file_uri")).toString());
            imgPreview.setImageBitmap(fileManager.getBitmapFromURI(uri));
        } else
            imgPreview.setImageResource(R.drawable.image);
    } else if (type.contains("audio")) {
        imgPreview.setImageResource(R.drawable.audio);
    } else if (type.contains("video")) {
        imgPreview.setImageResource(R.drawable.video);
    } else {
        imgPreview.setImageResource(R.drawable.file);
    }
    OControls.setText(attachmentView, R.id.attachmentFileName, fileName);
    attachmentView.setTag(values);
    attachmentView.findViewById(R.id.btnRemoveAttachment).setVisibility(View.GONE);
    attachmentView.setOnClickListener(this);
    horizontalScrollView.addView(attachmentView);
}
 
开发者ID:Odoo-mobile,项目名称:hr,代码行数:26,代码来源:MailDetailDialog.java

示例10: addAttachment

import com.odoo.core.utils.OControls; //导入依赖的package包/类
private void addAttachment(OValues values) {
    View attachmentView = LayoutInflater.from(this)
            .inflate(R.layout.base_attachment_item, horizontalScrollView, false);
    String fileName = values.getString("name");
    String type = values.getString("file_type");
    ImageView imgPreview = (ImageView) attachmentView.findViewById(R.id.attachmentPreview);
    if (type.contains("image")) {
        OLog.log(values.getString("file_uri"));
        imgPreview.setImageURI(Uri.parse(values.getString("file_uri")));
    } else if (type.contains("audio")) {
        imgPreview.setImageResource(R.drawable.audio);
    } else if (type.contains("video")) {
        imgPreview.setImageResource(R.drawable.video);
    } else {
        imgPreview.setImageResource(R.drawable.file);
    }
    OControls.setText(attachmentView, R.id.attachmentFileName, fileName);
    attachmentView.setTag(values);
    attachmentView.findViewById(R.id.btnRemoveAttachment)
            .setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    horizontalScrollView.removeView(
                            (View) v.getParent()
                    );
                }
            });
    horizontalScrollView.addView(attachmentView);
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:30,代码来源:MailChatterCompose.java

示例11: getView

import com.odoo.core.utils.OControls; //导入依赖的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

示例12: init

import com.odoo.core.utils.OControls; //导入依赖的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

示例13: onViewCreated

import com.odoo.core.utils.OControls; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    OdooNews news = new OdooNews(getActivity());
    getArgument();
    ODataRow row = news.browse(id);
    OControls.setText(view, R.id.detailSubject, row.getString("subject"));
    WebView wvMessage = (WebView) view.findViewById(R.id.detailMessage);
    wvMessage.loadData(row.getString("message"), "text/html;UTF-8", "UTF-8");

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

示例14: getCustomView

import com.odoo.core.utils.OControls; //导入依赖的package包/类
@Override
public View getCustomView(Context context, SliderItem item, ViewGroup parent) {
    View view = LayoutInflater.from(context).inflate(R.layout.base_intro_slider_view, parent, false);
    OControls.setText(view, R.id.big_title, item.getTitle());
    OControls.setImage(view, R.id.slider_image, item.getImagePath());
    OControls.setText(view, R.id.sub_title, item.getExtras().get("sub_title").toString());
    OControls.setText(view, R.id.description, item.getContent());
    return view;

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

示例15: bindOptions

import com.odoo.core.utils.OControls; //导入依赖的package包/类
private void bindOptions() {
    optionsView.removeAllViews();
    for (ODataRow val : mAttrValues) {
        LinearLayout item = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.shop_cart_attr_option_value_item, optionsView, false);
        OControls.setText(item, R.id.attrValueName, val.getString("name"));
        item.setTag(val);
        item.setOnClickListener(this);
        optionsView.addView(item);
    }
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:11,代码来源:ProductAttributeValuesView.java


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