Selaa lähdekoodia

1.完成打卡结果页面

wsad5123 5 vuotta sitten
vanhempi
commit
9000b0ed4e

+ 23 - 0
app/src/main/java/com/tongyu/luck/happywork/bean/ClockResultBean.java

@@ -7,13 +7,18 @@ public class ClockResultBean implements Parcelable {
     private String todayMoney;
     private String duration;
     private String sumMoney;
+    private String startPunchClock;
+    private String endPunchClock;
     private String ErrorCode2103;
     private String ErrorCode2102;
 
+
     protected ClockResultBean(Parcel in) {
         todayMoney = in.readString();
         duration = in.readString();
         sumMoney = in.readString();
+        startPunchClock = in.readString();
+        endPunchClock = in.readString();
         ErrorCode2103 = in.readString();
         ErrorCode2102 = in.readString();
     }
@@ -70,6 +75,22 @@ public class ClockResultBean implements Parcelable {
         ErrorCode2102 = errorCode2102;
     }
 
+    public String getStartPunchClock() {
+        return startPunchClock;
+    }
+
+    public void setStartPunchClock(String startPunchClock) {
+        this.startPunchClock = startPunchClock;
+    }
+
+    public String getEndPunchClock() {
+        return endPunchClock;
+    }
+
+    public void setEndPunchClock(String endPunchClock) {
+        this.endPunchClock = endPunchClock;
+    }
+
     @Override
     public int describeContents() {
         return 0;
@@ -80,6 +101,8 @@ public class ClockResultBean implements Parcelable {
         dest.writeString(todayMoney);
         dest.writeString(duration);
         dest.writeString(sumMoney);
+        dest.writeString(startPunchClock);
+        dest.writeString(endPunchClock);
         dest.writeString(ErrorCode2103);
         dest.writeString(ErrorCode2102);
     }

+ 28 - 2
app/src/main/java/com/tongyu/luck/happywork/ui/activity/cclient/clock/ClockResultActivity.java

@@ -2,10 +2,13 @@ package com.tongyu.luck.happywork.ui.activity.cclient.clock;
 
 import android.graphics.Typeface;
 import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import com.tongyu.luck.happywork.R;
+import com.tongyu.luck.happywork.baselibrary.utils.DateUtils;
 import com.tongyu.luck.happywork.bean.ClockResultBean;
 import com.tongyu.luck.happywork.callback.OnActionBarMenuClickListener;
 import com.tongyu.luck.happywork.ui.base.BaseActivity;
@@ -15,6 +18,7 @@ import com.tongyu.luck.happywork.ui.mvp.cclient.presenter.ClockResultPresenter;
 import butterknife.BindView;
 
 public class ClockResultActivity extends BaseActivity<ClockResultPresenter> implements ClockResultContacts.IClockResultView {
+
     @BindView(R.id.tv_result)
     TextView tvResult;
     @BindView(R.id.tv_time)
@@ -23,8 +27,14 @@ public class ClockResultActivity extends BaseActivity<ClockResultPresenter> impl
     TextView tvMoney;
     @BindView(R.id.ll_money)
     LinearLayout llMoney;
-    @BindView(R.id.tv_day)
-    TextView tvDay;
+    @BindView(R.id.tv_clock_in)
+    TextView tvClockIn;
+    @BindView(R.id.tv_hour)
+    TextView tvHour;
+    @BindView(R.id.tv_day_repay)
+    TextView tvDayRepay;
+    @BindView(R.id.ll_clock_out)
+    LinearLayout llClockOut;
 
     @Override
     public int getLayoutId() {
@@ -55,6 +65,8 @@ public class ClockResultActivity extends BaseActivity<ClockResultPresenter> impl
         setActionBarMenu(onActionBarMenuClickListener, R.mipmap.ic_clock_result_close);
         Typeface typeFace = Typeface.createFromAsset(mContext.getAssets(), "fonts/DIN_Condensed_Bold.woff.ttf");
         tvMoney.setTypeface(typeFace);
+        tvHour.setTypeface(typeFace);
+        tvDayRepay.setTypeface(typeFace);
     }
 
     /**
@@ -65,6 +77,20 @@ public class ClockResultActivity extends BaseActivity<ClockResultPresenter> impl
     @Override
     public void onClockResultData(ClockResultBean bean) {
         if (bean != null) {
+            tvMoney.setText(bean.getSumMoney());
+            if (!TextUtils.isEmpty(bean.getEndPunchClock())) {//下班卡
+                tvResult.setText(R.string.clock_out_success);
+                tvTime.setText("打卡时间 " + DateUtils.getFormatStrToHHmm(bean.getEndPunchClock()));
+                tvClockIn.setVisibility(View.GONE);
+                llClockOut.setVisibility(View.VISIBLE);
+                tvHour.setText(bean.getDuration());
+                tvDayRepay.setText(bean.getTodayMoney());
+            } else {//上班卡
+                tvResult.setText(R.string.clock_in_success);
+                tvTime.setText("打卡时间 " + DateUtils.getFormatStrToHHmm(bean.getStartPunchClock()));
+                tvClockIn.setVisibility(View.VISIBLE);
+                llClockOut.setVisibility(View.GONE);
+            }
         }
     }
 }

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

@@ -107,6 +107,11 @@ public class ClockFragment extends BaseFragment<ClockFragmentPresenter> implemen
     }
 
     @Override
+    public void onResume() {
+        super.onResume();
+    }
+
+    @Override
     public void onDestroyView() {
         super.onDestroyView();
         EventBus.getDefault().unregister(this);
@@ -174,7 +179,7 @@ public class ClockFragment extends BaseFragment<ClockFragmentPresenter> implemen
                     tvClockInState.setCompoundDrawables(dSuccess, null, null, null);
                     tvClockInState.setText(DateUtils.getFormatStrToHHmm(infoBean.getStartPunch()));
                 }
-                if ("未完成".equals(infoBean.getStartPunch())) {
+                if ("未完成".equals(infoBean.getEndPunch())) {
                     tvClockOutState.setCompoundDrawables(null, null, null, null);
                     tvClockOutState.setText(infoBean.getEndPunch());
                 } else {

+ 77 - 19
app/src/main/res/layout/activity_clock_result.xml

@@ -59,15 +59,14 @@
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_gravity="center_horizontal"
-                    android:layout_marginBottom="20dp"
                     android:orientation="horizontal">
 
                     <TextView
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:text="@string/clock_today_repay"
+                        android:text="@string/clock_repay_total_all"
                         android:textColor="@color/text_black"
-                        android:textSize="@dimen/px51_17sp"
+                        android:textSize="@dimen/px48_16sp"
                         android:textStyle="bold" />
 
                     <TextView
@@ -85,35 +84,94 @@
                         android:layout_height="wrap_content"
                         android:text="@string/yuan"
                         android:textColor="@color/text_black"
-                        android:textSize="@dimen/px51_17sp"
+                        android:textSize="@dimen/px48_16sp"
                         android:textStyle="bold" />
                 </LinearLayout>
 
                 <TextView
-                    android:id="@+id/tv_day"
-                    android:layout_width="wrap_content"
+                    android:id="@+id/tv_clock_in"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_gravity="center_horizontal"
-                    android:text="本月累计打卡 0 天"
+                    android:layout_marginTop="10dp"
+                    android:gravity="center"
+                    android:lineSpacingExtra="10dp"
+                    android:text="@string/clock_in_result_tips"
                     android:textColor="@color/text_black"
-                    android:textSize="@dimen/px51_17sp"
-                    android:textStyle="bold" />
+                    android:textSize="@dimen/px42_14sp" />
 
-                <TextView
-                    android:layout_width="wrap_content"
+                <LinearLayout
+                    android:id="@+id/ll_clock_out"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_gravity="center_horizontal"
-                    android:layout_marginTop="5dp"
-                    android:text="@string/clock_result_tips"
-                    android:textColor="@color/text_black_66"
-                    android:textSize="@dimen/px45_15sp" />
+                    android:orientation="vertical">
+
+                    <LinearLayout
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_horizontal"
+                        android:orientation="horizontal">
+
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:text="今日打卡已完成,打卡时长 "
+                            android:textColor="@color/text_black"
+                            android:textSize="@dimen/px42_14sp" />
+
+                        <TextView
+                            android:id="@+id/tv_hour"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:text="10"
+                            android:textColor="@color/blue_00"
+                            android:textSize="@dimen/px60_20sp" />
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:text=" 小时,"
+                            android:textColor="@color/text_black"
+                            android:textSize="@dimen/px42_14sp" />
+                    </LinearLayout>
+
+                    <LinearLayout
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_horizontal"
+                        android:orientation="horizontal">
+
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:text="可预支工资 "
+                            android:textColor="@color/text_black"
+                            android:textSize="@dimen/px42_14sp" />
+
+                        <TextView
+                            android:id="@+id/tv_day_repay"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:text="21.88"
+                            android:textColor="@color/blue_00"
+                            android:textSize="@dimen/px60_20sp" />
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:text=" 元。明天也要努力哦!"
+                            android:textColor="@color/text_black"
+                            android:textSize="@dimen/px42_14sp" />
+                    </LinearLayout>
+                </LinearLayout>
 
                 <Button
                     android:layout_width="269dp"
                     android:layout_height="43dp"
                     android:layout_gravity="center_horizontal"
-                    android:layout_marginTop="85dp"
-                    android:layout_marginBottom="96dp"
+                    android:layout_marginTop="62dp"
+                    android:layout_marginBottom="85dp"
                     android:background="@drawable/corners_stroke_black_5dp"
                     android:text="@string/clock_result_watch"
                     android:textColor="@color/text_black"

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

@@ -69,12 +69,13 @@
     <string name="service">客服</string>
     <string name="rules">规则</string>
     <string name="clock_in_success">上班打卡成功</string>
+    <string name="clock_out_success">下班打卡成功</string>
     <string name="clock_in">上班打卡</string>
     <string name="clock_out">下班打卡</string>
     <string name="clock_tips">实际预支发放结合企业考勤,以上金额仅供参考。</string>
     <string name="clock_result_tips">新的一天开始了,好好工作,天天向上!</string>
     <string name="clock_result_watch">查看打卡结果</string>
-    <string name="clock_today_repay">今日可预支工资</string>
+    <string name="clock_repay_total_all">累计预支</string>
     <string name="clock_happy">开心打卡</string>
     <string name="clock_month_statistics">月统计数据</string>
     <string name="clock_week_statistics">周统计数据</string>
@@ -96,6 +97,7 @@
     <string name="clock_today_money">当日可预支工资:</string>
     <string name="clock_relocation">重新定位</string>
     <string name="clock_relocation_ing">定位中</string>
+    <string name="clock_in_result_tips">新的一天开始啦!\n今天的你也要光芒万丈!记得下班也要打卡哦!</string>
     <string name="go_use">开启开心打卡之旅</string>
     <string name="no_finish">未完成</string>
     <!-- C Client-->

+ 1 - 1
baselibrary/src/main/java/com/tongyu/luck/happywork/baselibrary/utils/DateUtils.java

@@ -225,7 +225,7 @@ public class DateUtils {
         try {
             long dateLong = Long.parseLong(date);
             DateFormat format = new SimpleDateFormat("HH:mm");
-            return format.format(date);
+            return format.format(dateLong);
         } catch (Exception e) {
 
         }