Parcourir la source

Merge branch 'develop' of https://github.com/swict/LifeplusAndroid into develop

hyodong.min il y a 6 ans
Parent
commit
421d54bed2

+ 1 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/dialog/PromotionDialog.java

@@ -50,7 +50,7 @@ public class PromotionDialog extends DialogBase<ICustomDialogListener<PromotionD
 
     Window window = getDialog().getWindow();
     window.setBackgroundDrawableResource(R.color.C66000000);
-
+    window.getAttributes().windowAnimations = R.style.PromotionDialogAnimation;
 
     mainBannerView = getView().findViewById(R.id.promotion_banner);
     imageViewCancel = getView().findViewById(R.id.image_view_cancel);

+ 30 - 16
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventListFragment.java

@@ -34,6 +34,7 @@ public class EventListFragment extends FragmentBase<EventListPresenter> implemen
   private TabLayout eventTab;
   private ConstraintLayout layoutMyEvent;
   private EventViewPagerAdapter adapter;
+  private ConstraintLayout layoutListNone;
 
   @Override
   protected View onAfterCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -44,7 +45,7 @@ public class EventListFragment extends FragmentBase<EventListPresenter> implemen
   protected void onAfterActivityCreated(Bundle savedInstanceState) {
     recyclerViewEvent = findViewById(R.id.recycler_view_event);
     eventTab = findViewById(R.id.tab_layout_event);
-
+    layoutListNone = findViewById(R.id.layout_list_none);
     layoutMyEvent = findViewById(R.id.layout_my_event);
 
     layoutMyEvent.setOnClickListener(view -> {presenter.onEvent(new Event.Builder(Event.MY_EVENT).build());});
@@ -81,6 +82,7 @@ public class EventListFragment extends FragmentBase<EventListPresenter> implemen
 
   @Override
   public void draw(List<EventBean> eventBeans) {
+
     adapter = new EventViewPagerAdapter(getActivity(), eventBeans, event -> {
       switch (event.getEventId()) {
         case Event.CLICK:
@@ -90,22 +92,34 @@ public class EventListFragment extends FragmentBase<EventListPresenter> implemen
           break;
       }
     });
+    
+    if (eventBeans.size() > 0) {
+
+      recyclerViewEvent.setVisibility(View.VISIBLE);
+      layoutListNone.setVisibility(View.GONE);
+      recyclerViewEvent.setClipToPadding(false);
+      recyclerViewEvent.setPageMargin(ResourceUtil.dpToPx(15));
+      recyclerViewEvent.setPadding(ResourceUtil.dpToPx(25), 0, ResourceUtil.dpToPx(25), 0);
+      recyclerViewEvent.setAdapter(adapter);
+      recyclerViewEvent.setOffscreenPageLimit(10);
+      eventTab.setupWithViewPager(recyclerViewEvent, true);
+      eventTab.setVisibility(eventBeans.size() == 1 ? View.GONE : View.VISIBLE);
+
+      recyclerViewEvent.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
+        @Override
+        public void onPageSelected(int position) {
+          presenter.onChangedIndex(position);
+          eventTab.setVisibility(position == eventBeans.size() - 1 && eventBeans.size() > 1 ? View.GONE : View.VISIBLE);
+        }
+      });
+    }
+    else {
+      setVisibleMyEventButton(true);
+      recyclerViewEvent.setVisibility(View.GONE);
+      layoutListNone.setVisibility(View.VISIBLE);
+    }
+
 
-    recyclerViewEvent.setClipToPadding(false);
-    recyclerViewEvent.setPageMargin(ResourceUtil.dpToPx(15));
-    recyclerViewEvent.setPadding(ResourceUtil.dpToPx(25), 0, ResourceUtil.dpToPx(25), 0);
-    recyclerViewEvent.setAdapter(adapter);
-    recyclerViewEvent.setOffscreenPageLimit(10);
-    eventTab.setupWithViewPager(recyclerViewEvent, true);
-    eventTab.setVisibility(eventBeans.size() == 1 ? View.GONE : View.VISIBLE);
-
-    recyclerViewEvent.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
-      @Override
-      public void onPageSelected(int position) {
-        presenter.onChangedIndex(position);
-        eventTab.setVisibility(position == eventBeans.size() - 1 && eventBeans.size() > 1 ? View.GONE : View.VISIBLE);
-      }
-    });
   }
 
   @Override

+ 6 - 0
app/src/main/res/anim/fade_in.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<alpha xmlns:android="http://schemas.android.com/apk/res/android"
+       android:duration="200"
+       android:fromAlpha="0.0"
+       android:interpolator="@android:anim/accelerate_interpolator"
+       android:toAlpha="1.0"/>

+ 2 - 2
app/src/main/res/anim/fade_out.xml

@@ -2,8 +2,8 @@
 <set xmlns:android="http://schemas.android.com/apk/res/android"
      android:interpolator="@android:anim/linear_interpolator">
   <alpha
-    android:duration="1000"
+    android:duration="200"
     android:fromAlpha="1.0"
-    android:toAlpha="0.0" >
+    android:toAlpha="0.0">
   </alpha>
 </set>

+ 39 - 1
app/src/main/res/layout/fragment_event.xml

@@ -16,7 +16,8 @@
     app:layout_constraintEnd_toEndOf="parent"
     app:layout_constraintStart_toStartOf="parent"
     app:layout_constraintTop_toTopOf="parent"
-    tools:background="@color/CF6F6F6"/>
+    tools:background="@color/CF6F6F6"
+    tools:visibility="visible"/>
 
   <android.support.design.widget.TabLayout
     android:id="@+id/tab_layout_event"
@@ -65,4 +66,41 @@
 
   </android.support.constraint.ConstraintLayout>
 
+  <android.support.constraint.ConstraintLayout
+    android:id="@+id/layout_list_none"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_marginBottom="61dp"
+    app:layout_constraintBottom_toTopOf="@+id/layout_my_event"
+    app:layout_constraintEnd_toEndOf="parent"
+    app:layout_constraintStart_toStartOf="parent"
+    app:layout_constraintTop_toTopOf="parent"
+    android:visibility="gone">
+
+    <ImageView
+      android:id="@+id/image_icon"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      app:layout_constraintBottom_toBottomOf="parent"
+      app:layout_constraintEnd_toEndOf="parent"
+      app:layout_constraintStart_toStartOf="parent"
+      app:layout_constraintTop_toTopOf="parent"
+      app:srcCompat="@drawable/ic_icon_search_none"
+      />
+
+    <TextView
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_marginTop="10dp"
+      android:gravity="center_horizontal"
+      android:lineSpacingExtra="7sp"
+      android:text="@string/event_list_nothing"
+      android:textColor="@color/CC5C5C5"
+      android:textSize="18sp"
+      app:layout_constraintEnd_toEndOf="parent"
+      app:layout_constraintStart_toStartOf="parent"
+      app:layout_constraintTop_toBottomOf="@+id/image_icon"
+      />
+  </android.support.constraint.ConstraintLayout>
+
 </android.support.constraint.ConstraintLayout>

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -792,6 +792,7 @@
   <string name="event_winner">당첨자 발표</string>
   <string name="event_date_to">%s 종료</string>
   <string name="event_end">이벤트가 종료되었습니다.</string>
+  <string name="event_list_nothing">진행중인 이벤트가 없습니다.</string>
 
   <string name="coin_minus">사용</string>
   <string name="coin_plus">적립</string>

+ 5 - 0
app/src/main/res/values/styles.xml

@@ -110,6 +110,11 @@
     <item name="android:windowExitAnimation">@anim/slide_bottom</item>
   </style>
 
+  <style name="PromotionDialogAnimation">
+    <item name="android:windowEnterAnimation">@anim/fade_in</item>
+    <item name="android:windowExitAnimation">@anim/fade_out</item>
+  </style>
+
   <style name="AppThemeRatingBar" parent="Theme.AppCompat">
     <item name="colorControlNormal">@color/CC5C5C5</item>
     <item name="colorControlActivated">@color/C000000</item>