Przeglądaj źródła

1.优化完善打卡

wsad5123 5 lat temu
rodzic
commit
b8fd133c2c

+ 3 - 0
app/src/main/AndroidManifest.xml

@@ -273,6 +273,9 @@
         <activity
             android:name=".ui.activity.cclient.clock.ClockMonthStatisticsActivity"
             android:screenOrientation="portrait" />
+        <activity
+            android:name=".ui.activity.cclient.clock.ClockTipsActivity"
+            android:screenOrientation="portrait" />
 
         <!-- B Client-->
         <activity

+ 3 - 3
app/src/main/java/com/tongyu/luck/happywork/ui/activity/cclient/clock/ClockMonthStatisticsActivity.java

@@ -94,9 +94,9 @@ public class ClockMonthStatisticsActivity extends BaseActivity<ClockMonthStatist
     public void onMonthData(ClockMonthDataBean data) {
         setLoadingVisible(false);
         setErrorVisible(false);
-        tvRepayTotal.setText(data.getNextMoney());
-        tvWorkHourTotal.setText(data.getCountDuration());
-        tvLoss.setText(data.getLackClock());
+        tvRepayTotal.setText(TextUtils.isEmpty(data.getNextMoney()) ? "0.0" : data.getNextMoney());
+        tvWorkHourTotal.setText(TextUtils.isEmpty(data.getCountDuration()) ? "0" : data.getCountDuration());
+        tvLoss.setText(TextUtils.isEmpty(data.getLackClock()) ? "0" : data.getLackClock());
         tvMonthTitle.setText(Integer.parseInt(DateUtils.getFormatYMDStrToStr(data.getDate(), "MM")) + "月汇总");
         tvMonth.setText(Integer.parseInt(DateUtils.getFormatYMDStrToStr(data.getDate(), "MM")) + "月");
         if (data.isDateVisible()) {

+ 7 - 10
app/src/main/java/com/tongyu/luck/happywork/ui/activity/cclient/clock/ClockRulesActivity.java

@@ -1,5 +1,6 @@
 package com.tongyu.luck.happywork.ui.activity.cclient.clock;
 
+import android.content.Intent;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.TextView;
@@ -10,12 +11,9 @@ import com.tongyu.luck.happywork.ui.mvp.cclient.contacts.ClockRulesContacts;
 import com.tongyu.luck.happywork.ui.mvp.cclient.presenter.ClockRulesPresenter;
 
 import butterknife.BindView;
+import butterknife.OnClick;
 
 public class ClockRulesActivity extends BaseActivity<ClockRulesPresenter> implements ClockRulesContacts.IClockRulesView {
-    @BindView(R.id.v_video)
-    View vVideo;
-    @BindView(R.id.tv_rules)
-    TextView tvRules;
 
     @Override
     public int getLayoutId() {
@@ -27,14 +25,13 @@ public class ClockRulesActivity extends BaseActivity<ClockRulesPresenter> implem
         return new ClockRulesPresenter(this);
     }
 
-
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        initView();
+    public boolean isShowActionBar() {
+        return false;
     }
 
-    private void initView() {
-        setTitle(R.string.rules);
+    @Override
+    public boolean isShowStatusTitle() {
+        return false;
     }
 }

+ 29 - 0
app/src/main/java/com/tongyu/luck/happywork/ui/activity/cclient/clock/ClockTipsActivity.java

@@ -0,0 +1,29 @@
+package com.tongyu.luck.happywork.ui.activity.cclient.clock;
+
+import android.os.Bundle;
+
+import com.tongyu.luck.happywork.R;
+import com.tongyu.luck.happywork.ui.base.BaseActivity;
+import com.tongyu.luck.happywork.ui.base.IPresenter;
+
+public class ClockTipsActivity extends BaseActivity {
+    @Override
+    public int getLayoutId() {
+        return R.layout.activity_clock_tips;
+    }
+
+    @Override
+    public IPresenter bindPresenter() {
+        return null;
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        initView();
+    }
+
+    private void initView() {
+        setTitle(R.string.rules);
+    }
+}

+ 4 - 2
app/src/main/java/com/tongyu/luck/happywork/ui/fragment/cclient/ClockFragment.java

@@ -24,6 +24,7 @@ import com.tongyu.luck.happywork.ui.activity.cclient.CMainActivity;
 import com.tongyu.luck.happywork.ui.activity.cclient.clock.ClockMonthStatisticsActivity;
 import com.tongyu.luck.happywork.ui.activity.cclient.clock.ClockResultActivity;
 import com.tongyu.luck.happywork.ui.activity.cclient.clock.ClockRulesActivity;
+import com.tongyu.luck.happywork.ui.activity.cclient.clock.ClockTipsActivity;
 import com.tongyu.luck.happywork.ui.base.BaseFragment;
 import com.tongyu.luck.happywork.ui.mvp.cclient.contacts.ClockFragmentContacts;
 import com.tongyu.luck.happywork.ui.mvp.cclient.presenter.ClockFragmentPresenter;
@@ -113,6 +114,7 @@ public class ClockFragment extends BaseFragment<ClockFragmentPresenter> implemen
     @Override
     public void onResume() {
         super.onResume();
+        mvpPresenter.init();
     }
 
     @Override
@@ -121,13 +123,14 @@ public class ClockFragment extends BaseFragment<ClockFragmentPresenter> implemen
         EventBus.getDefault().unregister(this);
     }
 
-    @OnClick({R.id.v_clock, R.id.ll_statistics, R.id.ll_rules, R.id.tv_relocation, R.id.btn_authentication, R.id.ll_service})
+    @OnClick({R.id.v_clock, R.id.ll_statistics, R.id.ll_rules, R.id.tv_relocation, R.id.btn_authentication, R.id.ll_service, R.id.v_clock_video})
     public void onClick(View view) {
         switch (view.getId()) {
             case R.id.v_clock:
                 mvpPresenter.locationAddress(true, true);
                 break;
             case R.id.ll_rules:
+            case R.id.v_clock_video:
                 startActivity(new Intent(mContext, ClockRulesActivity.class));
                 break;
             case R.id.ll_statistics:
@@ -153,7 +156,6 @@ public class ClockFragment extends BaseFragment<ClockFragmentPresenter> implemen
         tvWorkHour.setTypeface(typeFace);
         tvWeekRepay.setTypeface(typeFace);
         tvTodayMoney.setTypeface(typeFace);
-        mvpPresenter.init();
     }
 
     /**

+ 3 - 1
app/src/main/java/com/tongyu/luck/happywork/ui/mvp/cclient/contacts/ClockFragmentContacts.java

@@ -21,7 +21,7 @@ public class ClockFragmentContacts {
 
         void getClockInfo();
 
-        void locationAddress(boolean isClock, boolean isShowDialog);
+        void locationAddress( boolean isClock, boolean isShowDialog);
 
         void getApproveStatus();
 
@@ -38,5 +38,7 @@ public class ClockFragmentContacts {
 
         void requestClock(MvpDataCallBack<ClockResultBean> callBack);
 
+
+
     }
 }

+ 10 - 0
app/src/main/java/com/tongyu/luck/happywork/ui/mvp/cclient/model/ClockFragmentModel.java

@@ -34,6 +34,8 @@ public class ClockFragmentModel extends BaseModel implements ClockFragmentContac
     private AMapLocation mLocation;//当前定位城市
     private ClockInfoBean infoBean;//打卡信息
 
+    private boolean isInit;//是否已经初始化
+
     public ClockFragmentModel(Context mContext) {
         super(mContext);
     }
@@ -153,4 +155,12 @@ public class ClockFragmentModel extends BaseModel implements ClockFragmentContac
             }
         });
     }
+
+    public boolean isInit() {
+        return isInit;
+    }
+
+    public void setInit(boolean init) {
+        isInit = init;
+    }
 }

+ 3 - 1
app/src/main/java/com/tongyu/luck/happywork/ui/mvp/cclient/presenter/ClockFragmentPresenter.java

@@ -54,6 +54,7 @@ public class ClockFragmentPresenter extends BasePresenter<ClockFragment> impleme
                 @Override
                 public void onData(ClockInfoBean data) {
                     if (isViewAttach()) {
+                        mModel.setInit(true);
                         mvpReference.get().initView(data);
                     }
                 }
@@ -61,7 +62,8 @@ public class ClockFragmentPresenter extends BasePresenter<ClockFragment> impleme
                 @Override
                 public void onError(ApiException exception) {
                     super.onError(exception);
-                    mvpReference.get().onError();
+                    if (!mModel.isInit())
+                        mvpReference.get().onError();
                 }
             });
         }

+ 8 - 42
app/src/main/res/layout/activity_clock_rules.xml

@@ -1,45 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="@color/gray_bg"
-    android:orientation="vertical">
-
-    <ImageView
-        android:id="@+id/v_video"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="11dp"
-        android:background="@mipmap/ic_clock_rules_bg" />
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="11dp"
-        android:background="@color/white"
-        android:orientation="vertical"
-        android:paddingLeft="15dp"
-        android:paddingTop="29dp"
-        android:paddingRight="15dp"
-        android:paddingBottom="24dp">
-
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="这里是周结打卡细则:"
-            android:textColor="@color/black"
-            android:textSize="@dimen/px54_18sp" />
-
-        <TextView
-            android:id="@+id/tv_rules"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="20dp"
-            android:text="1,这里是规则明细;1,这里是规则明细;1,这里是规则明细;1,这里是规则明细;1,这里是规则明细;1,这里是规则明细;1,这里是规则明细;"
-            android:textColor="@color/black"
-            android:textSize="@dimen/px48_16sp" />
-
-    </LinearLayout>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+android:layout_width="match_parent"
+android:layout_height="match_parent">
 
+<View
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@mipmap/ic_clock_rules" />
 
-</LinearLayout>
+</ScrollView>

+ 45 - 0
app/src/main/res/layout/activity_clock_tips.xml

@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/gray_bg"
+    android:orientation="vertical">
+
+    <ImageView
+        android:id="@+id/v_video"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="11dp"
+        android:background="@mipmap/ic_clock_rules_bg" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="11dp"
+        android:background="@color/white"
+        android:orientation="vertical"
+        android:paddingLeft="15dp"
+        android:paddingTop="29dp"
+        android:paddingRight="15dp"
+        android:paddingBottom="24dp">
+
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="这里是周结打卡细则:"
+            android:textColor="@color/black"
+            android:textSize="@dimen/px54_18sp" />
+
+        <TextView
+            android:id="@+id/tv_rules"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="20dp"
+            android:text="1,这里是规则明细;1,这里是规则明细;1,这里是规则明细;1,这里是规则明细;1,这里是规则明细;1,这里是规则明细;1,这里是规则明细;"
+            android:textColor="@color/black"
+            android:textSize="@dimen/px48_16sp" />
+
+    </LinearLayout>
+
+
+</LinearLayout>

BIN
app/src/main/res/mipmap-hdpi/ic_clock_rules.png


BIN
app/src/main/res/mipmap-xhdpi/ic_clock_rules.png


BIN
app/src/main/res/mipmap-xxhdpi/ic_clock_rules.png


BIN
app/src/main/res/mipmap-xxxhdpi/ic_clock_rules.png