更新了沉静是状态栏

我的UI小改动
搜索历史记录删除BUG修复
This commit is contained in:
muqing 2024-01-30 20:08:07 +08:00
parent f72caa8961
commit ba6d8dcedc
6 changed files with 71 additions and 50 deletions

View File

@ -1,6 +1,7 @@
package com.muqingbfq.fragment;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
@ -9,8 +10,11 @@ import android.widget.Toast;
import com.muqingbfq.R;
import com.muqingbfq.activity_about_software;
import com.muqingbfq.clean.fragment_clean;
import com.muqingbfq.home;
import com.muqingbfq.mq.gj;
import java.util.List;
public class sz {
@SuppressLint("NonConstantResourceId")
public static void switch_sz(Context context, int id) {
@ -46,6 +50,19 @@ public class sz {
} else if (id == R.id.f) {
context.startActivity(new Intent(context, activity_about_software.class));
// 关于软件
} else if (id == R.id.g) {
// 关闭软件
ActivityManager mActivityManager = (ActivityManager)home.appCompatActivity.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> mList = mActivityManager.getRunningAppProcesses();
for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : mList)
{
if (runningAppProcessInfo.pid != android.os.Process.myPid())
{
android.os.Process.killProcess(runningAppProcessInfo.pid);
}
}
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
}
}
}

View File

@ -124,23 +124,9 @@ public class wode extends Fragment {
});
jieshao = binding.text2;
imageView = binding.imageView;
binding.cardview.setOnClickListener(v -> {
File file = new File(wj.filesdri, "user.mq");
if (file.exists()) {
String[] a = new String[]{"退出登录"};
new MaterialAlertDialogBuilder(getContext())
.setItems(a, (dialogInterface, i) -> {
file.delete();
setname(getString(R.string.app_name));
setqianming(getString(R.string.app_name));
imageView.setImageResource(R.drawable.ic_launcher_foreground);
new visitor();
new com.muqingbfq.login.user_message();
}).show();
} else {
startActivity(new Intent(getContext(), user_logs.class));
}
});
binding.cardview.setOnClickListener(new dl());
binding.toolbar.setOnClickListener(new dl());
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 4) {
@Override
public boolean canScrollVertically() {
@ -266,6 +252,31 @@ public class wode extends Fragment {
return binding.getRoot();
}
class dl implements View.OnClickListener {
@Override
public void onClick(View v) {
File file = new File(wj.filesdri, "user.mq");
if (file.exists()) {
String[] a = new String[]{"退出登录"};
new MaterialAlertDialogBuilder(getContext())
.setItems(a, (dialogInterface, i) -> {
boolean delete = file.delete();
if (delete) {
setname(getString(R.string.app_name));
setqianming(getString(R.string.app_name));
imageView.setImageResource(R.drawable.ic_launcher_foreground);
new visitor();
new com.muqingbfq.login.user_message();
}
}).show();
} else {
startActivity(new Intent(getContext(), user_logs.class));
}
}
}
class VH extends RecyclerView.ViewHolder {
public ImageView imageView;

View File

@ -3,13 +3,10 @@ package com.muqingbfq;
import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.media.MediaBrowserCompat;
import android.util.DisplayMetrics;
import android.view.Menu;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
@ -74,7 +71,6 @@ public class home extends AppCompatActivity {
}
public static ComponentName componentName;
private Adaper adapter;
private class Adaper extends FragmentStateAdapter {
List<Fragment> list = new ArrayList<>();
@ -98,7 +94,7 @@ public class home extends AppCompatActivity {
}
public void UI() {
adapter = new Adaper(this);
Adaper adapter = new Adaper(this);
binding.viewPager.setAdapter(adapter);
binding.viewPager.setSaveEnabled(false);
// ViewPager2 绑定到 TabLayout
@ -111,7 +107,6 @@ public class home extends AppCompatActivity {
}
return true;
});
Object o = new Object();
binding.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override
public void onPageSelected(int position) {
@ -121,15 +116,6 @@ public class home extends AppCompatActivity {
break;
case 1:
binding.tablayout.setSelectedItemId(R.id.c);
/* new Thread() {
@Override
public void run() {
synchronized (o) {
wode fragment = (wode) adapter.createFragment(position);
fragment.sx();
}
}
}.start();*/
break;
}
}
@ -219,7 +205,5 @@ public class home extends AppCompatActivity {
if (mBrowser != null && mBrowser.isConnected()) {
mBrowser.disconnect();
}
// int i = Process.myPid();
// android.os.Process.killProcess(i);
}
}

View File

@ -14,12 +14,15 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:id="@+id/cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:padding="10dp">
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/imageView"
android:layout_width="65dp"
@ -35,24 +38,28 @@
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:text="@string/login"
android:textSize="26sp" />
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name" />
</LinearLayout>
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal">
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/aaa"
android:layout_width="wrap_content"
@ -76,26 +83,20 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.card.MaterialCardView
android:id="@+id/cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardUseCompatPadding="true"
app:layout_constraintTop_toTopOf="parent">
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:id="@+id/cardview2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardUseCompatPadding="true"
app:contentPadding="6dp"
app:layout_constraintTop_toBottomOf="@id/cardview">
app:layout_constraintTop_toTopOf="parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:focusableInTouchMode="false"
android:nestedScrollingEnabled="false" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
@ -114,6 +115,8 @@
android:id="@+id/recyclerview2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="false"
android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -29,4 +29,9 @@
android:icon="@drawable/app_warning"
android:title="@string/guanyuruanjiang" />
<item
android:id="@+id/g"
android:icon="@drawable/user_end"
android:title="@string/endapp" />
</menu>

View File

@ -30,6 +30,7 @@
<string name="Playlist">歌单</string>
<string name="quxiao">取消</string>
<string name="jianchagegnxin">检查更新</string>
<string name="endapp">关闭软件</string>
<string-array name="gd_list">
<item>下载歌单</item>
<item>收藏歌单(不可用)</item>