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";
}
/**
......
......@@ -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;
}
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();
}
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