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


Java R.dipToPx方法代码示例

本文整理汇总了Java中com.mob.tools.utils.R.dipToPx方法的典型用法代码示例。如果您正苦于以下问题:Java R.dipToPx方法的具体用法?Java R.dipToPx怎么用?Java R.dipToPx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mob.tools.utils.R的用法示例。


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

示例1: a

import com.mob.tools.utils.R; //导入方法依赖的package包/类
private Bitmap a(Context context, String str) {
    File file = new File(str);
    if (file.exists()) {
        CompressFormat bmpFormat = BitmapHelper.getBmpFormat(str);
        int dipToPx = R.dipToPx(context, 120);
        if (CompressFormat.PNG == bmpFormat) {
            dipToPx = R.dipToPx(context, 90);
        }
        Bitmap decodeFile = BitmapFactory.decodeFile(str, new Options());
        if (file.length() > this.b) {
            Bitmap bitmap = decodeFile;
            while (dipToPx > 40 && a(bitmap, bmpFormat) > 32768) {
                int i = dipToPx - 5;
                int width = bitmap.getWidth();
                int height = bitmap.getHeight();
                double d = (height > i || width > i) ? height > width ? ((double) i) / ((double) height) : ((double) i) / ((double) width) : PathListView.NO_ZOOM;
                bitmap = Bitmap.createScaledBitmap(bitmap, (int) (((double) width) * d), (int) (d * ((double) height)), true);
                dipToPx = i;
            }
            OutputStream fileOutputStream = new FileOutputStream(File.createTempFile("sina_bm_tmp", "." + bmpFormat.name().toLowerCase()));
            bitmap.compress(bmpFormat, 100, fileOutputStream);
            fileOutputStream.flush();
            fileOutputStream.close();
            return bitmap;
        }
        Ln.i("sina weibo decode bitmap size ==>>" + a(decodeFile, bmpFormat), new Object[0]);
        return decodeFile;
    }
    throw new FileNotFoundException();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:31,代码来源:SinaActivity.java

示例2: getPageView

import com.mob.tools.utils.R; //导入方法依赖的package包/类
private RelativeLayout getPageView() {
    this.rlPage = new RelativeLayout(getContext());
    this.rlPage.setBackgroundDrawable(this.background);
    if (this.dialogMode) {
        RelativeLayout rlDialog = new RelativeLayout(getContext());
        rlDialog.setBackgroundColor(-1070452174);
        int dp_8 = R.dipToPx(getContext(), 8);
        LayoutParams lpDialog = new LayoutParams(R.getScreenWidth(getContext()) - (dp_8 * 2), -2);
        lpDialog.topMargin = dp_8;
        lpDialog.bottomMargin = dp_8;
        lpDialog.addRule(13);
        rlDialog.setLayoutParams(lpDialog);
        this.rlPage.addView(rlDialog);
        rlDialog.addView(getPageTitle());
        rlDialog.addView(getPageBody());
        rlDialog.addView(getImagePin());
    } else {
        this.rlPage.addView(getPageTitle());
        this.rlPage.addView(getPageBody());
        this.rlPage.addView(getImagePin());
    }
    return this.rlPage;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:EditPage.java

示例3: getPageBody

import com.mob.tools.utils.R; //导入方法依赖的package包/类
private LinearLayout getPageBody() {
    this.llBody = new LinearLayout(getContext());
    this.llBody.setId(2);
    int resId = R.getBitmapRes(this.activity, "edittext_back");
    if (resId > 0) {
        this.llBody.setBackgroundResource(resId);
    }
    this.llBody.setOrientation(1);
    LayoutParams lpBody = new LayoutParams(-2, -2);
    lpBody.addRule(5, this.llTitle.getId());
    lpBody.addRule(3, this.llTitle.getId());
    lpBody.addRule(7, this.llTitle.getId());
    if (!this.dialogMode) {
        lpBody.addRule(12);
    }
    int dp_3 = R.dipToPx(getContext(), 3);
    lpBody.setMargins(dp_3, dp_3, dp_3, dp_3);
    this.llBody.setLayoutParams(lpBody);
    this.llBody.addView(getMainBody());
    this.llBody.addView(getSep());
    this.llBody.addView(getPlatformList());
    return this.llBody;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:EditPage.java

示例4: getMainBody

import com.mob.tools.utils.R; //导入方法依赖的package包/类
private LinearLayout getMainBody() {
    LinearLayout llMainBody = new LinearLayout(getContext());
    llMainBody.setOrientation(1);
    LinearLayout.LayoutParams lpMain = new LinearLayout.LayoutParams(-1, -2);
    lpMain.weight = 1.0f;
    int dp_4 = R.dipToPx(getContext(), 4);
    lpMain.setMargins(dp_4, dp_4, dp_4, dp_4);
    llMainBody.setLayoutParams(lpMain);
    LinearLayout llContent = new LinearLayout(getContext());
    LinearLayout.LayoutParams lpContent = new LinearLayout.LayoutParams(-1, -2);
    lpContent.weight = 1.0f;
    llMainBody.addView(llContent, lpContent);
    this.etContent = new EditText(getContext());
    this.etContent.setGravity(51);
    this.etContent.setBackgroundDrawable(null);
    this.etContent.setText(String.valueOf(this.shareParamMap.get("text")));
    this.etContent.addTextChangedListener(this);
    LinearLayout.LayoutParams lpEt = new LinearLayout.LayoutParams(-2, -2);
    lpEt.weight = 1.0f;
    this.etContent.setLayoutParams(lpEt);
    llContent.addView(this.etContent);
    llContent.addView(getThumbView());
    llMainBody.addView(getBodyBottom());
    return llMainBody;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:26,代码来源:EditPage.java

示例5: a

import com.mob.tools.utils.R; //导入方法依赖的package包/类
private byte[] a(Context context, Bitmap bitmap, CompressFormat compressFormat) {
    if (bitmap == null) {
        throw new RuntimeException("checkArgs fail, thumbData is null");
    } else if (bitmap.isRecycled()) {
        throw new RuntimeException("checkArgs fail, thumbData is recycled");
    } else {
        int i = 120;
        while (i > 40 && a(bitmap, compressFormat) > 32768) {
            int dipToPx = R.dipToPx(context, i);
            i -= 5;
            bitmap = a(bitmap, dipToPx);
        }
        OutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        bitmap.compress(compressFormat, 100, byteArrayOutputStream);
        byteArrayOutputStream.flush();
        byteArrayOutputStream.close();
        return byteArrayOutputStream.toByteArray();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:WechatHelper.java

示例6: getView

import com.mob.tools.utils.R; //导入方法依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
    FollowListItem item;
    boolean simpleMode = "FacebookMessenger".equals(this.platform.getName());
    if (convertView == null) {
        View llItem = new LinearLayout(parent.getContext());
        item = new FollowListItem();
        llItem.setTag(item);
        convertView = llItem;
        int dp_52 = R.dipToPx(getContext(), 52);
        int dp_10 = R.dipToPx(parent.getContext(), 10);
        int dp_5 = R.dipToPx(parent.getContext(), 5);
        if (!simpleMode) {
            item.aivIcon = new AsyncImageView(getContext());
            LayoutParams lpIcon = new LayoutParams(dp_52, dp_52);
            lpIcon.gravity = 16;
            lpIcon.setMargins(dp_10, dp_5, dp_10, dp_5);
            item.aivIcon.setLayoutParams(lpIcon);
            llItem.addView(item.aivIcon);
        }
        LinearLayout llText = new LinearLayout(parent.getContext());
        llText.setPadding(0, dp_10, dp_10, dp_10);
        llText.setOrientation(1);
        LayoutParams lpText = new LayoutParams(-2, -2);
        lpText.gravity = 16;
        lpText.weight = 1.0f;
        llText.setLayoutParams(lpText);
        llItem.addView(llText);
        item.tvName = new TextView(parent.getContext());
        item.tvName.setTextColor(-16777216);
        item.tvName.setTextSize(1, 18.0f);
        item.tvName.setSingleLine();
        if (simpleMode) {
            item.tvName.setPadding(dp_10, 0, 0, 0);
        }
        llText.addView(item.tvName);
        if (!simpleMode) {
            item.tvSign = new TextView(parent.getContext());
            item.tvSign.setTextColor(2130706432);
            item.tvSign.setTextSize(1, 14.0f);
            item.tvSign.setSingleLine();
            llText.addView(item.tvSign);
        }
        item.ivCheck = new ImageView(parent.getContext());
        item.ivCheck.setPadding(0, 0, dp_10, 0);
        LayoutParams lpCheck = new LayoutParams(-2, -2);
        lpCheck.gravity = 16;
        item.ivCheck.setLayoutParams(lpCheck);
        llItem.addView(item.ivCheck);
    } else {
        item = (FollowListItem) convertView.getTag();
    }
    Following following = getItem(position);
    item.tvName.setText(following.screenName);
    if (!simpleMode) {
        item.tvSign.setText(following.description);
    }
    item.ivCheck.setImageBitmap(following.checked ? this.bmChd : this.bmUnch);
    if (!simpleMode) {
        if (isFling()) {
            Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon);
            if (bm == null || bm.isRecycled()) {
                item.aivIcon.execute(null, 0);
            } else {
                item.aivIcon.setImageBitmap(bm);
            }
        } else {
            item.aivIcon.execute(following.icon, 0);
        }
    }
    if (position == getCount() - 1) {
        next();
    }
    return convertView;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:75,代码来源:FollowListPage.java

示例7: PRTHeader

import com.mob.tools.utils.R; //导入方法依赖的package包/类
public PRTHeader(Context context) {
    super(context);
    setOrientation(1);
    LinearLayout llInner = new LinearLayout(context);
    LayoutParams lpInner = new LayoutParams(-2, -2);
    lpInner.gravity = 1;
    addView(llInner, lpInner);
    this.ivArrow = new RotateImageView(context);
    int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr");
    if (resId > 0) {
        this.ivArrow.setImageResource(resId);
    }
    int dp_32 = R.dipToPx(context, 32);
    LayoutParams lpIv = new LayoutParams(dp_32, dp_32);
    lpIv.gravity = 16;
    llInner.addView(this.ivArrow, lpIv);
    this.pbRefreshing = new ProgressBar(context);
    llInner.addView(this.pbRefreshing, lpIv);
    this.pbRefreshing.setVisibility(8);
    this.tvHeader = new TextView(getContext());
    this.tvHeader.setTextSize(1, 18.0f);
    this.tvHeader.setGravity(17);
    int dp_10 = R.dipToPx(getContext(), 10);
    this.tvHeader.setPadding(dp_10, dp_10, dp_10, dp_10);
    this.tvHeader.setTextColor(-16777216);
    LayoutParams lpTv = new LayoutParams(-2, -2);
    lpTv.gravity = 16;
    llInner.addView(this.tvHeader, lpTv);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:30,代码来源:FollowListPage.java

示例8: getView

import com.mob.tools.utils.R; //导入方法依赖的package包/类
private LinearLayout getView(int position, OnClickListener ocL, Context context) {
    Bitmap logo;
    String label;
    OnClickListener listener;
    if (this.beans[position] instanceof Platform) {
        logo = getIcon((Platform) this.beans[position]);
        label = getName((Platform) this.beans[position]);
        listener = ocL;
    } else {
        logo = ((CustomerLogo) this.beans[position]).enableLogo;
        label = ((CustomerLogo) this.beans[position]).label;
        listener = ocL;
    }
    LinearLayout ll = new LinearLayout(context);
    ll.setOrientation(1);
    ImageView iv = new ImageView(context);
    int dp_5 = R.dipToPx(context, 5);
    iv.setPadding(dp_5, dp_5, dp_5, dp_5);
    iv.setScaleType(ScaleType.CENTER_INSIDE);
    LayoutParams lpIv = new LayoutParams(-2, -2);
    lpIv.setMargins(dp_5, dp_5, dp_5, dp_5);
    lpIv.gravity = 1;
    iv.setLayoutParams(lpIv);
    iv.setImageBitmap(logo);
    ll.addView(iv);
    TextView tv = new TextView(context);
    tv.setTextColor(AbstractWheelTextAdapter.DEFAULT_TEXT_COLOR);
    tv.setTextSize(1, 14.0f);
    tv.setSingleLine();
    tv.setIncludeFontPadding(false);
    LayoutParams lpTv = new LayoutParams(-2, -2);
    lpTv.gravity = 1;
    lpTv.weight = 1.0f;
    lpTv.setMargins(dp_5, 0, dp_5, dp_5);
    tv.setLayoutParams(lpTv);
    tv.setText(label);
    ll.addView(tv);
    ll.setOnClickListener(listener);
    return ll;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:41,代码来源:PlatformGridView.java

示例9: getPlatformList

import com.mob.tools.utils.R; //导入方法依赖的package包/类
private LinearLayout getPlatformList() {
    LinearLayout llToolBar = new LinearLayout(getContext());
    llToolBar.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
    TextView tvShareTo = new TextView(getContext());
    int resId = R.getStringRes(this.activity, "share_to");
    if (resId > 0) {
        tvShareTo.setText(resId);
    }
    tvShareTo.setTextColor(-3158065);
    tvShareTo.setTextSize(1, 18.0f);
    int dp_9 = R.dipToPx(getContext(), 9);
    LinearLayout.LayoutParams lpShareTo = new LinearLayout.LayoutParams(-2, -2);
    lpShareTo.gravity = 16;
    lpShareTo.setMargins(dp_9, 0, 0, 0);
    tvShareTo.setLayoutParams(lpShareTo);
    llToolBar.addView(tvShareTo);
    HorizontalScrollView sv = new HorizontalScrollView(getContext());
    sv.setHorizontalScrollBarEnabled(false);
    sv.setHorizontalFadingEdgeEnabled(false);
    LinearLayout.LayoutParams lpSv = new LinearLayout.LayoutParams(-2, -2);
    lpSv.setMargins(dp_9, dp_9, dp_9, dp_9);
    sv.setLayoutParams(lpSv);
    llToolBar.addView(sv);
    this.llPlat = new LinearLayout(getContext());
    this.llPlat.setLayoutParams(new FrameLayout.LayoutParams(-2, -1));
    sv.addView(this.llPlat);
    return llToolBar;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:29,代码来源:EditPage.java

示例10: getImagePin

import com.mob.tools.utils.R; //导入方法依赖的package包/类
private ImageView getImagePin() {
    this.ivPin = new ImageView(getContext());
    int resId = R.getBitmapRes(this.activity, "pin");
    if (resId > 0) {
        this.ivPin.setImageResource(resId);
    }
    LayoutParams lp = new LayoutParams(R.dipToPx(getContext(), 80), R.dipToPx(getContext(), 36));
    lp.topMargin = R.dipToPx(getContext(), 6);
    lp.addRule(6, this.llBody.getId());
    lp.addRule(11);
    this.ivPin.setLayoutParams(lp);
    this.ivPin.setVisibility(8);
    return this.ivPin;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:15,代码来源:EditPage.java

示例11: initPageView

import com.mob.tools.utils.R; //导入方法依赖的package包/类
private void initPageView() {
    this.flPage = new FrameLayout(getContext());
    this.flPage.setOnClickListener(this);
    this.flPage.setBackgroundDrawable(new ColorDrawable(1426063360));
    this.llPage = new LinearLayout(getContext()) {
        public boolean onTouchEvent(MotionEvent event) {
            return true;
        }
    };
    this.llPage.setOrientation(1);
    this.llPage.setBackgroundDrawable(new ColorDrawable(-1));
    LayoutParams lpLl = new LayoutParams(-1, -2);
    lpLl.gravity = 80;
    this.llPage.setLayoutParams(lpLl);
    this.flPage.addView(this.llPage);
    this.grid = new PlatformGridView(getContext());
    this.grid.setEditPageBackground(getBackgroundView());
    this.grid.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
    this.llPage.addView(this.grid);
    this.btnCancel = new Button(getContext());
    this.btnCancel.setTextColor(AbstractWheelTextAdapter.DEFAULT_TEXT_COLOR);
    this.btnCancel.setTextSize(1, 20.0f);
    int resId = R.getStringRes(getContext(), "cancel");
    if (resId > 0) {
        this.btnCancel.setText(resId);
    }
    this.btnCancel.setPadding(0, 0, 0, R.dipToPx(getContext(), 5));
    resId = R.getBitmapRes(getContext(), "classic_platform_corners_bg");
    if (resId > 0) {
        this.btnCancel.setBackgroundResource(resId);
    } else {
        this.btnCancel.setBackgroundDrawable(new ColorDrawable(-1));
    }
    LinearLayout.LayoutParams lpBtn = new LinearLayout.LayoutParams(-1, R.dipToPx(getContext(), 45));
    int dp_10 = R.dipToPx(getContext(), 10);
    lpBtn.setMargins(dp_10, dp_10, dp_10, dp_10);
    this.btnCancel.setLayoutParams(lpBtn);
    this.llPage.addView(this.btnCancel);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:40,代码来源:PlatformListPage.java

示例12: getAtLine

import com.mob.tools.utils.R; //导入方法依赖的package包/类
private LinearLayout getAtLine(String platform) {
    if (!isShowAtUserLayout(platform)) {
        return null;
    }
    LinearLayout llAt = new LinearLayout(getContext());
    LinearLayout.LayoutParams lpAt = new LinearLayout.LayoutParams(-2, -2);
    lpAt.rightMargin = R.dipToPx(getContext(), 4);
    lpAt.gravity = 83;
    lpAt.weight = 1.0f;
    llAt.setLayoutParams(lpAt);
    llAt.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            FollowListPage subPage = new FollowListPage();
            subPage.setPlatform((Platform) EditPage.this.platforms.get(0));
            subPage.showForResult(EditPage.this.activity, null, EditPage.this);
        }
    });
    TextView tvAt = new TextView(getContext());
    int resId = R.getBitmapRes(this.activity, "btn_back_nor");
    if (resId > 0) {
        tvAt.setBackgroundResource(resId);
    }
    int dp_32 = R.dipToPx(getContext(), 32);
    tvAt.setLayoutParams(new LinearLayout.LayoutParams(dp_32, dp_32));
    tvAt.setTextSize(1, 18.0f);
    tvAt.setText(getAtUserButtonText(platform));
    tvAt.setPadding(0, 0, 0, R.dipToPx(getContext(), 2));
    tvAt.setTypeface(Typeface.DEFAULT_BOLD);
    tvAt.setTextColor(-16777216);
    tvAt.setGravity(17);
    llAt.addView(tvAt);
    TextView tvName = new TextView(getContext());
    tvName.setTextSize(1, 18.0f);
    tvName.setTextColor(-16777216);
    resId = R.getStringRes(this.activity, "list_friends");
    tvName.setText(getContext().getString(resId, new Object[]{getName(platform)}));
    LinearLayout.LayoutParams lpName = new LinearLayout.LayoutParams(-2, -2);
    lpName.gravity = 16;
    tvName.setLayoutParams(lpName);
    llAt.addView(tvName);
    return llAt;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:43,代码来源:EditPage.java

示例13: afterPlatformListGot

import com.mob.tools.utils.R; //导入方法依赖的package包/类
public void afterPlatformListGot() {
    int size;
    if (this.platformList == null) {
        size = 0;
    } else {
        size = this.platformList.length;
    }
    this.views = new View[size];
    final int dp_24 = R.dipToPx(getContext(), 24);
    LinearLayout.LayoutParams lpItem = new LinearLayout.LayoutParams(dp_24, dp_24);
    final int dp_9 = R.dipToPx(getContext(), 9);
    lpItem.setMargins(0, 0, dp_9, 0);
    FrameLayout.LayoutParams lpMask = new FrameLayout.LayoutParams(-1, -1);
    lpMask.gravity = 51;
    int selection = 0;
    for (int i = 0; i < size; i++) {
        FrameLayout fl = new FrameLayout(getContext());
        fl.setLayoutParams(lpItem);
        if (i >= size - 1) {
            fl.setLayoutParams(new LinearLayout.LayoutParams(dp_24, dp_24));
        }
        this.llPlat.addView(fl);
        fl.setOnClickListener(this);
        ImageView iv = new ImageView(getContext());
        iv.setScaleType(ScaleType.CENTER_INSIDE);
        iv.setImageBitmap(getPlatLogo(this.platformList[i]));
        iv.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
        fl.addView(iv);
        this.views[i] = new View(getContext());
        this.views[i].setBackgroundColor(-805306369);
        this.views[i].setOnClickListener(this);
        String platformName = this.platformList[i].getName();
        for (Platform plat : this.platforms) {
            if (platformName.equals(plat.getName())) {
                this.views[i].setVisibility(4);
                selection = i;
            }
        }
        this.views[i].setLayoutParams(lpMask);
        fl.addView(this.views[i]);
    }
    final int postSel = selection;
    UIHandler.sendEmptyMessageDelayed(0, 333, new Callback() {
        public boolean handleMessage(Message msg) {
            ((HorizontalScrollView) EditPage.this.llPlat.getParent()).scrollTo(postSel * (dp_24 + dp_9), 0);
            return false;
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:50,代码来源:EditPage.java


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