|
|
@@ -2,15 +2,12 @@ package kr.co.zumo.app.lifeplus.view.screen.event;
|
|
|
|
|
|
import android.Manifest;
|
|
|
import android.content.Context;
|
|
|
-import android.content.CursorLoader;
|
|
|
import android.content.Intent;
|
|
|
import android.content.pm.PackageManager;
|
|
|
-import android.database.Cursor;
|
|
|
import android.graphics.Bitmap;
|
|
|
import android.graphics.BitmapFactory;
|
|
|
import android.net.Uri;
|
|
|
import android.os.Bundle;
|
|
|
-import android.provider.MediaStore;
|
|
|
import android.provider.Settings;
|
|
|
import android.support.annotation.NonNull;
|
|
|
import android.support.annotation.Nullable;
|
|
|
@@ -221,6 +218,7 @@ public class EventQuestionFragment extends FragmentBase<EventQuestionPresenter>
|
|
|
presenter.onEvent(new Event.Builder(Event.CLICK).build());
|
|
|
});
|
|
|
layoutContainer.addView(buttonView);
|
|
|
+ setEnabledSubmitButton(false);
|
|
|
|
|
|
//공지사항 영역
|
|
|
View noticeView = inflater.inflate(R.layout.event_participation_item_notice, null);
|
|
|
@@ -230,10 +228,25 @@ public class EventQuestionFragment extends FragmentBase<EventQuestionPresenter>
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void setEnabledSubmitButton(boolean isEnabled) {
|
|
|
+ layoutSubmit.setEnabled(isEnabled);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void validate(int index, boolean validation) {
|
|
|
+ EventQuestionViewHolder eventQuestionViewHolder = eventQuestionViewHolders.get(index);
|
|
|
+ Log.d("APP# EventQuestionFragment | validate", "|" + "holder -> " + eventQuestionViewHolder);
|
|
|
+ if (null != eventQuestionViewHolder) {
|
|
|
+ Log.d("APP# EventQuestionFragment | validate", "| " + eventQuestionViewHolder.getClass().getSimpleName());
|
|
|
+ eventQuestionViewHolder.validate(validation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void putAlbumImage(int index, Bitmap image) {
|
|
|
EventQuestionViewHolder eventQuestionViewHolder = eventQuestionViewHolders.get(index);
|
|
|
- Log.d("APP# EventQuestionFragment | putAlbumImage", "|" + "hoolder -> " + eventQuestionViewHolder);
|
|
|
+ Log.d("APP# EventQuestionFragment | putAlbumImage", "|" + "holder -> " + eventQuestionViewHolder);
|
|
|
if (null != eventQuestionViewHolder) {
|
|
|
Log.d("APP# EventQuestionFragment | putAlbumImage", "| " + eventQuestionViewHolder.getClass().getSimpleName());
|
|
|
eventQuestionViewHolder.setUploadImage(image);
|
|
|
@@ -253,35 +266,18 @@ public class EventQuestionFragment extends FragmentBase<EventQuestionPresenter>
|
|
|
if (requestCode == GET_ALBUM_PHOTO) {
|
|
|
try {
|
|
|
Uri uri = data.getData();
|
|
|
- String urlString = data.getData().getPath();
|
|
|
- Log.d("APP# EventQuestionFragment | onActivityResult", "| urlString" + urlString); // /external/images/media/196
|
|
|
- Log.d("APP# EventQuestionFragment | onActivityResult", "| uri" + uri); // content://media/external/images/media/196
|
|
|
- Log.d("APP# EventQuestionFragment | onActivityResult", "| 실제경로" + getPath(uri));// /storage/emulated/0/Pictures/Screenshots/Screenshot_2018-12-21-10-35-03.jpg
|
|
|
|
|
|
- // fixme 파일 url 구하기
|
|
|
-
|
|
|
InputStream inputStream = getContext().getContentResolver().openInputStream(data.getData());
|
|
|
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
|
|
|
inputStream.close();
|
|
|
|
|
|
- String path = getPath(uri);
|
|
|
- presenter.onImageReceived(bitmap, path);
|
|
|
+ presenter.onImageReceived(uri, bitmap);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private String getPath(Uri uri) {
|
|
|
- String[] projection = {MediaStore.Images.Media.DATA};
|
|
|
- CursorLoader cursorLoader = new CursorLoader(getContext(), uri, projection, null, null, null);
|
|
|
- Cursor cursor = cursorLoader.loadInBackground();
|
|
|
- int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
|
|
- cursor.moveToFirst();
|
|
|
- return cursor.getString(columnIndex);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
private String getTimeString(String timeString) {
|
|
|
return Formatter.format(timeString, EventBean.DATE_FORMAT, "yyyy.MM.dd");
|
|
|
}
|