|
|
@@ -7,14 +7,12 @@ import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
import android.text.Editable;
|
|
|
import android.text.TextWatcher;
|
|
|
-import android.util.Log;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
import android.widget.Button;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
-import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
@@ -24,7 +22,6 @@ import kr.co.zumo.app.R;
|
|
|
import kr.co.zumo.app.lifeplus.bean.TextImageBean;
|
|
|
import kr.co.zumo.app.lifeplus.manager.ActionBarManager;
|
|
|
import kr.co.zumo.app.lifeplus.model.MyBucketListModel;
|
|
|
-import kr.co.zumo.app.lifeplus.util.ResourceUtil;
|
|
|
import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
import kr.co.zumo.app.lifeplus.view.IMyBucketListView;
|
|
|
import kr.co.zumo.app.lifeplus.view.fragment.FragmentBase;
|
|
|
@@ -67,7 +64,6 @@ public class AddMyBucketListFragment extends FragmentBase<MyBucketListPresenter>
|
|
|
editTextMyBucketTitle.addTextChangedListener(new TextWatcher() {
|
|
|
@Override
|
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -76,8 +72,23 @@ public class AddMyBucketListFragment extends FragmentBase<MyBucketListPresenter>
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void afterTextChanged(Editable editable) {
|
|
|
-
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+ /*
|
|
|
+ * The loop is in reverse for a purpose,
|
|
|
+ * each replace or delete call on the Editable will cause
|
|
|
+ * the afterTextChanged method to be called again.
|
|
|
+ * Hence the return statement after the first removal.
|
|
|
+ * http://developer.android.com/reference/android/text/TextWatcher.html#afterTextChanged(android.text.Editable)
|
|
|
+ */
|
|
|
+ /*
|
|
|
+ 엔터는 제거해준다.
|
|
|
+ */
|
|
|
+ for (int i = s.length() - 1; i >= 0; --i) {
|
|
|
+ if (s.charAt(i) == '\n') {
|
|
|
+ s.delete(i, i + 1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -86,27 +97,15 @@ public class AddMyBucketListFragment extends FragmentBase<MyBucketListPresenter>
|
|
|
recyclerViewImageList = findViewById(R.id.recycler_view_image_list);
|
|
|
|
|
|
doDummyData();
|
|
|
+
|
|
|
AddMyBucketListAdapter addMyBucketListAdapter = new AddMyBucketListAdapter(getActivity(), addMyBucketListData);
|
|
|
recyclerViewImageList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
|
|
|
recyclerViewImageList.setAdapter(addMyBucketListAdapter);
|
|
|
- RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) recyclerViewImageList.getLayoutParams();
|
|
|
|
|
|
- recyclerViewImageList.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
|
|
- @Override
|
|
|
- public void onLayoutChange(View view, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
|
|
- if(bottom < oldBottom){
|
|
|
- //parameter 설명:
|
|
|
- // 1. textViewMyBucketDetail visibility 설정
|
|
|
- // 2. recyclerViewImageList layoutPrams 세팅
|
|
|
- // 3. recyclerViewImageList marginBottom 조정
|
|
|
- presenter.onLayoutChange(View.INVISIBLE, layoutParams , 35);
|
|
|
- }else{
|
|
|
- presenter.onLayoutChange(View.VISIBLE, layoutParams , 20);
|
|
|
- }
|
|
|
- }
|
|
|
+ recyclerViewImageList.addOnLayoutChangeListener((view, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
|
|
|
+ presenter.onLayoutChange(view, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom);
|
|
|
});
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -135,15 +134,26 @@ public class AddMyBucketListFragment extends FragmentBase<MyBucketListPresenter>
|
|
|
addMyBucketListData.add(new TextImageBean(R.drawable.img_select_bg_10, R.string.bucket_select_text5));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 등록 버튼 보이기 안보이기
|
|
|
+ *
|
|
|
+ * @param isVisible
|
|
|
+ */
|
|
|
@Override
|
|
|
- public void onTextChanged(String inputText) {
|
|
|
- buttonAddMyBucket.setVisibility(inputText.length() == 0 ? View.INVISIBLE : View.VISIBLE);
|
|
|
+ public void setVisibleRegisterButton(boolean isVisible) {
|
|
|
+ buttonAddMyBucket.setVisibility(isVisible ? View.VISIBLE : View.INVISIBLE);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 키보드 표시 유무에 따라서 레이아웃 설정
|
|
|
+ *
|
|
|
+ * @param isBig
|
|
|
+ */
|
|
|
@Override
|
|
|
- public void onLayoutChange(int visible, RelativeLayout.LayoutParams layoutParams, int margin) {
|
|
|
- textViewMyBucketDetail.setVisibility(visible);
|
|
|
- layoutParams.setMargins(0, 0 ,0 , ResourceUtil.dpToPx(margin));
|
|
|
- recyclerViewImageList.setLayoutParams(layoutParams);
|
|
|
+ public void setLayoutSize(boolean isBig) {
|
|
|
+ // setVisibility 를 직접 실행하면 누락되는 경우가 있어서 post 로 실행
|
|
|
+ textViewMyBucketDetail.post(() -> {
|
|
|
+ textViewMyBucketDetail.setVisibility(isBig ? View.VISIBLE : View.GONE);
|
|
|
+ });
|
|
|
}
|
|
|
}
|