package safeluck.drive.evaluation.fragment;
|
|
import android.os.Bundle;
|
|
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 androidx.annotation.NonNull;
|
import androidx.annotation.Nullable;
|
|
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() {
|
|
|
PasswordFragment fragment = new PasswordFragment();
|
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;
|
}
|
}
|
}
|