本文整理汇总了Java中com.mob.tools.utils.ResHelper类的典型用法代码示例。如果您正苦于以下问题:Java ResHelper类的具体用法?Java ResHelper怎么用?Java ResHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResHelper类属于com.mob.tools.utils包,在下文中一共展示了ResHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onKeyEvent
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
public boolean onKeyEvent(int keyCode, KeyEvent event) {
try {
int resId = ResHelper.getIdRes(activity, "llSearch");
if (keyCode == KeyEvent.KEYCODE_BACK
&& event.getAction() == KeyEvent.ACTION_DOWN
&& activity.findViewById(resId).getVisibility() == View.VISIBLE) {
activity.findViewById(resId).setVisibility(View.GONE);
resId = ResHelper.getIdRes(activity, "llTitle");
activity.findViewById(resId).setVisibility(View.VISIBLE);
etSearch.setText("");
return true;
}
} catch (Throwable e) {
SMSLog.getInstance().w(e);
}
return super.onKeyEvent(keyCode, event);
}
示例2: updateTitleRightImg
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
protected void updateTitleRightImg(WritePostStatus status) {
if (status == null) {
titleBar.setRightImageResource(ResHelper.getBitmapRes(getContext(), "bbs_title_writepost"));
return;
}
switch (status) {
case Failed: {
titleBar.setRightImageResource(ResHelper.getBitmapRes(getContext(), "bbs_ic_writethread_failed"));
} break;
case Success: {
titleBar.setRightImageResource(ResHelper.getBitmapRes(getContext(), "bbs_ic_writethread_success"));
} break;
case Normal: {
titleBar.setRightImageResource(ResHelper.getBitmapRes(getContext(), "bbs_title_writepost"));
} break;
default: {
titleBar.setRightImageResource(ResHelper.getBitmapRes(getContext(), "bbs_title_writepost"));
} break;
}
}
示例3: calculateSize
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
protected void calculateSize(Context context, ArrayList<Object> plats) {
int screenWidth = ResHelper.getScreenWidth(context);
lineSize = LINE_SIZE_P;
float ratio = ((float) screenWidth) / DESIGN_SCREEN_WIDTH_P;
sepLineWidth = (int) (DESIGN_SEP_LINE_WIDTH * ratio);
sepLineWidth = sepLineWidth < 1 ? 1 : sepLineWidth;
logoHeight = (int) (DESIGN_LOGO_HEIGHT * ratio);
paddingTop = (int) (DESIGN_PADDING_TOP * ratio);
bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio);
cellHeight = (screenWidth - sepLineWidth * 3) / 4;
if (plats.size() <= lineSize) {
panelHeight = cellHeight + sepLineWidth;
} else if (plats.size() <= PAGE_SIZE_P - lineSize) {
panelHeight = (cellHeight + sepLineWidth) * 2;
} else {
panelHeight = (cellHeight + sepLineWidth) * 3;
}
}
示例4: sendMsg
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
/**
* 发送消息
* @param String phone
*/
private void sendMsg(String phone){
Uri smsToUri = Uri.parse("smsto:" + phone);
Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri);
int resId = ResHelper.getStringRes(activity, "smssdk_invite_content");
if (resId > 0) {
intent.putExtra("sms_body", activity.getString(resId));
}
if (intent.resolveActivity(this.getContext().getPackageManager()) != null) {
startActivity(intent);
}
}
示例5: initDownloadListener
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
private FileDownloadListener initDownloadListener() {
downloadListener = new FileDownloadListener() {
public void onProgress(final int progress, final long curSize, final long totalSize) {
if (progress > 0 && progress % 10 == 0) {
UIHandler.sendEmptyMessage(0, new Handler.Callback() {
public boolean handleMessage(Message msg) {
tvLoad.setText(getContext().getResources().getString(ResHelper.getStringRes(getContext(), "bbs_attachment_download_ing"),
String.valueOf(CommonUtils.formatFileSize(curSize)), CommonUtils.formatFileSize(totalSize)));
pbDownload.setProgress(progress);
return false;
}
});
}
}
};
return downloadListener;
}
示例6: afterAlbum
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
private void afterAlbum(Intent data) {
if (data != null) {
String path = ResHelper.contentUriToPath(activity, data.getData());
if (path != null && new File(path).exists()) {
pickResult = path;
onCreateOfSuper();
return;
}
}
ErrorDialog.Builder builder = new ErrorDialog.Builder(getContext(), getTheme());
int resId = ResHelper.getStringRes(getContext(), "umssdk_operation_faield");
builder.setTitle(getContext().getString(resId));
resId = ResHelper.getStringRes(getContext(), "umssdk_image_not_exists");
builder.setMessage(getContext().getString(resId));
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
public void onDismiss(DialogInterface dialog) {
finish();
}
});
builder.show();
}
示例7: getContentView
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
@Override
protected View getContentView(int position, View convertView, ViewGroup parent) {
final View view = ListViewItemBuilder.getInstance().buildLayoutThreadView(
getItem(position), convertView, parent
, ResHelper.getLayoutRes(parent.getContext(), "bbs_item_defaultmythread"));
Object tag = view.getTag();
//Doesn't show header layout.
if (tag instanceof ListViewItemBuilder.ThreadViewHolder) {
ListViewItemBuilder.ThreadViewHolder holder = (ListViewItemBuilder.ThreadViewHolder) tag;
holder.layoutHeader.setVisibility(GONE);
holder.tvLeftTime.setVisibility(GONE);
holder.tvRightTime.setVisibility(VISIBLE);
}
final ForumThread item = getItem(position);
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (item != null) {
PageForumThreadDetail pageForumThreadDetail = BBSViewBuilder.getInstance().buildPageForumThreadDetail();
pageForumThreadDetail.setForumThread(item);
pageForumThreadDetail.show(view.getContext());
}
}
});
return view;
}
示例8: repick
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
public void repick() {
pickResult = null;
output = (ResHelper.getCachePath(activity, "images") + System.currentTimeMillis() + ".jpg");
if (cameraType) {
Intent i = new Intent("android.media.action.IMAGE_CAPTURE");
Uri uri;
if (Build.VERSION.SDK_INT >= 24) {
ContentValues values = new ContentValues(1);
values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpg");
uri = activity.getContentResolver().insert(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
output = ResHelper.contentUriToPath(activity, uri);
} else {
uri = Uri.fromFile(new File(output));
}
i.putExtra("output", uri);
i.putExtra("android.intent.extra.videoQuality", 1);
startActivityForResult(i, REQ_PICK_IMAGE_FROM_CAMERA);
} else {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setFlags(0x00080000); // 0x00080000 == FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET或者FLAG_ACTIVITY_NEW_DOCUMENT
intent.setType("image/*");
startActivityForResult(intent, REQ_PICK_IMAGE_FROM_ALBUM);
}
}
示例9: getThreadCache
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
public synchronized static HashMap<String, Object> getThreadCache(Context context) {
SharePrefrenceHelper sp = new SharePrefrenceHelper(context);
sp.open(CACHE_THREAD);
ForumForum forum = ResHelper.forceCast(sp.get("ForumForum"));
String subject = sp.getString("subject");
String message = sp.getString("message");
String failedMsg = sp.getString("failedMsg");
int status = sp.getInt("status");
String[] imgList= ResHelper.forceCast(sp.get("imgList"));
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("ForumForum", forum);
map.put("subject", subject);
map.put("message", message);
map.put("imgList", imgList);
map.put("failedMsg", failedMsg);
map.put("status", status);
return map;
}
示例10: checkIsAllowToReply
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
private boolean checkIsAllowToReply(boolean gotoLogin, boolean toast) {
User user = BBSViewBuilder.getInstance().ensureLogin(false);
boolean isLogin = (user != null);
if (isLogin) {
if (user.allowReply == 1) {
return true;
} else if (toast){//不允许发帖
ToastUtils.showToast(getContext(),
getResources().getString(ResHelper.getStringRes(getContext(), "bbs_dont_allowreply")));
return false;
}
} else if (gotoLogin) {
PageLogin pagelogin = BBSViewBuilder.getInstance().buildPageLogin();
pagelogin.showForResult(getContext(), new FakeActivity() {
public void onResult(HashMap<String, Object> data) {
super.onResult(data);
}
});
}
return false;
}
示例11: shareDataToShareParams
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
final ShareParams shareDataToShareParams(Platform plat) {
if (plat == null || shareParamsMap == null) {
toast("ssdk_oks_share_failed");
return null;
}
try {
String imagePath = ResHelper.forceCast(shareParamsMap.get("imagePath"));
Bitmap viewToShare = ResHelper.forceCast(shareParamsMap.get("viewToShare"));
if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) {
String path = ResHelper.getCachePath(plat.getContext(), "screenshot");
File ss = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg");
FileOutputStream fos = new FileOutputStream(ss);
viewToShare.compress(CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
shareParamsMap.put("imagePath", ss.getAbsolutePath());
}
} catch (Throwable t) {
t.printStackTrace();
toast("ssdk_oks_share_failed");
return null;
}
return new ShareParams(shareParamsMap);
}
示例12: updateTitleRightImg
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
protected void updateTitleRightImg(MainView.WritePostStatus status) {
if (status == null) {
imageViewWritePost.setImageResource(ResHelper.getBitmapRes(getContext(), "bbs_theme1_title_writepost"));
return;
}
switch (status) {
case Failed: {
imageViewWritePost.setImageResource(ResHelper.getBitmapRes(getContext(), "bbs_ic_writethread_failed"));
} break;
case Success: {
imageViewWritePost.setImageResource(ResHelper.getBitmapRes(getContext(), "bbs_ic_writethread_success"));
} break;
case Normal: {
imageViewWritePost.setImageResource(ResHelper.getBitmapRes(getContext(), "bbs_theme1_title_writepost"));
} break;
default: {
imageViewWritePost.setImageResource(ResHelper.getBitmapRes(getContext(), "bbs_theme1_title_writepost"));
} break;
}
}
示例13: setThreadReaded
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
public void setThreadReaded(View view, boolean readed) {
if (view == null) {
return;
}
Context context = view.getContext();
TextView tvTitle = (TextView) view.findViewById(ResHelper.getIdRes(context, "bbs_item_forumpost_textViewTitle"));
if (!readed) {
if (tvTitle != null) {
tvTitle.setTextColor(context.getResources().getColor(ResHelper.getColorRes(context, "bbs_postitem_title")));
}
} else {
int color = context.getResources().getColor(ResHelper.getColorRes(context, "bbs_postitem_titleclicked"));
if (tvTitle != null) {
tvTitle.setTextColor(color);
}
}
}
示例14: onCreate
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MobSDK.init(this);
setContentView(ResHelper.getLayoutRes(this, "layout_test"));
cleverImageView = (CleverImageView) findViewById(ResHelper.getIdRes(this, "cleverImageView"));
btnTest = (Button) findViewById(ResHelper.getIdRes(this, "btnTest"));
btnTest.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// cleverImageView.setOval(false);
cleverImageView.setBorderColor(Color.BLUE);
cleverImageView.setBorderWidthDP(2);
cleverImageView.setCornerRadiiDP(10, 5, 20, 30);
cleverImageView.setImageUrl(IMAGE_URL);
}
});
}
示例15: ProgressDialog
import com.mob.tools.utils.ResHelper; //导入依赖的package包/类
/**加载对话框*/
public static final Dialog ProgressDialog(Context context){
int resId = ResHelper.getStyleRes(context, "CommonDialog");
if (resId > 0) {
final Dialog dialog = new Dialog(context, resId);
LinearLayout layout = ProgressDialogLayout.create(context);
if (layout != null) {
dialog.setContentView(layout);
return dialog;
}
}
return null;
}