Commit 2b89d8b8 by Lee Jaebin

#32824_作業一覧画面改善

parent 60419936
package jp.agentec.abook.abv.bl.acms.type;
public interface OperationButtonType {
// 0:リスト、1:図面、2:360
// 0:360編集、1:情報更新、2:作業画面
int PANO_EDIT = 0;
int INFORMATION_UPDATE = 1;
int WORK = 2;
int DOCUMENT_REFERENCE = 3;
}
......@@ -14,6 +14,14 @@
android:minHeight="50dp"
android:visibility="visible">
<ImageButton
android:id="@+id/btn_view_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:background="@drawable/ic_communication_menu" />
<TextView
android:id="@+id/title"
style="@style/DialogToolBarTitle"
......@@ -102,7 +110,7 @@
</RelativeLayout>
<FrameLayout
android:id="@+id/contents_list_layout"
android:id="@+id/operation_list_layout"
style="@style/content_list_bg"
android:layout_width="match_parent"
android:layout_height="match_parent" />
......
......@@ -2,7 +2,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/operation_underline"
android:background="@drawable/list_selector_holo_light"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
......@@ -99,7 +100,7 @@
android:id="@+id/btn_information_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_information_update" />
android:background="@drawable/btn_information_update"/>
<TextView
android:id="@+id/txt_information_update"
......@@ -108,45 +109,6 @@
style="@style/ProjectIconText"
android:text="@string/information_update" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="vertical">
<ImageView
android:id="@+id/btn_work"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_work" />
<TextView
android:id="@+id/txt_work"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/ProjectIconText" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="vertical">
<ImageView
android:id="@+id/btn_document_reference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_document_reference" />
<TextView
android:id="@+id/txt_document_reference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/ProjectIconText"
android:text="@string/document_reference" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<RelativeLayout
......@@ -14,6 +15,14 @@
android:minHeight="50dp"
android:visibility="visible">
<ImageButton
android:id="@+id/btn_view_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:background="@drawable/ic_communication_menu" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -118,9 +127,10 @@
</RelativeLayout>
<com.handmark.pulltorefresh.library.PullToRefreshListView
android:id="@+id/operationListView"
<FrameLayout
android:id="@+id/operation_list_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:clickable="true"/>
</LinearLayout>
\ No newline at end of file
......@@ -127,26 +127,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="vertical">
<ImageView
android:id="@+id/btn_document_reference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_document_reference" />
<TextView
android:id="@+id/txt_document_reference"
style="@style/ProjectIconText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/document_reference" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -3,11 +3,14 @@
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_selector_holo_light"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
......@@ -24,31 +27,28 @@
android:orientation="horizontal">
<TextView
android:id="@+id/content_submenu_button"
android:id="@+id/operation_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/content_description"
android:text="TaskName" />
android:layout_marginTop="5dp"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/dummy_str"
android:textColor="@color/operation_name"
android:textSize="@dimen/app_large_text_size"
android:textStyle="bold" />
</LinearLayout>
<RelativeLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp">
<FrameLayout
android:id="@+id/frameLayout1"
android:layout_width="@dimen/content_panel_image_size_width"
android:layout_height="@dimen/content_panel_image_size_height"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp">
<RelativeLayout
android:id="@+id/content_thumbnail_layout"
android:layout_width="@dimen/content_panel_image_size_width"
android:layout_height="@dimen/content_panel_image_size_height"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:layout_gravity="center">
<ImageButton
......@@ -58,58 +58,42 @@
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:background="@drawable/btn_information_update" />
</RelativeLayout>
</FrameLayout>
<LinearLayout
android:id="@+id/operation_date_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/frameLayout1"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_weight="1"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="@+id/content_thumbnail_layout"
android:background="#dce6e6"
android:orientation="vertical"
android:padding="3dp"
android:paddingBottom="10dp">
<LinearLayout
android:id="@+id/content_size_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:layout_weight="2"
android:background="#dce6e6"
android:orientation="vertical"
android:padding="3dp">
<TextView
android:id="@+id/content_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/dummy_num"
android:textColor="@color/text_select"
android:textSize="18sp" />
<TextView
android:id="@+id/content_delivery_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="2"
android:text="@string/dummy_date"
android:textColor="@color/text_select"
android:textSize="15sp" />
</LinearLayout>
<TextView
android:id="@+id/operation_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/dummy_date"
android:textColor="@color/operation_date"
android:textSize="@dimen/operation_normal_text_size" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/button_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e6e6e6"
android:background="@drawable/operation_border"
android:orientation="horizontal"
android:padding="5dp"
android:visibility="visible">
......@@ -119,7 +103,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#e6e6e6"
android:gravity="center"
android:orientation="horizontal"
android:padding="5dp"
......@@ -146,16 +129,13 @@
android:layout_height="wrap_content"
android:text="@string/pano_edit" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/update_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#e6e6e6"
android:gravity="center"
android:orientation="horizontal"
android:padding="5dp"
......
......@@ -7,6 +7,7 @@ import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.CategoryDto;
import jp.agentec.abook.abv.bl.dto.GroupDto;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.DefPrefKey;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.UserPrefKey;
import jp.agentec.adf.util.DateTimeUtil;
......@@ -19,10 +20,7 @@ public class ABVUIDataCache {
private Context context;
// ホーム画面項目
private ArrayList<Integer> mContentTypes;
private ArrayList<Integer> mContentTypesForMyData;
private boolean mSelectedDashboardMenu = false;
private int mSelectedHomeMenuType;
private int viewMode; // パンネル、リスト形式
public long lastUpdateTime = -1;
public String searchText;
......@@ -30,10 +28,6 @@ public class ABVUIDataCache {
public boolean isFirstLaunching = true; // ログアウトした時もtrueに変える
public boolean checkLocationServiceFlg = true; // アプリ起動一回につき一度位置情報アラートを表示する
// グループ、ジャンル、マイフォルダ階層スタック
public Stack<GroupDto> groupStack;
public Stack<CategoryDto> categoryStack;
public boolean preIsCatalogEdition;
// ユーザ情報コピー元コンテンツID
......@@ -55,8 +49,7 @@ public class ABVUIDataCache {
}
private void init() {
groupStack = new Stack<>();
categoryStack = new Stack<>();
viewMode = loadViewMode();
}
public long saveLastUpdateTime() {
......@@ -79,6 +72,19 @@ public class ABVUIDataCache {
return PreferenceUtil.getUserPref(context, UserPrefKey.SHOWED_PERMISSION_ACCESS_LOCATION_ALERT, false);
}
public int getViewMode() {
return viewMode;
}
public void setViewMode(int viewMode) {
this.viewMode = viewMode;
PreferenceUtil.putUserPref(context, UserPrefKey.VIEW_MODE, viewMode);
}
private int loadViewMode() {
return PreferenceUtil.getUserPref(context, UserPrefKey.VIEW_MODE, AppDefType.ViewMode.PANEL);
}
/**
* コンテンツビューからコンテンツビューへ
* 戻る時のコンテンツIDとページのセット
......
......@@ -51,6 +51,8 @@ public interface AppDefType {
String ALL_PERMISSION_CHECK = "appPermissionCheck";
String SYNC_TARGET_OPERATION_ID = "syncTargetOperationId";
String SYNCED_OPERATION_ID = "syncedOperationId_%d";//一日一回情報更新が出来るように
String VIEW_MODE = "viewMode";
}
/**
......
......@@ -10,7 +10,6 @@ import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.provider.MediaStore;
import android.view.KeyEvent;
import android.view.View;
......@@ -21,6 +20,7 @@ import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
......@@ -30,7 +30,6 @@ import android.widget.TextView;
import android.widget.Toast;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import net.lingala.zip4j.exception.ZipException;
......@@ -85,6 +84,7 @@ import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.bl.logic.PushMessageLogic;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.ABVApplication;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
......@@ -96,12 +96,9 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.KeyboardUtils;
import jp.agentec.abook.abv.ui.home.adapter.FixPushMessageAdapter;
import jp.agentec.abook.abv.ui.home.adapter.OperationListAdapter;
import jp.agentec.abook.abv.ui.home.adapter.OperationListPanelAdapter;
import jp.agentec.abook.abv.ui.home.adapter.OperationSelectAdapter;
import jp.agentec.abook.abv.ui.home.adapter.PushMessageListAdapter;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.AbstractOperationListHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.helper.OperationListHelper;
import jp.agentec.abook.abv.ui.viewer.activity.HTMLXWalkWebViewActivity;
......@@ -116,15 +113,13 @@ import jp.agentec.adf.util.StringUtil;
public class OperationListActivity extends ABVUIActivity {
private static final String TAG = "OperationListActivity";
private PullToRefreshListView mListView;
private OperationListAdapter mOperationListAdapter;
private OperationListPanelAdapter mOperationListPanelAdapter;
private ImageButton mViewModeButton;
private ImageButton mSearchButton;
private ImageButton mCommunicationButton;
private ImageButton mCommonContentButton;
private List<OperationDto> mOperationList;
public int checkedViewModeId = 0;
public String mSearchWord;
public String mStartDateStr;
......@@ -175,23 +170,24 @@ public class OperationListActivity extends ABVUIActivity {
private boolean activityResultFlg;
private ListView mFixPushMessageListView;
private Dialog mMeetingListDialog;
private Dialog mPushMessageSendDialog;
private int mSelectedFixPuchMessagePosition;
private int mSendType;
private AbstractOperationListHelper mListHelper = null;
private OperationListHelper mListHelper = null;
// 新着更新処理の終了後、プルダウンを完了させるためのビュー
private PullToRefreshBase refreshBaseView;
private class ReloadHandler implements Runnable {
@Override
public void run() {
View child = mListHelper.getOperationList();
View child = mListHelper.getOperationView();
ViewGroup parent = (ViewGroup) child.getParent();
if (parent != null) {
parent.removeView(child);
}
FrameLayout vg = (FrameLayout) findViewById(R.id.contents_list_layout);
FrameLayout vg = (FrameLayout) findViewById(R.id.operation_list_layout);
vg.removeAllViews();
vg.addView(child);
}
......@@ -201,68 +197,8 @@ public class OperationListActivity extends ABVUIActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ac_operation_list);
mListHelper = getListHelper();
//
// mListView = (PullToRefreshListView) findViewById(R.id.operationListView);
// mListView.setEmptyView(findViewById(android.R.layout.simple_list_item_1));
//
// mListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
// @Override
// public void onRefresh(PullToRefreshBase<ListView> refreshView) {
// if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
// handler.post(new Runnable() {
// @Override
// public void run() {
// final ABookAlertDialog messageDialog = AlertDialogUtil.createAlertDialog(OperationListActivity.this, R.string.app_name);
// messageDialog.setMessage(getString(R.string.msg_network_offline));
// messageDialog.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int whichButton) {
// messageDialog.dismiss();
// }
// });
// messageDialog.show();
// mListView.onRefreshComplete();
// }
// });
// return;
// }
// long lastUpdateTime = PreferenceUtil.getUserPref(getApplicationContext(), AppDefType.UserPrefKey.LAST_UPDATE_TIME, 0L);
// if (lastUpdateTime > 0) {
// String lastUpdateTimeLabel = null;
// String strUpdateTime = DateTimeUtil.toString(new Date(lastUpdateTime), DateTimeFormat.yyyyMMddHHmmss_slash);
// String formatStr = getRString(R.string.recent_update_date);
// if (formatStr != null && formatStr.length() > 0) {
// lastUpdateTimeLabel = String.format(formatStr, strUpdateTime);
// }
// // Update the LastUpdatedLabel
// if (lastUpdateTimeLabel != null) {
// refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(lastUpdateTimeLabel);
// }
// }
//
// CommonExecutor.execute(new Runnable() {
// @Override
// public void run() {
// handler.post(new Runnable() {
// @Override
// public void run() {
// if (!contentRefresher.isRefreshing()) {
// dataRefresh(true);
// }
// mListView.onRefreshComplete();
// }
// });
// }
// });
// }
// });
//
// // ラベル変更
// mListView.getLoadingLayoutProxy().setRefreshingLabel(getRString(R.string.updating));
// mListView.getLoadingLayoutProxy().setPullLabel(getRString(R.string.pull_to_refresh_label));
// mListView.getLoadingLayoutProxy().setReleaseLabel(getRString(R.string.release_to_refresh_label));
mListHelper = new OperationListHelper(this);;
mViewModeButton = (ImageButton) findViewById(R.id.btn_view_mode);
mSearchButton = (ImageButton) findViewById(R.id.btn_search);
mSearchResultLayout = (LinearLayout) findViewById(R.id.search_result);
......@@ -270,6 +206,18 @@ public class OperationListActivity extends ABVUIActivity {
mCommunicationButton = (ImageButton) findViewById(R.id.btn_communication_menu);
mCommonContentButton = (ImageButton) findViewById(R.id.btn_common_content);
mViewModeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (getABVUIDataCache().getViewMode() == AppDefType.ViewMode.PANEL) {
getABVUIDataCache().setViewMode(AppDefType.ViewMode.LIST);
} else {
getABVUIDataCache().setViewMode(AppDefType.ViewMode.PANEL);
}
handler.post(new ReloadHandler());
}
});
// 画面リロード
refreshOperation();
......@@ -388,7 +336,7 @@ public class OperationListActivity extends ABVUIActivity {
// // ツールバーの検索結果レイアウトの表示・非表示
// checkShowSearchResult();
// if (mOperationListPanelAdapter == null) {
// mOperationListPanelAdapter = new OperationListPanelAdapter(OperationListActivity.this, mOperationList);
// mOperationListPanelAdapter = new OperationPanelAdapter(OperationListActivity.this, mOperationList);
// mListView.setAdapter(mOperationListPanelAdapter);
// mOperationListAdapter.setAdapterListener(new OperationListAdapter.OperationAdapterListener() {
// @Override
......@@ -467,6 +415,10 @@ public class OperationListActivity extends ABVUIActivity {
stopUpdateAnimation();
// 新着更新時間の更新
getABVUIDataCache().saveLastUpdateTime();
// 新着更新の完了通知
if (refreshBaseView != null) {
refreshBaseView.onRefreshComplete();
}
}
}
});
......@@ -604,7 +556,8 @@ public class OperationListActivity extends ABVUIActivity {
refreshOperation();
mSearchDialog.dismiss();
ABVToastUtil.showMakeText(OperationListActivity.this, String.format(getString(R.string.operation_search_count), mOperationList.size() + ""), Toast.LENGTH_SHORT);
ABVToastUtil.showMakeText(OperationListActivity.this, String.format(getString(R.string.operation_search_count), mListHelper.getOperationCount() + ""), Toast.LENGTH_SHORT);
}
});
......@@ -689,8 +642,10 @@ public class OperationListActivity extends ABVUIActivity {
// プロジェクト名の初期化
mSearchTextView.setText(StringUtil.Empty);
// 種別の初期化
setSearchOperationReportTypeBtn(-1);
if (mOperationAuthLevel == OperationAuthLevel.WORKER && ABVDataCache.getInstance().serviceOption.isRoutineTaskReport()) {
// 種別の初期化
setSearchOperationReportTypeBtn(-1);
}
}
// 開始日と終了日のバリデーション
......@@ -957,7 +912,7 @@ public class OperationListActivity extends ABVUIActivity {
*
* @param operationDto
*/
private void startPanoEdit(OperationDto operationDto) {
public void startPanoEdit(OperationDto operationDto) {
if (operationDto.contentId != null && operationDto.contentId != 0) {
showProgressPopup();
try {
......@@ -1265,6 +1220,10 @@ public class OperationListActivity extends ABVUIActivity {
*/
public void showPanoEntryDialog(final OperationDto operationDto) {
Logger.d(TAG, "*****************showPanoEntryDialog");
if (contentRefresher != null && contentRefresher.isRefreshing()) {
// 新着更新処理が行っていれば、止める
contentRefresher.stopRefresh();
}
if (mPanoEntryDialog == null) {
mPanoEntryDialog = new Dialog(OperationListActivity.this);
mPanoEntryDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
......@@ -1498,7 +1457,7 @@ public class OperationListActivity extends ABVUIActivity {
mOperationSelectDialog.setContentView(R.layout.operation_select_dialog);
mOperationSelectListView = (ListView) mOperationSelectDialog.findViewById(R.id.lv_operation_select);
mOperationSelectAdapter = new OperationSelectAdapter(OperationListActivity.this, mOperationList);
mOperationSelectAdapter = new OperationSelectAdapter(OperationListActivity.this, mListHelper.getOperationList());
mOperationSelectListView.setAdapter(mOperationSelectAdapter);
mOperationSelectListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
......@@ -1780,9 +1739,133 @@ public class OperationListActivity extends ABVUIActivity {
return false;
}
private AbstractOperationListHelper getListHelper() {
AbstractOperationListHelper contentListHelper;
contentListHelper = new OperationListHelper(this);
return contentListHelper;
/**
* 作業指示または、報告画面に移動
* @param operationDto
*/
public void openDirectionsOrReportView(OperationDto operationDto) {
// 新着更新を止める
contentRefresher.stopRefresh();
startTaskDirectionOrReportView(operationDto);
}
/**
* 同期処理
* @param operationDto
*/
public void startSyncOperation(final OperationDto operationDto) {
//ネットワークチェック
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
ABVToastUtil.showMakeText(OperationListActivity.this, R.string.request_network_connection, Toast.LENGTH_SHORT);
return;
}
//新着更新中
if (contentRefresher.isRefreshing()) {
return;
}
showProgressView(getString(R.string.synchronizing));
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
Logger.i(TAG, "[syncOperation] operationId=%s, contentId=%s", operationDto.operationId, operationDto.contentId);
// コンテンツダウンロード
ContentDto contentDto = contentDao.getContent(operationDto.contentId);
if (contentDto == null || !contentDto.downloadedFlg || contentDto.updatedFlg) {
contentDownload(operationDto.contentId, false);
} else {
syncOperation(operationDto.operationId, operationDto.operationReportType, true);
}
}
});
}
/**
* リストビュー用のプルダウンで新着更新処理
* @param refreshView
*/
public void pullToListViewRefresh(PullToRefreshBase<ListView> refreshView) {
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
showDisConnectNetworkDialog();
return;
}
long lastUpdateTime = PreferenceUtil.getUserPref(getApplicationContext(), AppDefType.UserPrefKey.LAST_UPDATE_TIME, 0L);
if (lastUpdateTime > 0) {
String lastUpdateTimeLabel = null;
String strUpdateTime = DateTimeUtil.toString(new Date(lastUpdateTime), DateTimeFormat.yyyyMMddHHmmss_slash);
String formatStr = getString(R.string.recent_update_date);
lastUpdateTimeLabel = String.format(formatStr, strUpdateTime);
// Update the LastUpdatedLabel
if (lastUpdateTimeLabel != null) {
refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(lastUpdateTimeLabel);
}
}
refreshBaseView = refreshView;
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
if (!contentRefresher.isRefreshing()) {
dataRefresh(true);
}
}
});
}
/**
* パンネルビュー用のプルダウンで新着更新処理
* @param refreshView
*/
public void pullToGridViewRefresh(PullToRefreshBase<GridView> refreshView) {
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
showDisConnectNetworkDialog();
return;
}
long lastUpdateTime = PreferenceUtil.getUserPref(getApplicationContext(), AppDefType.UserPrefKey.LAST_UPDATE_TIME, 0L);
if (lastUpdateTime > 0) {
String lastUpdateTimeLabel = null;
String strUpdateTime = DateTimeUtil.toString(new Date(lastUpdateTime), DateTimeFormat.yyyyMMddHHmmss_slash);
String formatStr = getString(R.string.recent_update_date);
lastUpdateTimeLabel = String.format(formatStr, strUpdateTime);
// Update the LastUpdatedLabel
if (lastUpdateTimeLabel != null) {
refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(lastUpdateTimeLabel);
}
}
refreshBaseView = refreshView;
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
handler.post(new Runnable() {
@Override
public void run() {
if (!contentRefresher.isRefreshing()) {
dataRefresh(true);
}
}
});
}
});
}
/**
* インターネットが繋がってない場合のダイアログ表示
*/
private void showDisConnectNetworkDialog() {
handler.post(new Runnable() {
@Override
public void run() {
final ABookAlertDialog messageDialog = AlertDialogUtil.createAlertDialog(OperationListActivity.this, R.string.app_name);
messageDialog.setMessage(getString(R.string.msg_network_offline));
messageDialog.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
messageDialog.dismiss();
}
});
messageDialog.show();
}
});
}
}
......@@ -8,6 +8,9 @@ import android.widget.ImageView;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.launcher.android.R;
......@@ -15,18 +18,17 @@ import jp.agentec.abook.abv.launcher.android.R;
* Created by leej on 2019/03/06.
*/
public abstract class AbstractOperationListAdapter extends BaseAdapter {
public abstract class AbstractOperationAdapter extends BaseAdapter {
protected AbstractOperationListAdapterListener listener;
protected List<OperationDto> listItem = new ArrayList<>(); // NullPointException防止
public boolean isEditMode;
protected int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
protected ContentDao mContentDao = AbstractDao.getDao(ContentDao.class);
public interface AbstractOperationListAdapterListener {
boolean onContentDownload(long contentId);
void onContentDownloadPause(long contentId);
void onContentDownloadResume(OperationDto OperationDto);
void onOpenContentView(long contentId);
void onOpenContentSubmenu(OperationDto OperationDto);
void onContentChecked();
// 360編集
void onPanoEdit(OperationDto operationDto);
// 同期処理
void onSyncOperation(OperationDto OperationDto);
}
@Override
......@@ -52,58 +54,4 @@ public abstract class AbstractOperationListAdapter extends BaseAdapter {
public void setAdapterListener(AbstractOperationListAdapterListener listener) {
this.listener = listener;
}
protected class OnDownloadPauseButtonClickListener implements View.OnClickListener{
private OperationDto OperationDto;
public OnDownloadPauseButtonClickListener(OperationDto OperationDto) {
this.OperationDto = OperationDto;
}
@Override
public void onClick(View v) {
AsyncTask<Params, Void, Void> task = new AsyncTask<Params, Void, Void>() {
@Override
protected Void doInBackground(Params... params) {
listener.onContentDownloadPause(params[0].contentId);
return null;
}
};
Params params = new Params();
params.contentId = OperationDto.contentId;
task.execute(params);
}
}
protected class OnDownloadResumeButtonClickListener implements View.OnClickListener{
private OperationDto OperationDto;
public OnDownloadResumeButtonClickListener(OperationDto OperationDto) {
this.OperationDto = OperationDto;
}
@Override
public void onClick(View v) {
// ダウンロード登録に時間がかかるので非同期処理で実行
AsyncTask<Params, Void, Void> task = new AsyncTask<Params, Void, Void>() {
@Override
protected Void doInBackground(Params... params) {
listener.onContentDownloadResume(OperationDto);
return null;
}
};
Params params = new Params();
params.contentId = OperationDto.contentId;
task.execute(params);
}
}
}
class Params {
long contentId;
}
class Result {
boolean result;
}
......@@ -4,7 +4,6 @@ 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 android.widget.LinearLayout;
import android.widget.TextView;
......@@ -16,11 +15,7 @@ import jp.agentec.abook.abv.bl.acms.type.OperationAuthLevel;
import jp.agentec.abook.abv.bl.acms.type.OperationButtonType;
import jp.agentec.abook.abv.bl.acms.type.OperationType;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.dto.CategoryContentDto;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
......@@ -37,16 +32,11 @@ import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
* Created by leej on 2018/08/17.
*/
public class OperationListAdapter extends AbstractOperationListAdapter {
public class OperationListAdapter extends AbstractOperationAdapter {
private static final String TAG = "OperationListAdapter";
private Context mContext;
private LayoutInflater mInflater;
// private OperationListAdapter.OperationAdapterListener listener;
private List<OperationDto> mListItem = new ArrayList<>();
private ContentDao mContentDao = AbstractDao.getDao(ContentDao.class);
private int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
private List<CategoryContentDto> mOperationContentList;
private OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
private boolean mNormalSizeFlg;
public OperationListAdapter(Context context, List<OperationDto> listItem) {
......@@ -73,22 +63,6 @@ public class OperationListAdapter extends AbstractOperationListAdapter {
return mListItem.get(position).operationId;
}
public interface OperationAdapterListener {
void onPanoEdit(OperationDto operationDto);
void onSyncOperation(OperationDto operationDto);
void onOpenDirectionsOrReportView(OperationDto operationDto);
void onOpenRelatedContentList(OperationDto operationDto);
void onShowEntryPanoContentDialog(OperationDto operationDto);
}
public void setAdapterListener(OperationAdapterListener listener) {
// this.listener = listener;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
......@@ -108,14 +82,6 @@ public class OperationListAdapter extends AbstractOperationListAdapter {
holder.ivInformationUpdate = (ImageView) convertView.findViewById(R.id.btn_information_update);
holder.tvInformationUpdateText = (TextView) convertView.findViewById(R.id.txt_information_update);
// 作業指示、報告関連
holder.ivWork = (ImageView) convertView.findViewById(R.id.btn_work);
holder.tvWorkText = (TextView) convertView.findViewById(R.id.txt_work);
// 資料参照関連
holder.ivDocumentReference = (ImageView) convertView.findViewById(R.id.btn_document_reference);
holder.tvDocumentReferenceText = (TextView) convertView.findViewById(R.id.txt_document_reference);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
......@@ -136,11 +102,6 @@ public class OperationListAdapter extends AbstractOperationListAdapter {
holder.tvDate.setText(mContext.getString(R.string.date_label) + " : " + DateTimeUtil.toString(operationDto.operationStartDate, DateTimeFormat.yyyyMMdd_slash) + " ~ " + DateTimeUtil.toString(operationDto.operationEndDate, DateTimeFormat.yyyyMMdd_slash));
}
holder.tvDescription.setText(operationDto.operationDescriptions);
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
holder.tvWorkText.setText(mContext.getString(R.string.work_instruction));
} else {
holder.tvWorkText.setText(mContext.getString(R.string.work_report));
}
// 同期ボタン表示・非表示
if (operationDto.contentId != null && operationDto.contentId != 0) {
......@@ -174,76 +135,34 @@ public class OperationListAdapter extends AbstractOperationListAdapter {
if (operationDto.contentCreatingFlg) { //Panoコンテンツ作成中の状態
setButtonEnabled(holder, OperationButtonType.PANO_EDIT, false);
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, false);
setButtonEnabled(holder, OperationButtonType.WORK, false);
} else {
setButtonEnabled(holder, OperationButtonType.PANO_EDIT, true);
if (operationDto.contentId != null && operationDto.contentId != 0) {
// コンテンツIDが存在する場合
ContentDto contentDto = mContentDao.getContent(operationDto.contentId);
if (contentDto.downloadedFlg) {
setButtonEnabled(holder, OperationButtonType.WORK, true);
} else {
// TODO ダウンロード失敗時、どうする?
setButtonEnabled(holder, OperationButtonType.WORK, false);
}
if (operationDto.contentId == null || operationDto.contentId != 0) {
setButtonEnabled(holder, OperationButtonType.PANO_EDIT, true);
} else {
setButtonEnabled(holder, OperationButtonType.WORK, true);
setButtonEnabled(holder, OperationButtonType.PANO_EDIT, false);
}
}
} else {
holder.lyPanoEditLayout.setVisibility(View.INVISIBLE);
if (operationDto.contentId != null && operationDto.contentId != 0) {
// コンテンツIDが存在する場合
ContentDto contentDto = mContentDao.getContent(operationDto.contentId);
if (contentDto != null && contentDto.downloadedFlg && !noRoutineTaskAll) {
setButtonEnabled(holder, OperationButtonType.WORK, true);
} else {
setButtonEnabled(holder, OperationButtonType.WORK, false);
}
} else {
setButtonEnabled(holder, OperationButtonType.WORK, false);
}
}
if(mOperationAuthLevel == OperationAuthLevel.WORKER) {
holder.lyPanoEditLayout.setVisibility(View.GONE);
}
// holder.ivPanoEdit.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// listener.onPanoEdit(operationDto);
// }
// });
//
// holder.ivInformationUpdate.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// listener.onSyncOperation(operationDto);
// }
// });
//
// holder.ivWork.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// if(operationDto.contentId != null && operationDto.contentId != 0) {
// listener.onOpenDirectionsOrReportView(operationDto);
// } else {
// listener.onShowEntryPanoContentDialog(operationDto);
// }
// }
// });
//
// holder.ivDocumentReference.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
//
// listener.onOpenRelatedContentList(operationDto);
// }
// });
holder.ivPanoEdit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onPanoEdit(operationDto);
}
});
checkRelatedContent(holder, operationDto.operationId);
holder.ivInformationUpdate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onSyncOperation(operationDto);
}
});
}
return convertView;
......@@ -261,20 +180,6 @@ public class OperationListAdapter extends AbstractOperationListAdapter {
// 情報更新関連
ImageView ivInformationUpdate;
TextView tvInformationUpdateText;
// 作業指示、報告関連
ImageView ivWork;
TextView tvWorkText;
// 資料参照関連
ImageView ivDocumentReference;
TextView tvDocumentReferenceText;
}
// ListViewのタップ時、反応を無効化
@Override
public boolean isEnabled(int position) {
return false;
}
private void setButtonEnabled(ViewHolder holder, int buttonType, boolean isEnabled) {
......@@ -287,23 +192,6 @@ public class OperationListAdapter extends AbstractOperationListAdapter {
holder.ivInformationUpdate.setEnabled(isEnabled);
holder.tvInformationUpdateText.setTextColor(mContext.getResources().getColor(isEnabled ? R.color.operation_color : R.color.operation_disable_color));
break;
case OperationButtonType.DOCUMENT_REFERENCE:
holder.ivDocumentReference.setEnabled(isEnabled);
holder.tvDocumentReferenceText.setTextColor(mContext.getResources().getColor(isEnabled ? R.color.operation_color : R.color.operation_disable_color));
break;
case OperationButtonType.WORK:
holder.ivWork.setEnabled(isEnabled);
holder.tvWorkText.setTextColor(mContext.getResources().getColor(isEnabled ? R.color.operation_color : R.color.operation_disable_color));
break;
}
}
private void checkRelatedContent(ViewHolder holder, long operationId){
if (mOperationLogic.isExistOperationRelatedContent(operationId)) {
setButtonEnabled(holder, OperationButtonType.DOCUMENT_REFERENCE, true);
} else {
setButtonEnabled(holder, OperationButtonType.DOCUMENT_REFERENCE, false);
}
}
}
package jp.agentec.abook.abv.ui.home.adapter;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.cl.util.BitmapUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
/**
* Created by leej on 2019/03/06.
*/
public class OperationListPanelAdapter extends AbstractOperationListAdapter {
final private String TAG = "OperationListPanelAdapter";
private Context context;
private LayoutInflater inflater;
private DecimalFormat df;
private final int padding;
private int categoryId;
private OperationListPanelAdapter.OperationListPanelAdapterListener mListener;
private ConcurrentHashMap<Long, OperationListPanelAdapter.ViewHolder> viewHolderMap;
public interface OperationListPanelAdapterListener {
void onPanoEdit(OperationDto operationDto);
void onSyncOperation(OperationDto operationDto);
void onOpenDirectionsOrReportView(OperationDto operationDto);
void onOpenRelatedContentList(OperationDto operationDto);
void onShowEntryPanoContentDialog(OperationDto operationDto);
}
public OperationListPanelAdapter(Context context, List<OperationDto> listItem) {
this.context = context;
this.listItem = listItem;
padding = (int) (4f * context.getResources().getDisplayMetrics().density + 0.5f);
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
df = new DecimalFormat("#,##0.00");
viewHolderMap = new ConcurrentHashMap<>();
}
public void setAdapterListener(OperationListPanelAdapter.OperationListPanelAdapterListener listener) {
this.mListener = listener;
}
@Override
public int getCount() {
return listItem.size();
}
@Override
public OperationDto getItem(int position) {
return listItem.get(position);
}
@Override
public long getItemId(int position) {
return listItem.get(position).contentId;
}
public List<OperationDto> getListItem() {
return listItem;
}
private static class ViewHolder {
long contentId;
TextView tvGenreName;
RelativeLayout thumbnailLayout;
TextView tvContentId;
TextView tvLastDeliveryDate;
TextView tvNewContentMark;
TextView tvContentName;
ImageView ivThumbnail;
ProgressBar downloadProgressBar;
LinearLayout operationLayout;
Button btnSaveContent;
Button btnDeleteContent;
Button btnOpenContent;
Button btnUpdateContent;
Button btnPauseSave;
Button btnRestartSave;
Button btnCancelSave;
}
@Override
public View getView(int position, View convertView, final ViewGroup parent) {
OperationListPanelAdapter.ViewHolder holder = null;
Logger.i(TAG, "OperationListPanelAdapter getView ......");
if (null == convertView) {
holder = new OperationListPanelAdapter.ViewHolder();
convertView = inflater.inflate(R.layout.item_operation_list_panel_render, null);
convertView.setTag(holder);
} else {
holder = (OperationListPanelAdapter.ViewHolder) convertView.getTag();
}
final OperationDto operationDto = getItem(position);
// // コンテンツID
// holder.tvContentId.setText(context.getString(R.string.content_num) + " " + contentDto.contractContentId);
//
// // 最後の公開処理日
// String lastDeliveryDate = DateTimeUtil.toString(contentDto.lastDeliveryDate, DateTimeFormat.yyyyMMdd_slash);
// if (lastDeliveryDate != null) {
// holder.tvLastDeliveryDate.setText(lastDeliveryDate + " " + context.getString(R.string.content_update));
// }
//
// // コンテンツ名
// holder.tvContentName.setText(" " + contentDto.contentName);
//
// // サムネイル
// if (holder.ivThumbnail.getDrawable() != null) {
// ((BitmapDrawable) holder.ivThumbnail.getDrawable()).getBitmap().recycle();
// }
//
// Bitmap resized = BitmapUtil.getResizedBitmap(contentDto.thumbnailNormalPath, thumbnailSizeWidth, thumbnailSizeHeight, Bitmap.Config.RGB_565);
// // nullの場合サムネイルなしイメージを表示
// if (resized == null) {
// resized = BitmapUtil.getResizedBitmapResource(context.getResources(), R.drawable.not_exist_thumbnail, thumbnailSizeWidth, thumbnailSizeHeight, Bitmap.Config.RGB_565);
// }
// // レイアウトを画像サイズに合わせる
// ViewGroup.LayoutParams params = holder.thumbnailLayout.getLayoutParams();
// params.width = resized.getWidth() + padding;
// params.height = resized.getHeight() + padding;
// holder.ivThumbnail.setImageBitmap(resized);
//
//
// // 操作
// configureOperationButton(holder, contentDto);
holder.contentId = getItemId(position);
viewHolderMap.put(operationDto.operationId, holder);
return convertView;
}
public void configureOperationButton(final OperationListPanelAdapter.ViewHolder holder, final ContentDto contentDto) {
Logger.i(TAG, "configureOperationButton ......");
holder.tvNewContentMark.setVisibility(View.GONE);
holder.operationLayout.setVisibility(View.VISIBLE);
holder.btnSaveContent.setVisibility(View.GONE);
holder.btnDeleteContent.setVisibility(View.GONE);
holder.btnOpenContent.setVisibility(View.GONE);
holder.btnUpdateContent.setVisibility(View.GONE);
holder.btnPauseSave.setVisibility(View.GONE);
holder.btnRestartSave.setVisibility(View.GONE);
holder.btnCancelSave.setVisibility(View.GONE);
}
class Params {
long contentId;
}
class Result {
boolean result;
}
}
package jp.agentec.abook.abv.ui.home.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.type.OperationAuthLevel;
import jp.agentec.abook.abv.bl.acms.type.OperationButtonType;
import jp.agentec.abook.abv.bl.acms.type.OperationType;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.StringUtil;
import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
/**
* Created by leej on 2019/03/06.
*/
public class OperationPanelAdapter extends AbstractOperationAdapter {
final private String TAG = "OperationPanelAdapter";
private Context mContext;
private LayoutInflater mInflater;
private final int padding;
private int categoryId;
private OperationPanelAdapter.OperationListPanelAdapterListener mListener;
public interface OperationListPanelAdapterListener {
void onPanoEdit(OperationDto operationDto);
void onSyncOperation(OperationDto operationDto);
void onOpenDirectionsOrReportView(OperationDto operationDto);
void onOpenRelatedContentList(OperationDto operationDto);
void onShowEntryPanoContentDialog(OperationDto operationDto);
}
public OperationPanelAdapter(Context context, List<OperationDto> listItem) {
this.mContext = context;
this.listItem = listItem;
padding = (int) (4f * mContext.getResources().getDisplayMetrics().density + 0.5f);
mInflater = (LayoutInflater) mContext.getSystemService(mContext.LAYOUT_INFLATER_SERVICE);
}
public void setAdapterListener(OperationPanelAdapter.OperationListPanelAdapterListener listener) {
this.mListener = listener;
}
@Override
public int getCount() {
return listItem.size();
}
@Override
public OperationDto getItem(int position) {
return listItem.get(position);
}
@Override
public long getItemId(int position) {
return listItem.get(position).contentId;
}
public List<OperationDto> getListItem() {
return listItem;
}
private static class ViewHolder {
TextView tvOperationName;
TextView tvDate;
TextView tvDescription;
// 360編集関連
LinearLayout lyPanoEditLayout;
ImageView ivPanoEdit;
TextView tvPanoEditText;
// 情報更新関連
ImageView ivInformationUpdate;
TextView tvInformationUpdateText;
}
@Override
public View getView(int position, View convertView, final ViewGroup parent) {
final OperationPanelAdapter.ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.item_operation_panel, parent, false);
holder = new OperationPanelAdapter.ViewHolder();
holder.tvOperationName = (TextView) convertView.findViewById(R.id.operation_name);
holder.tvDate = (TextView) convertView.findViewById(R.id.operation_date);
// holder.tvDescription = (TextView) convertView.findViewById(R.id.description);
// 360編集関連
holder.lyPanoEditLayout = (LinearLayout) convertView.findViewById(R.id.layout_pano_edit);
holder.ivPanoEdit = (ImageView) convertView.findViewById(R.id.btn_pano_edit);
holder.tvPanoEditText = (TextView) convertView.findViewById(R.id.txt_pano_edit);
// 情報更新関連
holder.ivInformationUpdate = (ImageView) convertView.findViewById(R.id.btn_information_update);
holder.tvInformationUpdateText = (TextView) convertView.findViewById(R.id.txt_information_update);
convertView.setTag(holder);
} else {
holder = (OperationPanelAdapter.ViewHolder) convertView.getTag();
}
final OperationDto operationDto = getItem(position);
if (operationDto != null) {
boolean noRoutineTaskAll = (operationDto.operationReportType == Constant.OperationReportType.INSPECT_REPORT && operationDto.reportCount == 0);
holder.tvOperationName.setText(operationDto.operationName);
if (operationDto.operationReportType == Constant.OperationReportType.INSPECT_REPORT) {
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod)) {
holder.tvDate.setText(mContext.getString(R.string.date_label_routineTask) + " : " + mContext.getString(R.string.msg_no_report_data));
} else {
holder.tvDate.setText(mContext.getString(R.string.date_label_routineTask) + " : " + operationDto.reportPeriod);
}
} else {
holder.tvDate.setText(mContext.getString(R.string.date_label) + " : " + DateTimeUtil.toString(operationDto.operationStartDate, DateTimeFormat.yyyyMMdd_slash) + " ~ " + DateTimeUtil.toString(operationDto.operationEndDate, DateTimeFormat.yyyyMMdd_slash));
}
// 同期ボタン表示・非表示
if (operationDto.contentId != null && operationDto.contentId != 0) {
if ((operationDto.needSyncFlg)) {
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, true);
} else {
// needSyncFlgがfalseの場合
if (operationDto.operationReportType == Constant.OperationReportType.INSPECT_REPORT) {
// 定期点検プロジェクトの場合のみ、以下の処理を行う
String syncedDate = getUserPref(mContext, String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationDto.operationId), "");
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod) && !syncedDate.equals(DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none))) {
// 同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, true);
} else {
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, false);
}
} else {
// 定期点検プロジェクトではない場合、同期ボタンを非活性化する
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, false);
}
}
} else {
// プロジェクトのコンテンツが存在しない場合は、同期ボタンを非活性化する
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, false);
}
if(operationDto.operationType == OperationType.PANO) {
// 360タイプのみ360編集ボタン表示
holder.lyPanoEditLayout.setVisibility(View.VISIBLE);
if (operationDto.contentCreatingFlg) { //Panoコンテンツ作成中の状態
setButtonEnabled(holder, OperationButtonType.PANO_EDIT, false);
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, false);
} else {
if (operationDto.contentId != null && operationDto.contentId != 0) {
setButtonEnabled(holder, OperationButtonType.PANO_EDIT, true);
} else {
setButtonEnabled(holder, OperationButtonType.PANO_EDIT, false);
}
}
} else {
holder.lyPanoEditLayout.setVisibility(View.INVISIBLE);
}
if(mOperationAuthLevel == OperationAuthLevel.WORKER) {
holder.lyPanoEditLayout.setVisibility(View.GONE);
}
holder.ivPanoEdit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onPanoEdit(operationDto);
}
});
holder.ivInformationUpdate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onSyncOperation(operationDto);
}
});
}
return convertView;
}
private void setButtonEnabled(OperationPanelAdapter.ViewHolder holder, int buttonType, boolean isEnabled) {
switch (buttonType) {
case OperationButtonType.PANO_EDIT :
holder.ivPanoEdit.setEnabled(isEnabled);
holder.tvPanoEditText.setTextColor(mContext.getResources().getColor(isEnabled ? R.color.operation_color : R.color.operation_disable_color));
break;
case OperationButtonType.INFORMATION_UPDATE:
holder.ivInformationUpdate.setEnabled(isEnabled);
holder.tvInformationUpdateText.setTextColor(mContext.getResources().getColor(isEnabled ? R.color.operation_color : R.color.operation_disable_color));
break;
}
}
}
package jp.agentec.abook.abv.ui.home.helper;
import android.view.ViewGroup;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
/**
* Created by leej on 2019/03/06.
*/
public abstract class AbstractOperationListHelper {
protected OperationListActivity mAppActivity;
public AbstractOperationListHelper(OperationListActivity activity) {
mAppActivity = activity;
}
/**
* 表示するコンテンツリスト取得を実装するメソッド
* @return ViewGroup
*/
public abstract ViewGroup getOperationList();
/**
* 表示中のリストを再表示する
*/
public abstract void refreshList();
}
package jp.agentec.abook.abv.ui.home.helper;
import android.content.Intent;
import android.net.Uri;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.GridView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Toast;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshGridView;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.OperationDao;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.bl.logic.UnAuthorizedContentLogic;
import jp.agentec.abook.abv.launcher.android.ABVApplication;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.ViewMode;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
import jp.agentec.abook.abv.ui.home.adapter.AbstractOperationListAdapter;
import jp.agentec.abook.abv.ui.home.adapter.AbstractOperationAdapter;
import jp.agentec.abook.abv.ui.home.adapter.OperationListAdapter;
import jp.agentec.abook.abv.ui.home.adapter.OperationListPanelAdapter;
import jp.agentec.adf.util.StringUtil;
import jp.agentec.abook.abv.ui.home.adapter.OperationPanelAdapter;
import static jp.agentec.abook.abv.bl.acms.type.OperationType.PANO;
/**
* Created by leej on 2019/03/06.
*/
public class OperationListHelper extends AbstractOperationListHelper {
public class OperationListHelper {
private static final String TAG = "OperationListHelper";
private AbstractOperationListAdapter mAdapter;
private OperationListActivity mAppActivity;
private AbstractOperationAdapter mAdapter;
private PullToRefreshListView mPullToRefreshListView;
private PullToRefreshGridView mPullToRefreshGridView;
private OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
private List<OperationDto> operationDtoList = new ArrayList<>();;
public OperationListHelper(OperationListActivity activity) {
super(activity);
mAppActivity = activity;
mPullToRefreshListView = new PullToRefreshListView(activity);
mPullToRefreshGridView = new PullToRefreshGridView(activity);
}
private List<OperationDto> filterOperationList() {
List<OperationDto> operationDtoList = new ArrayList<OperationDto>();
try {
operationDtoList = mOperationLogic.getRefreshOperation(mAppActivity.mSearchWord, mAppActivity.mStartDateStr, mAppActivity.mEndDateStr, mAppActivity.mSearchOperationReportType);
} catch (Exception e) {
......@@ -71,13 +61,12 @@ public class OperationListHelper extends AbstractOperationListHelper {
return operationDtoList;
}
@Override
public ViewGroup getOperationList() {
public ViewGroup getOperationView() {
int checkedViewModeId = ABVApplication.getABVUIDataCache(mAppActivity).getViewMode();
ViewGroup child;
if (mAppActivity.checkedViewModeId == ViewMode.PANEL) {
if (checkedViewModeId == ViewMode.PANEL) {
child = getPanelModeView();
} else if (mAppActivity.checkedViewModeId == ViewMode.LIST) {
} else if (checkedViewModeId == ViewMode.LIST) {
child = getListModeView();
} else {
child = getPanelModeView();
......@@ -88,168 +77,158 @@ public class OperationListHelper extends AbstractOperationListHelper {
// パネル式のViewを取得
private ViewGroup getPanelModeView() {
Logger.d(TAG, "getPanelModeView");
mPullToRefreshGridView.onRefreshComplete();
mPullToRefreshGridView.setEmptyView(mAppActivity.findViewById(android.R.layout.simple_list_item_1));
GridView child = mPullToRefreshGridView.getRefreshableView();
mPullToRefreshGridView.onRefreshComplete();
mPullToRefreshGridView.getRefreshableView();
mPullToRefreshGridView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<GridView>() {
@Override
public void onRefresh(PullToRefreshBase<GridView> refreshView) {
// 新着更新処理
mAppActivity.pullToGridViewRefresh(refreshView);
}
});
// ラベル変更
mPullToRefreshGridView.getLoadingLayoutProxy().setRefreshingLabel(mAppActivity.getString(R.string.updating));
mPullToRefreshGridView.getLoadingLayoutProxy().setPullLabel(mAppActivity.getString(R.string.pull_to_refresh_label));
mPullToRefreshGridView.getLoadingLayoutProxy().setReleaseLabel(mAppActivity.getString(R.string.release_to_refresh_label));
child.setSelector(mAppActivity.getResources().getDrawable(R.drawable.grid_selecter));
child.setNumColumns(3);
OperationListPanelAdapter adapter = new OperationListPanelAdapter(mAppActivity, filterOperationList());
OperationPanelAdapter adapter = new OperationPanelAdapter(mAppActivity, filterOperationList());
child.setAdapter(adapter);
// リストのクリック処理
mPullToRefreshGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long operationId) {
OperationDto operationDto = (OperationDto) parent.getAdapter().getItem(position);
if (operationDto.contentId != null && operationDto.contentId != 0) {
//TODO テスト用のため、削除
ABVToastUtil.showMakeText(mAppActivity, "open operationId : " + operationId, Toast.LENGTH_LONG);
// 作業画面
mAppActivity.openDirectionsOrReportView(operationDto);
} else {
if (operationDto.operationType == PANO) {
// パノラマ登録画面
mAppActivity.showPanoEntryDialog(operationDto);
} else {
// 何もしない
//TODO テスト用のため、削除
ABVToastUtil.showMakeText(mAppActivity, "何もしない", Toast.LENGTH_LONG);
}
}
}
});
// リスト以外のクリック処理
// mPullToRefreshGridView.setContenPanelAdapterListener(new ContentPanelAdapter.ContenPanelAdapterListener() {
// @Override
// public void onOpenContentSubmenu(ContentDto contentDto) {
// mAppActivity.showSubMenuDialog(contentDto);
// }
// @Override
// public void onContentFavorite(long contentId) {
// mAppActivity.contentFavoriteFlgChange(contentId);
// }
// @Override
// public boolean onContentDownload(long contentId) {
// return mAppActivity.contentValidCheckAndDownload(contentId, true);
// }
// @Override
// public void onContentDownloadPause(long contentId) {
// mAppActivity.contentDownloadPause(contentId);
// }
// @Override
// public void onContentDownloadResume(ContentDto contentDto) {
// mAppActivity.contentDownloadResume(contentDto);
// }
// @Override
// public void onOpenContentView(long contentId) {
// try {
// ContentDto content = contentDao.getContent(contentId);
// if (!content.downloadingFlg && content.downloadedFlg) {
// mAppActivity.startContentViewActivity(contentId);
// }
// } catch (Exception e) {
// Logger.e(TAG, "onOpenContentView failed.", e);
// ErrorMessage.showErrorMessageToast(mAppActivity.getApplicationContext(), ErrorCode.E107);
// }
// }
// @Override
// public void onContentChecked() {
// performContentChecked();
// }
// @Override
// public void onOpenContentDetail(long contentId) {
// mAppActivity.contentDetailActivityMove(contentId, HomeUIActivity.class.getName());
// }
// });
adapter.setAdapterListener(new AbstractOperationAdapter.AbstractOperationListAdapterListener() {
@Override
public void onPanoEdit(OperationDto operationDto) {
// 360編集処理
mAppActivity.startPanoEdit(operationDto);
}
@Override
public void onSyncOperation(final OperationDto operationDto) {
// 同期処理
mAppActivity.startSyncOperation(operationDto);
}
});
child.setScrollingCacheEnabled(false);
mAdapter = adapter;
// LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) child.getLayoutParams();
// lp.bottomMargin = 10;
return mPullToRefreshGridView;
}
// リスト式のViewを取得
private ViewGroup getListModeView() {
Logger.d(TAG, "getListModeView");
mPullToRefreshListView.onRefreshComplete();
mPullToRefreshListView.setEmptyView(mAppActivity.findViewById(android.R.layout.simple_list_item_1));
ListView child = mPullToRefreshListView.getRefreshableView();
OperationListAdapter adapter = new OperationListAdapter(mAppActivity, filterOperationList());
child.setAdapter(adapter);
mPullToRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
// 新着更新処理
mAppActivity.pullToListViewRefresh(refreshView);
}
});
// ラベル変更
mPullToRefreshListView.getLoadingLayoutProxy().setRefreshingLabel(mAppActivity.getString(R.string.updating));
mPullToRefreshListView.getLoadingLayoutProxy().setPullLabel(mAppActivity.getString(R.string.pull_to_refresh_label));
mPullToRefreshListView.getLoadingLayoutProxy().setReleaseLabel(mAppActivity.getString(R.string.release_to_refresh_label));
// リストのクリック処理
// child.setOnItemClickListener(new AdapterView.OnItemClickListener() {
// @Override
// public void onItemClick(AdapterView<?> parent, View view, int position, long contentId) {
// ContentDto contentDto = mAdapter.getItem(position);
// if (mAdapter.isEditMode) {
// if (!contentDto.downloadingFlg) {
// contentDto.isChecked = !contentDto.isChecked;
// mAdapter.notifyDataSetChanged();
// performContentChecked();
// }
// } else {
// try {
// if (contentDto.downloadingFlg) {
// if (contentDto.isDownloadPaused()) {
// mAppActivity.contentDownloadResume(contentDto);
// } else if (!contentDto.isDownloadInitializing()) {
// mAppActivity.contentDownloadPause(contentDto.contentId);
// }
// } else {
// mAppActivity.contentOpenOrDownload(contentDto);
// }
// } catch (Exception e) {
// Logger.e(TAG, "onItemClick failed.", e);
// ErrorMessage.showErrorMessageToast(mAppActivity.getApplicationContext(), ErrorCode.E107);
// }
// }
// }
// });
//
// // リストの長押し処理
// child.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
// @Override
// public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
// ContentDto contentDto = mAdapter.getItem(position);
// mAppActivity.showSubMenuDialog(contentDto);
// return true;
// }
// });
// // リスト以外のクリック処理
// adapter.setAdapterListener(new AbstractContentListAdapter.AbstractContentListAdapterListener() {
// @Override
// public void onOpenContentSubmenu(ContentDto contentDto) {
// mAppActivity.showSubMenuDialog(contentDto);
// }
// @Override
// public void onContentDownloadPause(long contentId) {
// mAppActivity.contentDownloadPause(contentId);
// }
// @Override
// public boolean onContentDownload(long contentId) {
// return mAppActivity.contentValidCheckAndDownload(contentId, true);
// }
// @Override
// public void onContentDownloadResume(ContentDto contentDto) {
// mAppActivity.contentDownloadResume(contentDto);
// }
// @Override
// public void onOpenContentView(long contentId) {
// try {
// ContentDto content = contentDao.getContent(contentId);
// if (!content.downloadingFlg && content.downloadedFlg) {
// mAppActivity.startContentViewActivity(contentId);
// }
// } catch (Exception e) {
// Logger.e(TAG, "onOpenContentView", e);
// ErrorMessage.showErrorMessageToast(mAppActivity.getApplicationContext(), ErrorCode.E107);
// }
// }
// @Override
// public void onContentChecked() {
// performContentChecked();
// }
// });
mPullToRefreshListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long operationId) {
OperationDto operationDto = (OperationDto) parent.getAdapter().getItem(position);
if (operationDto.contentId != null && operationDto.contentId != 0) {
//TODO テスト用のため、削除
ABVToastUtil.showMakeText(mAppActivity, "open operationId : " + operationId, Toast.LENGTH_LONG);
// 作業画面
mAppActivity.openDirectionsOrReportView(operationDto);
} else {
if (operationDto.operationType == PANO) {
// パノラマ登録画面
mAppActivity.showPanoEntryDialog(operationDto);
} else {
// 何もしない
//TODO テスト用のため、削除
ABVToastUtil.showMakeText(mAppActivity, "何もしない", Toast.LENGTH_LONG);
}
}
}
});
child.setScrollingCacheEnabled(false);
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) child.getLayoutParams();
lp.leftMargin = 20;
lp.rightMargin = 20;
lp.bottomMargin = 20;
child.setLayoutParams(lp);
// リスト以外のクリック処理
adapter.setAdapterListener(new AbstractOperationAdapter.AbstractOperationListAdapterListener() {
@Override
public void onPanoEdit(OperationDto operationDto) {
// 360編集処理
mAppActivity.startPanoEdit(operationDto);
}
@Override
public void onSyncOperation(final OperationDto operationDto) {
// 同期処理
mAppActivity.startSyncOperation(operationDto);
}
});
child.setScrollingCacheEnabled(false);
mAdapter = adapter;
return mPullToRefreshListView;
}
@Override
public void refreshList() {
if (mAdapter != null) {
mAdapter.setItem(filterOperationList());
}
}
/**
* プロジェクトの件数取得
* @return
*/
public int getOperationCount() {
return operationDtoList.size();
}
/**
* プロジェクトリスト取得
* @return
*/
public List<OperationDto> getOperationList() {
return operationDtoList;
}
}
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