Commit 0a48b48c by onuma

Merge branch 'features/1.2.363_42130' into 'features/1.2.363'

Bug #42130 巨大な画像を含む差替え画像のコンテンツを開くことができない

See merge request !116
parents d33f2864 0c422efa
...@@ -16,8 +16,8 @@ public class MediaInfoJSON extends AbstractJSON { ...@@ -16,8 +16,8 @@ public class MediaInfoJSON extends AbstractJSON {
public static final int BUTTON_TYPE = 1; public static final int BUTTON_TYPE = 1;
public static final int VIDEO_TYPE = 2; public static final int VIDEO_TYPE = 2;
public static final int MUSIC_TYPE = 3; public static final int MUSIC_TYPE = 3;
public static final int CHANGE_IMAGE_TYPE = 4; public static final int CHANGE_IMAGE_TYPE = 4; // 差し替え画像
public static final int CHANGE_VIDEO_TYPE = 5; public static final int CHANGE_VIDEO_TYPE = 5; // 差し替え動画
public static final int TRIGGER_TYPE = 6; public static final int TRIGGER_TYPE = 6;
public static final int RICH_TEXT_TYPE = 7; public static final int RICH_TEXT_TYPE = 7;
public static final int VIEW3D_TYPE = 8; public static final int VIEW3D_TYPE = 8;
......
...@@ -133,6 +133,19 @@ android { ...@@ -133,6 +133,19 @@ android {
abiFilters "arm64-v8a", "" abiFilters "arm64-v8a", ""
} }
} }
x86 {
versionCode defaultConfig.versionCode + 2
ndk {
abiFilters "x86", ""
}
}
x86_64 {
versionCode defaultConfig.versionCode + 3
ndk {
abiFilters "x86_64", ""
}
}
} }
} }
} }
......
...@@ -433,4 +433,39 @@ public class BitmapUtil { ...@@ -433,4 +433,39 @@ public class BitmapUtil {
return bitmapList; return bitmapList;
} }
/**
* アスペクト比を維持して、横に引き延ばしたBitmapを作成する
* @param filePath ファイルパス
* @param dispWidth 画面の幅
* @param dispHeight 画面の高さ
* @return リサイズしたBitmap
*/
public static Bitmap getResizedBitmap(String filePath, int dispWidth, int dispHeight) {
// Bitmap情報取得
BitmapFactory.Options options = BitmapUtil.getBitmapDimensions(filePath);
int bitmapWidth = options.outWidth;
int bitmpaHeight = options.outHeight;
// 変更するサイズを計算
int targetW;
int targetH;
if (bitmapWidth > bitmpaHeight) {
targetW = dispWidth;
targetH = (int) ((float) bitmpaHeight * (float) dispWidth / (float) bitmapWidth);
if (targetH > dispHeight) {
targetH = dispHeight;
targetW = (int) ((float) bitmapWidth * (float) dispHeight / (float) bitmpaHeight);
}
} else {
targetH = dispHeight;
targetW = (int) ((float) bitmapWidth * (float) dispHeight / (float) bitmpaHeight);
if (targetW > dispWidth) {
targetW = dispWidth;
targetH = (int) ((float) bitmpaHeight * (float) dispWidth / (float) bitmapWidth);
}
}
return BitmapUtil.getResizedBitmap(filePath, targetW, targetH, Config.RGB_565, true);
}
} }
package jp.agentec.abook.abv.ui.viewer.view.action; package jp.agentec.abook.abv.ui.viewer.view.action;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.util.BitmapUtil;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.util.DisplayUtil;
import jp.agentec.abook.abv.ui.viewer.view.ActionImageView; import jp.agentec.abook.abv.ui.viewer.view.ActionImageView;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Point;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ImageView.ScaleType; import android.widget.ImageView.ScaleType;
...@@ -99,10 +102,14 @@ public class ImageChangeAction { ...@@ -99,10 +102,14 @@ public class ImageChangeAction {
//noinspection deprecation(API16から非推奨になった。無視) //noinspection deprecation(API16から非推奨になった。無視)
imgView.setBackgroundDrawable(null); //半透明表示 imgView.setBackgroundDrawable(null); //半透明表示
Bitmap myBitmap = BitmapFactory.decodeFile(imgfile); Bitmap myBitmap = BitmapFactory.decodeFile(imgfile);
imgView.setImageBitmap(myBitmap);
// イメージをアスペクト比を無視してリサイズしているため、処理をコメントアウトする // ディスプレイ情報取得して、アクセプト比を維持してリサイズ
// Bitmap resized = BitmapUtil.getResizedBitmap(imgfile, w, h, Config.RGB_565, false); //イメージサイズをリサイズする Point point = DisplayUtil.getDisplaySize(context);
// imgView.setImageBitmap(resized); int dispWidth = point.x;
int dispHeight = point.y;
Bitmap resized = BitmapUtil.getResizedBitmap(imgfile,dispWidth,dispHeight);
imgView.setImageBitmap(resized);
layout.addView(imgView, param1); layout.addView(imgView, param1);
return imgView; return imgView;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment