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


Java FileParams类代码示例

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


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

示例1: displayImageMessage

import eu.siacs.conversations.entities.Message.FileParams; //导入依赖的package包/类
private void displayImageMessage(ViewHolder viewHolder,
		final Message message) {
	if (viewHolder.download_button != null) {
		viewHolder.download_button.setVisibility(View.GONE);
	}
	viewHolder.messageBody.setVisibility(View.GONE);
	viewHolder.image.setVisibility(View.VISIBLE);
	FileParams params = message.getFileParams();
	double target = metrics.density * 288;
	int scalledW;
	int scalledH;
	if (params.width <= params.height) {
		scalledW = (int) (params.width / ((double) params.height / target));
		scalledH = (int) target;
	} else {
		scalledW = (int) target;
		scalledH = (int) (params.height / ((double) params.width / target));
	}
	LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(scalledW, scalledH);
	layoutParams.setMargins(0, (int) (metrics.density * 4), 0, (int) (metrics.density * 4));
	viewHolder.image.setLayoutParams(layoutParams);
	activity.loadBitmap(message, viewHolder.image);
	viewHolder.image.setOnClickListener(new OnClickListener() {

		@Override
		public void onClick(View v) {
			openDownloadable(message);
		}
	});
	viewHolder.image.setOnLongClickListener(openContextMenu);
}
 
开发者ID:xavierle,项目名称:messengerxmpp,代码行数:32,代码来源:MessageAdapter.java

示例2: displayImageMessage

import eu.siacs.conversations.entities.Message.FileParams; //导入依赖的package包/类
private void displayImageMessage(ViewHolder viewHolder, final Message message) {
	viewHolder.download_button.setVisibility(View.GONE);
	viewHolder.messageBody.setVisibility(View.GONE);
	viewHolder.audioPlayer.setVisibility(View.GONE);
	viewHolder.image.setVisibility(View.VISIBLE);
	FileParams params = message.getFileParams();
	double target = metrics.density * 288;
	int scaledW;
	int scaledH;
	if (Math.max(params.height, params.width) * metrics.density <= target) {
		scaledW = (int) (params.width * metrics.density);
		scaledH = (int) (params.height * metrics.density);
	} else if (Math.max(params.height,params.width) <= target) {
		scaledW = params.width;
		scaledH = params.height;
	} else if (params.width <= params.height) {
		scaledW = (int) (params.width / ((double) params.height / target));
		scaledH = (int) target;
	} else {
		scaledW = (int) target;
		scaledH = (int) (params.height / ((double) params.width / target));
	}
	LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(scaledW, scaledH);
	layoutParams.setMargins(0, (int) (metrics.density * 4), 0, (int) (metrics.density * 4));
	viewHolder.image.setLayoutParams(layoutParams);
	activity.loadBitmap(message, viewHolder.image);
	viewHolder.image.setOnClickListener(new OnClickListener() {

		@Override
		public void onClick(View v) {
			openDownloadable(message);
		}
	});
}
 
开发者ID:siacs,项目名称:Conversations,代码行数:35,代码来源:MessageAdapter.java


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