Skip to content

Commit

Permalink
优化退出登录UI
Browse files Browse the repository at this point in the history
  • Loading branch information
BoMingZhao committed May 19, 2020
1 parent 37b9f51 commit 92ed020
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 14 deletions.
Binary file modified .gradle/5.6.4/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/5.6.4/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/5.6.4/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/5.6.4/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/5.6.4/javaCompile/classAnalysis.bin
Binary file not shown.
Binary file modified .gradle/5.6.4/javaCompile/javaCompile.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
4 changes: 1 addition & 3 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions PullToRefresh/PullToRefresh.iml
Expand Up @@ -31,15 +31,15 @@
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugUnitTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
Expand Down
6 changes: 3 additions & 3 deletions app/app.iml
Expand Up @@ -30,15 +30,15 @@
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugUnitTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
Expand Down
@@ -1,8 +1,10 @@
package com.example.my_test6.user_module;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
Expand All @@ -29,8 +31,11 @@
import com.example.my_test6.user_module.GsonBean.Users;
import com.google.gson.Gson;

import static com.example.my_test6.Pool.login.clearCache;

public class UserFragment extends Fragment {
private UserViewModel userViewModel;
private SharedPreferences.Editor editor;
private SharedPreferences sp;
private View root;
private Button message;
Expand Down Expand Up @@ -71,6 +76,7 @@ public View onCreateView(@NonNull LayoutInflater inflater,
head1 = root.findViewById(R.id.UserHeadImage);
head2 = root.findViewById(R.id.Userhead);
sp = getActivity().getSharedPreferences("User",Context.MODE_PRIVATE);
editor = sp.edit();
setUI();
/*final TextView textView = root.findViewById(R.id.text_user);
userViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
Expand Down Expand Up @@ -206,10 +212,7 @@ public void onClick(View v) {
@Override
public void onClick(View v) {
//goto login
Intent intent = new Intent();
ComponentName componentname = new ComponentName("com.example.my_test6", "com.example.my_test6.user_module.logout");
intent.setComponent(componentname);
startActivity(intent);
showCoverDialog();
}
});
head1.setImageResource(R.drawable.circle);
Expand Down Expand Up @@ -304,4 +307,27 @@ public void onClick(View v) {
head2.setImageResource(R.drawable.head);
}
}
private void showCoverDialog(){
final Context context = this.getContext();
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("提示");
builder.setMessage("确定退出登录吗?");
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
TokenPool.getTokenPool().UserToken = "";
TokenPool.getTokenPool().isLogin = false;
setUI();//这里不用清理登录网页缓存,因为在每次进入登录的模块前清理了
editor.putBoolean("isLogin",false);
editor.commit();
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {

}
});
builder.show();
}
}

0 comments on commit 92ed020

Please sign in to comment.