From a5d00632ca329a437853f447a43c9ecb38c9a6e6 Mon Sep 17 00:00:00 2001
From: MUQING <1966944300@qq.com>
Date: Fri, 24 Nov 2023 17:40:26 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E6=92=AD=E6=94=BE?=
=?UTF-8?q?=E5=99=A8=E6=97=A0=E6=92=AD=E6=94=BE=E5=88=97=E8=A1=A8=E9=97=AA?=
=?UTF-8?q?=E9=80=80=20=E9=9F=B3=E4=B9=90=E6=90=9C=E7=B4=A2=EF=BC=8C=20?=
=?UTF-8?q?=E6=AD=8C=E8=AF=8DUI=E6=98=BE=E7=A4=BA=EF=BC=8C=20=E4=B8=BB?=
=?UTF-8?q?=E9=A1=B5=E6=8A=A5=E9=94=99=EF=BC=8C=20=E4=BC=98=E5=8C=96?=
=?UTF-8?q?=E4=BA=86=E4=B8=80=E4=BA=9B=E4=BD=93=E9=AA=8C=E4=B8=8A=E9=9D=A2?=
=?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD=EF=BC=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/inspectionProfiles/Project_Default.xml | 51 ++++
.idea/misc.xml | 8 +
app/build.gradle | 2 +-
app/src/main/AndroidManifest.xml | 17 +-
.../main/java/com/muqingbfq/MediaPlayer.java | 2 +-
app/src/main/java/com/muqingbfq/bfq.java | 15 +-
app/src/main/java/com/muqingbfq/bfqkz.java | 28 ++-
.../java/com/muqingbfq/fragment/search.java | 2 +-
.../main/java/com/muqingbfq/fragment/sz.java | 89 +------
app/src/main/java/com/muqingbfq/home.java | 119 ++++-----
.../main/java/com/muqingbfq/login/cookie.java | 109 +++++++++
.../main/java/com/muqingbfq/login/enroll.java | 2 +-
.../com/muqingbfq/login/user_editing.java | 229 ++++++++++++++++++
.../java/com/muqingbfq/login/user_logs.java | 217 ++++++++---------
.../com/muqingbfq/login/user_message.java | 107 +++++---
app/src/main/java/com/muqingbfq/main.java | 30 ++-
.../com/muqingbfq/mq/ActivityToolbar.java | 16 ++
app/src/main/java/com/muqingbfq/mq/wl.java | 39 ++-
app/src/main/java/com/muqingbfq/sz.java | 16 +-
app/src/main/java/com/muqingbfq/yc.java | 3 +-
app/src/main/res/layout/activity_cookie.xml | 96 ++++++++
app/src/main/res/layout/activity_enroll.xml | 12 +-
app/src/main/res/layout/activity_sz.xml | 1 -
.../main/res/layout/activity_user_editing.xml | 135 +++++++++++
.../main/res/layout/activity_user_logs.xml | 44 +++-
app/src/main/res/layout/erweima.xml | 19 --
app/src/main/res/layout/fragment_bfq.xml | 5 +-
app/src/main/res/layout/fragment_sz.xml | 6 +-
app/src/main/res/layout/list_text.xml | 14 +-
app/src/main/res/menu/sz.xml | 22 +-
app/src/main/res/values/strings.xml | 5 +-
31 files changed, 1023 insertions(+), 437 deletions(-)
create mode 100644 app/src/main/java/com/muqingbfq/login/cookie.java
create mode 100644 app/src/main/java/com/muqingbfq/login/user_editing.java
create mode 100644 app/src/main/java/com/muqingbfq/mq/ActivityToolbar.java
create mode 100644 app/src/main/res/layout/activity_cookie.xml
create mode 100644 app/src/main/res/layout/activity_user_editing.xml
delete mode 100644 app/src/main/res/layout/erweima.xml
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 32f0450..49ca6d0 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -3,21 +3,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index adb8ae0..c86b41f 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,12 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index ccddee9..a12f6c7 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -18,7 +18,7 @@ android {
//noinspection OldTargetApi
targetSdk 31
versionCode 1
- versionName "1.6.6"
+ versionName "1.6.7"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index acaae7a..ee083c8 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,14 +3,14 @@
xmlns:tools="http://schemas.android.com/tools">
-
-
+
+
-
+
@@ -36,7 +36,8 @@
android:supportsRtl="true"
android:theme="@style/Theme.云音乐"
android:usesCleartextTraffic="true"
- tools:targetApi="31">
+ android:requestLegacyExternalStorage="true"
+ tools:targetApi="s">
+
+
-
-
+
() {
diff --git a/app/src/main/java/com/muqingbfq/bfq.java b/app/src/main/java/com/muqingbfq/bfq.java
index f69cb2e..10720ec 100644
--- a/app/src/main/java/com/muqingbfq/bfq.java
+++ b/app/src/main/java/com/muqingbfq/bfq.java
@@ -1,5 +1,6 @@
package com.muqingbfq;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
@@ -9,14 +10,13 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
-import com.muqingbfq.fragment.Media;
-
public class bfq extends AppCompatActivity {
- public static AppCompatActivity context;
+ @SuppressLint("StaticFieldLeak")
+ public static Context context;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- context = this;
+ context = this.getApplicationContext();
setContentView(R.layout.activity_bfq);
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setNavigationIcon(R.drawable.end);
@@ -41,11 +41,4 @@ public class bfq extends AppCompatActivity {
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(intent);
}
-
- public static boolean getVisibility() {
- if (Media.view == null) {
- return false;
- }
- return Media.view.isShown();
- }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/muqingbfq/bfqkz.java b/app/src/main/java/com/muqingbfq/bfqkz.java
index a9fe28f..4951c01 100644
--- a/app/src/main/java/com/muqingbfq/bfqkz.java
+++ b/app/src/main/java/com/muqingbfq/bfqkz.java
@@ -1,15 +1,16 @@
package com.muqingbfq;
import android.annotation.SuppressLint;
-import android.os.Bundle;
-import android.support.v4.media.MediaBrowserCompat;
+import android.app.Service;
+import android.content.Intent;
+import android.os.Binder;
+import android.os.IBinder;
import android.support.v4.media.MediaMetadataCompat;
import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.media.session.PlaybackStateCompat;
+import android.text.TextUtils;
-import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.media.MediaBrowserServiceCompat;
import com.muqingbfq.api.url;
import com.muqingbfq.mq.BluetoothMusicController;
@@ -19,7 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
-public class bfqkz extends MediaBrowserServiceCompat {
+public class bfqkz extends Service {
public static com.muqingbfq.MediaPlayer mt;
public static List list = new ArrayList<>();
public static int ms;
@@ -45,10 +46,11 @@ public class bfqkz extends MediaBrowserServiceCompat {
@SuppressLint("NotifyDataSetChanged")
public static void mp3(String id) {
try {
- if (id == null) {
+ if (TextUtils.isEmpty(id)) {
return;
}
- if (xm.picurl == null || xm.picurl.equals("")) {
+ gj.sc(xm.picurl);
+ if (TextUtils.isEmpty(xm.picurl.toString())) {
xm.picurl = url.picurl(xm.id);
}
mt.setDataSource(id);
@@ -103,20 +105,20 @@ public class bfqkz extends MediaBrowserServiceCompat {
mSession.setMetadata(build);
mSession.setPlaybackState(playback);
mSession.setActive(true);
- setSessionToken(mSession.getSessionToken());
+// setSessionToken(mSession.getSessionToken());
notify = new com.muqingbfq.mq.NotificationManagerCompat(this);
}
@Nullable
@Override
- public BrowserRoot onGetRoot(@NonNull String clientPackageName, int clientUid, @Nullable Bundle rootHints) {
+ public IBinder onBind(Intent intent) {
return null;
}
-
- @Override
- public void onLoadChildren(@NonNull String parentId, @NonNull Result> result) {
-
+ public class MyBinder extends Binder {
+ bfqkz getService() {
+ return bfqkz.this;
+ }
}
public static void updateNotification() {
diff --git a/app/src/main/java/com/muqingbfq/fragment/search.java b/app/src/main/java/com/muqingbfq/fragment/search.java
index f771007..edbd862 100644
--- a/app/src/main/java/com/muqingbfq/fragment/search.java
+++ b/app/src/main/java/com/muqingbfq/fragment/search.java
@@ -104,7 +104,7 @@ public class search extends Fragment {
zz.append("/").append(name_zz);
}
}
- list.add(new xm(id, name, zz.toString(), null));
+ list.add(new xm(id, name, zz.toString(), ""));
}
main.handler.post(() -> lbspq.notifyDataSetChanged());
} catch (Exception e) {
diff --git a/app/src/main/java/com/muqingbfq/fragment/sz.java b/app/src/main/java/com/muqingbfq/fragment/sz.java
index 4ad6850..e1a47bc 100644
--- a/app/src/main/java/com/muqingbfq/fragment/sz.java
+++ b/app/src/main/java/com/muqingbfq/fragment/sz.java
@@ -2,28 +2,20 @@ package com.muqingbfq.fragment;
import android.annotation.SuppressLint;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
-import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.muqingbfq.R;
import com.muqingbfq.activity_about_software;
-import com.muqingbfq.home;
+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.mq.wl;
-
-import org.json.JSONException;
-import org.json.JSONObject;
public class sz {
@SuppressLint("StaticFieldLeak")
@@ -39,78 +31,12 @@ public class sz {
imageView = view.findViewById(R.id.image);
view.findViewById(R.id.xdbj).
setOnClickListener(v -> {
- if (!wj.cz(wj.filesdri + "user")) {
+ if (main.getToken() == null) {
context.startActivity(new Intent(context, user_logs.class));
+ } else {
+ context.startActivity(new Intent(context, user_editing.class));
}
});
- name.setOnClickListener(vw -> {
- if (main.user == null) {
- context.startActivity(new Intent(context, user_logs.class));
- return;
- }
- EditViewDialog dialog = new EditViewDialog(vw.getContext(), "修改名称");
- dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- EditText viewById = dialog.getEditText();
- String s = viewById.getText().toString();
- new Thread() {
- @Override
- public void run() {
- super.run();
- String s1 = wl.get(main.http + "/setname?user=" + main.user + "&name=" + s);
- try {
- JSONObject jsonObject = new JSONObject(s1);
- if (jsonObject.getInt("code") == 200) {
- setname(s);
- }
- gj.xcts(home.appCompatActivity, jsonObject.getString("msg"));
- } catch (JSONException e) {
- throw new RuntimeException(e);
- }
- }
- }.start();
- }
- });
- dialog.show();
- });
- jieshao.setOnClickListener(vw -> {
- if (main.user == null) {
- context.startActivity(new Intent(context, user_logs.class));
- return;
- }
- EditViewDialog dialog = new EditViewDialog(vw.getContext(), "修改签名");
- dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- EditText viewById = dialog.getEditText();
- String s = viewById.getText().toString();
- new Thread() {
- @Override
- public void run() {
- super.run();
- String s1 = wl.get(main.http + "/setqianming?user=" + main.user + "&qianming=" + s);
- try {
- JSONObject jsonObject = new JSONObject(s1);
- if (jsonObject.getInt("code") == 200) {
- setqianming(s);
- }
- gj.xcts(home.appCompatActivity, jsonObject.getString("msg"));
- } catch (JSONException e) {
- throw new RuntimeException(e);
- }
- }
- }.start();
- }
- });
- dialog.show();
- });
- imageView.setOnClickListener(vw -> {
- if (main.user == null) {
- context.startActivity(new Intent(context, user_logs.class));
- return;
- }
- });
new user_message();
}
@@ -126,10 +52,12 @@ public class sz {
}
});
}
-
+ @SuppressLint("NonConstantResourceId")
public static void switch_sz(Context context, int id) {
if (id == R.id.a) {
gj.llq(context, "https://rust.coldmint.top/ftp/muqing/");
+ } else if (id == R.id.cookie) {
+
} else if (id == R.id.b) {
context.startActivity(new Intent(context, com.muqingbfq.sz.class));
// 设置中心
@@ -160,9 +88,10 @@ public class sz {
context.startActivity(new Intent(context, activity_about_software.class));
// 关于软件
} else if (id == R.id.g) {
- wj.sc(wj.filesdri + "user");
+ main.settoken(null, null);
setname("未登录");
setqianming(null);
+ imageView.setImageResource(R.drawable.icon);
}
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/muqingbfq/home.java b/app/src/main/java/com/muqingbfq/home.java
index 5f4b06a..6fcc479 100644
--- a/app/src/main/java/com/muqingbfq/home.java
+++ b/app/src/main/java/com/muqingbfq/home.java
@@ -4,15 +4,13 @@ import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.ServiceConnection;
import android.content.SharedPreferences;
-import android.content.res.Configuration;
import android.os.Bundle;
-import android.support.v4.media.MediaBrowserCompat;
-import android.support.v4.media.session.MediaControllerCompat;
+import android.os.IBinder;
import android.view.Menu;
import android.view.MenuItem;
-import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
@@ -23,11 +21,25 @@ import com.muqingbfq.fragment.Media;
import com.muqingbfq.fragment.bfq_db;
import com.muqingbfq.mq.gj;
-import java.util.List;
+public class home extends AppCompatActivity {
+ private final ServiceConnection serviceConnection=new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
+ bfqkz.MyBinder binder = (bfqkz.MyBinder) iBinder;
+ bfqkz service = binder.getService();
+ // 与Service建立连接后,可以通过myService调用Service中的方法
+ isBound = true;
+ }
-public class home extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
+ @Override
+ public void onServiceDisconnected(ComponentName componentName) {
+ isBound = false;
+ //断开连接
+ }
+ };
+ private boolean isBound = false;
@SuppressLint("StaticFieldLeak")
- public static Context appCompatActivity;
+ public static AppCompatActivity appCompatActivity;
@SuppressLint({"CommitTransaction", "ObsoleteSdkInt"})
@Override
@@ -35,6 +47,7 @@ public class home extends AppCompatActivity implements NavigationView.OnNavigati
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
appCompatActivity = this;
+ Media.view = null;
try {
//初始化工具栏
Toolbar toolbar = findViewById(R.id.toolbar);
@@ -46,15 +59,17 @@ public class home extends AppCompatActivity implements NavigationView.OnNavigati
toggle.syncState();
//初始化侧滑
NavigationView chb = findViewById(R.id.chb);
- chb.setNavigationItemSelectedListener(this);
+ chb.setNavigationItemSelectedListener(item -> {
+ com.muqingbfq.fragment.sz.switch_sz(home.this, item.getItemId());
+ return false;
+ });
new com.muqingbfq.fragment.sz(this, chb.getHeaderView(0));
//初始化播放器组件
- if (mediaBrowser == null) {
- mediaBrowser = new MediaBrowserCompat(this,
- new ComponentName(this, bfqkz.class),
- connectionCallbacks,
- null);
- mediaBrowser.connect();
+ // 启动Service
+ if (serviceIntent == null) {
+ serviceIntent = new Intent(this, bfqkz.class);
+// startService(serviceIntent);
+ bindService(serviceIntent,serviceConnection, Context.BIND_AUTO_CREATE);
}
//检测更新
new gj.jianchagengxin(this);
@@ -62,56 +77,7 @@ public class home extends AppCompatActivity implements NavigationView.OnNavigati
yc.tc(this, e);
}
}
-
- public static MediaBrowserCompat mediaBrowser;
- private MediaBrowserCompat.ConnectionCallback connectionCallbacks =
- new MediaBrowserCompat.ConnectionCallback() {
- @Override
- public void onConnected() {
- // 已连接到服务,可以开始浏览媒体内容
- // 订阅媒体内容
- mediaBrowser.subscribe("mediaId", subscriptionCallback);
- // 请求当前播放状态
- MediaControllerCompat mediaController = new MediaControllerCompat(home.this, mediaBrowser.getSessionToken());
- MediaControllerCompat.TransportControls transportControls = mediaController.getTransportControls();
- // 执行媒体控制操作
- transportControls.play();
- }
-
- @Override
- public void onConnectionSuspended() {
- // 与服务的连接暂停或断开
- // 取消订阅媒体内容
- mediaBrowser.unsubscribe("mediaId", subscriptionCallback);
- // 清除播放状态
- MediaControllerCompat mediaController = new MediaControllerCompat(home.this, mediaBrowser.getSessionToken());
- MediaControllerCompat.TransportControls transportControls = mediaController.getTransportControls();
- // 执行媒体控制操作
- transportControls.stop();
- }
-
- @Override
- public void onConnectionFailed() {
- // 与服务的连接失败
- // 尝试重新连接服务或显示错误信息等
- }
- };
- private MediaBrowserCompat.SubscriptionCallback subscriptionCallback =
- new MediaBrowserCompat.SubscriptionCallback() {
- @Override
- public void onChildrenLoaded(@NonNull String parentId, @NonNull List children) {
- // 媒体内容加载完成
- // 处理每个媒体项
- // ...
- }
-
- @Override
- public void onError(@NonNull String parentId) {
- // 媒体内容加载失败
- // 处理加载失败的情况
- }
- };
-
+ private static Intent serviceIntent;
@Override
protected void onPause() {
super.onPause();
@@ -131,9 +97,18 @@ public class home extends AppCompatActivity implements NavigationView.OnNavigati
.add(R.id.bfq_db, new bfq_db()).commit();
}
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ //销毁之前 finish();
+ // 解绑Service
+ if (isBound) {
+ unbindService(serviceConnection);
+ isBound = false;
+ }
+ }
+
private long time;
- @SuppressLint("StaticFieldLeak")
- public static com.muqingbfq.fragment.bfq_db bfq_db = new bfq_db();
@Override
public void onBackPressed() {
if (bfqkz.mt.isPlaying()) {
@@ -149,11 +124,13 @@ public class home extends AppCompatActivity implements NavigationView.OnNavigati
}
}
}
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.home, menu);
return super.onCreateOptionsMenu(menu);
}
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_search) {
@@ -162,14 +139,4 @@ public class home extends AppCompatActivity implements NavigationView.OnNavigati
}
return super.onOptionsItemSelected(item);
}
- @Override
- public boolean onNavigationItemSelected(@NonNull MenuItem item) {
- com.muqingbfq.fragment.sz.switch_sz(this, item.getItemId());
- return false;
- }
- @Override
- public void onConfigurationChanged(@NonNull Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- Media.view = null;
- }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/muqingbfq/login/cookie.java b/app/src/main/java/com/muqingbfq/login/cookie.java
new file mode 100644
index 0000000..ef4ddf0
--- /dev/null
+++ b/app/src/main/java/com/muqingbfq/login/cookie.java
@@ -0,0 +1,109 @@
+package com.muqingbfq.login;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.muqingbfq.R;
+import com.muqingbfq.main;
+import com.muqingbfq.mq.ActivityToolbar;
+import com.muqingbfq.mq.gj;
+import com.muqingbfq.mq.wl;
+
+import org.json.JSONObject;
+
+import java.util.Objects;
+
+public class cookie extends ActivityToolbar {
+
+ View view_a, view_b;
+ TextView textView;
+ ImageView imageView;
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_cookie);
+ view_a = findViewById(R.id.view1);
+ view_b = findViewById(R.id.view2);
+ view_a.setVisibility(View.GONE);
+
+ //view2 里面的控件
+ textView = findViewById(R.id.textView);
+ imageView = findViewById(R.id.imageView);
+ new erweima();
+ }
+
+ class erweima extends Thread {
+ int code = 800;
+ String unikey, qrimg, hq;
+ private long time = 0;
+ public erweima() {
+ textView.setText("请使用网易云音乐扫码");
+ start();
+ }
+ @Override
+ public void run() {
+ super.run();
+ while (code != 0) {
+ try {
+ hq = wl.hq("/login/qr/check?key=" + unikey + Time());
+ if (hq != null) {
+ JSONObject json = new JSONObject(hq);
+ code = json.getInt("code");
+ switch (code) {
+ case 800:
+ case 400:
+ setwb("二维码过期");
+ hqkey();
+ break;
+ case 801:
+ setwb("等待扫码");
+ break;
+ case 802:
+ setwb("等待确认");
+ break;
+ case 803:
+ setwb("登录成功");
+ wl.setcookie(json.getString("cookie"));
+ code = 0;
+ cookie.this.finish();
+ break;
+ default:
+ code = 0;
+ // 默认情况下的操作
+ break;
+ }
+ }
+ sleep(1000);
+ } catch (Exception e) {
+ gj.sc(e);
+ }
+ }
+ }
+
+ private void hqkey() throws Exception {
+ unikey = new JSONObject(Objects.requireNonNull(wl.hq("/login/qr/key"))).
+ getJSONObject("data").getString("unikey");
+ JSONObject jsonObject = new JSONObject(Objects.requireNonNull(wl.hq("/login/qr/create?key=" +
+ unikey +
+ "&qrimg=base64")));
+ qrimg = jsonObject.getJSONObject("data").getString("qrimg");
+ main.handler.post(() -> imageView.setImageBitmap(user_logs.stringToBitmap(qrimg)));
+ }
+
+ private String Time() {
+ if (time < System.currentTimeMillis() - 1000) {
+ time = System.currentTimeMillis();
+ }
+ return "×tamp" + time;
+ }
+ private void setwb(String wb) {
+ main.handler.post(() -> textView.setText(wb));
+ }
+ }
+
+
+}
diff --git a/app/src/main/java/com/muqingbfq/login/enroll.java b/app/src/main/java/com/muqingbfq/login/enroll.java
index 10e5234..66c4e29 100644
--- a/app/src/main/java/com/muqingbfq/login/enroll.java
+++ b/app/src/main/java/com/muqingbfq/login/enroll.java
@@ -34,7 +34,7 @@ public class enroll extends AppCompatActivity {
//设置密码编辑框
edpassword = findViewById(R.id.edit_password);
- findViewById(R.id.edit_cookie).setOnClickListener(view -> new user_logs.erweima(view.getContext()));
+// findViewById(R.id.edit_cookie).setOnClickListener(view -> new user_logs.erweima(view.getContext()));
findViewById(R.id.enroll).setOnClickListener(view -> a());
}
diff --git a/app/src/main/java/com/muqingbfq/login/user_editing.java b/app/src/main/java/com/muqingbfq/login/user_editing.java
new file mode 100644
index 0000000..d454145
--- /dev/null
+++ b/app/src/main/java/com/muqingbfq/login/user_editing.java
@@ -0,0 +1,229 @@
+package com.muqingbfq.login;
+
+import android.Manifest;
+import android.annotation.SuppressLint;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.MediaStore;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.AutoCompleteTextView;
+import android.widget.EditText;
+import android.widget.ImageView;
+
+import androidx.activity.result.ActivityResultLauncher;
+import androidx.activity.result.contract.ActivityResultContracts;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.core.app.ActivityCompat;
+import androidx.core.content.ContextCompat;
+
+import com.bumptech.glide.Glide;
+import com.muqingbfq.R;
+import com.muqingbfq.main;
+import com.muqingbfq.mq.ActivityToolbar;
+import com.muqingbfq.mq.gj;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.File;
+import java.io.IOException;
+
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+
+public class user_editing extends ActivityToolbar {
+ //头像,用户名,签名,性别,背景
+ ImageView imageViewa;
+ EditText edit_name, edit_qianming;
+ AutoCompleteTextView autoCompleteTextView;
+ ImageView imageViewb;
+ String file_a, file_b;
+ @SuppressLint("CheckResult")
+ ActivityResultLauncher setimagea =
+ registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
+ result -> {
+ if (result.getResultCode() == RESULT_OK) {
+ Intent data = result.getData();
+ if (data != null) {
+ Uri uri = data.getData();
+ file_a = getImagePath(uri);
+ Glide.with(user_editing.this)
+ .load(file_a)
+ .error(R.drawable.icon)
+ .into(imageViewa);
+ // 处理选择的图片
+ }
+
+ }
+ }), setimageb =
+ registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
+ result -> {
+ if (result.getResultCode() == RESULT_OK) {
+ Intent data = result.getData();
+ if (data != null) {
+ Uri imageUri = data.getData();
+ file_b = getImagePath(imageUri);
+ Glide.with(user_editing.this)
+ .load(file_b)
+ .error(R.drawable.icon)
+ .into(imageViewb);
+ // 处理选择的图片
+ }
+ }
+ });
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_user_editing);
+ setSupportActionBar(findViewById(R.id.toolbar));
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ imageViewa = findViewById(R.id.image1);
+ edit_name = findViewById(R.id.edit_name);
+ edit_qianming = findViewById(R.id.edit_qianming);
+ autoCompleteTextView = findViewById(R.id.autoComplete);
+ imageViewb = findViewById(R.id.image2);
+ new Thread() {
+ @Override
+ public void run() {
+ super.run();
+ try {
+ user_message.string string = user_message.get();
+ if (string == null) {
+ return;
+ }
+ main.handler.post(() -> {
+ Glide.with(user_editing.this)
+ .load(string.headIcon())
+ .into(imageViewa);
+ edit_name.setText(string.userName());
+ edit_qianming.setText(string.introduce());
+ Glide.with(user_editing.this)
+ .load(string.cover())
+ .into(imageViewb);
+ });
+ } catch (Exception e) {
+ gj.sc(e);
+ }
+ }
+ }.start();
+
+ View.OnClickListener onClickListener = view -> {
+ Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+ intent.setType("image/*");
+ intent.putExtra(Intent.EXTRA_MIME_TYPES, new String[]{"image/jpeg", "image/png", "image/jpg", "image/gif"}); // 指定可选的文件类型
+ intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); // 仅显示本地存储的文件
+ // 检查权限
+ if (ContextCompat.checkSelfPermission(user_editing.this,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
+ // 如果没有写入存储的权限,则请求权限
+ ActivityCompat.requestPermissions(user_editing.this,
+ new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
+ 1);
+ } else {
+ if (view.getId() == R.id.image1) {
+ setimagea.launch(new Intent(Intent.ACTION_PICK,
+ MediaStore.Images.Media.EXTERNAL_CONTENT_URI));
+ } else if (view.getId() == R.id.image2) {
+ setimageb.launch(new Intent(Intent.ACTION_PICK,
+ MediaStore.Images.Media.EXTERNAL_CONTENT_URI));
+ }
+ }
+ };
+ imageViewa.setOnClickListener(onClickListener);
+ imageViewb.setOnClickListener(onClickListener);
+ findViewById(R.id.button2).setOnClickListener(view -> startActivity(new Intent(user_editing.this, cookie.class)));
+ findViewById(R.id.button1).setOnClickListener(view -> {
+ // 创建OkHttpClient实例
+ OkHttpClient client = new OkHttpClient();
+
+// 创建MultipartBody.Builder来构建请求体
+ MultipartBody.Builder builder = new MultipartBody.Builder()
+ .setType(MultipartBody.FORM);
+ if (file_a != null) {
+ File file = new File(file_a);
+ RequestBody requestBody = RequestBody.create(file, MediaType.parse("image/*"));
+ builder.addFormDataPart("icon", file.getName(), requestBody);
+ }
+ if (file_b != null) {
+ File file = new File(file_b);
+ RequestBody requestBody = RequestBody.create(file, MediaType.parse("image/*"));
+ builder.addFormDataPart("cover", file.getName(), requestBody);
+ }
+ builder.addFormDataPart("token", main.token)
+ .addFormDataPart("userName", edit_name.getText().toString())
+ .addFormDataPart("introduce", edit_qianming.getText().toString())
+ .addFormDataPart("gender", "1")
+ .addFormDataPart("dynamicColor", "");
+// 构建请求体
+ Request request = new Request.Builder()
+ .url("https://rust.coldmint.top/php/user.php?action=updateSpaceInfo")
+ .post(builder.build())
+ .build();
+// 发起请求
+ client.newCall(request).enqueue(new Callback() {
+ @Override
+ public void onFailure(@NonNull Call call, @NonNull IOException e) {
+ gj.sc(e);
+ // 请求失败处理
+ }
+
+ @Override
+ public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
+ // 请求成功处理
+ String responseData = response.body().string();
+ gj.sc(responseData);
+ if (TextUtils.isEmpty(responseData)) {
+ return;
+ }
+ try {
+ JSONObject jsonObject = new JSONObject(responseData);
+ int code = jsonObject.getInt("code");
+ if (code == 1) {
+ String data = jsonObject.getString("data");
+ switch (data) {
+ case "@event:用户名占用":
+ break;
+ case "introduce":
+ break;
+ }
+ } else if (code == 0) {
+ new user_message();
+ }
+ gj.xcts(user_editing.this, jsonObject.getString("message"));
+ } catch (JSONException e) {
+ gj.sc(e);
+ }
+ // 处理响应数据
+ }
+ });
+
+ });
+ }
+
+ // 获取图片的实际路径
+ private String getImagePath(Uri uri) {
+ String path = null;
+ String[] projection = {MediaStore.Images.Media.DATA};
+ Cursor cursor = getContentResolver().query(uri, projection, null, null, null);
+ if (cursor != null) {
+ int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
+ if (cursor.moveToFirst()) {
+ path = cursor.getString(columnIndex);
+ }
+ cursor.close();
+ }
+ return path;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/muqingbfq/login/user_logs.java b/app/src/main/java/com/muqingbfq/login/user_logs.java
index e28c8d5..5fde2ea 100644
--- a/app/src/main/java/com/muqingbfq/login/user_logs.java
+++ b/app/src/main/java/com/muqingbfq/login/user_logs.java
@@ -1,60 +1,60 @@
package com.muqingbfq.login;
+import android.annotation.SuppressLint;
import android.app.Activity;
-import android.content.Context;
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.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
-import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.muqingbfq.R;
import com.muqingbfq.main;
+import com.muqingbfq.mq.EditViewDialog;
import com.muqingbfq.mq.gj;
-import com.muqingbfq.mq.wj;
import com.muqingbfq.mq.wl;
-import com.muqingbfq.yc;
import org.json.JSONException;
import org.json.JSONObject;
-import java.io.File;
-import java.util.Objects;
-
public class user_logs extends AppCompatActivity {
EditText edituser, editpassword;
Toolbar toolbar;
+ public static String UUID;
+ @SuppressLint("HardwareIds")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_logs);
toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
- Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
+ 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 -> {
+/* findViewById(R.id.enroll).setOnClickListener(view -> {
Intent intent = new Intent(user_logs.this, enroll.class);
intent.putExtra("user", edituser.getText().toString());
startActivityForResult(intent, 0);
- });
+ });*/
}
@Override
@@ -94,16 +94,17 @@ public class user_logs extends AppCompatActivity {
return bitmap;
}
- class CloudUser extends Thread {
- String user, password;
- public CloudUser(String user, String password) {
+ class CloudUser extends Thread {
+ String account, password;
+
+ public CloudUser(String account, String password) {
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
View v = getWindow().peekDecorView();
if (null != v) {
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
- this.user = user;
+ this.account = account;
this.password = password;
start();
}
@@ -111,20 +112,86 @@ public class user_logs extends AppCompatActivity {
@Override
public void run() {
super.run();
- String s = wl.get(main.http + "/user.php?" + "user=" + user + "&password=" + password);
try {
- JSONObject jsonObject = new JSONObject(s);
- int code = jsonObject.getInt("code");
- String msg = jsonObject.getString("msg");
- main.handler.post(() -> gj.ts(user_logs.this, msg));
- if (code == 200) {
- String cookie = jsonObject.getString("cookie");
- if (wl.iskong()) {
- new visitor();
+ String post = wl.post("/php/user.php?action=login",
+ new String[]{
+ "account", "passWord", "appID", "isEmail"
+ },
+ new String[]{
+ account, password, UUID, ""
+ });
+ gj.sc(post);
+ if (!TextUtils.isEmpty(post)) {
+ 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);
+ user_logs.this.finish();
+ } 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, ""
+ });
+ 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, "false"
+ });
+ 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();
+ });
+ }
}
- wl.setcookie(cookie);
- new user_message(user);
- user_logs.this.finish();
}
} catch (Exception e) {
gj.sc(e);
@@ -132,94 +199,4 @@ public class user_logs extends AppCompatActivity {
}
}
- public static class erweima extends Thread {
- int code = 800;
- String unikey, qrimg, hq;
- private long time = 0;
- ImageView imageView;
- TextView textView;
- MaterialAlertDialogBuilder materialAlertDialogBuilder;
-
- public erweima(Context context) {
- View inflate = LayoutInflater.from(context).inflate(R.layout.erweima, null);
- imageView = inflate.findViewById(R.id.image);
- textView = inflate.findViewById(R.id.text);
-// 创建布局参数对象
- LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(main.g, main.k);
-// 设置视图的布局参数
- imageView.setLayoutParams(layoutParams);
- materialAlertDialogBuilder = new MaterialAlertDialogBuilder(context) {
- };
- materialAlertDialogBuilder.setOnDismissListener(dialog -> {
- // 对话框消失时触发的操作
- // 可以在这里处理一些额外的逻辑
- code = 0;
- });
- materialAlertDialogBuilder.setView(inflate).setTitle("请使用网易云音乐扫码");
- materialAlertDialogBuilder.show();
- start();
- }
-
- @Override
- public void run() {
- super.run();
- while (code != 0) {
- try {
- hq = wl.hq("/login/qr/check?key=" + unikey + Time());
- if (hq != null) {
- JSONObject json = new JSONObject(hq);
- code = json.getInt("code");
- switch (code) {
- case 800:
- case 400:
- setwb("二维码过期");
- hqkey();
- break;
- case 801:
- setwb("等待扫码");
- break;
- case 802:
- setwb("等待确认");
- break;
- case 803:
- setwb("登录成功");
- wl.setcookie(json.getString("cookie"));
- main.handler.postDelayed(() -> materialAlertDialogBuilder.create().cancel(),
- 500);
- code = 0;
- break;
- default:
- code = 0;
- // 默认情况下的操作
- break;
- }
- }
- sleep(1000);
- } catch (Exception e) {
- gj.sc(e);
- }
- }
- }
-
- private void hqkey() throws Exception {
- unikey = new JSONObject(Objects.requireNonNull(wl.hq("/login/qr/key"))).
- getJSONObject("data").getString("unikey");
- JSONObject jsonObject = new JSONObject(Objects.requireNonNull(wl.hq("/login/qr/create?key=" +
- unikey +
- "&qrimg=base64")));
- qrimg = jsonObject.getJSONObject("data").getString("qrimg");
- main.handler.post(() -> imageView.setImageBitmap(stringToBitmap(qrimg)));
- }
-
- private String Time() {
- if (time < System.currentTimeMillis() - 1000) {
- time = System.currentTimeMillis();
- }
- return "×tamp" + time;
- }
-
- private void setwb(String wb) {
- main.handler.post(() -> textView.setText(wb));
- }
- }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/muqingbfq/login/user_message.java b/app/src/main/java/com/muqingbfq/login/user_message.java
index a288f4e..7c3c7b0 100644
--- a/app/src/main/java/com/muqingbfq/login/user_message.java
+++ b/app/src/main/java/com/muqingbfq/login/user_message.java
@@ -2,54 +2,105 @@ package com.muqingbfq.login;
import android.text.TextUtils;
-import com.bumptech.glide.Glide;
import com.muqingbfq.R;
-import com.muqingbfq.fragment.sz;
import com.muqingbfq.main;
import com.muqingbfq.mq.gj;
-import com.muqingbfq.mq.wj;
import com.muqingbfq.mq.wl;
import org.json.JSONObject;
+
public class user_message extends Thread {
- public user_message(String user) {
- main.user = user;
+ public user_message(String account) {
+ main.account = account;
+ main.token = main.getToken();
start();
}
+
public user_message() {
- main.user=wj.dqwb(wj.filesdri + "user");
- start();
+ main.account = main.getAccount();
+ main.token = main.getToken();
+ if (!TextUtils.isEmpty(main.account)) {
+ start();
+ }
}
- String name = "未登录", signature = "游客模式";
@Override
public void run() {
super.run();
try {
- if (main.user != null) {
- String hq = wl.get(main.http + "/getid.php?" + "user=" + main.user);
- if (!TextUtils.isEmpty(hq)) {
- JSONObject json = new JSONObject(hq);
- if (json.getInt("code") == 200) {
- name = json.getString("name");
- signature = json.getString("qianming");
- json.put("name", name);
- json.put("qianming", signature);
- json.put("user", main.user);
- wj.xrwb(wj.filesdri + "user", main.user);
- }
- }
- }
- main.handler.post(() -> {
- sz.name.setText(name);
- sz.jieshao.setText(signature);
- Glide.with(sz.imageView)
- .load(main.http + "/picurl/" + main.user + ".jpg")
+ string strings = get();
+ main.handler.post(() -> {
+ com.muqingbfq.fragment.
+ sz.setname(strings.userName());
+ com.muqingbfq.fragment.
+ sz.setqianming(strings.introduce());
+ com.bumptech.glide.Glide.with(com.muqingbfq.fragment.
+ sz.imageView)
+ .load(strings.headIcon())
.placeholder(R.drawable.icon)//图片加载出来前,显示的图片
.error(R.drawable.icon)//图片加载失败后,显示的图片
- .into(sz.imageView);
+ .into(com.muqingbfq.fragment.
+ sz.imageView);
});
} catch (Exception e) {
gj.sc(e);
}
}
+
+ public static string get() throws Exception {
+ JSONObject post = wl.jsonpost("/php/user.php?action=getSpaceInfo",
+ new String[]{
+ "account"
+ },
+ new String[]{
+ main.account
+ });
+ gj.sc(post);
+ if (!TextUtils.isEmpty(post.toString()) &&
+ post.getInt("code") == 0) {
+ JSONObject data = post.getJSONObject("data");
+ String headIcon = data.getString("headIcon");//头像
+ String account = data.getString("account");//账号
+ String userName = data.getString("userName");//名称
+ String introduce = data.getString("introduce");//签名
+ String cover = data.getString("cover");//背景
+ if (headIcon.startsWith("..")) {
+ headIcon = "https://rust.coldmint.top" + headIcon.substring(2);
+ }
+ if (cover.startsWith("..")) {
+ cover = "https://rust.coldmint.top" + cover.substring(2);
+ }
+ return new string(new String[]{
+ headIcon, account, userName, introduce, cover
+ });
+ }
+ return null;
+ }
+
+ static class string {
+ private final String[] strings;
+ public string(String[] strings) {
+ this.strings = strings;
+ }
+
+ public String headIcon() {
+ return strings[0];
+ }
+
+ public String account() {
+ return strings[1];
+ }
+
+ public String userName() {
+ return strings[2];
+ }
+
+ public String introduce() {
+ return strings[3];
+ }
+
+ public String cover() {
+ return strings[4];
+ }
+
+ }
}
diff --git a/app/src/main/java/com/muqingbfq/main.java b/app/src/main/java/com/muqingbfq/main.java
index 14a180b..1c0f16d 100644
--- a/app/src/main/java/com/muqingbfq/main.java
+++ b/app/src/main/java/com/muqingbfq/main.java
@@ -2,7 +2,6 @@ package com.muqingbfq;
import android.annotation.SuppressLint;
import android.app.Application;
-import android.content.Context;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Looper;
@@ -11,6 +10,8 @@ import com.muqingbfq.mq.wj;
import com.muqingbfq.mq.wl;
public class main extends Application {
+ private static Application application;
+
public static Handler handler = new Handler(Looper.getMainLooper());
public static String api = "http://139.196.224.229:3000";
public static String http = "http://139.196.224.229/muqing";
@@ -19,11 +20,15 @@ public class main extends Application {
public static SharedPreferences.Editor edit;
public static String mp3 = "mp3", mp3_csh,
- Cookie = "Cookie", user;
+ Cookie = "Cookie";
+ public static String account,token;
+ @SuppressLint("HardwareIds")
@Override
public void onCreate() {
super.onCreate();
+ application = this;
+// UUID.randomUUID().toString();
new wj(this);
sp = getSharedPreferences("Set_up", MODE_PRIVATE);
edit = sp.edit();
@@ -53,4 +58,25 @@ public class main extends Application {
edit.commit();
}
}
+
+ 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();
+ }
}
diff --git a/app/src/main/java/com/muqingbfq/mq/ActivityToolbar.java b/app/src/main/java/com/muqingbfq/mq/ActivityToolbar.java
new file mode 100644
index 0000000..b34ee8e
--- /dev/null
+++ b/app/src/main/java/com/muqingbfq/mq/ActivityToolbar.java
@@ -0,0 +1,16 @@
+package com.muqingbfq.mq;
+
+import android.view.MenuItem;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+
+public class ActivityToolbar extends AppCompatActivity {
+ @Override
+ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ finish();
+ }
+ return super.onOptionsItemSelected(item);
+ }
+}
diff --git a/app/src/main/java/com/muqingbfq/mq/wl.java b/app/src/main/java/com/muqingbfq/mq/wl.java
index 8737859..f145f4f 100644
--- a/app/src/main/java/com/muqingbfq/mq/wl.java
+++ b/app/src/main/java/com/muqingbfq/mq/wl.java
@@ -5,13 +5,16 @@ import com.muqingbfq.main;
import com.muqingbfq.xm;
import org.json.JSONArray;
+import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import okhttp3.Call;
+import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
@@ -26,10 +29,6 @@ public class wl {
main.edit.commit();
}
- public static boolean iskong() {
- return Cookie.equals("");
- }
-
public static String hq(String url) {
try {
OkHttpClient client = new OkHttpClient();
@@ -46,6 +45,36 @@ public class wl {
return null;
}
+ public static String post(String str, String[] a,String[] b) {
+
+ OkHttpClient client = new OkHttpClient().newBuilder()
+ .build();
+ FormBody.Builder builder = new FormBody.Builder();
+ for (int i = 0; i < a.length; i++) {
+ builder.add(a[i], b[i]);
+ }
+ Request request = new Request.Builder()
+ .url("https://rust.coldmint.top" + str)
+ .post(builder.build())
+ .build();
+ try {
+ Response response = client.newCall(request).execute();
+ return response.body().string();
+ } catch (IOException e) {
+ gj.sc(e);
+ }
+ return null;
+ }
+
+ public static JSONObject jsonpost(String str, String[] a, String[] b){
+ try {
+ return new JSONObject(post(str, a, b));
+ } catch (JSONException e) {
+ gj.sc(e);
+ return null;
+ }
+ }
+
public static String get(String url) {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
@@ -113,10 +142,8 @@ public class wl {
if (songs.length() > 30) {
songs.remove(0);
String id = songs.getJSONObject(0).getString("id");
- gj.sc(wj.mp3 + id);
new File(wj.mp3+id).delete();
}
- File file = new File(wj.mp3);
JSONObject json = new JSONObject();
json.put("id", x.id);
json.put("name", x.name);
diff --git a/app/src/main/java/com/muqingbfq/sz.java b/app/src/main/java/com/muqingbfq/sz.java
index 9e782e1..4ab66b3 100644
--- a/app/src/main/java/com/muqingbfq/sz.java
+++ b/app/src/main/java/com/muqingbfq/sz.java
@@ -7,11 +7,7 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
-import android.view.LayoutInflater;
import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
@@ -28,15 +24,8 @@ public class sz extends AppCompatActivity {
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-// UI();
-// kaifazhe();
- }
-
- /**
- * 建立底部浮动栏的方法
- */
- public void CreateFloatView(){
- View mFloatView = LayoutInflater.from(getBaseContext()).inflate(R.layout.fragment_bfq_db,null);
+ UI();
+ kaifazhe();
}
@SuppressLint("ApplySharedPref")
@@ -104,6 +93,7 @@ public class sz extends AppCompatActivity {
}
});
}
+
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
diff --git a/app/src/main/java/com/muqingbfq/yc.java b/app/src/main/java/com/muqingbfq/yc.java
index 09813b4..f3ed8ac 100644
--- a/app/src/main/java/com/muqingbfq/yc.java
+++ b/app/src/main/java/com/muqingbfq/yc.java
@@ -27,7 +27,8 @@ public class yc extends AppCompatActivity {
String deviceManufacturer = Build.MANUFACTURER;
String osVersion = Build.VERSION.RELEASE;
int sdkVersion = Build.VERSION.SDK_INT;
- @SuppressLint("HardwareIds") String deviceId = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
+ @SuppressLint("HardwareIds") String deviceId = Settings.Secure.getString(getContentResolver(),
+ Settings.Secure.ANDROID_ID);
DisplayMetrics metrics = getResources().getDisplayMetrics();
int widthPixels = metrics.widthPixels;
int heightPixels = metrics.heightPixels;
diff --git a/app/src/main/res/layout/activity_cookie.xml b/app/src/main/res/layout/activity_cookie.xml
new file mode 100644
index 0000000..dc1f9a3
--- /dev/null
+++ b/app/src/main/res/layout/activity_cookie.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_enroll.xml b/app/src/main/res/layout/activity_enroll.xml
index e7b46d4..827f05f 100644
--- a/app/src/main/res/layout/activity_enroll.xml
+++ b/app/src/main/res/layout/activity_enroll.xml
@@ -1,13 +1,10 @@
-
+ android:orientation="vertical">
-
diff --git a/app/src/main/res/layout/activity_user_editing.xml b/app/src/main/res/layout/activity_user_editing.xml
new file mode 100644
index 0000000..e2ee111
--- /dev/null
+++ b/app/src/main/res/layout/activity_user_editing.xml
@@ -0,0 +1,135 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_user_logs.xml b/app/src/main/res/layout/activity_user_logs.xml
index c603b37..d435fe2 100644
--- a/app/src/main/res/layout/activity_user_logs.xml
+++ b/app/src/main/res/layout/activity_user_logs.xml
@@ -5,8 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
- android:orientation="vertical"
- tools:context=".login.user_logs">
+ android:orientation="vertical">
-
+ android:hint="铁锈助手账号">
+ android:inputType="textEmailAddress"
+ tools:ignore="LabelFor,VisualLintTextFieldSize,TextContrastCheck"
+ android:autofillHints="" />
+ android:hint="密码"
+ app:passwordToggleEnabled="true">
+ android:textColorHint="#546E7A"
+ tools:ignore="LabelFor,TextContrastCheck,VisualLintTextFieldSize" />
+
+
+
+
+ android:text="@string/login"
+ tools:ignore="ButtonStyle,DuplicateSpeakableTextCheck" />
+ android:text="注册(维护中)"
+ tools:ignore="ButtonStyle" />
diff --git a/app/src/main/res/layout/erweima.xml b/app/src/main/res/layout/erweima.xml
deleted file mode 100644
index 3598544..0000000
--- a/app/src/main/res/layout/erweima.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_bfq.xml b/app/src/main/res/layout/fragment_bfq.xml
index 80166d2..ffc7477 100644
--- a/app/src/main/res/layout/fragment_bfq.xml
+++ b/app/src/main/res/layout/fragment_bfq.xml
@@ -32,12 +32,14 @@
android:scaleType="fitXY"
android:src="@drawable/icon" />
+
+
+
+
diff --git a/app/src/main/res/layout/list_text.xml b/app/src/main/res/layout/list_text.xml
index 504cb62..44ccc4a 100644
--- a/app/src/main/res/layout/list_text.xml
+++ b/app/src/main/res/layout/list_text.xml
@@ -2,18 +2,14 @@
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_marginStart="6dp">
+ android:textColor="@color/text"
+ app:strokeWidth="1dp" />
diff --git a/app/src/main/res/menu/sz.xml b/app/src/main/res/menu/sz.xml
index 14cc4c5..14b1673 100644
--- a/app/src/main/res/menu/sz.xml
+++ b/app/src/main/res/menu/sz.xml
@@ -1,52 +1,40 @@
-