Browse Source

提交类型 编写功能
提交内容 编写日程提交代码

Bitliker 7 years ago
parent
commit
9b6815528b

+ 5 - 1
app_core/common/src/main/java/com/common/preferences/PreferenceUtils.java

@@ -10,7 +10,11 @@ import com.common.config.BaseConfig;
  * SharedPreferences存储数据类
  */
 public class PreferenceUtils {
-    public static final String  AUTO_SIGN_SW="AUTO_SIGN_SW";
+    public interface Constants{
+        String  AUTO_SIGN_SW="AUTO_SIGN_SW";//是否开启自动打卡
+        String  SAVE_SYSTEM_SCHEDULE="saveSystemSchedule";//是否保存日程到系统
+
+    }
 
 
 

+ 1 - 0
app_modular/appworks/src/main/AndroidManifest.xml

@@ -472,6 +472,7 @@
         <activity android:name=".activity.RegisterDetailActivity" />
         <activity android:name=".activity.EnterpriseInviteStatisticsActivity" />
         <activity android:name=".activity.ScheduleSearchActivity" />
+        <activity android:name=".activity.ScheduleSettingActivity" />
         <activity android:name=".activity.SchedulerCreateActivity" />
         <activity android:name=".activity.ScheduleActivity">
             <intent-filter>

+ 2 - 2
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/SignSeniorSettingActivity.java

@@ -241,7 +241,7 @@ public class SignSeniorSettingActivity extends BaseActivity implements View.OnCl
         signin_face_sv.setOnCheckedChangeListener(this);
         auto_sign_sw.setOnClickListener(this);
 
-        boolean isAlert = PreferenceUtils.getBoolean(PreferenceUtils.AUTO_SIGN_SW, true);
+        boolean isAlert = PreferenceUtils.getBoolean(PreferenceUtils.Constants.AUTO_SIGN_SW, true);
         signin_alert_sv.setChecked(isAlert);
         signin_alert_sv.setOnCheckedChangeListener(this);
 
@@ -508,7 +508,7 @@ public class SignSeniorSettingActivity extends BaseActivity implements View.OnCl
     @Override
     public void onCheckedChanged(View view, final boolean isChecked) {
         if (view.getId() == R.id.signin_alert_sv) {
-            PreferenceUtils.putBoolean(PreferenceUtils.AUTO_SIGN_SW, isChecked);
+            PreferenceUtils.putBoolean(PreferenceUtils.Constants.AUTO_SIGN_SW, isChecked);
         } else if (R.id.signin_face_sv == view.getId()) {
             //TODO
             ToastUtil.showToast(ct, "请点击下方保存按钮以保存数据");

+ 3 - 3
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/utils/AutoErpSigninUitl.java

@@ -444,7 +444,7 @@ public class AutoErpSigninUitl implements OnHttpResultListener {
                     break;
                 case SIGNING:
                     String subtitle = UasLocationHelper.getInstance().getUASLocation().getName();
-                    if (PreferenceUtils.getBoolean(PreferenceUtils.AUTO_SIGN_SW, true)) {
+                    if (PreferenceUtils.getBoolean(PreferenceUtils.Constants.AUTO_SIGN_SW, true)) {
                         MediaUtils.saveLogOk(MyApplication.getInstance());
                         boolean saveOk = MessageDao.getInstance().instartSignin(getString(R.string.auto_work_signin_alert),
                                 StringUtil.isEmpty(subtitle) ? getString(R.string.uu_auto_work_signined_up) : subtitle);
@@ -719,7 +719,7 @@ public class AutoErpSigninUitl implements OnHttpResultListener {
                 && model.getWorkTime().compareTo(time) >= 0) {
             model.setWorkSignin(time);
             long i = WorkModelDao.getInstance().update(model);
-            if (PreferenceUtils.getBoolean(PreferenceUtils.AUTO_SIGN_SW, true)) {
+            if (PreferenceUtils.getBoolean(PreferenceUtils.Constants.AUTO_SIGN_SW, true)) {
                 notificationManage.sendNotification(MyApplication.getInstance(),
                         R.string.auto_signin, WorkActivity.class);
                 LogUtil.i("发送上班打卡通知");
@@ -733,7 +733,7 @@ public class AutoErpSigninUitl implements OnHttpResultListener {
                 && model.getOffend().compareTo(time) >= 0) {
             model.setOffSignin(time);
             WorkModelDao.getInstance().update(model);
-            if (PreferenceUtils.getBoolean(PreferenceUtils.AUTO_SIGN_SW, true)) {
+            if (PreferenceUtils.getBoolean(PreferenceUtils.Constants.AUTO_SIGN_SW, true)) {
                 notificationManage.sendNotification(MyApplication.getInstance(),
                         R.string.auto_signin, WorkActivity.class);
             }

+ 19 - 5
app_modular/appworks/src/main/java/com/uas/appworks/activity/ScheduleActivity.java

@@ -6,6 +6,8 @@ import android.os.Bundle;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Button;
@@ -19,7 +21,6 @@ import com.modular.apputils.widget.compactcalender.Lunar;
 import com.modular.apputils.widget.compactcalender.domain.Event;
 import com.uas.appworks.R;
 import com.uas.appworks.model.Schedule;
-import com.uas.appworks.widget.ScheduleDividerItemDecoration;
 
 import java.util.ArrayList;
 import java.util.Calendar;
@@ -38,11 +39,26 @@ public class ScheduleActivity extends BaseActivity {
     private String mCurrentDateStr;
     private ScheduleAdapter mScheduleAdapter;
 
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(R.menu.menu_schedule, menu);
+        return super.onCreateOptionsMenu(menu);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == R.id.search) {
+            startActivity(new Intent(ct,ScheduleSearchActivity.class));
+        } else if (item.getItemId() == R.id.setting) {
+            startActivity(new Intent(ct,ScheduleSettingActivity.class));
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_schedule);
-
         initView();
     }
 
@@ -61,8 +77,7 @@ public class ScheduleActivity extends BaseActivity {
         compactCalendarView.setLocale(TimeZone.getDefault(), Locale.CHINESE);
         compactCalendarView.setUseThreeLetterAbbreviation(true);
         mRecyclerView.setLayoutManager(new LinearLayoutManager(ct));
-        mRecyclerView.addItemDecoration(new ScheduleDividerItemDecoration(ct));
-
+//        mRecyclerView.addItemDecoration(new ScheduleDividerItemDecoration(ct));
         changeDate(mCurrentDate);
         newDayTv.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -122,7 +137,6 @@ public class ScheduleActivity extends BaseActivity {
         public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
             if (viewType == 1) {
                 return new ViewHoder(LayoutInflater.from(ct).inflate(R.layout.item_schedule_bottom, parent, false));
-
             } else if (viewType == -1) {
                 return new CreateViewHoder(LayoutInflater.from(ct).inflate(R.layout.item_create_schedule, parent, false));
 

+ 107 - 0
app_modular/appworks/src/main/java/com/uas/appworks/activity/ScheduleSettingActivity.java

@@ -0,0 +1,107 @@
+package com.uas.appworks.activity;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.TextView;
+
+import com.common.preferences.PreferenceUtils;
+import com.core.base.BaseActivity;
+import com.core.model.SelectBean;
+import com.core.widget.view.Activity.SelectActivity;
+import com.core.widget.view.SwitchView;
+import com.uas.appworks.R;
+
+import java.util.ArrayList;
+
+public class ScheduleSettingActivity extends BaseActivity {
+    private final String[] warns = {"不提醒", "开始时", "提醒前5分钟", "提醒前15分钟", "提醒前30分钟", "提醒前1小时", "提醒前一天"};
+    private final String[] repeats = {"不重复(默认)", "每天重复", "每周重复", "每月重复"};
+
+    private TextView warmTimeTv;
+    private TextView repeatTv;
+    private SwitchView saveSystemSv;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_schedule_search);
+        initView();
+    }
+
+    private void initView() {
+        saveSystemSv = findViewById(R.id.saveSystemSv);
+        warmTimeTv = (TextView) findViewById(R.id.warmTimeTv);
+        repeatTv = (TextView) findViewById(R.id.repeatTv);
+        findViewById(R.id.warmTimeRl).setOnClickListener(mOnClickListener);
+        findViewById(R.id.repeatRl).setOnClickListener(mOnClickListener);
+        saveSystemSv.setClickable(PreferenceUtils.getBoolean(PreferenceUtils.Constants.SAVE_SYSTEM_SCHEDULE, true));
+        saveSystemSv.setOnCheckedChangeListener(new SwitchView.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(View view, boolean isChecked) {
+                PreferenceUtils.putBoolean(PreferenceUtils.Constants.SAVE_SYSTEM_SCHEDULE, isChecked);
+                if (isChecked) {
+                    //开启,TODO 将添加到日程
+                } else {
+                    //关闭,TODO 询问是否清楚以前的日程
+                }
+            }
+        });
+    }
+
+
+    private View.OnClickListener mOnClickListener = new View.OnClickListener() {
+        @Override
+        public void onClick(View view) {
+            if (view.getId() == R.id.warmTimeRl) {
+                ArrayList<SelectBean> beans = new ArrayList<>();
+                String[] datas = warns;
+                SelectBean bean = null;
+                for (String e : datas) {
+                    bean = new SelectBean();
+                    bean.setName(e);
+                    bean.setClick(e.contains("默认") ? true : false);
+                    beans.add(bean);
+                }
+                Intent intent = new Intent(ct, SelectActivity.class);
+                intent.putExtra("type", 2);
+                intent.putParcelableArrayListExtra("data", beans);
+                intent.putExtra("title", getString(R.string.select_approvel_people));
+                startActivityForResult(intent, 0x11);
+            } else if (R.id.repeatRl == view.getId()) {
+                ArrayList<SelectBean> beans = new ArrayList<>();
+                SelectBean bean = null;
+                for (String e : repeats) {
+                    bean = new SelectBean();
+                    bean.setName(e);
+                    bean.setClick(e.contains("默认") ? true : false);
+                    beans.add(bean);
+                }
+                Intent intent = new Intent(ct, SelectActivity.class);
+                intent.putExtra("type", 2);
+                intent.putParcelableArrayListExtra("data", beans);
+                intent.putExtra("title", getString(R.string.select_approvel_people));
+                startActivityForResult(intent, 0x12);
+            }
+        }
+    };
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (data != null) {
+            SelectBean b = data.getParcelableExtra("data");
+            if (b != null) {
+                switch (requestCode) {
+                    case 0x11:
+                        warmTimeTv.setText(b.getName());
+                        break;
+                    case 0x12:
+                        repeatTv.setText(b.getName());
+                        break;
+                }
+            }
+        }
+    }
+
+}

+ 13 - 12
app_modular/appworks/src/main/res/layout/activity_schedule.xml

@@ -21,32 +21,33 @@
     <TextView
         android:id="@+id/lunarCalendarTv"
         android:layout_width="wrap_content"
-        app:layout_constraintRight_toRightOf="parent"
-        android:layout_marginRight="30dp"
         android:layout_height="wrap_content"
-        app:layout_constraintTop_toTopOf="@id/monthTv"
-        app:layout_constraintBottom_toBottomOf="@id/monthTv"
+        android:layout_marginRight="30dp"
         android:text="农历 十八"
         android:textColor="#FF696969"
         android:textSize="11sp"
-        />
+        app:layout_constraintBottom_toBottomOf="@id/monthTv"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="@id/monthTv" />
+
     <TextView
         android:id="@+id/newDayTv"
-        android:layout_width="wrap_content"
-        app:layout_constraintLeft_toLeftOf="parent"
+        android:layout_width="25sp"
+        android:layout_height="25sp"
         android:layout_marginLeft="30dp"
         android:background="@drawable/bg_circular_bule"
-        android:layout_height="wrap_content"
-        app:layout_constraintTop_toTopOf="@id/monthTv"
-        app:layout_constraintBottom_toBottomOf="@id/monthTv"
+        android:gravity="center"
         android:text="今"
         android:textColor="@color/white"
         android:textSize="12sp"
-        />
+        app:layout_constraintBottom_toBottomOf="@id/monthTv"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="@id/monthTv" />
+
     <com.modular.apputils.widget.compactcalender.CompactCalendarView xmlns:app="http://schemas.android.com/apk/res-auto"
         android:id="@+id/compactcalendar_view"
         android:layout_width="fill_parent"
-        android:layout_height="230dp"
+        android:layout_height="250dp"
         app:compactCalendarBackgroundColor="@color/white"
         app:compactCalendarCurrentDayBackgroundColor="#206390"
         app:compactCalendarCurrentDayIndicatorStyle="fill_large_indicator"

+ 97 - 0
app_modular/appworks/src/main/res/layout/activity_schedule_setting.xml

@@ -0,0 +1,97 @@
+<?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:orientation="vertical">
+
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/white"
+        android:padding="@dimen/padding">
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="同步日程到手机系统中"
+            android:textColor="#FF383838"
+            android:textSize="14sp" />
+
+        <com.core.widget.view.SwitchView
+            android:id="@+id/saveSystemSv"
+            android:layout_width="40dp"
+            android:layout_height="25dp"
+            android:layout_alignParentRight="true"
+            android:layout_centerVertical="true" />
+
+    </RelativeLayout>
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="@dimen/padding"
+        android:padding="@dimen/padding"
+        android:text="同步日程到手机系统中,系统日程也可以同步到uu互联日程表中"
+        android:textColor="#FF7E7E7E"
+        android:textSize="10sp" />
+
+    <RelativeLayout
+        android:id="@+id/warmTimeRl"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/white"
+        android:padding="@dimen/padding">
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="提示时间默认"
+            android:textColor="#FF383838"
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/warmTimeTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:layout_centerVertical="true"
+            android:drawableRight="@drawable/oa_next"
+            android:text="开始时"
+            android:drawablePadding="@dimen/padding"
+            android:textColor="#FF797979"
+            android:textSize="12sp" />
+    </RelativeLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:background="@color/linen"/>
+
+    <RelativeLayout
+        android:id="@+id/repeatRl"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/white"
+        android:padding="@dimen/padding">
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="提醒重复默认"
+            android:textColor="#FF383838"
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/repeatTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:layout_centerVertical="true"
+            android:drawableRight="@drawable/oa_next"
+            android:text="不重复"
+            android:drawablePadding="@dimen/padding"
+            android:textColor="#FF797979"
+            android:textSize="12sp" />
+    </RelativeLayout>
+</LinearLayout>

+ 31 - 2
app_modular/appworks/src/main/res/layout/item_schedule_bottom.xml

@@ -3,17 +3,39 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:background="@color/white"
-    android:padding="@dimen/padding">
+    android:background="@color/white">
+
+    <View
+        android:id="@+id/line"
+        android:layout_width="2px"
+        android:layout_height="0dp"
+        android:background="#CDCDCD"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="@+id/spot"
+        app:layout_constraintRight_toRightOf="@+id/spot"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <View
+        android:id="@+id/spot"
+        android:layout_width="5dp"
+        android:layout_height="5dp"
+        android:layout_marginLeft="10dp"
+        android:background="@drawable/bg_circular_bule"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
 
     <TextView
         android:id="@+id/timeTv"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:layout_marginLeft="10dp"
         android:text="全天"
         android:textColor="#FF000000"
         android:textSize="14sp"
         app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toRightOf="@id/spot"
         app:layout_constraintTop_toTopOf="parent" />
 
     <TextView
@@ -43,4 +65,11 @@
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
+    <View
+        android:layout_width="0dp"
+        android:layout_height="@dimen/line"
+        android:background="@color/linen"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintLeft_toLeftOf="@id/contentTv"
+        app:layout_constraintBottom_toBottomOf="parent"/>
 </android.support.constraint.ConstraintLayout>

+ 16 - 0
app_modular/appworks/src/main/res/menu/menu_schedule.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <item
+        android:id="@+id/search"
+        android:icon="@drawable/icon_search_white"
+        android:title="搜索"
+        app:showAsAction="always" />
+
+    <item
+        android:id="@+id/setting"
+        android:icon="@drawable/ic_dot_more"
+        android:title="设置"
+        app:showAsAction="always" />
+</menu>