修复没有登录后的播放问题
This commit is contained in:
parent
62f3634fe7
commit
dfcb99848e
|
@ -18,7 +18,7 @@ android {
|
|||
//noinspection OldTargetApi
|
||||
targetSdk 31
|
||||
versionCode 1
|
||||
versionName "1.9.0"
|
||||
versionName "1.9.1"
|
||||
|
||||
}
|
||||
compileOptions {
|
||||
|
|
|
@ -19,9 +19,8 @@ public class resource {
|
|||
public static void recommend(List<XM> list) {
|
||||
try {
|
||||
list.clear();
|
||||
String hq;
|
||||
JSONObject json;
|
||||
hq = wl.hq("/recommend/resource?cookie=" + wl.Cookie);
|
||||
String hq = wl.hq("/recommend/resource?cookie=" + wl.Cookie);
|
||||
if (hq == null) {
|
||||
hq = wj.dqwb(wj.gd_json);
|
||||
if (hq != null) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.mpatric.mp3agic.Mp3File;
|
|||
import com.muqingbfq.MP3;
|
||||
import com.muqingbfq.bfq;
|
||||
import com.muqingbfq.fragment.Media;
|
||||
import com.muqingbfq.home;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
import com.muqingbfq.mq.wl;
|
||||
|
@ -54,6 +55,11 @@ public class url extends Thread {
|
|||
return null;
|
||||
}
|
||||
JSONObject json = new JSONObject(hq);
|
||||
if (json.getInt("code") == -460) {
|
||||
String message = json.getString("message");
|
||||
gj.xcts(home.appCompatActivity, message + "-可能需要登录网易云");
|
||||
return null;
|
||||
}
|
||||
JSONArray data = json.getJSONArray("data");
|
||||
JSONObject jsonObject = data.getJSONObject(0);
|
||||
String url = jsonObject.getString("url");
|
||||
|
|
|
@ -19,13 +19,10 @@ import androidx.media.MediaBrowserServiceCompat;
|
|||
|
||||
import com.muqingbfq.api.url;
|
||||
import com.muqingbfq.mq.BluetoothMusicController;
|
||||
import com.muqingbfq.mq.FloatingLyricsService;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class bfqkz extends MediaBrowserServiceCompat {
|
||||
public static MediaPlayer mt = new MediaPlayer();
|
||||
|
@ -52,6 +49,10 @@ public class bfqkz extends MediaBrowserServiceCompat {
|
|||
@SuppressLint("NotifyDataSetChanged")
|
||||
public static void mp3(String id) {
|
||||
try {
|
||||
if (id == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
//针对错误进行相应的处理
|
||||
bfqkz.list.remove(bfqkz.xm);
|
||||
|
|
|
@ -2,14 +2,19 @@ package com.muqingbfq.fragment;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
@ -19,17 +24,20 @@ import com.muqingbfq.api.url;
|
|||
import com.muqingbfq.bfq;
|
||||
import com.muqingbfq.bfq_an;
|
||||
import com.muqingbfq.bfqkz;
|
||||
import com.muqingbfq.home;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.List;
|
||||
|
||||
public class bfq_db extends Fragment {
|
||||
public class bfq_db extends Fragment implements GestureDetector.OnGestureListener {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
public static View view;
|
||||
|
||||
private GestureDetector gestureDetector;
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
@ -67,7 +75,18 @@ public class bfq_db extends Fragment {
|
|||
TextView name = view.findViewById(R.id.name);
|
||||
view.findViewById(R.id.kg).setOnClickListener(new bfq_an.kz());
|
||||
view.findViewById(R.id.txb).setOnClickListener(view -> bflb_db.start(getContext()));
|
||||
view.setOnClickListener(vw -> bfq.start(home.appCompatActivity));
|
||||
// view.setOnClickListener(vw -> bfq.start(getContext()));
|
||||
gestureDetector = new GestureDetector(getContext(), this);
|
||||
|
||||
view.setOnTouchListener((view, motionEvent) -> {
|
||||
/* if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
|
||||
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.bj));
|
||||
return true;
|
||||
}*/
|
||||
return gestureDetector.onTouchEvent(motionEvent);
|
||||
|
||||
});
|
||||
|
||||
// 恢复列表数据
|
||||
if (bfqkz.xm != null) {
|
||||
name.setText(bfqkz.xm.name + "/" + bfqkz.xm.zz);
|
||||
|
@ -99,4 +118,53 @@ public class bfq_db extends Fragment {
|
|||
textView.setText(str);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDown(@NonNull MotionEvent motionEvent) {
|
||||
view.setBackgroundColor(Color.parseColor("#80F2ECF6"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowPress(@NonNull MotionEvent motionEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSingleTapUp(@NonNull MotionEvent motionEvent) {
|
||||
bfq.start(getContext());
|
||||
view.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.bj));
|
||||
// view.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.bj));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScroll(@Nullable MotionEvent motionEvent, @NonNull MotionEvent motionEvent1,
|
||||
float v, float v1) {
|
||||
view.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.bj));
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLongPress(@NonNull MotionEvent motionEvent) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFling(@Nullable MotionEvent e1,
|
||||
@NonNull MotionEvent e2, float v, float v1) {
|
||||
view.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.bj));
|
||||
float distance = e1.getX() - e2.getX();
|
||||
float threshold = main.k / 2.0f;
|
||||
// 判断手势方向并限制滑动距离
|
||||
if (distance > threshold) {
|
||||
// 向左滑动
|
||||
// 在这里添加你的逻辑代码
|
||||
bfq_an.xyq();
|
||||
} else if (distance < -threshold) {
|
||||
// 向右滑动
|
||||
// 在这里添加你的逻辑代码
|
||||
bfq_an.syq();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -8,7 +8,6 @@ import android.view.ViewGroup;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
|
|
@ -19,19 +19,21 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.gson.Gson;
|
||||
import com.muqingbfq.R;
|
||||
import com.muqingbfq.XM;
|
||||
import com.muqingbfq.databinding.FragmentWdBinding;
|
||||
import com.muqingbfq.login.user_editing;
|
||||
import com.muqingbfq.login.user_logs;
|
||||
import com.muqingbfq.login.user_message;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.EditViewDialog;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wj;
|
||||
import com.muqingbfq.XM;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -57,19 +59,52 @@ public class wode extends Fragment {
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
binding = FragmentWdBinding.inflate(inflater, container, false);
|
||||
name = binding.text1;
|
||||
jieshao = binding.text2;
|
||||
imageView = binding.imageView;
|
||||
binding.cardview.setOnClickListener(v -> {
|
||||
if (main.getToken() == null) {
|
||||
startActivity(new Intent(getContext(), user_logs.class));
|
||||
|
||||
|
||||
File file = new File(wj.filesdri, "user.mq");
|
||||
// user_logs.USER.user;
|
||||
if (file.exists()) {
|
||||
String[] a = new String[]{"退出登录"};
|
||||
new MaterialAlertDialogBuilder(getContext())
|
||||
.setItems(a, (dialogInterface, i) -> {
|
||||
file.delete();
|
||||
new com.muqingbfq.login.user_message();
|
||||
}).show();
|
||||
} else {
|
||||
startActivity(new Intent(getContext(), user_editing.class));
|
||||
startActivity(new Intent(getContext(), user_logs.class));
|
||||
}
|
||||
/*
|
||||
v.setEnabled(false);
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
String hq = wl.hq("/login/status?cookie=" + wl.Cookie);
|
||||
if (hq != null) {
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(hq);
|
||||
JSONObject jsonObject1 = jsonObject.getJSONObject("data").getJSONObject("profile");
|
||||
if (TextUtils.isEmpty(jsonObject1.toString())) {
|
||||
} else {
|
||||
main.handler.post(() -> {
|
||||
});
|
||||
new user_message();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
gj.sc(e);
|
||||
}
|
||||
}
|
||||
main.handler.post(() -> v.setEnabled(true));
|
||||
}
|
||||
}.start();*/
|
||||
});
|
||||
// new user_message();
|
||||
// int k = (int) (main.k / getResources().getDisplayMetrics().density + 0.5f);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 4) {
|
||||
@Override
|
||||
|
@ -78,7 +113,6 @@ public class wode extends Fragment {
|
|||
}
|
||||
};
|
||||
binding.recyclerview1.setLayoutManager(gridLayoutManager);
|
||||
|
||||
binding.recyclerview1.setFocusable(false);
|
||||
binding.recyclerview1.setAdapter(new RecyclerView.Adapter<VH>() {
|
||||
@NonNull
|
||||
|
@ -148,6 +182,7 @@ public class wode extends Fragment {
|
|||
binding.recyclerview2.setFocusable(false);
|
||||
binding.recyclerview2.setAdapter(new gd.baseadapter(getContext(), list, true));
|
||||
sx();
|
||||
denglu();
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
|
@ -193,4 +228,17 @@ public class wode extends Fragment {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void denglu() {
|
||||
if (!wj.cz(wj.filesdri + "user.mq")) {
|
||||
return;
|
||||
}
|
||||
String dqwb = wj.dqwb(wj.filesdri + "user.mq");
|
||||
user_logs.USER user = new Gson().fromJson(dqwb, user_logs.USER.class);
|
||||
setname(user.name);
|
||||
setqianming(user.qianming);
|
||||
Glide.with(getContext())
|
||||
.load(user.picUrl)
|
||||
.into(binding.imageView);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,17 +5,13 @@ import android.content.ComponentName;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.media.session.MediaSessionManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.os.Process;
|
||||
import android.support.v4.media.MediaBrowserCompat;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
@ -29,7 +25,6 @@ import com.muqingbfq.databinding.ActivityHomeBinding;
|
|||
import com.muqingbfq.fragment.bfq_db;
|
||||
import com.muqingbfq.fragment.gd_adapter;
|
||||
import com.muqingbfq.fragment.wode;
|
||||
import com.muqingbfq.mq.FloatingLyricsService;
|
||||
import com.muqingbfq.mq.gj;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -259,4 +254,15 @@ public class home extends AppCompatActivity {
|
|||
gj.sc("onChildrenLoaded------");
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
super.finish();
|
||||
// 断开连接并释放资源
|
||||
if (mBrowser != null && mBrowser.isConnected()) {
|
||||
mBrowser.disconnect();
|
||||
}
|
||||
int i = Process.myPid();
|
||||
android.os.Process.killProcess(i);
|
||||
}
|
||||
}
|
|
@ -98,10 +98,8 @@ public class user_editing extends FragmentActivity {
|
|||
public void run() {
|
||||
super.run();
|
||||
try {
|
||||
user_message.string string = user_message.get();
|
||||
if (string == null) {
|
||||
return;
|
||||
}
|
||||
// user_message.string string = user_message.get();
|
||||
/*
|
||||
main.handler.post(() -> {
|
||||
Glide.with(user_editing.this)
|
||||
.load(string.headIcon())
|
||||
|
@ -118,7 +116,7 @@ public class user_editing extends FragmentActivity {
|
|||
gender = "女";
|
||||
}
|
||||
binding.autoComplete.setText(gender);
|
||||
});
|
||||
});*/
|
||||
} catch (Exception e) {
|
||||
gj.sc(e);
|
||||
}
|
||||
|
@ -151,7 +149,7 @@ public class user_editing extends FragmentActivity {
|
|||
imageViewb.setOnClickListener(onClickListener);
|
||||
binding.userEnd.setOnClickListener(view ->{
|
||||
finish();
|
||||
main.settoken(null, null);
|
||||
// main.settoken(null, null);
|
||||
com.muqingbfq.fragment.wode.setname("未登录");
|
||||
com.muqingbfq.fragment.wode.setqianming(null);
|
||||
com.muqingbfq.fragment.wode.imageView.setImageResource(R.drawable.icon);
|
||||
|
@ -211,7 +209,7 @@ public class user_editing extends FragmentActivity {
|
|||
break;
|
||||
}
|
||||
} else if (code == 0) {
|
||||
new user_message();
|
||||
// new user_message();
|
||||
}
|
||||
gj.xcts(user_editing.this, jsonObject.getString("message"));
|
||||
} catch (JSONException e) {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package com.muqingbfq.login;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.view.MenuItem;
|
||||
|
@ -17,9 +15,8 @@ import androidx.activity.result.ActivityResultLauncher;
|
|||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import com.muqingbfq.R;
|
||||
import com.muqingbfq.databinding.ActivityUserLogsBinding;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.EditViewDialog;
|
||||
import com.muqingbfq.mq.gj;
|
||||
|
@ -28,12 +25,20 @@ import com.muqingbfq.mq.wl;
|
|||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
public class user_logs extends AppCompatActivity {
|
||||
public static class USER {
|
||||
public String name, qianming;
|
||||
public Object picUrl;
|
||||
|
||||
public USER(String user, String qianming, Object picUrl) {
|
||||
this.name = user;
|
||||
this.qianming = qianming;
|
||||
this.picUrl = picUrl;
|
||||
}
|
||||
}
|
||||
EditText edituser, editpassword;
|
||||
Toolbar toolbar;
|
||||
public static String UUID;
|
||||
|
||||
ActivityResultLauncher<Intent> enroll =
|
||||
|
@ -50,29 +55,25 @@ public class user_logs extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
});
|
||||
@SuppressLint("HardwareIds")
|
||||
ActivityUserLogsBinding binding;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_user_logs);
|
||||
toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
binding = ActivityUserLogsBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
setSupportActionBar(binding.toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
||||
UUID = Settings.Secure.getString(getContentResolver(),
|
||||
Settings.Secure.ANDROID_ID);
|
||||
|
||||
edituser = findViewById(R.id.edit_user);
|
||||
editpassword = findViewById(R.id.edit_password);
|
||||
findViewById(R.id.login).setOnClickListener(view -> new CloudUser(edituser.getText().toString()
|
||||
, editpassword.getText().toString()));
|
||||
findViewById(R.id.enroll).setOnClickListener(view -> {
|
||||
// UUID = Settings.Secure.getString(getContentResolver(),
|
||||
// Settings.Secure.ANDROID_ID);
|
||||
binding.login.setOnClickListener(view -> new CloudUser());
|
||||
/* findViewById(R.id.enroll).setOnClickListener(view -> {
|
||||
Intent intent = new Intent(user_logs.this, enroll.class);
|
||||
intent.putExtra("user", edituser.getText().toString());
|
||||
intent.putExtra("appID", UUID);
|
||||
enroll.launch(intent);
|
||||
});
|
||||
});*/
|
||||
}
|
||||
//some statement
|
||||
|
||||
|
@ -100,22 +101,16 @@ public class user_logs extends AppCompatActivity {
|
|||
return bitmap;
|
||||
}
|
||||
|
||||
String isEmail="false";
|
||||
public String account, password;
|
||||
class CloudUser extends Thread {
|
||||
|
||||
public CloudUser(String account, String password) {
|
||||
public CloudUser() {
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||
View v = getWindow().peekDecorView();
|
||||
if (null != v) {
|
||||
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
||||
}
|
||||
user_logs.this.account = account;
|
||||
user_logs.this.password = password;
|
||||
Pattern pattern = Pattern.compile("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");
|
||||
if (pattern.matcher(account).matches()) {
|
||||
isEmail = "true";
|
||||
}
|
||||
user_logs.this.account = binding.editUser.getText().toString();
|
||||
user_logs.this.password = binding.editPassword.getText().toString();
|
||||
start();
|
||||
}
|
||||
|
||||
|
@ -123,89 +118,26 @@ public class user_logs extends AppCompatActivity {
|
|||
public void run() {
|
||||
super.run();
|
||||
try {
|
||||
String post = wl.post("/php/user.php?action=login",
|
||||
new String[]{
|
||||
"account", "passWord", "appID", "isEmail"
|
||||
},
|
||||
new String[]{
|
||||
account, password, UUID, isEmail
|
||||
});
|
||||
gj.sc(post);
|
||||
if (TextUtils.isEmpty(post)) {
|
||||
String hq = wl.hq("/login/cellphone?phone=" + account + "&password=" + password);
|
||||
if (TextUtils.isEmpty(hq)) {
|
||||
return;
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject(post);
|
||||
if (jsonObject.getInt("code") == 0) {
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
gj.sc(data);
|
||||
//用户token
|
||||
String token = data.getString("token");
|
||||
//用户名称account
|
||||
String account = data.getString("account");
|
||||
main.settoken(token, account);
|
||||
new user_message(account);
|
||||
JSONObject jsonObject = new JSONObject(hq);
|
||||
int code = jsonObject.getInt("code");
|
||||
if (code == 200) {
|
||||
JSONObject data = jsonObject.getJSONObject("profile");
|
||||
String nickname = data.getString("nickname");//用户名
|
||||
String avatarUrl = data.getString("avatarUrl");//用户头像
|
||||
String signature = data.getString("signature");//用户签名
|
||||
String cookie = jsonObject.getString("cookie");
|
||||
gj.xcts(user_logs.this, "登录成功");
|
||||
wl.setcookie(cookie);
|
||||
new user_message(nickname,signature,avatarUrl);
|
||||
user_logs.this.finish();
|
||||
} else if (code == 502) {
|
||||
gj.xcts(user_logs.this, jsonObject.getString("message"));
|
||||
} else {
|
||||
String message = jsonObject.getString("message");
|
||||
gj.xcts(user_logs.this, message);
|
||||
if (message.equals("请更改登录设备")) {
|
||||
JSONObject jsonpost = wl.jsonpost("/php/user.php?action=verification",
|
||||
new String[]{
|
||||
"account", "passWord", "appID", "isEmail"
|
||||
},
|
||||
new String[]{
|
||||
account, password, UUID, isEmail
|
||||
});
|
||||
gj.sc(jsonpost);
|
||||
if (!TextUtils.isEmpty(jsonpost.toString()) &&
|
||||
jsonpost.getInt("code") != 0) {
|
||||
return;
|
||||
}
|
||||
String message1 = jsonpost.getString("message");
|
||||
gj.xcts(user_logs.this, message1);
|
||||
main.handler.post(() -> {
|
||||
EditViewDialog editViewDialog = new EditViewDialog(user_logs.this,
|
||||
"请输入验证码");
|
||||
editViewDialog.setMessage("验证码在你账号锁绑定的邮箱绘制垃圾桶中请及时查看");
|
||||
editViewDialog.setPositive(view -> {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
JSONObject jsonpost = wl.jsonpost("/php/user.php?action=changeAppId",
|
||||
new String[]{
|
||||
"account", "key", "appID", "isEmail"
|
||||
},
|
||||
new String[]{
|
||||
account, editViewDialog.getEditText(), UUID, isEmail
|
||||
});
|
||||
|
||||
gj.sc(jsonpost.toString());
|
||||
if (!TextUtils.isEmpty(jsonpost.toString())) {
|
||||
try {
|
||||
int code = jsonpost.getInt("code");
|
||||
if (code == 0) {
|
||||
gj.xcts(user_logs.this,
|
||||
"验证成功请重新登录");
|
||||
editViewDialog.dismiss();
|
||||
} else {
|
||||
gj.xcts(user_logs.this,
|
||||
jsonpost.getString("message"));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
editViewDialog.dismiss();
|
||||
gj.sc(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
// editViewDialog.dismiss();
|
||||
});
|
||||
editViewDialog.setEditinputType("number");
|
||||
editViewDialog.show();
|
||||
});
|
||||
} else if (message.equals("请先激活您的账户")) {
|
||||
jihuo();
|
||||
}
|
||||
gj.xcts(user_logs.this, "找不到此账号");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
gj.sc(e);
|
||||
|
@ -213,7 +145,8 @@ public class user_logs extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
public void jihuo() {
|
||||
@Deprecated
|
||||
private void jihuo() {
|
||||
main.handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -1,28 +1,26 @@
|
|||
package com.muqingbfq.login;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.muqingbfq.R;
|
||||
import com.muqingbfq.main;
|
||||
import com.muqingbfq.mq.gj;
|
||||
import com.muqingbfq.mq.wl;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import com.muqingbfq.mq.wj;
|
||||
|
||||
public class user_message extends Thread {
|
||||
public user_message(String account) {
|
||||
main.account = account;
|
||||
main.token = main.getToken();
|
||||
public String name,qiangming, picurl;
|
||||
|
||||
public user_message() {
|
||||
wj.sc(wj.filesdri + "user.mq");
|
||||
}
|
||||
public user_message(String nickname, String signature, String avatarUrl) {
|
||||
name = nickname;
|
||||
qiangming = signature;
|
||||
picurl = avatarUrl;
|
||||
String s = new Gson().toJson(new user_logs.USER(name, qiangming, picurl));
|
||||
wj.xrwb(wj.filesdri + "user.mq", s);
|
||||
start();
|
||||
}
|
||||
|
||||
public user_message() {
|
||||
main.account = main.getAccount();
|
||||
main.token = main.getToken();
|
||||
if (!TextUtils.isEmpty(main.account)) {
|
||||
start();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
|
@ -32,10 +30,10 @@ public class user_message extends Thread {
|
|||
com.muqingbfq.fragment.
|
||||
wode.setname(strings.userName());
|
||||
com.muqingbfq.fragment.
|
||||
wode.setqianming(strings.introduce());
|
||||
wode.setqianming(strings.qianming());
|
||||
com.bumptech.glide.Glide.with(com.muqingbfq.fragment.
|
||||
wode.imageView)
|
||||
.load(strings.headIcon())
|
||||
.load(strings.picurl())
|
||||
.placeholder(R.drawable.icon)//图片加载出来前,显示的图片
|
||||
.error(R.drawable.icon)//图片加载失败后,显示的图片
|
||||
.into(com.muqingbfq.fragment.
|
||||
|
@ -46,8 +44,8 @@ public class user_message extends Thread {
|
|||
}
|
||||
}
|
||||
|
||||
public static string get() throws Exception {
|
||||
JSONObject post = wl.jsonpost("/php/user.php?action=getSpaceInfo",
|
||||
public string get() throws Exception {
|
||||
/* JSONObject post = wl.jsonpost("/php/user.php?action=getSpaceInfo",
|
||||
new String[]{
|
||||
"account"
|
||||
},
|
||||
|
@ -69,13 +67,11 @@ public class user_message extends Thread {
|
|||
if (cover.startsWith("..")) {
|
||||
cover = "https://rust.coldmint.top" + cover.substring(2);
|
||||
}
|
||||
String gender = data.getString("gender");
|
||||
String gender = data.getString("gender");*/
|
||||
return new string(new String[]{
|
||||
headIcon, account, userName, introduce, cover, gender
|
||||
name, qiangming, picurl
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static class string {
|
||||
private final String[] strings;
|
||||
|
@ -83,27 +79,16 @@ public class user_message extends Thread {
|
|||
this.strings = strings;
|
||||
}
|
||||
|
||||
public String headIcon() {
|
||||
return strings[0];
|
||||
public String picurl() {
|
||||
return strings[2];
|
||||
}
|
||||
|
||||
public String account() {
|
||||
public String qianming() {
|
||||
return strings[1];
|
||||
}
|
||||
|
||||
public String userName() {
|
||||
return strings[2];
|
||||
}
|
||||
|
||||
public String introduce() {
|
||||
return strings[3];
|
||||
}
|
||||
|
||||
public String cover() {
|
||||
return strings[4];
|
||||
}
|
||||
public String gender() {
|
||||
return strings[5];
|
||||
return strings[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,25 +156,4 @@ public class main extends Application {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static SharedPreferences getSharedPreferences(String string) {
|
||||
return application.getSharedPreferences(string, MODE_PRIVATE);
|
||||
}
|
||||
|
||||
public static String getToken() {
|
||||
SharedPreferences token1 = getSharedPreferences("token");
|
||||
return token1.getString("token", null);
|
||||
}
|
||||
public static String getAccount() {
|
||||
SharedPreferences token1 = getSharedPreferences("token");
|
||||
return token1.getString("account", null);
|
||||
}
|
||||
|
||||
public static void settoken(String token, String account) {
|
||||
SharedPreferences token1 = getSharedPreferences("token");
|
||||
SharedPreferences.Editor edit1 = token1.edit();
|
||||
edit1.putString("token", token);
|
||||
edit1.putString("account", account);
|
||||
edit1.apply();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
android:layout_marginEnd="16dp">
|
||||
<EditText
|
||||
android:id="@+id/edit_user"
|
||||
android:hint="铁锈助手账号"
|
||||
android:hint="网易云音乐账号/手机号"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textEmailAddress"
|
||||
|
@ -86,18 +86,10 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/login"
|
||||
tools:ignore="ButtonStyle,DuplicateSpeakableTextCheck" />
|
||||
<Button
|
||||
android:id="@+id/enroll"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/enroll"
|
||||
tools:ignore="ButtonStyle" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user