endian11
2019-03-29 d1833b2a7cad46529087e2a40f596c205022f02f
给系统设置加上密码才能进入
2个文件已修改
4个文件已添加
211 ■■■■■ 已修改文件
app/src/main/java/safeluck/drive/evaluation/fragment/HomeFragment.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/fragment/PasswordFragment.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/anim/v_fragment_enter.xml 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/anim/v_fragment_exit.xml 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/layout_pwd_fragment.xml 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/values/strings.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/fragment/HomeFragment.java
@@ -15,7 +15,8 @@
import me.yokeyword.fragmentation.SupportFragment;
import safeluck.drive.evaluation.R;
/**首页
/**
 * 首页
 * MyApplication2
 * Created by lzw on 2019/3/15. 10:21:58
 * 邮箱:632393724@qq.com
@@ -83,11 +84,16 @@
                break;
            case R.id.system_setting:
                BaseSettingFragment sysSetingFragment = findFragment(BaseSettingFragment.class);
                if (sysSetingFragment == null){
                    sysSetingFragment = (BaseSettingFragment) BaseSettingFragment.newInstance();
                SupportFragment pwdFragment = findFragment(PasswordFragment.class);
                if (pwdFragment == null) {
                    pwdFragment = PasswordFragment.newInstance();
                    extraTransaction().startDontHideSelf(pwdFragment);
                } else {
                    extraTransaction().startDontHideSelf(pwdFragment);
                }
                start(sysSetingFragment);
                break;
        }
    }
app/src/main/java/safeluck/drive/evaluation/fragment/PasswordFragment.java
New file
@@ -0,0 +1,78 @@
package safeluck.drive.evaluation.fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import me.yokeyword.fragmentation.SupportFragment;
import safeluck.drive.evaluation.R;
/**
 * MyApplication2
 * Created by lzw on 2019/3/29. 13:22:38
 * 邮箱:632393724@qq.com
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */
public class PasswordFragment extends SupportFragment implements View.OnClickListener {
    private Button btn_sure;
    private Button btn_cancle;
    private EditText editText;
    public static SupportFragment newInstance() {
        Bundle args = new Bundle();
        PasswordFragment fragment = new PasswordFragment();
        fragment.setArguments(args);
        return fragment;
    }
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.layout_pwd_fragment, container, false);
        initView(view);
        return view;
    }
    private void initView(View view) {
        btn_cancle = view.findViewById(R.id.btn_cancle);
        btn_sure = view.findViewById(R.id.btn_sure);
        editText = view.findViewById(R.id.et_pwd);
        btn_sure.setOnClickListener(this);
        btn_cancle.setOnClickListener(this);
    }
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_cancle:
               pop();
                break;
            case R.id.btn_sure:
                String pwd = editText.getText().toString().trim();
                if (!TextUtils.isEmpty(pwd) && pwd.equals("123456")) {
                    BaseSettingFragment sysSetingFragment = findFragment(BaseSettingFragment.class);
                    if (sysSetingFragment == null) {
                        sysSetingFragment = (BaseSettingFragment) BaseSettingFragment.newInstance();
                    }
                    startWithPop(sysSetingFragment);
                }else{
                    Toast.makeText(_mActivity, "密码错误!!", Toast.LENGTH_SHORT).show();
                }
                break;
            default:
                break;
        }
    }
}
app/src/main/res/anim/v_fragment_enter.xml
New file
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2009, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
        android:shareInterpolator="false"
        android:zAdjustment="top">
    <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
            android:interpolator="@android:anim/decelerate_interpolator"
            android:fillEnabled="true"
            android:fillBefore="false" android:fillAfter="true"
            android:duration="200"/>
    <translate android:fromYDelta="8%" android:toYDelta="0"
            android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
            android:interpolator="@android:anim/decelerate_interpolator"
            android:duration="300"/>
</set>
app/src/main/res/anim/v_fragment_exit.xml
New file
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2009, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
        android:shareInterpolator="false" android:zAdjustment="top">
    <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
            android:interpolator="@android:anim/linear_interpolator"
            android:fillEnabled="true"
            android:fillBefore="false" android:fillAfter="true"
            android:startOffset="100"
            android:duration="150"/>
    <translate android:fromYDelta="0%" android:toYDelta="8%"
            android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
            android:interpolator="@android:anim/accelerate_interpolator"
            android:duration="250"/>
</set>
app/src/main/res/layout/layout_pwd_fragment.xml
New file
@@ -0,0 +1,51 @@
<?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="@android:color/transparent"
    android:gravity="center"
    android:orientation="vertical">
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="220dp"
    android:layout_height="140dp"
    android:background="@color/train_bg"
    android:layout_gravity="center"
    android:padding="10dp">
<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    app:counterMaxLength="8"
    app:counterEnabled="true"
    android:id="@+id/txt_input_1"
    android:layout_height="60dp">
<EditText
    android:layout_width="match_parent"
    android:hint="@string/plspwd"
    android:id="@+id/et_pwd"
    android:inputType="textPassword"
    android:layout_height="50dp" />
</android.support.design.widget.TextInputLayout>
<Button
    android:layout_marginTop="20dp"
    android:layout_marginStart="20dp"
    android:layout_width="80dp"
    android:layout_height="50dp"
    android:id="@+id/btn_sure"
    android:layout_alignParentStart="true"
    android:layout_below="@+id/txt_input_1"
    android:text="确定"/>
    <Button
        android:id="@+id/btn_cancle"
        android:layout_width="80dp"
        android:layout_height="50dp"
        android:layout_below="@+id/txt_input_1"
        android:layout_alignParentEnd="true"
        android:layout_marginTop="20dp"
        android:layout_marginEnd="20dp"
        android:text="取消" />
</RelativeLayout>
</LinearLayout>
app/src/main/res/values/strings.xml
@@ -11,4 +11,6 @@
    <string name="sys_setting_sub">智能考培,助力驾考新旅程</string>
    <string name="save">保存</string>
    <string name="on_board_sn">车载设备号:</string>
    <string name="pwd">密码</string>
    <string name="plspwd">请输入密码</string>
</resources>