Java Code Examples for com.mob.tools.utils.ResHelper#getStringRes()
The following examples show how to use
com.mob.tools.utils.ResHelper#getStringRes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PRTHeader.java From enjoyshop with Apache License 2.0 | 5 votes |
public void onRequest() { ivArrow.setVisibility(View.GONE); pbRefreshing.setVisibility(View.VISIBLE); int resId = ResHelper.getStringRes(getContext(), "ssdk_oks_refreshing"); if (resId > 0) { tvHeader.setText(resId); } }
Example 2
Source File: EditPage.java From BaoKanAndroid with MIT License | 5 votes |
/** 执行分享时的方法 */ private void shareAndFinish() { int resId = ResHelper.getStringRes(activity, "ssdk_oks_sharing"); if (resId > 0) { Toast.makeText(activity, resId, Toast.LENGTH_SHORT).show(); } if (isDisableSSO()) { platform.SSOSetting(true); } platform.setPlatformActionListener(getCallback()); platform.share(sp); finish(); }
Example 3
Source File: PRTHeader.java From LiuAGeAndroid with MIT License | 5 votes |
public void onRequest() { ivArrow.setVisibility(View.GONE); pbRefreshing.setVisibility(View.VISIBLE); int resId = ResHelper.getStringRes(getContext(), "ssdk_oks_refreshing"); if (resId > 0) { tvHeader.setText(resId); } }
Example 4
Source File: EditPage.java From LiuAGeAndroid with MIT License | 5 votes |
/** 执行分享时的方法 */ private void shareAndFinish() { int resId = ResHelper.getStringRes(activity, "ssdk_oks_sharing"); if (resId > 0) { Toast.makeText(activity, resId, Toast.LENGTH_SHORT).show(); } if (isDisableSSO()) { platform.SSOSetting(true); } platform.setPlatformActionListener(getCallback()); platform.share(sp); finish(); }
Example 5
Source File: FriendListPage.java From LiuAGeAndroid with MIT License | 5 votes |
private void updateConfirmView() { int resId = ResHelper.getStringRes(activity, "ssdk_oks_confirm"); String confirm = "Confirm"; if(resId > 0) { confirm = getContext().getResources().getString(resId); } if(checkNum == 0) { tvConfirm.setText(confirm); } else if(checkNum > 0) { tvConfirm.setText(confirm + "(" + checkNum + ")"); } }
Example 6
Source File: PRTHeader.java From LQRWeChat with MIT License | 5 votes |
public void onRequest() { ivArrow.setVisibility(View.GONE); pbRefreshing.setVisibility(View.VISIBLE); int resId = ResHelper.getStringRes(getContext(), "ssdk_oks_refreshing"); if (resId > 0) { tvHeader.setText(resId); } }
Example 7
Source File: EditPage.java From enjoyshop with Apache License 2.0 | 5 votes |
/** 执行分享时的方法 */ private void shareAndFinish() { int resId = ResHelper.getStringRes(activity, "ssdk_oks_sharing"); if (resId > 0) { Toast.makeText(activity, resId, Toast.LENGTH_SHORT).show(); } if (isDisableSSO()) { platform.SSOSetting(true); } platform.setPlatformActionListener(getCallback()); platform.share(sp); finish(); }
Example 8
Source File: OnekeyShareThemeImpl.java From LQRWeChat with MIT License | 4 votes |
public final boolean handleMessage(Message msg) { switch (msg.arg1) { case 1: { // 成功 int resId = ResHelper.getStringRes(context, "ssdk_oks_share_completed"); if (resId > 0) { toast(context.getString(resId)); } } break; case 2: { // 失败 String expName = msg.obj.getClass().getSimpleName(); if ("WechatClientNotExistException".equals(expName) || "WechatTimelineNotSupportedException".equals(expName) || "WechatFavoriteNotSupportedException".equals(expName)) { toast("ssdk_wechat_client_inavailable"); } else if ("GooglePlusClientNotExistException".equals(expName)) { toast("ssdk_google_plus_client_inavailable"); } else if ("QQClientNotExistException".equals(expName)) { toast("ssdk_qq_client_inavailable"); } else if ("YixinClientNotExistException".equals(expName) || "YixinTimelineNotSupportedException".equals(expName)) { toast("ssdk_yixin_client_inavailable"); } else if ("KakaoTalkClientNotExistException".equals(expName)) { toast("ssdk_kakaotalk_client_inavailable"); } else if ("KakaoStoryClientNotExistException".equals(expName)) { toast("ssdk_kakaostory_client_inavailable"); } else if("WhatsAppClientNotExistException".equals(expName)){ toast("ssdk_whatsapp_client_inavailable"); } else if("FacebookMessengerClientNotExistException".equals(expName)){ toast("ssdk_facebookmessenger_client_inavailable"); } else { toast("ssdk_oks_share_failed"); } } break; case 3: { // 取消 toast("ssdk_oks_share_canceled"); } break; } return false; }
Example 9
Source File: FriendListPage.java From enjoyshop with Apache License 2.0 | 4 votes |
private void initTitle(RelativeLayout rlTitle, float ratio) { tvCancel = new TextView(activity); tvCancel.setTextColor(0xff3b3b3b); tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvCancel.setGravity(Gravity.CENTER); int resId = ResHelper.getStringRes(activity, "ssdk_oks_cancel"); if (resId > 0) { tvCancel.setText(resId); } int padding = (int) (DESIGN_LEFT_PADDING * ratio); tvCancel.setPadding(padding, 0, padding, 0); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); rlTitle.addView(tvCancel, lp); tvCancel.setOnClickListener(this); TextView tvTitle = new TextView(activity); tvTitle.setTextColor(0xff3b3b3b); tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); tvTitle.setGravity(Gravity.CENTER); resId = ResHelper.getStringRes(activity, "ssdk_oks_contacts"); if (resId > 0) { tvTitle.setText(resId); } lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT); rlTitle.addView(tvTitle, lp); tvConfirm = new TextView(activity); tvConfirm.setTextColor(0xffff6d11); tvConfirm.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvConfirm.setGravity(Gravity.CENTER); resId = ResHelper.getStringRes(activity, "ssdk_oks_confirm"); if (resId > 0) { tvConfirm.setText(resId); } tvConfirm.setPadding(padding, 0, padding, 0); lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlTitle.addView(tvConfirm, lp); tvConfirm.setOnClickListener(this); }
Example 10
Source File: OnekeyShareThemeImpl.java From BaoKanAndroid with MIT License | 4 votes |
public final boolean handleMessage(Message msg) { switch (msg.arg1) { case 1: { // 成功 int resId = ResHelper.getStringRes(context, "ssdk_oks_share_completed"); if (resId > 0) { toast(context.getString(resId)); } } break; case 2: { // 失败 String expName = msg.obj.getClass().getSimpleName(); if ("WechatClientNotExistException".equals(expName) || "WechatTimelineNotSupportedException".equals(expName) || "WechatFavoriteNotSupportedException".equals(expName)) { toast("ssdk_wechat_client_inavailable"); } else if ("GooglePlusClientNotExistException".equals(expName)) { toast("ssdk_google_plus_client_inavailable"); } else if ("QQClientNotExistException".equals(expName)) { toast("ssdk_qq_client_inavailable"); } else if ("YixinClientNotExistException".equals(expName) || "YixinTimelineNotSupportedException".equals(expName)) { toast("ssdk_yixin_client_inavailable"); } else if ("KakaoTalkClientNotExistException".equals(expName)) { toast("ssdk_kakaotalk_client_inavailable"); } else if ("KakaoStoryClientNotExistException".equals(expName)) { toast("ssdk_kakaostory_client_inavailable"); } else if("WhatsAppClientNotExistException".equals(expName)){ toast("ssdk_whatsapp_client_inavailable"); } else if("FacebookMessengerClientNotExistException".equals(expName)){ toast("ssdk_facebookmessenger_client_inavailable"); } else { toast("ssdk_oks_share_failed"); } } break; case 3: { // 取消 toast("ssdk_oks_share_canceled"); } break; } return false; }
Example 11
Source File: FriendListPage.java From LQRWeChat with MIT License | 4 votes |
private void initTitle(RelativeLayout rlTitle, float ratio) { tvCancel = new TextView(activity); tvCancel.setTextColor(0xff3b3b3b); tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvCancel.setGravity(Gravity.CENTER); int resId = ResHelper.getStringRes(activity, "ssdk_oks_cancel"); if (resId > 0) { tvCancel.setText(resId); } int padding = (int) (DESIGN_LEFT_PADDING * ratio); tvCancel.setPadding(padding, 0, padding, 0); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); rlTitle.addView(tvCancel, lp); tvCancel.setOnClickListener(this); TextView tvTitle = new TextView(activity); tvTitle.setTextColor(0xff3b3b3b); tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); tvTitle.setGravity(Gravity.CENTER); resId = ResHelper.getStringRes(activity, "ssdk_oks_contacts"); if (resId > 0) { tvTitle.setText(resId); } lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT); rlTitle.addView(tvTitle, lp); tvConfirm = new TextView(activity); tvConfirm.setTextColor(0xffff6d11); tvConfirm.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvConfirm.setGravity(Gravity.CENTER); resId = ResHelper.getStringRes(activity, "ssdk_oks_confirm"); if (resId > 0) { tvConfirm.setText(resId); } tvConfirm.setPadding(padding, 0, padding, 0); lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlTitle.addView(tvConfirm, lp); tvConfirm.setOnClickListener(this); }
Example 12
Source File: OnekeyShareThemeImpl.java From YiZhi with Apache License 2.0 | 4 votes |
public final boolean handleMessage(Message msg) { switch (msg.arg1) { case 1: { // 成功 int resId = ResHelper.getStringRes(context, "ssdk_oks_share_completed"); if (resId > 0) { toast(context.getString(resId)); } } break; case 2: { // 失败 String expName = msg.obj.getClass().getSimpleName(); if ("WechatClientNotExistException".equals(expName) || "WechatTimelineNotSupportedException".equals(expName) || "WechatFavoriteNotSupportedException".equals(expName)) { toast("ssdk_wechat_client_inavailable"); } else if ("GooglePlusClientNotExistException".equals(expName)) { toast("ssdk_google_plus_client_inavailable"); } else if ("QQClientNotExistException".equals(expName)) { toast("ssdk_qq_client_inavailable"); } else if ("YixinClientNotExistException".equals(expName) || "YixinTimelineNotSupportedException".equals(expName)) { toast("ssdk_yixin_client_inavailable"); } else if ("KakaoTalkClientNotExistException".equals(expName)) { toast("ssdk_kakaotalk_client_inavailable"); } else if ("KakaoStoryClientNotExistException".equals(expName)) { toast("ssdk_kakaostory_client_inavailable"); } else if("WhatsAppClientNotExistException".equals(expName)){ toast("ssdk_whatsapp_client_inavailable"); } else if("FacebookMessengerClientNotExistException".equals(expName)){ toast("ssdk_facebookmessenger_client_inavailable"); } else { toast("ssdk_oks_share_failed"); } } break; case 3: { // 取消 toast("ssdk_oks_share_canceled"); } break; } return false; }
Example 13
Source File: PlatformPageAdapter.java From BaoKanAndroid with MIT License | 4 votes |
private void refreshPanel(LinearLayout[] llCells, Object[] logos) { int cellBack = ResHelper.getBitmapRes(page.getContext(), "ssdk_oks_classic_platform_cell_back"); int disableBack = ResHelper.getBitmapRes(page.getContext(), "ssdk_oks_classic_platfrom_cell_back_nor"); for (int i = 0; i < logos.length; i++) { ImageView ivLogo = ResHelper.forceCast(llCells[i].getChildAt(0)); TextView tvName = ResHelper.forceCast(llCells[i].getChildAt(1)); if (logos[i] == null) { ivLogo.setVisibility(View.INVISIBLE); tvName.setVisibility(View.INVISIBLE); llCells[i].setBackgroundResource(disableBack); llCells[i].setOnClickListener(null); } else { ivLogo.setVisibility(View.VISIBLE); tvName.setVisibility(View.VISIBLE); llCells[i].setBackgroundResource(cellBack); llCells[i].setOnClickListener(this); llCells[i].setTag(logos[i]); if (logos[i] instanceof CustomerLogo) { CustomerLogo logo = ResHelper.forceCast(logos[i]); if (logo.logo != null) { ivLogo.setImageBitmap(logo.logo); } else { ivLogo.setImageBitmap(null); } if (logo.label != null) { tvName.setText(logo.label); } else { tvName.setText(""); } } else { Platform plat = ResHelper.forceCast(logos[i]); String name = plat.getName().toLowerCase(); int resId = ResHelper.getBitmapRes(ivLogo.getContext(),"ssdk_oks_classic_" + name); if (resId > 0) { ivLogo.setImageResource(resId); } else { ivLogo.setImageBitmap(null); } resId = ResHelper.getStringRes(tvName.getContext(), "ssdk_" + name); if (resId > 0) { tvName.setText(resId); } else { tvName.setText(""); } } } } }
Example 14
Source File: EditPageLand.java From BaoKanAndroid with MIT License | 4 votes |
private void initTitle(RelativeLayout rlTitle, float ratio) { tvCancel = new TextView(activity); tvCancel.setTextColor(0xff3b3b3b); tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvCancel.setGravity(Gravity.CENTER); int resId = ResHelper.getStringRes(activity, "ssdk_oks_cancel"); if (resId > 0) { tvCancel.setText(resId); } int padding = (int) (DESIGN_LEFT_PADDING * ratio); tvCancel.setPadding(padding, 0, padding, 0); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); rlTitle.addView(tvCancel, lp); tvCancel.setOnClickListener(this); TextView tvTitle = new TextView(activity); tvTitle.setTextColor(0xff3b3b3b); tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); tvTitle.setGravity(Gravity.CENTER); resId = ResHelper.getStringRes(activity, "ssdk_oks_multi_share"); if (resId > 0) { tvTitle.setText(resId); } lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT); rlTitle.addView(tvTitle, lp); tvShare = new TextView(activity); tvShare.setTextColor(0xffff6d11); tvShare.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvShare.setGravity(Gravity.CENTER); resId = ResHelper.getStringRes(activity, "ssdk_oks_share"); if (resId > 0) { tvShare.setText(resId); } tvShare.setPadding(padding, 0, padding, 0); lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlTitle.addView(tvShare, lp); tvShare.setOnClickListener(this); }
Example 15
Source File: EditPagePort.java From enjoyshop with Apache License 2.0 | 4 votes |
private void initTitle(RelativeLayout rlTitle, float ratio) { tvCancel = new TextView(activity); tvCancel.setTextColor(0xff3b3b3b); tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvCancel.setGravity(Gravity.CENTER); int resId = ResHelper.getStringRes(activity, "ssdk_oks_cancel"); if (resId > 0) { tvCancel.setText(resId); } int padding = (int) (DESIGN_LEFT_PADDING * ratio); tvCancel.setPadding(padding, 0, padding, 0); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); rlTitle.addView(tvCancel, lp); tvCancel.setOnClickListener(this); TextView tvTitle = new TextView(activity); tvTitle.setTextColor(0xff3b3b3b); tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); tvTitle.setGravity(Gravity.CENTER); resId = ResHelper.getStringRes(activity, "ssdk_oks_multi_share"); if (resId > 0) { tvTitle.setText(resId); } lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT); rlTitle.addView(tvTitle, lp); tvShare = new TextView(activity); tvShare.setTextColor(0xffff6d11); tvShare.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvShare.setGravity(Gravity.CENTER); resId = ResHelper.getStringRes(activity, "ssdk_oks_share"); if (resId > 0) { tvShare.setText(resId); } tvShare.setPadding(padding, 0, padding, 0); lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlTitle.addView(tvShare, lp); tvShare.setOnClickListener(this); }
Example 16
Source File: PlatformPageAdapter.java From YiZhi with Apache License 2.0 | 4 votes |
private void refreshPanel(LinearLayout[] llCells, Object[] logos) { int cellBack = ResHelper.getBitmapRes(page.getContext(), "ssdk_oks_classic_platform_cell_back"); int disableBack = ResHelper.getBitmapRes(page.getContext(), "ssdk_oks_classic_platfrom_cell_back_nor"); for (int i = 0; i < logos.length; i++) { ImageView ivLogo = ResHelper.forceCast(llCells[i].getChildAt(0)); TextView tvName = ResHelper.forceCast(llCells[i].getChildAt(1)); if (logos[i] == null) { ivLogo.setVisibility(View.INVISIBLE); tvName.setVisibility(View.INVISIBLE); llCells[i].setBackgroundResource(disableBack); llCells[i].setOnClickListener(null); } else { ivLogo.setVisibility(View.VISIBLE); tvName.setVisibility(View.VISIBLE); ivLogo.requestLayout(); tvName.requestLayout(); llCells[i].setBackgroundResource(cellBack); llCells[i].setOnClickListener(this); llCells[i].setTag(logos[i]); if (logos[i] instanceof CustomerLogo) { CustomerLogo logo = ResHelper.forceCast(logos[i]); if (logo.logo != null) { ivLogo.setImageBitmap(logo.logo); } else { ivLogo.setImageBitmap(null); } if (logo.label != null) { tvName.setText(logo.label); } else { tvName.setText(""); } } else { Platform plat = ResHelper.forceCast(logos[i]); String name = plat.getName().toLowerCase(); int resId = ResHelper.getBitmapRes(ivLogo.getContext(),"ssdk_oks_classic_" + name); if (resId > 0) { ivLogo.setImageResource(resId); } else { ivLogo.setImageBitmap(null); } resId = ResHelper.getStringRes(tvName.getContext(), "ssdk_" + name); if (resId > 0) { tvName.setText(resId); } else { tvName.setText(""); } } } } }
Example 17
Source File: EditPagePort.java From BaoKanAndroid with MIT License | 4 votes |
private void initTitle(RelativeLayout rlTitle, float ratio) { tvCancel = new TextView(activity); tvCancel.setTextColor(0xff3b3b3b); tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvCancel.setGravity(Gravity.CENTER); int resId = ResHelper.getStringRes(activity, "ssdk_oks_cancel"); if (resId > 0) { tvCancel.setText(resId); } int padding = (int) (DESIGN_LEFT_PADDING * ratio); tvCancel.setPadding(padding, 0, padding, 0); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); rlTitle.addView(tvCancel, lp); tvCancel.setOnClickListener(this); TextView tvTitle = new TextView(activity); tvTitle.setTextColor(0xff3b3b3b); tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); tvTitle.setGravity(Gravity.CENTER); resId = ResHelper.getStringRes(activity, "ssdk_oks_multi_share"); if (resId > 0) { tvTitle.setText(resId); } lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT); rlTitle.addView(tvTitle, lp); tvShare = new TextView(activity); tvShare.setTextColor(0xffff6d11); tvShare.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvShare.setGravity(Gravity.CENTER); resId = ResHelper.getStringRes(activity, "ssdk_oks_share"); if (resId > 0) { tvShare.setText(resId); } tvShare.setPadding(padding, 0, padding, 0); lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlTitle.addView(tvShare, lp); tvShare.setOnClickListener(this); }
Example 18
Source File: OnekeyShareThemeImpl.java From POCenter with MIT License | 4 votes |
public final boolean handleMessage(Message msg) { switch (msg.arg1) { case 1: { // 成功 int resId = ResHelper.getStringRes(context, "ssdk_oks_share_completed"); if (resId > 0) { toast(context.getString(resId)); } } break; case 2: { // 失败 String expName = msg.obj.getClass().getSimpleName(); if ("WechatClientNotExistException".equals(expName) || "WechatTimelineNotSupportedException".equals(expName) || "WechatFavoriteNotSupportedException".equals(expName)) { toast("ssdk_wechat_client_inavailable"); } else if ("GooglePlusClientNotExistException".equals(expName)) { toast("ssdk_google_plus_client_inavailable"); } else if ("QQClientNotExistException".equals(expName)) { toast("ssdk_qq_client_inavailable"); } else if ("YixinClientNotExistException".equals(expName) || "YixinTimelineNotSupportedException".equals(expName)) { toast("ssdk_yixin_client_inavailable"); } else if ("KakaoTalkClientNotExistException".equals(expName)) { toast("ssdk_kakaotalk_client_inavailable"); } else if ("KakaoStoryClientNotExistException".equals(expName)) { toast("ssdk_kakaostory_client_inavailable"); } else if("WhatsAppClientNotExistException".equals(expName)){ toast("ssdk_whatsapp_client_inavailable"); } else if("FacebookMessengerClientNotExistException".equals(expName)){ toast("ssdk_facebookmessenger_client_inavailable"); } else { toast("ssdk_oks_share_failed"); } } break; case 3: { // 取消 toast("ssdk_oks_share_canceled"); } break; } return false; }
Example 19
Source File: FriendListPage.java From POCenter with MIT License | 4 votes |
private void initTitle(RelativeLayout rlTitle, float ratio) { tvCancel = new TextView(activity); tvCancel.setTextColor(0xff3b3b3b); tvCancel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvCancel.setGravity(Gravity.CENTER); int resId = ResHelper.getStringRes(activity, "ssdk_oks_cancel"); if (resId > 0) { tvCancel.setText(resId); } int padding = (int) (DESIGN_LEFT_PADDING * ratio); tvCancel.setPadding(padding, 0, padding, 0); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); rlTitle.addView(tvCancel, lp); tvCancel.setOnClickListener(this); TextView tvTitle = new TextView(activity); tvTitle.setTextColor(0xff3b3b3b); tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); tvTitle.setGravity(Gravity.CENTER); resId = ResHelper.getStringRes(activity, "ssdk_oks_contacts"); if (resId > 0) { tvTitle.setText(resId); } lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT); rlTitle.addView(tvTitle, lp); tvConfirm = new TextView(activity); tvConfirm.setTextColor(0xffff6d11); tvConfirm.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvConfirm.setGravity(Gravity.CENTER); resId = ResHelper.getStringRes(activity, "ssdk_oks_confirm"); if (resId > 0) { tvConfirm.setText(resId); } tvConfirm.setPadding(padding, 0, padding, 0); lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlTitle.addView(tvConfirm, lp); tvConfirm.setOnClickListener(this); }
Example 20
Source File: PlatformPageAdapter.java From POCenter with MIT License | 4 votes |
private void refreshPanel(LinearLayout[] llCells, Object[] logos) { int cellBack = ResHelper.getBitmapRes(page.getContext(), "ssdk_oks_classic_platform_cell_back"); int disableBack = ResHelper.getBitmapRes(page.getContext(), "ssdk_oks_classic_platfrom_cell_back_nor"); for (int i = 0; i < logos.length; i++) { ImageView ivLogo = ResHelper.forceCast(llCells[i].getChildAt(0)); TextView tvName = ResHelper.forceCast(llCells[i].getChildAt(1)); if (logos[i] == null) { ivLogo.setVisibility(View.INVISIBLE); tvName.setVisibility(View.INVISIBLE); llCells[i].setBackgroundResource(disableBack); llCells[i].setOnClickListener(null); } else { ivLogo.setVisibility(View.VISIBLE); tvName.setVisibility(View.VISIBLE); llCells[i].setBackgroundResource(cellBack); llCells[i].setOnClickListener(this); llCells[i].setTag(logos[i]); if (logos[i] instanceof CustomerLogo) { CustomerLogo logo = ResHelper.forceCast(logos[i]); if (logo.logo != null) { ivLogo.setImageBitmap(logo.logo); } else { ivLogo.setImageBitmap(null); } if (logo.label != null) { tvName.setText(logo.label); } else { tvName.setText(""); } } else { Platform plat = ResHelper.forceCast(logos[i]); String name = plat.getName().toLowerCase(); int resId = ResHelper.getBitmapRes(ivLogo.getContext(),"ssdk_oks_classic_" + name); if (resId > 0) { ivLogo.setImageResource(resId); } else { ivLogo.setImageBitmap(null); } resId = ResHelper.getStringRes(tvName.getContext(), "ssdk_" + name); if (resId > 0) { tvName.setText(resId); } else { tvName.setText(""); } } } } }