Commit 60419936 by Lee Jaebin

#32706 作業一覧画面改善(パンネル・リストビューの切り替え表示)

parent 8fb0a434
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid
android:color="#ffffff" />
<stroke
android:width="1px"
android:color="#cccccc" />
</shape>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid
android:color="#ffffff" />
<stroke
android:width="1px"
android:color="#cccccc" />
</shape>
</item>
</selector>
\ No newline at end of file
......@@ -101,8 +101,9 @@
android:onClick="onClickShowHelpView" />
</RelativeLayout>
<com.handmark.pulltorefresh.library.PullToRefreshListView
android:id="@+id/operationListView"
<FrameLayout
android:id="@+id/contents_list_layout"
style="@style/content_list_bg"
android:layout_width="match_parent"
android:layout_height="match_parent" />
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/panel_frame"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/content_submenu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/content_description"
android:text="TaskName" />
</LinearLayout>
<RelativeLayout
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_gravity="center">
<ImageButton
android:id="@+id/btn_information_update1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:background="@drawable/btn_information_update" />
</RelativeLayout>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/frameLayout1"
android:layout_centerInParent="true"
android:orientation="vertical"
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>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/button_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e6e6e6"
android:orientation="horizontal"
android:padding="5dp"
android:visibility="visible">
<LinearLayout
android:id="@+id/edit_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"
android:visibility="visible">
<LinearLayout
android:id="@+id/layout_pano_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="vertical"
android:visibility="visible">
<ImageView
android:id="@+id/btn_pano_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_pano_edit" />
<TextView
android:id="@+id/txt_pano_edit"
style="@style/ProjectIconText"
android:layout_width="wrap_content"
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"
android:visibility="visible">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="vertical">
<ImageButton
android:id="@+id/btn_information_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_information_update" />
<TextView
android:id="@+id/txt_information_update"
style="@style/ProjectIconText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/information_update" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="gridview" type="id"/>
</resources>
\ No newline at end of file
/*******************************************************************************
* Copyright 2011, 2012 Chris Banes.
*
* 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.handmark.pulltorefresh.library;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.util.AttributeSet;
import android.view.View;
import android.widget.GridView;
import com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor;
import jp.agentec.abook.abv.launcher.android.R;
public class PullToRefreshGridView extends PullToRefreshAdapterViewBase<GridView> {
public PullToRefreshGridView(Context context) {
super(context);
}
public PullToRefreshGridView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public PullToRefreshGridView(Context context, Mode mode) {
super(context, mode);
}
public PullToRefreshGridView(Context context, Mode mode, AnimationStyle style) {
super(context, mode, style);
}
@Override
public final Orientation getPullToRefreshScrollDirection() {
return Orientation.VERTICAL;
}
@Override
protected final GridView createRefreshableView(Context context, AttributeSet attrs) {
final GridView gv;
if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
gv = new InternalGridViewSDK9(context, attrs);
} else {
gv = new InternalGridView(context, attrs);
}
// Use Generated ID (from res/values/ids.xml)
gv.setId(R.id.gridview);
return gv;
}
class InternalGridView extends GridView implements EmptyViewMethodAccessor {
public InternalGridView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void setEmptyView(View emptyView) {
PullToRefreshGridView.this.setEmptyView(emptyView);
}
@Override
public void setEmptyViewInternal(View emptyView) {
super.setEmptyView(emptyView);
}
}
@TargetApi(9)
final class InternalGridViewSDK9 extends InternalGridView {
public InternalGridViewSDK9(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX,
int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX,
scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
// Does all of the hard work...
OverscrollHelper.overScrollBy(PullToRefreshGridView.this, deltaX, scrollX, deltaY, scrollY, isTouchEvent);
return returnValue;
}
}
}
\ No newline at end of file
......@@ -6,6 +6,11 @@ public interface AppDefType {
interface PrefName {
String USER_PREFERENCE = "user_info";
}
interface ViewMode{
int PANEL = 0;
int LIST = 1;
}
interface DefPrefKey {
String REPEATABLE_PLAY = "repeatablePlay";
......
......@@ -10,14 +10,17 @@ 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;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
......@@ -94,10 +97,13 @@ 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;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
......@@ -112,16 +118,17 @@ public class OperationListActivity extends ABVUIActivity {
private static final String TAG = "OperationListActivity";
private PullToRefreshListView mListView;
private OperationListAdapter mOperationListAdapter;
private OperationListPanelAdapter mOperationListPanelAdapter;
private ImageButton mSearchButton;
private ImageButton mCommunicationButton;
private ImageButton mCommonContentButton;
private List<OperationDto> mOperationList;
public int checkedViewModeId = 0;
private String mSearchWord;
private String mStartDateStr;
private String mEndDateStr;
public String mSearchWord;
public String mStartDateStr;
public String mEndDateStr;
private EditText mSearchTextView;
private TextView mStartDate;
......@@ -134,7 +141,7 @@ public class OperationListActivity extends ABVUIActivity {
private Button mReportTypeAllButton;
private Button mReportTypeDefaultButton;
private Button mReportTypeRoutineTaskButton;
private int mSearchOperationReportType = -1; //-1:All, 0:None, 1:RoutineTask
public int mSearchOperationReportType = -1; //-1:All, 0:None, 1:RoutineTask
private Dialog mSearchDialog;
private Date mOperationLastEditDate;
......@@ -173,70 +180,88 @@ public class OperationListActivity extends ABVUIActivity {
private int mSelectedFixPuchMessagePosition;
private int mSendType;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ac_operation_list);
private AbstractOperationListHelper mListHelper = null;
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();
}
});
}
});
private class ReloadHandler implements Runnable {
@Override
public void run() {
View child = mListHelper.getOperationList();
ViewGroup parent = (ViewGroup) child.getParent();
if (parent != null) {
parent.removeView(child);
}
});
FrameLayout vg = (FrameLayout) findViewById(R.id.contents_list_layout);
vg.removeAllViews();
vg.addView(child);
}
}
// ラベル変更
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));
@Override
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));
mSearchButton = (ImageButton) findViewById(R.id.btn_search);
......@@ -358,72 +383,74 @@ public class OperationListActivity extends ABVUIActivity {
}
public void refreshOperation() {
Logger.d(TAG, "--refreshOperation start");
mOperationList = mOperationLogic.getRefreshOperation(mSearchWord, mStartDateStr, mEndDateStr, mSearchOperationReportType);
// ツールバーの検索結果レイアウトの表示・非表示
checkShowSearchResult();
if (mOperationListAdapter == null) {
mOperationListAdapter = new OperationListAdapter(OperationListActivity.this, mOperationList, isNormalSize());
mListView.setAdapter(mOperationListAdapter);
mOperationListAdapter.setAdapterListener(new OperationListAdapter.OperationAdapterListener() {
@Override
public void onOpenDirectionsOrReportView(final OperationDto operationDto) {
contentRefresher.stopRefresh();
startTaskDirectionOrReportView(operationDto);
}
@Override
public void onPanoEdit(OperationDto operationDto) {
startPanoEdit(operationDto);
}
@Override
public void onSyncOperation(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);
}
}
});
}
@Override
public void onOpenRelatedContentList(OperationDto operationDto) {
if (operationDto.operationId != null) {
Intent intent = new Intent();
intent.putExtra(ABookKeys.OPERATION_ID, operationDto.operationId);
intent.putExtra(ABookKeys.OPERATION_NAME, operationDto.operationName);
intent.setClass(OperationListActivity.this, OperationRelatedContentActivity.class);
startActivity(intent);
}
}
@Override
public void onShowEntryPanoContentDialog(OperationDto operationDto) {
contentRefresher.stopRefresh();
showPanoEntryDialog(operationDto);
}
});
} else {
mOperationListAdapter.setItem(mOperationList);
}
// Logger.d(TAG, "--refreshOperation start");
// mOperationList = mOperationLogic.getRefreshOperation(mSearchWord, mStartDateStr, mEndDateStr, mSearchOperationReportType);
// // ツールバーの検索結果レイアウトの表示・非表示
// checkShowSearchResult();
// if (mOperationListPanelAdapter == null) {
// mOperationListPanelAdapter = new OperationListPanelAdapter(OperationListActivity.this, mOperationList);
// mListView.setAdapter(mOperationListPanelAdapter);
// mOperationListAdapter.setAdapterListener(new OperationListAdapter.OperationAdapterListener() {
// @Override
// public void onOpenDirectionsOrReportView(final OperationDto operationDto) {
// contentRefresher.stopRefresh();
// startTaskDirectionOrReportView(operationDto);
// }
//
// @Override
// public void onPanoEdit(OperationDto operationDto) {
// startPanoEdit(operationDto);
// }
//
// @Override
// public void onSyncOperation(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);
// }
// }
// });
// }
//
// @Override
// public void onOpenRelatedContentList(OperationDto operationDto) {
// if (operationDto.operationId != null) {
// Intent intent = new Intent();
// intent.putExtra(ABookKeys.OPERATION_ID, operationDto.operationId);
// intent.putExtra(ABookKeys.OPERATION_NAME, operationDto.operationName);
// intent.setClass(OperationListActivity.this, OperationRelatedContentActivity.class);
// startActivity(intent);
// }
// }
//
// @Override
// public void onShowEntryPanoContentDialog(OperationDto operationDto) {
// contentRefresher.stopRefresh();
// showPanoEntryDialog(operationDto);
// }
// });
// } else {
// mOperationListAdapter.setItem(mOperationList);
// }
mListHelper.refreshList();
handler.post(new ReloadHandler());
configurationToolbarIcon();
}
......@@ -1752,4 +1779,10 @@ public class OperationListActivity extends ABVUIActivity {
}
return false;
}
private AbstractOperationListHelper getListHelper() {
AbstractOperationListHelper contentListHelper;
contentListHelper = new OperationListHelper(this);
return contentListHelper;
}
}
package jp.agentec.abook.abv.ui.home.adapter;
import android.os.AsyncTask;
import android.view.View;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.launcher.android.R;
/**
* Created by leej on 2019/03/06.
*/
public abstract class AbstractOperationListAdapter extends BaseAdapter {
protected AbstractOperationListAdapterListener listener;
protected List<OperationDto> listItem = new ArrayList<>(); // NullPointException防止
public boolean isEditMode;
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();
}
@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 void setItem(List<OperationDto> listItem) {
this.listItem= listItem;
notifyDataSetChanged();
}
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;
}
......@@ -26,6 +26,7 @@ import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.StringUtil;
......@@ -36,11 +37,11 @@ import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
* Created by leej on 2018/08/17.
*/
public class OperationListAdapter extends BaseAdapter {
public class OperationListAdapter extends AbstractOperationListAdapter {
private static final String TAG = "OperationListAdapter";
private Context mContext;
private LayoutInflater mInflater;
private OperationListAdapter.OperationAdapterListener listener;
// private OperationListAdapter.OperationAdapterListener listener;
private List<OperationDto> mListItem = new ArrayList<>();
private ContentDao mContentDao = AbstractDao.getDao(ContentDao.class);
private int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
......@@ -48,10 +49,10 @@ public class OperationListAdapter extends BaseAdapter {
private OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
private boolean mNormalSizeFlg;
public OperationListAdapter(Context context, List<OperationDto> listItem, boolean isNormalSize) {
public OperationListAdapter(Context context, List<OperationDto> listItem) {
mContext = context;
mListItem = listItem;
mNormalSizeFlg = isNormalSize;
mNormalSizeFlg = ((OperationListActivity)context).isNormalSize();
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public List<OperationDto> getData() {
......@@ -72,11 +73,6 @@ public class OperationListAdapter extends BaseAdapter {
return mListItem.get(position).operationId;
}
public void setItem(List<OperationDto> listItem) {
mListItem= listItem;
notifyDataSetChanged();
}
public interface OperationAdapterListener {
void onPanoEdit(OperationDto operationDto);
......@@ -90,7 +86,7 @@ public class OperationListAdapter extends BaseAdapter {
}
public void setAdapterListener(OperationAdapterListener listener) {
this.listener = listener;
// this.listener = listener;
}
@Override
......@@ -214,38 +210,38 @@ public class OperationListAdapter extends BaseAdapter {
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);
// }
// });
//
// 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);
// }
// });
checkRelatedContent(holder, operationDto.operationId);
}
......
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.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.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 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.home.activity.OperationListActivity;
import jp.agentec.abook.abv.ui.home.adapter.AbstractOperationListAdapter;
import jp.agentec.abook.abv.ui.home.adapter.OperationListAdapter;
import jp.agentec.abook.abv.ui.home.adapter.OperationListPanelAdapter;
import jp.agentec.adf.util.StringUtil;
/**
* Created by leej on 2019/03/06.
*/
public class OperationListHelper extends AbstractOperationListHelper {
private static final String TAG = "OperationListHelper";
private AbstractOperationListAdapter mAdapter;
private PullToRefreshListView mPullToRefreshListView;
private PullToRefreshGridView mPullToRefreshGridView;
private OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
public OperationListHelper(OperationListActivity activity) {
super(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) {
Logger.e(TAG, "findOperationList", e);
ErrorMessage.showErrorMessageToast(mAppActivity.getApplicationContext(), ErrorCode.E107);
}
return operationDtoList;
}
@Override
public ViewGroup getOperationList() {
ViewGroup child;
if (mAppActivity.checkedViewModeId == ViewMode.PANEL) {
child = getPanelModeView();
} else if (mAppActivity.checkedViewModeId == ViewMode.LIST) {
child = getListModeView();
} else {
child = getPanelModeView();
}
return child;
}
// パネル式のViewを取得
private ViewGroup getPanelModeView() {
Logger.d(TAG, "getPanelModeView");
mPullToRefreshGridView.onRefreshComplete();
GridView child = mPullToRefreshGridView.getRefreshableView();
mPullToRefreshGridView.onRefreshComplete();
mPullToRefreshGridView.getRefreshableView();
child.setSelector(mAppActivity.getResources().getDrawable(R.drawable.grid_selecter));
child.setNumColumns(3);
OperationListPanelAdapter adapter = new OperationListPanelAdapter(mAppActivity, filterOperationList());
child.setAdapter(adapter);
// リスト以外のクリック処理
// 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());
// }
// });
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();
ListView child = mPullToRefreshListView.getRefreshableView();
OperationListAdapter adapter = new OperationListAdapter(mAppActivity, filterOperationList());
child.setAdapter(adapter);
// リストのクリック処理
// 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();
// }
// });
child.setScrollingCacheEnabled(false);
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) child.getLayoutParams();
lp.leftMargin = 20;
lp.rightMargin = 20;
lp.bottomMargin = 20;
child.setLayoutParams(lp);
mAdapter = adapter;
return mPullToRefreshListView;
}
@Override
public void refreshList() {
if (mAdapter != null) {
mAdapter.setItem(filterOperationList());
}
}
}
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