修复了播放器无播放列表闪退
音乐搜索, 歌词UI显示, 主页报错, 优化了一些体验上面的功能!
This commit is contained in:
parent
533cc2d0aa
commit
a5d00632ca
|
@ -3,21 +3,72 @@
|
|||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AndroidLintContentDescription" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintHardcodedText" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintLabelFor" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ArgumentSelectionDefects" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ArrayIndexOutOfBounds" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,okhttp3.Call,execute,android.app.DownloadManager,query" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ClangTidy" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ClangdErrorsAndWarnings" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="Clazy" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ConstantConditionsOC" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ConstantFunctionResult" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ConstantParameter" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DanglingPointer" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DataFlowIssue" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
|
||||
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="DeprecatedApi" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DuplicateSwitchCase" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="EmptyDeclOrStmt" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="EndlessLoop" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="EqualityInConditionalOperator" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="FormatSpecifiers" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="FunctionImplicitDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="HidesUpperScope" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="HidingNonVirtualFunction" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IgnoreResultOfCall" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="m_reportAllNonLibraryCalls" value="false" />
|
||||
<option name="callCheckString" value="java.io.File,.*,java.io.InputStream,read|skip|available|markSupported,java.io.Reader,read|skip|ready|markSupported,java.lang.AbstractStringBuilder,capacity|codePointAt|codePointBefore|codePointCount|indexOf|lastIndexOf|offsetByCodePoints|substring|subSequence,java.lang.Boolean,.*,java.lang.Byte,.*,java.lang.Character,.*,java.lang.Double,.*,java.lang.Float,.*,java.lang.Integer,.*,java.lang.Long,.*,java.lang.Math,.*,java.lang.Object,equals|hashCode|toString,java.lang.Short,.*,java.lang.StrictMath,.*,java.lang.String,.*,java.lang.Thread,interrupted,java.math.BigDecimal,.*,java.math.BigInteger,.*,java.net.InetAddress,.*,java.net.URI,.*,java.nio.channels.AsynchronousChannelGroup,.*,java.util.Arrays,.*,java.util.Collections,(?!addAll).*,java.util.List,of,java.util.Map,of|ofEntries|entry,java.util.Set,of,java.util.UUID,.*,java.util.concurrent.BlockingQueue,offer|remove,java.util.concurrent.CountDownLatch,await|getCount,java.util.concurrent.ExecutorService,awaitTermination|isShutdown|isTerminated,java.util.concurrent.ForkJoinPool,awaitQuiescence,java.util.concurrent.Semaphore,tryAcquire|availablePermits|isFair|hasQueuedThreads|getQueueLength|getQueuedThreads,java.util.concurrent.locks.Condition,await|awaitNanos|awaitUntil,java.util.concurrent.locks.Lock,tryLock|newCondition,java.util.regex.Matcher,pattern|toMatchResult|start|end|group|groupCount|matches|find|lookingAt|quoteReplacement|replaceAll|replaceFirst|regionStart|regionEnd|hasTransparentBounds|hasAnchoringBounds|hitEnd|requireEnd,java.util.regex.Pattern,.*,java.util.stream.BaseStream,.*,java.util.stream.DoubleStream,.*,java.util.stream.IntStream,.*,java.util.stream.LongStream,.*,java.util.stream.Stream,.*" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ImplicitIntegerAndEnumConversion" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ImplicitPointerAndIntegerConversion" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IncompatibleEnums" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IncompatibleInitializers" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IncompatiblePointers" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="KRUnspecifiedParameters" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="LocalValueEscapesScope" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="LoopDoesntUseConditionVariable" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MissingReturn" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MissingSwitchCase" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="NotImplementedFunctions" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="NotInitializedVariable" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="NotSuperclass" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="NullDereference" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OCUnusedConcept" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OCUnusedGlobalDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OCUnusedMacro" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OCUnusedStruct" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OCUnusedTemplateParameter" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OCUnusedTypeAlias" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PreprocessorComment" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ResourceNotFound" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SignednessMismatch" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="Simplify" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||
<option name="processCode" value="true" />
|
||||
<option name="processLiterals" value="true" />
|
||||
<option name="processComments" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="UnreachableCallsOfFunction" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnreachableCode" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnusedExpressionResult" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnusedLocalVariable" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnusedParameter" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnusedValue" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ValueMayNotFitIntoReceiver" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="VirtualCallInCtorOrDtor" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
|
@ -1,4 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK" />
|
||||
<component name="VisualizationToolProject">
|
||||
<option name="state">
|
||||
<ProjectState>
|
||||
<option name="scale" value="0.4883720930232558" />
|
||||
</ProjectState>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -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
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 存储权限 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<!-- 存储权限 -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||
tools:ignore="ScopedStorage" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" /> <!-- 网络权限 -->
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||
|
@ -36,7 +36,8 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.云音乐"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:targetApi="31">
|
||||
android:requestLegacyExternalStorage="true"
|
||||
tools:targetApi="s">
|
||||
<activity
|
||||
android:name=".start"
|
||||
android:configChanges="uiMode"
|
||||
|
@ -48,24 +49,24 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".login.enroll" />
|
||||
<activity android:name=".login.user_logs" />
|
||||
<activity android:name=".login.user_editing" />
|
||||
<activity android:name=".activity_search" />
|
||||
<activity
|
||||
android:name=".bfq"
|
||||
android:configChanges="screenSize|smallestScreenSize|orientation|screenLayout"
|
||||
android:exported="true"
|
||||
android:theme="@style/fragment_dialog" />
|
||||
|
||||
<activity android:name=".fragment.mp3" />
|
||||
<activity android:name=".activity_about_software" />
|
||||
<activity android:name=".login.user_logs" />
|
||||
<activity android:name=".sz" />
|
||||
<activity
|
||||
android:name=".home"
|
||||
android:configChanges="screenSize|smallestScreenSize|orientation|screenLayout"
|
||||
android:exported="false" />
|
||||
<activity android:name=".mq.llq" />
|
||||
<activity android:name=".fragment.baseactivity" />
|
||||
<activity android:name=".yc" />
|
||||
<activity android:name=".login.cookie" />
|
||||
|
||||
<service
|
||||
android:name=".bfqkz"
|
||||
|
|
|
@ -140,7 +140,7 @@ public class MediaPlayer {
|
|||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private void bfui() {
|
||||
Glide.with(home.appCompatActivity)
|
||||
Glide.with(home.appCompatActivity.getApplicationContext())
|
||||
.asBitmap()
|
||||
.load(bfqkz.xm.picurl)
|
||||
.listener(new RequestListener<Bitmap>() {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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<xm> 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<List<MediaBrowserCompat.MediaItem>> result) {
|
||||
|
||||
public class MyBinder extends Binder {
|
||||
bfqkz getService() {
|
||||
return bfqkz.this;
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateNotification() {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<MediaBrowserCompat.MediaItem> 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;
|
||||
}
|
||||
}
|
109
app/src/main/java/com/muqingbfq/login/cookie.java
Normal file
109
app/src/main/java/com/muqingbfq/login/cookie.java
Normal file
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
229
app/src/main/java/com/muqingbfq/login/user_editing.java
Normal file
229
app/src/main/java/com/muqingbfq/login/user_editing.java
Normal file
|
@ -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<Intent> 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;
|
||||
}
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
16
app/src/main/java/com/muqingbfq/mq/ActivityToolbar.java
Normal file
16
app/src/main/java/com/muqingbfq/mq/ActivityToolbar.java
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
96
app/src/main/res/layout/activity_cookie.xml
Normal file
96
app/src/main/res/layout/activity_cookie.xml
Normal file
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical">
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:title="绑定网易云音乐"/>
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/view1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints="name"
|
||||
android:hint="网易云账号/网易云邮箱"
|
||||
android:inputType="text"
|
||||
android:singleLine="true"
|
||||
tools:ignore="TextContrastCheck,VisualLintTextFieldSize" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
app:passwordToggleEnabled="true">
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints="name"
|
||||
android:hint="密码"
|
||||
android:inputType="text"
|
||||
android:singleLine="true"
|
||||
tools:ignore="TextContrastCheck,VisualLintTextFieldSize" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="登录"
|
||||
tools:ignore="VisualLintButtonSize" />
|
||||
</LinearLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/view2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="36dp"
|
||||
app:cardUseCompatPadding="true">
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center_horizontal" />
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/icon" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/button1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:contentDescription="登录模式切换"
|
||||
android:text="二维码"
|
||||
app:icon="@drawable/icon"/>
|
||||
</LinearLayout>
|
|
@ -1,13 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical"
|
||||
tools:context=".login.user_logs">
|
||||
|
||||
android:orientation="vertical">
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -44,13 +41,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:inputType="textPassword" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<Button
|
||||
android:id="@+id/edit_cookie"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="绑定网易云音乐"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_gravity="end"/>
|
||||
<Button
|
||||
android:id="@+id/enroll"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="26dp"
|
||||
android:enabled="false"
|
||||
android:text="深色模式" />
|
||||
</LinearLayout>
|
||||
|
||||
|
|
135
app/src/main/res/layout/activity_user_editing.xml
Normal file
135
app/src/main/res/layout/activity_user_editing.xml
Normal file
|
@ -0,0 +1,135 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:title="用户编辑"/>
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingEnd="16dp">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
tools:ignore="UseCompoundDrawables,UselessParent">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="头像:" />
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="68dp"
|
||||
android:layout_height="68dp">
|
||||
<ImageView
|
||||
android:id="@+id/image1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/icon" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</LinearLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:counterEnabled="true"
|
||||
app:counterMaxLength="10">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints="name"
|
||||
android:hint="用户名"
|
||||
android:inputType="text"
|
||||
android:singleLine="true"
|
||||
tools:ignore="VisualLintTextFieldSize,TextContrastCheck" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:counterEnabled="true"
|
||||
app:counterMaxLength="36">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_qianming"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints="name"
|
||||
android:hint="签名"
|
||||
android:inputType="text"
|
||||
android:singleLine="true"
|
||||
tools:ignore="VisualLintTextFieldSize,TextContrastCheck" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/menu"
|
||||
style="@style/Widget.Material3.TextInputLayout.FilledBox.ExposedDropdownMenu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/autoComplete"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="性别"
|
||||
android:inputType="none"
|
||||
app:simpleItems="@array/xingbie"
|
||||
tools:ignore="SpeakableTextPresentCheck,VisualLintTextFieldSize" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UseCompoundDrawables,UselessParent">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="背景(此软件暂无使用背景):" />
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
app:cardUseCompatPadding="true">
|
||||
<ImageView
|
||||
android:id="@+id/image2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/icon" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/button2"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="绑定网易云(Cookie储在本地)" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/button1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:contentDescription="保存"
|
||||
android:text="保存"
|
||||
app:icon="@drawable/icon"/>
|
||||
</LinearLayout>
|
|
@ -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">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
|
@ -33,13 +32,14 @@
|
|||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:hint="UID">
|
||||
|
||||
android:hint="铁锈助手账号">
|
||||
<EditText
|
||||
android:id="@+id/edit_user"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textEmailAddress" />
|
||||
android:inputType="textEmailAddress"
|
||||
tools:ignore="LabelFor,VisualLintTextFieldSize,TextContrastCheck"
|
||||
android:autofillHints="" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -47,29 +47,49 @@
|
|||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:hint="密码">
|
||||
android:hint="密码"
|
||||
app:passwordToggleEnabled="true">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints=""
|
||||
android:inputType="textPassword"
|
||||
android:textColorHint="#546E7A" />
|
||||
android:textColorHint="#546E7A"
|
||||
tools:ignore="LabelFor,TextContrastCheck,VisualLintTextFieldSize" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:visibility="gone"
|
||||
android:hint="验证码">
|
||||
<EditText
|
||||
android:id="@+id/edit_key"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints=""
|
||||
android:inputType="number"
|
||||
tools:ignore="TextContrastCheck,VisualLintTextFieldSize" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="登录"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/bj" />
|
||||
android:text="@string/login"
|
||||
tools:ignore="ButtonStyle,DuplicateSpeakableTextCheck" />
|
||||
<Button
|
||||
android:id="@+id/enroll"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -77,8 +97,8 @@
|
|||
android:layout_marginTop="30dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="注册"
|
||||
android:textColor="@color/bj" />
|
||||
android:text="注册(维护中)"
|
||||
tools:ignore="ButtonStyle" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="26sp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/icon" />
|
||||
</LinearLayout>
|
|
@ -32,12 +32,14 @@
|
|||
android:scaleType="fitXY"
|
||||
android:src="@drawable/icon" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/view1"
|
||||
android:layout_alignStart="@id/view1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -46,6 +48,7 @@
|
|||
android:text="@string/name"
|
||||
android:textColor="@color/text"
|
||||
android:textSize="26sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/zz"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -33,21 +33,19 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sz_text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toEndOf="@id/cardview"
|
||||
android:text="@string/denglu"
|
||||
android:text="@string/login"
|
||||
android:textSize="26sp" />
|
||||
<TextView
|
||||
android:id="@+id/sz_text2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/sz_text1"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginBottom="35dp"
|
||||
android:layout_toEndOf="@id/cardview"
|
||||
android:text="我是一名小小的游客" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -2,18 +2,14 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_marginStart="6dp">
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:backgroundTint="@android:color/transparent"
|
||||
android:textColor="?attr/colorOnSurface"
|
||||
android:textAppearance="?attr/textAppearanceLabelLarge"
|
||||
android:layout_marginStart="6dp"
|
||||
app:strokeColor="?attr/colorOnSurface"
|
||||
app:strokeWidth="1dp"
|
||||
app:elevation="0dp"
|
||||
app:rippleColor="?attr/colorOnSurface"/>
|
||||
android:textColor="@color/text"
|
||||
app:strokeWidth="1dp" />
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,52 +1,40 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/a"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:icon="@drawable/fuwuzhongxing"
|
||||
android:title="@string/fuwuzhongxing" />
|
||||
|
||||
<item
|
||||
android:id="@+id/cookie"
|
||||
android:icon="@drawable/icon"
|
||||
android:title="绑定Cookie" />
|
||||
<item
|
||||
android:id="@+id/b"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:icon="@drawable/set_up"
|
||||
android:title="@string/shezhizhongxing" />
|
||||
|
||||
<item
|
||||
android:id="@+id/c"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:icon="@drawable/deleat"
|
||||
android:title="@string/chucunqingli" />
|
||||
|
||||
<item
|
||||
android:id="@+id/d"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:icon="@drawable/liaoqun"
|
||||
android:title="@string/guanfangliaoqun" />
|
||||
|
||||
<item
|
||||
android:id="@+id/e"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:icon="@drawable/qq"
|
||||
android:title="@string/lianxizuozhe" />
|
||||
|
||||
<item
|
||||
android:id="@+id/f"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:icon="@drawable/app_warning"
|
||||
android:title="@string/guanyuruanjiang" />
|
||||
|
||||
<item
|
||||
android:id="@+id/g"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:icon="@drawable/user_end"
|
||||
android:title="@string/tuichudenglu" />
|
||||
</menu>
|
|
@ -31,7 +31,6 @@
|
|||
<string name="guanfangliaoqun">官方聊群</string>
|
||||
<string name="lianxizuozhe">联系作者</string>
|
||||
<string name="guanyuruanjiang">关于软件</string>
|
||||
<string name="denglu">登录</string>
|
||||
<string name="deleat">删除</string>
|
||||
<string name="lishijilu">历史记录</string>
|
||||
<string name="_00_00">00:00</string>
|
||||
|
@ -44,4 +43,8 @@
|
|||
<item>收藏歌单(不可用)</item>
|
||||
<item>删除歌单</item>
|
||||
</string-array>
|
||||
<string-array name="xingbie">
|
||||
<item>男</item>
|
||||
<item>女</item>
|
||||
</string-array>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user