Commit f193357b by Kim Jinsung

WBS #37838 360編集時のシーン追加処理改善

parent 4e03e1bd
......@@ -182,6 +182,12 @@
android:label="LoginPasswordChangeActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="jp.agentec.abook.abv.ui.viewer.activity.DeviceImageListActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="DeviceImageListActivity"
android:theme="@style/Theme_Contentdetailview" />
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ABookSettingActivity" android:theme="@android:style/Theme.NoTitleBar"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ChangePasswordActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ChangePasswordActivityDialog" android:theme="@style/Theme.MyTheme.ModalDialog"/>
......
......@@ -360,7 +360,7 @@
<string name="label_entry">登録</string>
<string name="label_base_file">ベースファイル</string>
<string name="select_image">画像選択</string>
<string name="error_msg_open_pano_edit">他の端末で資料が編集中の為、編集できません(%1$s)</string>
<string name="error_msg_open_pano_edit">他の端末で資料が編集中の為、編集できません。</string>
<string name="P001">資料名に半角カタカナは使用できません。</string>
<string name="P002">既に資料が登録されています。</string>
......@@ -577,7 +577,7 @@
<string name="label_entry_1">登録(1)</string>
<string name="label_base_file_1">ベースファイル(1)</string>
<string name="select_image_1">画像選択(1)</string>
<string name="error_msg_open_pano_edit_1">他の端末で資料が編集中の為、編集できません(%1$s)。(1)</string>
<string name="error_msg_open_pano_edit_1">他の端末で資料が編集中の為、編集できません。(1)</string>
<string name="P001_1">資料名に半角カタカナは使用できません。(1)</string>
<string name="P002_1">既に資料が登録されています。(1)</string>
......@@ -753,7 +753,7 @@
<string name="label_entry_2">登録(2)</string>
<string name="label_base_file_2">ベースファイル(2)</string>
<string name="select_image_2">画像選択(2)</string>
<string name="error_msg_open_pano_edit_2">他の端末で資料が編集中の為、編集できません(%1$s)。(2)</string>
<string name="error_msg_open_pano_edit_2">他の端末で資料が編集中の為、編集できません。(2)</string>
<string name="P001_2">資料名に半角カタカナは使用できません。(2)</string>
<string name="P002_2">既に資料が登録されています。(2)</string>
......@@ -929,7 +929,7 @@
<string name="label_entry_3">登録(3)</string>
<string name="label_base_file_3">ベースファイル(3)</string>
<string name="select_image_3">画像選択(3)</string>
<string name="error_msg_open_pano_edit_3">他の端末で資料が編集中の為、編集できません(%1$s)。(3)</string>
<string name="error_msg_open_pano_edit_3">他の端末で資料が編集中の為、編集できません。(3)</string>
<string name="P001_3">資料名に半角カタカナは使用できません。(3)</string>
<string name="P002_3">既に資料が登録されています。(3)</string>
......@@ -1105,7 +1105,7 @@
<string name="label_entry_4">登録(4)</string>
<string name="label_base_file_4">ベースファイル(4)</string>
<string name="select_image_4">画像選択(4)</string>
<string name="error_msg_open_pano_edit_4">他の端末で資料が編集中の為、編集できません(%1$s)。(4)</string>
<string name="error_msg_open_pano_edit_4">他の端末で資料が編集中の為、編集できません。(4)</string>
<string name="P001_4">資料名に半角カタカナは使用できません。(4)</string>
<string name="P002_4">既に資料が登録されています。(4)</string>
......@@ -1281,7 +1281,7 @@
<string name="label_entry_5">登録(5)</string>
<string name="label_base_file_5">ベースファイル(5)</string>
<string name="select_image_5">画像選択(5)</string>
<string name="error_msg_open_pano_edit_5">他の端末で資料が編集中の為、編集できません(%1$s)。(5)</string>
<string name="error_msg_open_pano_edit_5">他の端末で資料が編集中の為、編集できません。(5)</string>
<string name="P001_5">資料名に半角カタカナは使用できません。(5)</string>
<string name="P002_5">既に資料が登録されています。(5)</string>
......@@ -1417,4 +1417,12 @@
<string name="msg_confirm_close_edit_page">編集を終了しますか?\n(保存されていない変更は破棄されます。)</string>
<string name="msg_error_edit_page_save">ファイルの保存中に予想以外のエラーが発生しました。\n編集画面を終了します。</string>
<string name="msg_error_edit_page_open">編集画面の表示に失敗しました。</string>
<!-- ABookCheck 1.2.300 -->
<string name="title_scene_image_select">シーン画像選択</string>
<string name="msg_image_select_max_count_over">シーン画像の選択可能な最大数は%s個までです。</string>
<string name="msg_image_select_send_comfirm">選択したシーン画像を登録しますか?</string>
<string name="msg_image_select_send_success">シーン画像の登録に成功しました。</string>
<string name="msg_image_select_send_fail_retry">シーン画像の登録に失敗しました。再度登録処理を実行しますか?</string>
<string name="msg_access_registing">登録中</string>
</resources>
......@@ -362,7 +362,7 @@
<string name="label_entry">등록</string>
<string name="label_base_file">베이스 파일</string>
<string name="select_image">이미지 선택</string>
<string name="error_msg_open_pano_edit">다른 단말에서 자료를 편집중이기때문에 편집할수 없습니다(%1$s).</string>
<string name="error_msg_open_pano_edit">다른 단말에서 자료를 편집중이기때문에 편집할수 없습니다.</string>
<string name="P001">자료명에 반각가타가나는 사용할 수 없습니다.</string>
<string name="P002">이미 자료가 등록되어 있습니다.</string>
......@@ -580,7 +580,7 @@
<string name="label_entry_1">등록(1)</string>
<string name="label_base_file_1">베이스 파일(1)</string>
<string name="select_image_1">이미지 선택(1)</string>
<string name="error_msg_open_pano_edit_1">다른 단말에서 자료를 편집중이기때문에 편집할수 없습니다(%1$s).(1)</string>
<string name="error_msg_open_pano_edit_1">다른 단말에서 자료를 편집중이기때문에 편집할수 없습니다.(1)</string>
<string name="P001_1">자료명에 반각가타가나는 사용할 수 없습니다.(1)</string>
<string name="P002_1">이미 자료가 등록되어 있습니다.(1)</string>
......@@ -758,7 +758,7 @@
<string name="label_entry_2">등록(2)</string>
<string name="label_base_file_2">베이스 파일(2)</string>
<string name="select_image_2">이미지 선택(2)</string>
<string name="error_msg_open_pano_edit_2">다른 단말에서 자료를 편집중이기때문에 편집할수 없습니다(%1$s).(2)</string>
<string name="error_msg_open_pano_edit_2">다른 단말에서 자료를 편집중이기때문에 편집할수 없습니다.(2)</string>
<string name="P001_2">자료명에 반각가타가나는 사용할 수 없습니다.(2)</string>
<string name="P002_2">이미 자료가 등록되어 있습니다.(2)</string>
......@@ -935,7 +935,7 @@
<string name="label_entry_3">등록(3)</string>
<string name="label_base_file_3">베이스 파일(3)</string>
<string name="select_image_3">이미지 선택(3)</string>
<string name="error_msg_open_pano_edit_3">다른 단말에서 자료를 편집중이기때문에 편집할수 없습니다(%1$s).(3)</string>
<string name="error_msg_open_pano_edit_3">다른 단말에서 자료를 편집중이기때문에 편집할수 없습니다.(3)</string>
<string name="P001_3">자료명에 반각가타가나는 사용할 수 없습니다.(3)</string>
<string name="P002_3">이미 자료가 등록되어 있습니다.(3)</string>
......@@ -1112,7 +1112,7 @@
<string name="label_entry_4">등록(4)</string>
<string name="label_base_file_4">베이스 파일(4)</string>
<string name="select_image_4">이미지 선택(4)</string>
<string name="error_msg_open_pano_edit_4">다른 단말에서 자료를 편집중이기때문에 편집할수 없습니다(%1$s).(4)</string>
<string name="error_msg_open_pano_edit_4">다른 단말에서 자료를 편집중이기때문에 편집할수 없습니다.(4)</string>
<string name="P001_4">자료명에 반각가타가나는 사용할 수 없습니다.(4)</string>
<string name="P002_4">이미 자료가 등록되어 있습니다.(4)</string>
......@@ -1289,7 +1289,7 @@
<string name="label_entry_5">등록(5)</string>
<string name="label_base_file_5">베이스 파일(5)</string>
<string name="select_image_5">이미지 선택(5)</string>
<string name="error_msg_open_pano_edit_5">다른 단말에서 자료를 편집중이기때문에 편집할수 없습니다(%1$s).(5)</string>
<string name="error_msg_open_pano_edit_5">다른 단말에서 자료를 편집중이기때문에 편집할수 없습니다.(5)</string>
<string name="P001_5">자료명에 반각가타가나는 사용할 수 없습니다.(5)</string>
<string name="P002_5">이미 자료가 등록되어 있습니다.(5)</string>
......@@ -1425,4 +1425,11 @@
<string name="msg_confirm_close_edit_page">편집을 종료하시겠습니까?\n(저장되지 않은 변경 사항은 삭제됩니다.)</string>
<string name="msg_error_edit_page_save">파일 저장 중에 예기치 않은 오류가 발생했습니다.\n편집창을 종료합니다.</string>
<string name="msg_error_edit_page_open">편집창을 여는데 실패했습니다.</string>
<!-- ABookCheck 1.2.300 -->
<string name="title_scene_image_select">장면 이미지 선택</string>
<string name="msg_image_select_max_count_over">장면 이미지의 선택 가능한 최대 개수는 %s개입니다.</string>
<string name="msg_image_select_send_comfirm">선택한 장면 이미지를 등록하시겠습니까?</string>
<string name="msg_image_select_send_success">장면 이미지 등록에 성공하였습니다.</string>
<string name="msg_image_select_send_fail_retry">장면 이미지 등록에 실패하였습니다. 다시 등록 처리를 실행 하시겠습니까?</string>
<string name="msg_access_registing">등록중</string>
</resources>
\ No newline at end of file
......@@ -366,7 +366,7 @@
<string name="label_entry">Registration</string>
<string name="label_base_file">Base file</string>
<string name="select_image">Image selection</string>
<string name="error_msg_open_pano_edit">The content can not be edited (%1$s) because the content is being edited on another terminal.</string> d
<string name="error_msg_open_pano_edit">The content can not be edited because the content is being edited on another terminal.</string> d
<string name="P001">Hankaku katakana can not be used for content name.</string>
<string name="P002">Content has already been registered.</string>
......@@ -583,7 +583,7 @@
<string name="label_entry_1">Registration(1)</string>
<string name="label_base_file_1">Base file(1)</string>
<string name="select_image_1">Image selection(1)</string>
<string name="error_msg_open_pano_edit_1">The content can not be edited (%1$s) because the content is being edited on another terminal.(1)</string>
<string name="error_msg_open_pano_edit_1">The content can not be edited because the content is being edited on another terminal.(1)</string>
<string name="P001_1">Hankaku katakana can not be used for content name.(1)</string>
<string name="P002_1">Content has already been registered.(1)</string>
......@@ -759,7 +759,7 @@
<string name="label_entry_2">Registration(2)</string>
<string name="label_base_file_2">Base file(2)</string>
<string name="select_image_2">Image selection(2)</string>
<string name="error_msg_open_pano_edit_2">The content can not be edited (%1$s) because the content is being edited on another terminal.(2)</string>
<string name="error_msg_open_pano_edit_2">The content can not be edited because the content is being edited on another terminal.(2)</string>
<string name="P001_2">Hankaku katakana can not be used for content name.(2)</string>
<string name="P002_2">Content has already been registered.(2)</string>
......@@ -935,7 +935,7 @@
<string name="label_entry_3">Registration(3)</string>
<string name="label_base_file_3">Base file(3)</string>
<string name="select_image_3">Image selection(3)</string>
<string name="error_msg_open_pano_edit_3">The content can not be edited (%1$s) because the content is being edited on another terminal.(3)</string>
<string name="error_msg_open_pano_edit_3">The content can not be edited because the content is being edited on another terminal.(3)</string>
<string name="P001_3">Hankaku katakana can not be used for content name.(3)</string>
<string name="P002_3">Content has already been registered.(3)</string>
......@@ -1111,7 +1111,7 @@
<string name="label_entry_4">Registration(4)</string>
<string name="label_base_file_4">Base file(4)</string>
<string name="select_image_4">Image selection(4)</string>
<string name="error_msg_open_pano_edit_4">The content can not be edited (%1$s) because the content is being edited on another terminal.(4)</string>
<string name="error_msg_open_pano_edit_4">The content can not be edited because the content is being edited on another terminal.(4)</string>
<string name="P001_4">Hankaku katakana can not be used for content name.(4)</string>
<string name="P002_4">Content has already been registered.(4)</string>
......@@ -1287,7 +1287,7 @@
<string name="label_entry_5">Registration(5)</string>
<string name="label_base_file_5">Base file(5)</string>
<string name="select_image_5">Image selection(5)</string>
<string name="error_msg_open_pano_edit_5">The content can not be edited (%1$s) because the content is being edited on another terminal.(5)</string>
<string name="error_msg_open_pano_edit_5">The content can not be edited because the content is being edited on another terminal.(5)</string>
<string name="P001_5">Hankaku katakana can not be used for content name.(5)</string>
<string name="P002_5">Content has already been registered.(5)</string>
......@@ -1424,4 +1424,11 @@
<string name="msg_error_edit_page_save">An unexpected error has occurred while saving the image.\nClosing the editing Page.</string>
<string name="msg_error_edit_page_open">Failed to open the edit tool.</string>
<!-- ABookCheck 1.2.300 -->
<string name="title_scene_image_select">Select scene image</string>
<string name="msg_image_select_max_count_over">The maximum number of scene images that can be selected is %s.</string>
<string name="msg_image_select_send_comfirm">Register the selected scene image?</string>
<string name="msg_image_select_send_success">You have successfully registered a scene image.</string>
<string name="msg_image_select_send_fail_retry">Registration of the scene image failed. Do you want to register again?</string>
<string name="msg_access_registing">Registring</string>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/device_image_list_list_toolbar"
style="@style/OperationSearchToolBar"
android:layout_width="match_parent"
android:layout_height="50dp">
<Button
android:id="@+id/regist"
android:layout_width="87dp"
android:layout_height="45dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="@string/label_entry" />
<TextView
android:id="@+id/device_image_list_title"
style="@style/DialogToolBarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/title_scene_image_select"
android:textColor="@color/edt_text"
android:textSize="@dimen/opeartion_title_text_size" />
<Button
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_operation_close"
android:contentDescription="@string/cont_desc" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/alert_background"
android:orientation="vertical">
<GridView
android:id="@+id/gallery_grid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawSelectorOnTop="false"
android:horizontalSpacing="2dp"
android:numColumns="3"
android:stretchMode="columnWidth"
android:verticalSpacing="2dp" />
</LinearLayout>
<!--android:listSelector="?android:attr/selectableItemBackground" -->
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
<ImageView
android:id="@+id/iv_thumbnail"
android:layout_width="match_parent"
android:layout_height="150dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/iv_thumbnail_selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/check_mark" />
</RelativeLayout>
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.imagepicker;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.util.Log;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* A simple subclass of {@link ImageResizer} that fetches and resizes images fetched from a URL.
*/
public class ImageFetcher extends ImageResizer {
private static final String TAG = "ImageFetcher";
private static final int HTTP_CACHE_SIZE = 10 * 1024 * 1024; // 10MB
private static final String HTTP_CACHE_DIR = "http";
private static final int IO_BUFFER_SIZE = 8 * 1024;
private DiskLruCache mHttpDiskCache;
private File mHttpCacheDir;
private boolean mHttpDiskCacheStarting = true;
private final Object mHttpDiskCacheLock = new Object();
private static final int DISK_CACHE_INDEX = 0;
/**
* Initialize providing a target image width and height for the processing images.
*
* @param context
* @param imageWidth
* @param imageHeight
*/
public ImageFetcher(Context context, int imageWidth, int imageHeight) {
super(context, imageWidth, imageHeight);
init(context);
}
/**
* Initialize providing a single target image size (used for both width and height);
*
* @param context
* @param imageSize
*/
public ImageFetcher(Context context, int imageSize) {
super(context, imageSize);
init(context);
}
private void init(Context context) {
checkConnection(context);
mHttpCacheDir = ImageCache.getDiskCacheDir(context, HTTP_CACHE_DIR);
}
@Override
protected void initDiskCacheInternal() {
super.initDiskCacheInternal();
initHttpDiskCache();
}
private void initHttpDiskCache() {
if (!mHttpCacheDir.exists()) {
mHttpCacheDir.mkdirs();
}
synchronized (mHttpDiskCacheLock) {
if (ImageCache.getUsableSpace(mHttpCacheDir) > HTTP_CACHE_SIZE) {
try {
mHttpDiskCache = DiskLruCache.open(mHttpCacheDir, 1, 1, HTTP_CACHE_SIZE);
} catch (IOException e) {
mHttpDiskCache = null;
}
}
mHttpDiskCacheStarting = false;
mHttpDiskCacheLock.notifyAll();
}
}
@Override
protected void clearCacheInternal() {
super.clearCacheInternal();
synchronized (mHttpDiskCacheLock) {
if (mHttpDiskCache != null && !mHttpDiskCache.isClosed()) {
try {
mHttpDiskCache.delete();
Log.d(TAG, "HTTP cache cleared");
} catch (IOException e) {
Log.e(TAG, "clearCacheInternal - " + e);
}
mHttpDiskCache = null;
mHttpDiskCacheStarting = true;
initHttpDiskCache();
}
}
}
@Override
protected void flushCacheInternal() {
super.flushCacheInternal();
synchronized (mHttpDiskCacheLock) {
if (mHttpDiskCache != null) {
try {
mHttpDiskCache.flush();
} catch (IOException e) {
Log.e(TAG, "flush - " + e);
}
}
}
}
@Override
protected void closeCacheInternal() {
super.closeCacheInternal();
synchronized (mHttpDiskCacheLock) {
if (mHttpDiskCache != null) {
try {
if (!mHttpDiskCache.isClosed()) {
mHttpDiskCache.close();
mHttpDiskCache = null;
}
} catch (IOException e) {
Log.e(TAG, "closeCacheInternal - " + e);
}
}
}
}
/**
* Simple network connection check.
*
* @param context
*/
private void checkConnection(Context context) {
final ConnectivityManager cm =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
final NetworkInfo networkInfo = cm.getActiveNetworkInfo();
if (networkInfo == null || !networkInfo.isConnectedOrConnecting()) {
Log.e(TAG, "checkConnection - no connection found");
}
}
/**
* The main process method, which will be called by the ImageWorker in the AsyncTask background
* thread.
*
* @param data The data to load the bitmap, in this case, a regular http URL
* @return The downloaded and resized bitmap
*/
private Bitmap processBitmap(String data) {
final String key = ImageCache.hashKeyForDisk(data);
FileDescriptor fileDescriptor = null;
FileInputStream fileInputStream = null;
DiskLruCache.Snapshot snapshot;
synchronized (mHttpDiskCacheLock) {
// Wait for disk cache to initialize
while (mHttpDiskCacheStarting) {
try {
mHttpDiskCacheLock.wait();
} catch (InterruptedException e) {}
}
if (mHttpDiskCache != null) {
try {
snapshot = mHttpDiskCache.get(key);
if (snapshot == null) {
DiskLruCache.Editor editor = mHttpDiskCache.edit(key);
if (editor != null) {
if (downloadUrlToStream(data,
editor.newOutputStream(DISK_CACHE_INDEX))) {
editor.commit();
} else {
editor.abort();
}
}
snapshot = mHttpDiskCache.get(key);
}
if (snapshot != null) {
fileInputStream =
(FileInputStream) snapshot.getInputStream(DISK_CACHE_INDEX);
fileDescriptor = fileInputStream.getFD();
}
} catch (IOException e) {
Log.e(TAG, "processBitmap - " + e);
} catch (IllegalStateException e) {
Log.e(TAG, "processBitmap - " + e);
} finally {
if (fileDescriptor == null && fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e) {}
}
}
}
}
Bitmap bitmap = null;
if (fileDescriptor != null) {
bitmap = decodeSampledBitmapFromDescriptor(fileDescriptor, mImageWidth,
mImageHeight, getImageCache());
}
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e) {}
}
return bitmap;
}
@Override
protected Bitmap processBitmap(Object data) {
return processBitmap(String.valueOf(data));
}
/**
* Download a bitmap from a URL and write the content to an output stream.
*
* @param urlString The URL to fetch
* @return true if successful, false otherwise
*/
public boolean downloadUrlToStream(String urlString, OutputStream outputStream) {
disableConnectionReuseIfNecessary();
HttpURLConnection urlConnection = null;
BufferedOutputStream out = null;
BufferedInputStream in = null;
try {
final URL url = new URL(urlString);
urlConnection = (HttpURLConnection) url.openConnection();
in = new BufferedInputStream(urlConnection.getInputStream(), IO_BUFFER_SIZE);
out = new BufferedOutputStream(outputStream, IO_BUFFER_SIZE);
int b;
while ((b = in.read()) != -1) {
out.write(b);
}
return true;
} catch (final IOException e) {
Log.e(TAG, "Error in downloadBitmap - " + e);
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
}
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (final IOException e) {}
}
return false;
}
/**
* Workaround for bug pre-Froyo, see here for more info:
* http://android-developers.blogspot.com/2011/09/androids-http-clients.html
*/
public static void disableConnectionReuseIfNecessary() {
// HTTP connection reuse which was buggy pre-froyo
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) {
System.setProperty("http.keepAlive", "false");
}
}
}
package com.imagepicker;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
/**
* Created by Gil on 07/06/2014.
*/
public class ImageInternalFetcher extends ImageResizer {
Context mContext;
public ImageInternalFetcher(Context context, int imageWidth, int imageHeight) {
super(context, imageWidth, imageHeight);
init(context);
}
public ImageInternalFetcher(Context context, int imageSize) {
super(context, imageSize);
init(context);
}
private void init(Context context){
mContext = context;
}
protected Bitmap processBitmap(Uri uri){
return decodeSampledBitmapFromFile(uri.getPath(), mImageWidth, mImageHeight, getImageCache());
}
@Override
protected Bitmap processBitmap(Object data) {
return processBitmap((Uri)data);
}
}
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.imagepicker;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.util.Log;
/**
* A BitmapDrawable that keeps track of whether it is being displayed or cached.
* When the drawable is no longer being displayed or cached,
* {@link android.graphics.Bitmap#recycle() recycle()} will be called on this drawable's bitmap.
*/
public class RecyclingBitmapDrawable extends BitmapDrawable {
static final String TAG = "CountingBitmapDrawable";
private int mCacheRefCount = 0;
private int mDisplayRefCount = 0;
private boolean mHasBeenDisplayed;
public RecyclingBitmapDrawable(Resources res, Bitmap bitmap) {
super(res, bitmap);
}
/**
* Notify the drawable that the displayed state has changed. Internally a
* count is kept so that the drawable knows when it is no longer being
* displayed.
*
* @param isDisplayed - Whether the drawable is being displayed or not
*/
public void setIsDisplayed(boolean isDisplayed) {
//BEGIN_INCLUDE(set_is_displayed)
synchronized (this) {
if (isDisplayed) {
mDisplayRefCount++;
mHasBeenDisplayed = true;
} else {
mDisplayRefCount--;
}
}
// Check to see if recycle() can be called
checkState();
//END_INCLUDE(set_is_displayed)
}
/**
* Notify the drawable that the cache state has changed. Internally a count
* is kept so that the drawable knows when it is no longer being cached.
*
* @param isCached - Whether the drawable is being cached or not
*/
public void setIsCached(boolean isCached) {
//BEGIN_INCLUDE(set_is_cached)
synchronized (this) {
if (isCached) {
mCacheRefCount++;
} else {
mCacheRefCount--;
}
}
// Check to see if recycle() can be called
checkState();
//END_INCLUDE(set_is_cached)
}
private synchronized void checkState() {
//BEGIN_INCLUDE(check_state)
// If the drawable cache and display ref counts = 0, and this drawable
// has been displayed, then recycle
if (mCacheRefCount <= 0 && mDisplayRefCount <= 0 && mHasBeenDisplayed
&& hasValidBitmap()) {
getBitmap().recycle();
}
//END_INCLUDE(check_state)
}
private synchronized boolean hasValidBitmap() {
Bitmap bitmap = getBitmap();
return bitmap != null && !bitmap.isRecycled();
}
}
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.imagepicker;
import android.os.Build;
import android.os.Build.VERSION_CODES;
/**
* Class containing some static utility methods.
*/
public class Utils {
private Utils() {};
public static boolean hasFroyo() {
// Can use static final constants like FROYO, declared in later versions
// of the OS since they are inlined at compile time. This is guaranteed behavior.
return Build.VERSION.SDK_INT >= VERSION_CODES.FROYO;
}
public static boolean hasGingerbread() {
return Build.VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD;
}
public static boolean hasHoneycomb() {
return Build.VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB;
}
public static boolean hasHoneycombMR1() {
return Build.VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB_MR1;
}
public static boolean hasJellyBean() {
return Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN;
}
public static boolean hasKitKat() {
return Build.VERSION.SDK_INT >= VERSION_CODES.KITKAT;
}
}
......@@ -88,7 +88,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
private static final String TAG ="ABVContentViewActivity";
public final static int ABOOK_CHECK_TASK_IMAGE = 103;
public final static int ABOOK_CHECK_TASK_VIDEO = 104;
protected final static int ABOOK_CHECK_SELECT_SCENE = 105;
protected long contentId;// 表示中のコンテンツID
protected long objectId; // オブジェクトID(オブジェクト用のActivityのときのみ使用)
......
......@@ -107,7 +107,8 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
// OS 8.0で起きるバグ(ダイアログActivity表示後(windowIsTranslucent: true)、画面を固定するとCrashされる問題対策)
// showPushMessageActivityが存在する場合は、以下のメソッドを実行しない
if (!ActivityHandlingHelper.getInstance().hasShowPushMessageActivity()) {
if (!ActivityHandlingHelper.getInstance().hasShowPushMessageActivity() &&
!ActivityHandlingHelper.getInstance().hasShowDeviceImageListActivity()) {
setPortraitIfNormal();
}
......
......@@ -3,6 +3,7 @@ import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.FrameLayout;
......@@ -42,6 +43,25 @@ public class AlertDialogUtil {
return alertDialog;
}
/**
* 共通ダイアログ表示用(Cancel表示・非表示、OKボタンコールバック)
* @param context コンテキスト
* @param title タイトル
* @param message メッセージ
* @param isCancleButtonHidden Cancelボタン表示(false)・非表示(true)
* @param okOnClick OKボタンコールバック
*/
public static void showAlertDialog(Context context, int title, int message, boolean isCancleButtonHidden, DialogInterface.OnClickListener okOnClick) {
ABookAlertDialog alertDialog = createAlertDialog(context, context.getResources().getString(title), context.getResources().getString(message));
if (!isCancleButtonHidden) {
alertDialog.setNegativeButton(R.string.cancel, null);
}
alertDialog.setPositiveButton(R.string.ok, okOnClick);
alertDialog.show();
}
public static ABookAlertDialog deleteContentAlertDialog(Context context, int deleteMessage) {
ABookAlertDialog alertDialog = createAlertDialog(context, R.string.delete);
alertDialog.setMessage(deleteMessage);
......
......@@ -21,6 +21,7 @@ import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
import jp.agentec.abook.abv.ui.viewer.activity.DeviceImageListActivity;
import jp.agentec.abook.abv.ui.viewer.activity.HTMLWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.HTMLXWalkWebViewActivity;
......@@ -97,7 +98,10 @@ public class ABookPermissionHelper {
// ストレージ
if (ContextCompat.checkSelfPermission(mContext, android.Manifest.permission.READ_EXTERNAL_STORAGE) != PERMISSION_GRANTED ||
ContextCompat.checkSelfPermission(mContext, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) {
if (mContext instanceof HTMLWebViewActivity || mContext instanceof HTMLXWalkWebViewActivity || mContext instanceof OperationListActivity) {
if (mContext instanceof HTMLWebViewActivity ||
mContext instanceof HTMLXWalkWebViewActivity ||
mContext instanceof OperationListActivity ||
mContext instanceof DeviceImageListActivity) {
// リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(mContext,
R.string.msg_permission_dialog_storage_album,
......@@ -108,7 +112,6 @@ public class ABookPermissionHelper {
R.string.msg_permission_dialog_storage_update,
getUserPref(mContext, AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
}
}
break;
case Constant.ABookPermissionType.AccessFineLocation:
......
......@@ -78,6 +78,7 @@ import jp.agentec.abook.abv.ui.home.activity.OperationRelatedContentActivity;
import jp.agentec.abook.abv.ui.viewer.activity.AudioPlayActivity;
import jp.agentec.abook.abv.ui.viewer.activity.CheckOZDViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.ContentViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.DeviceImageListActivity;
import jp.agentec.abook.abv.ui.viewer.activity.EnqueteWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.HTMLWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.activity.HTMLXWalkWebViewActivity;
......@@ -820,6 +821,21 @@ public class ActivityHandlingHelper extends ABookHelper implements RemoteObserve
}
/**
* シーン選択画面Activityが存在確認
* @return true:表示中状態、false:非表示状態
*/
public boolean hasShowDeviceImageListActivity() {
if (CollectionUtil.isNotEmpty(currentActivityStack)) {
for (ABVAuthenticatedActivity activity : currentActivityStack) {
if ((activity instanceof DeviceImageListActivity)) {
return true;
}
}
}
return false;
}
/**
* 履歴から該当の360コンテンツを削除する
* @param contentId long
*/
......
......@@ -657,10 +657,6 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
return;
}
mUploadMessage.onReceiveValue(result);
} else if (requestCode == ABOOK_CHECK_SELECT_SCENE) {
if (intent != null && result != null) {
confirmEntrySceneDialog(result[0]);
}
}
mUploadMessage = null;
}
......
......@@ -729,10 +729,6 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
}
// 動画
mUploadMessage.onReceiveValue(result);
} else if (requestCode == ABOOK_CHECK_SELECT_SCENE) {
if (intent != null && result != null) {
confirmEntrySceneDialog(result);
}
}
mUploadMessage = null;
}
......
package jp.agentec.abook.abv.ui.viewer.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import java.util.List;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.viewer.activity.DeviceImageListActivity;
import jp.agentec.abook.abv.ui.viewer.view.CustomImage;
public class ImageGalleryAdapter extends BaseAdapter {
Context context;
LayoutInflater inflater;
List<CustomImage> imageUriList;
int mRowHeight;
public ImageGalleryAdapter(Context context, List<CustomImage> imageUriList, int rowHeight) {
this.context = context;
this.imageUriList = imageUriList;
this.mRowHeight = rowHeight;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return imageUriList.size();
}
@Override
public CustomImage getItem(int position) {
return imageUriList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_device_thumbnail, null);
holder = new ViewHolder();
holder.mThumbnail = (ImageView) convertView.findViewById(R.id.iv_thumbnail);
holder.mThumbnailSelected = (ImageView) convertView.findViewById(R.id.iv_thumbnail_selected);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.mThumbnail.getLayoutParams().height = mRowHeight;
holder.mThumbnail.requestLayout();
CustomImage customImage = getItem(position);
boolean isSelected = ((DeviceImageListActivity)context).containsCustomImageUri(customImage.mUri);
if (isSelected) {
holder.mThumbnailSelected.setVisibility(View.VISIBLE);
} else {
holder.mThumbnailSelected.setVisibility(View.INVISIBLE);
}
if (holder.customImage == null || !holder.customImage.mUri.equals(customImage.mUri)) {
((DeviceImageListActivity)context).mImageFetcher.loadImage(customImage.mUri, holder.mThumbnail, customImage.mOrientation);
holder.customImage = customImage;
}
return convertView;
}
class ViewHolder {
ImageView mThumbnail;
ImageView mThumbnailSelected;
CustomImage customImage;
}
}
package jp.agentec.abook.abv.ui.viewer.view;
import android.net.Uri;
/**
* シーン選択画面で表示するイメージ情報
* Created by 金鎭星 on 2020/05/08.
*/
public class CustomImage {
public Uri mUri;
public int mOrientation;
public CustomImage(Uri uri, int orientation){
mUri = uri;
mOrientation = orientation;
}
}
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