|
@@ -1,22 +1,62 @@
|
|
|
package me.yoqi.android.open2share;
|
|
|
|
|
|
-import androidx.appcompat.app.AppCompatActivity;
|
|
|
-import androidx.fragment.app.Fragment;
|
|
|
-
|
|
|
-import android.content.ComponentName;
|
|
|
-import android.content.pm.PackageManager;
|
|
|
+import android.content.Context;
|
|
|
import android.os.Bundle;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.CompoundButton;
|
|
|
+import android.widget.Switch;
|
|
|
+import android.widget.TextView;
|
|
|
|
|
|
-import java.util.Objects;
|
|
|
+import androidx.appcompat.app.AlertDialog;
|
|
|
+import androidx.appcompat.app.AppCompatActivity;
|
|
|
+
|
|
|
+import me.yoqi.android.utils.SPUtils;
|
|
|
+import me.yoqi.android.utils.SimplexToast;
|
|
|
|
|
|
/**
|
|
|
* 设置界面
|
|
|
*/
|
|
|
public class MainActivity extends AppCompatActivity {
|
|
|
+ TextView tvAbout;
|
|
|
+ Switch swIcon;
|
|
|
+ SPUtils spUtils;
|
|
|
+ SimplexToast toast;
|
|
|
+ Context mContext;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
setContentView(R.layout.activity_setting);
|
|
|
+ mContext = this;
|
|
|
+ spUtils = new SPUtils(mContext);
|
|
|
+ toast = new SimplexToast(mContext);
|
|
|
+ initView();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initView() {
|
|
|
+ tvAbout = findViewById(R.id.tv_about);
|
|
|
+ swIcon = findViewById(R.id.switch_icon);
|
|
|
+ boolean hideIcon = spUtils.getBoolean("hideIcon", false);
|
|
|
+ swIcon.setChecked(hideIcon);
|
|
|
+
|
|
|
+ tvAbout.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ AlertDialog.Builder mDialogBuilder = new AlertDialog.Builder(mContext.getApplicationContext());
|
|
|
+ mDialogBuilder.create();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ swIcon.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
+ if (isChecked) {
|
|
|
+ //隐藏图片
|
|
|
+
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ spUtils.putBoolean("hideIcon", isChecked);
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|