com.mob.tools.utils.R Java Examples

The following examples show how to use com.mob.tools.utils.R. 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: PlatformPageAdapterPort.java    From fingerpoetry-android with Apache License 2.0 6 votes vote down vote up
protected void calculateSize(Context context, ArrayList<Object> plats) {
	int screenWidth = R.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;
	}
}
 
Example #2
Source File: OnekeyShareThemeImpl.java    From MyHearts with Apache License 2.0 6 votes vote down vote up
final ShareParams shareDataToShareParams(Platform plat) {
	if (plat == null || shareParamsMap == null) {
		toast("ssdk_oks_share_failed");
		return null;
	}

	try {
		String imagePath = R.forceCast(shareParamsMap.get("imagePath"));
		Bitmap viewToShare = R.forceCast(shareParamsMap.get("viewToShare"));
		if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) {
			String path = R.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);
}
 
Example #3
Source File: PlatformPageAdapterPort.java    From Social with Apache License 2.0 6 votes vote down vote up
protected void calculateSize(Context context, ArrayList<Object> plats) {
	int screenWidth = R.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;
	}
}
 
Example #4
Source File: EditPageLand.java    From Mobike with Apache License 2.0 5 votes vote down vote up
public void onCreate() {
	super.onCreate();

	int screenHeight = R.getScreenHeight(activity);
	float ratio = ((float) screenHeight) / DESIGN_SCREEN_WIDTH;

	maxBodyHeight = 0;

	llPage = new LinearLayout(activity);
	llPage.setOrientation(LinearLayout.VERTICAL);
	activity.setContentView(llPage);

	rlTitle = new RelativeLayout(activity);
	rlTitle.setBackgroundColor(0xffe6e9ec);
	int titleHeight = (int) (DESIGN_TITLE_HEIGHT_L * ratio);

	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight);
	llPage.addView(rlTitle, lp);
	initTitle(rlTitle, ratio);

	RelativeLayout rlBody = new RelativeLayout(activity);
	rlBody.setBackgroundColor(0xffffffff);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(rlBody, lp);
	initBody(rlBody, ratio);

	LinearLayout llShadow = new LinearLayout(activity);
	llShadow.setOrientation(LinearLayout.VERTICAL);
	rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	initShadow(llShadow, ratio);

	llBottom = new LinearLayout(activity);
	llBottom.setOrientation(LinearLayout.VERTICAL);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(llBottom, lp);
	initBottom(llBottom, ratio);
}
 
Example #5
Source File: EditPageLand.java    From fingerpoetry-android with Apache License 2.0 5 votes vote down vote up
public void onCreate() {
	super.onCreate();

	int screenHeight = R.getScreenHeight(activity);
	float ratio = ((float) screenHeight) / DESIGN_SCREEN_WIDTH;

	maxBodyHeight = 0;

	llPage = new LinearLayout(activity);
	llPage.setOrientation(LinearLayout.VERTICAL);
	activity.setContentView(llPage);

	rlTitle = new RelativeLayout(activity);
	rlTitle.setBackgroundColor(0xffe6e9ec);
	int titleHeight = (int) (DESIGN_TITLE_HEIGHT_L * ratio);

	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight);
	llPage.addView(rlTitle, lp);
	initTitle(rlTitle, ratio);

	RelativeLayout rlBody = new RelativeLayout(activity);
	rlBody.setBackgroundColor(0xffffffff);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(rlBody, lp);
	initBody(rlBody, ratio);

	LinearLayout llShadow = new LinearLayout(activity);
	llShadow.setOrientation(LinearLayout.VERTICAL);
	rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	initShadow(llShadow, ratio);

	llBottom = new LinearLayout(activity);
	llBottom.setOrientation(LinearLayout.VERTICAL);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(llBottom, lp);
	initBottom(llBottom, ratio);
}
 
Example #6
Source File: EditPage.java    From GithubApp with Apache License 2.0 5 votes vote down vote up
/** 动态适配编辑界面的高度 */
public void run() {
	int height = svContent.getChildAt(0).getHeight();
	RelativeLayout.LayoutParams lp = R.forceCast(svContent.getLayoutParams());
	if (height > maxBodyHeight && lp.height != maxBodyHeight) {
		lp.height = maxBodyHeight;
		svContent.setLayoutParams(lp);
	} else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
		lp.height = LayoutParams.WRAP_CONTENT;
		svContent.setLayoutParams(lp);
	}
}
 
Example #7
Source File: FriendListPage.java    From MyHearts with Apache License 2.0 5 votes vote down vote up
private void updateConfirmView() {
	int resId = R.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 #8
Source File: EditPagePort.java    From fingerpoetry-android with Apache License 2.0 5 votes vote down vote up
public void onCreate() {
	super.onCreate();

	int screenHeight = R.getScreenHeight(activity);
	float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT;

	maxBodyHeight = 0;

	llPage = new LinearLayout(activity);
	llPage.setOrientation(LinearLayout.VERTICAL);
	activity.setContentView(llPage);

	rlTitle = new RelativeLayout(activity);
	rlTitle.setBackgroundColor(0xffe6e9ec);
	int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio);

	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight);
	llPage.addView(rlTitle, lp);
	initTitle(rlTitle, ratio);

	RelativeLayout rlBody = new RelativeLayout(activity);
	rlBody.setBackgroundColor(0xffffffff);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(rlBody, lp);
	initBody(rlBody, ratio);

	LinearLayout llShadow = new LinearLayout(activity);
	llShadow.setOrientation(LinearLayout.VERTICAL);
	rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	initShadow(llShadow, ratio);

	llBottom = new LinearLayout(activity);
	llBottom.setOrientation(LinearLayout.VERTICAL);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(llBottom, lp);
	initBottom(llBottom, ratio);
}
 
Example #9
Source File: OnekeyShare.java    From fingerpoetry-android with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void show(Context context) {
	HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
	shareParamsMap.putAll(params);

	ShareSDK.initSDK(context);

	// 打开分享菜单的统计
	ShareSDK.logDemoEvent(1, null);

	int iTheme = 0;
	try {
		iTheme = R.parseInt(String.valueOf(shareParamsMap.remove("theme")));
	} catch (Throwable t) {}
	OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
	OnekeyShareThemeImpl themeImpl = theme.getImpl();

	themeImpl.setShareParamsMap(shareParamsMap);
	themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
	themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
	themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
	themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
	themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
	themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
	if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
		themeImpl.disableSSO();
	}

	themeImpl.show(context);
}
 
Example #10
Source File: PlatformPageAdapter.java    From Mobike with Apache License 2.0 5 votes vote down vote up
public View getView(int index, View convertView, ViewGroup parent) {
	if (convertView == null) {
		convertView = createPanel(parent.getContext());
	}

	LinearLayout llPanel = R.forceCast(convertView);
	LinearLayout[] llCells = R.forceCast(llPanel.getTag());
	refreshPanel(llCells, cells[index]);
	return convertView;
}
 
Example #11
Source File: OnekeyShare.java    From GithubApp with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void show(Context context) {
	HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
	shareParamsMap.putAll(params);

	ShareSDK.initSDK(context);

	// 打开分享菜单的统计
	ShareSDK.logDemoEvent(1, null);

	int iTheme = 0;
	try {
		iTheme = R.parseInt(String.valueOf(shareParamsMap.remove("theme")));
	} catch (Throwable t) {}
	OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
	OnekeyShareThemeImpl themeImpl = theme.getImpl();

	themeImpl.setShareParamsMap(shareParamsMap);
	themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
	themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
	themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
	themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
	themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
	themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
	if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
		themeImpl.disableSSO();
	}

	themeImpl.show(context);
}
 
Example #12
Source File: EditPagePort.java    From GithubApp with Apache License 2.0 5 votes vote down vote up
public void onCreate() {
	super.onCreate();

	int screenHeight = R.getScreenHeight(activity);
	float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT;

	maxBodyHeight = 0;

	llPage = new LinearLayout(activity);
	llPage.setOrientation(LinearLayout.VERTICAL);
	activity.setContentView(llPage);

	rlTitle = new RelativeLayout(activity);
	rlTitle.setBackgroundColor(0xffe6e9ec);
	int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio);

	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight);
	llPage.addView(rlTitle, lp);
	initTitle(rlTitle, ratio);

	RelativeLayout rlBody = new RelativeLayout(activity);
	rlBody.setBackgroundColor(0xffffffff);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(rlBody, lp);
	initBody(rlBody, ratio);

	LinearLayout llShadow = new LinearLayout(activity);
	llShadow.setOrientation(LinearLayout.VERTICAL);
	rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	initShadow(llShadow, ratio);

	llBottom = new LinearLayout(activity);
	llBottom.setOrientation(LinearLayout.VERTICAL);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(llBottom, lp);
	initBottom(llBottom, ratio);
}
 
Example #13
Source File: PlatformPageAdapterLand.java    From Mobike with Apache License 2.0 5 votes vote down vote up
protected void calculateSize(Context context, ArrayList<Object> plats) {
	int screenWidth = R.getScreenWidth(context);
	float ratio = ((float) screenWidth) / DESIGN_SCREEN_WIDTH_L;
	int cellWidth = (int) (DESIGN_CELL_WIDTH_L * ratio);
	lineSize = screenWidth / cellWidth;

	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) / (lineSize - 1);
	panelHeight = cellHeight + sepLineWidth;
}
 
Example #14
Source File: FriendListItem.java    From fingerpoetry-android with Apache License 2.0 5 votes vote down vote up
public FriendListItem(Context context, float ratio) {
	super(context);
	int itemPadding = (int) (ratio * DESIGN_ITEM_PADDING);
	setPadding(itemPadding, 0, itemPadding, 0);
	setMinimumHeight((int) (ratio * DESIGN_ITEM_HEIGHT));
	setBackgroundColor(0xffffffff);

	ivCheck = new ImageView(context);
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	addView(ivCheck, lp);

	aivIcon = new AsyncImageView(context);
	int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
	lp = new LinearLayout.LayoutParams(avatarWidth, avatarWidth);
	lp.gravity = Gravity.CENTER_VERTICAL;
	int avatarMargin = (int) (ratio * DESIGN_AVATAR_PADDING);
	lp.setMargins(avatarMargin, 0, avatarMargin, 0);
	addView(aivIcon, lp);

	tvName = new TextView(context);
	tvName.setTextColor(0xff000000);
	tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvName.setSingleLine();
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	lp.weight = 1;
	addView(tvName, lp);

	int resId = R.getBitmapRes(context, "ssdk_oks_classic_check_checked");
	if (resId > 0) {
		bmChd = BitmapFactory.decodeResource(context.getResources(), resId);
	}
	resId = R.getBitmapRes(getContext(), "ssdk_oks_classic_check_default");
	if (resId > 0) {
		bmUnch = BitmapFactory.decodeResource(context.getResources(), resId);
	}
}
 
Example #15
Source File: OnekeyShare.java    From MyHearts with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void show(Context context) {
	HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
	shareParamsMap.putAll(params);

	ShareSDK.initSDK(context.getApplicationContext());

	// 打开分享菜单的统计
	ShareSDK.logDemoEvent(1, null);

	int iTheme = 0;
	try {
		iTheme = R.parseInt(String.valueOf(shareParamsMap.remove("theme")));
	} catch (Throwable t) {}
	OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
	OnekeyShareThemeImpl themeImpl = theme.getImpl();

	themeImpl.setShareParamsMap(shareParamsMap);
	themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
	themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
	themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
	themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
	themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
	themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
	if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
		themeImpl.disableSSO();
	}

	themeImpl.show(context.getApplicationContext());
}
 
Example #16
Source File: PlatformPageAdapterLand.java    From fingerpoetry-android with Apache License 2.0 5 votes vote down vote up
protected void calculateSize(Context context, ArrayList<Object> plats) {
	int screenWidth = R.getScreenWidth(context);
	float ratio = ((float) screenWidth) / DESIGN_SCREEN_WIDTH_L;
	int cellWidth = (int) (DESIGN_CELL_WIDTH_L * ratio);
	lineSize = screenWidth / cellWidth;

	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) / (lineSize - 1);
	panelHeight = cellHeight + sepLineWidth;
}
 
Example #17
Source File: OnekeyShare.java    From fingerpoetry-android with Apache License 2.0 5 votes vote down vote up
/** 设置自己图标和点击事件,可以重复调用添加多次 */
public void setCustomerLogo(Bitmap logo, String label, OnClickListener ocl) {
	CustomerLogo cl = new CustomerLogo();
	cl.logo = logo;
	cl.label = label;
	cl.listener = ocl;
	ArrayList<CustomerLogo> customers = R.forceCast(params.get("customers"));
	customers.add(cl);
}
 
Example #18
Source File: PRTHeader.java    From Mobike with Apache License 2.0 5 votes vote down vote up
public PRTHeader(Context context) {
	super(context);
	int[] size = R.getScreenSize(context);
	float screenWidth = size[0] < size[1] ? size[0] : size[1];
	float ratio = screenWidth / DESIGN_SCREEN_WIDTH;

	setOrientation(VERTICAL);

	LinearLayout llInner = new LinearLayout(context);
	LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_HORIZONTAL;
	addView(llInner, lp);

	ivArrow = new RotateImageView(context);
	int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr");
	if (resId > 0) {
		ivArrow.setImageResource(resId);
	}
	int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
	lp = new LayoutParams(avatarWidth, avatarWidth);
	lp.gravity = Gravity.CENTER_VERTICAL;
	int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING);
	lp.topMargin = lp.bottomMargin = avataPadding;
	llInner.addView(ivArrow, lp);

	pbRefreshing = new ProgressBar(context);
	resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar");
	Drawable pbdrawable = context.getResources().getDrawable(resId);
	pbRefreshing.setIndeterminateDrawable(pbdrawable);
	llInner.addView(pbRefreshing, lp);
	pbRefreshing.setVisibility(View.GONE);

	tvHeader = new TextView(getContext());
	tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvHeader.setPadding(avataPadding, 0, avataPadding, 0);
	tvHeader.setTextColor(0xff09bb07);
	lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	llInner.addView(tvHeader, lp);
}
 
Example #19
Source File: EditPageLand.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
public void onCreate() {
	super.onCreate();

	int screenHeight = R.getScreenHeight(activity);
	float ratio = ((float) screenHeight) / DESIGN_SCREEN_WIDTH;

	maxBodyHeight = 0;

	llPage = new LinearLayout(activity);
	llPage.setOrientation(LinearLayout.VERTICAL);
	activity.setContentView(llPage);

	rlTitle = new RelativeLayout(activity);
	rlTitle.setBackgroundColor(0xffe6e9ec);
	int titleHeight = (int) (DESIGN_TITLE_HEIGHT_L * ratio);

	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight);
	llPage.addView(rlTitle, lp);
	initTitle(rlTitle, ratio);

	RelativeLayout rlBody = new RelativeLayout(activity);
	rlBody.setBackgroundColor(0xffffffff);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(rlBody, lp);
	initBody(rlBody, ratio);

	LinearLayout llShadow = new LinearLayout(activity);
	llShadow.setOrientation(LinearLayout.VERTICAL);
	rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	initShadow(llShadow, ratio);

	llBottom = new LinearLayout(activity);
	llBottom.setOrientation(LinearLayout.VERTICAL);
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	llPage.addView(llBottom, lp);
	initBottom(llBottom, ratio);
}
 
Example #20
Source File: FriendListPage.java    From GithubApp with Apache License 2.0 5 votes vote down vote up
private void updateConfirmView() {
	int resId = R.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 #21
Source File: FriendListItem.java    From Social with Apache License 2.0 5 votes vote down vote up
public FriendListItem(Context context, float ratio) {
	super(context);
	int itemPadding = (int) (ratio * DESIGN_ITEM_PADDING);
	setPadding(itemPadding, 0, itemPadding, 0);
	setMinimumHeight((int) (ratio * DESIGN_ITEM_HEIGHT));
	setBackgroundColor(0xffffffff);

	ivCheck = new ImageView(context);
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	addView(ivCheck, lp);

	aivIcon = new AsyncImageView(context);
	int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
	lp = new LinearLayout.LayoutParams(avatarWidth, avatarWidth);
	lp.gravity = Gravity.CENTER_VERTICAL;
	int avatarMargin = (int) (ratio * DESIGN_AVATAR_PADDING);
	lp.setMargins(avatarMargin, 0, avatarMargin, 0);
	addView(aivIcon, lp);

	tvName = new TextView(context);
	tvName.setTextColor(0xff000000);
	tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvName.setSingleLine();
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	lp.weight = 1;
	addView(tvName, lp);

	int resId = R.getBitmapRes(context, "ssdk_oks_classic_check_checked");
	if (resId > 0) {
		bmChd = BitmapFactory.decodeResource(context.getResources(), resId);
	}
	resId = R.getBitmapRes(getContext(), "ssdk_oks_classic_check_default");
	if (resId > 0) {
		bmUnch = BitmapFactory.decodeResource(context.getResources(), resId);
	}
}
 
Example #22
Source File: OnekeyShareThemeImpl.java    From GithubApp with Apache License 2.0 5 votes vote down vote up
private void toast(final String resOrName) {
	UIHandler.sendEmptyMessage(0, new Callback() {
		public boolean handleMessage(Message msg) {
			int resId = R.getStringRes(context, resOrName);
			if (resId > 0) {
				Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, resOrName, Toast.LENGTH_SHORT).show();
			}
			return false;
		}
	});
}
 
Example #23
Source File: EditPage.java    From GithubApp with Apache License 2.0 5 votes vote down vote up
/** 执行分享时的方法 */
private void shareAndFinish() {
	int resId = R.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 #24
Source File: EditPage.java    From Mobike with Apache License 2.0 5 votes vote down vote up
/** 动态适配编辑界面的高度 */
public void run() {
	int height = svContent.getChildAt(0).getHeight();
	RelativeLayout.LayoutParams lp = R.forceCast(svContent.getLayoutParams());
	if (height > maxBodyHeight && lp.height != maxBodyHeight) {
		lp.height = maxBodyHeight;
		svContent.setLayoutParams(lp);
	} else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
		lp.height = LayoutParams.WRAP_CONTENT;
		svContent.setLayoutParams(lp);
	}
}
 
Example #25
Source File: PlatformPageAdapter.java    From MyHearts with Apache License 2.0 5 votes vote down vote up
public void onClick(View v) {
	long time = System.currentTimeMillis();
	if (time - lastClickTime < MIN_CLICK_INTERVAL) {
		return;
	}
	lastClickTime = time;

	if (v.getTag() instanceof CustomerLogo) {
		CustomerLogo logo = R.forceCast(v.getTag());
		page.performCustomLogoClick(v, logo);
	} else {
		Platform plat = R.forceCast(v.getTag());
		page.showEditPage(plat);
	}
}
 
Example #26
Source File: OnekeyShare.java    From GithubApp with Apache License 2.0 5 votes vote down vote up
/** 设置自己图标和点击事件,可以重复调用添加多次 */
public void setCustomerLogo(Bitmap logo, String label, OnClickListener ocl) {
	CustomerLogo cl = new CustomerLogo();
	cl.logo = logo;
	cl.label = label;
	cl.listener = ocl;
	ArrayList<CustomerLogo> customers = R.forceCast(params.get("customers"));
	customers.add(cl);
}
 
Example #27
Source File: EditPage.java    From fingerpoetry-android with Apache License 2.0 5 votes vote down vote up
/** 执行分享时的方法 */
private void shareAndFinish() {
	int resId = R.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 #28
Source File: PlatformPageAdapterLand.java    From GithubApp with Apache License 2.0 5 votes vote down vote up
protected void calculateSize(Context context, ArrayList<Object> plats) {
	int screenWidth = R.getScreenWidth(context);
	float ratio = ((float) screenWidth) / DESIGN_SCREEN_WIDTH_L;
	int cellWidth = (int) (DESIGN_CELL_WIDTH_L * ratio);
	lineSize = screenWidth / cellWidth;

	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) / (lineSize - 1);
	panelHeight = cellHeight + sepLineWidth;
}
 
Example #29
Source File: ShareCore.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
/**
 * 向指定平台分享内容
 * <p>
 * <b>注意:</b><br>
 * 参数data的键值需要严格按照{@link ShareParams}不同子类具体字段来命名,
 *否则无法反射此字段,也无法设置其值。
 */
public boolean share(Platform plat, HashMap<String, Object> data) {
	if (plat == null || data == null) {
		return false;
	}

	try {
		String imagePath = (String) data.get("imagePath");
		Bitmap viewToShare = (Bitmap) data.get("viewToShare");
		if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) {
			String path = R.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();
			data.put("imagePath", ss.getAbsolutePath());
		}
	} catch (Throwable t) {
		t.printStackTrace();
		return false;
	}

	ShareParams sp = new ShareParams(data);
	if (customizeCallback != null) {
		customizeCallback.onShare(plat, sp);
	}

	plat.share(sp);
	return true;
}
 
Example #30
Source File: PlatformPageAdapterLand.java    From MyHearts with Apache License 2.0 5 votes vote down vote up
protected void calculateSize(Context context, ArrayList<Object> plats) {
	int screenWidth = R.getScreenWidth(context);
	float ratio = ((float) screenWidth) / DESIGN_SCREEN_WIDTH_L;
	int cellWidth = (int) (DESIGN_CELL_WIDTH_L * ratio);
	lineSize = screenWidth / cellWidth;

	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) / (lineSize - 1);
	panelHeight = cellHeight + sepLineWidth;
}