Commit 224f2e00 authored by Your Name's avatar Your Name

正式包

parent 369139ae
......@@ -8,6 +8,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import android.Manifest;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
......@@ -121,16 +122,18 @@ public class BatteryInfoActivity extends BaseActivity<ActivityBatteryInfoBinding
}
private void requestFilesAccessPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
intent.addCategory("android.intent.category.DEFAULT");
intent.setData(Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, REQUEST_ALL_FILES_ACCESS_PERMISSION);
} else {
// 在Android 10及以下版本,请求READ_EXTERNAL_STORAGE和WRITE_EXTERNAL_STORAGE权限
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_PERMISSION_CODE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
try {
Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
intent.addCategory("android.intent.category.DEFAULT");
intent.setData(Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, REQUEST_ALL_FILES_ACCESS_PERMISSION);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, "Activity not found", Toast.LENGTH_SHORT).show();
}
}
}
@Override
......
......@@ -60,14 +60,15 @@ public class SettingActivity extends AppCompatActivity {
String token = SPUtils.Companion.getInstance().getString("token", "");
Log.d("setting_token",token);
binding.settingTitle.setOnClickListener(v->{
if (!token.isEmpty()){
binding.settingToken.setText(token);
copyTextToClipboard(token);
}else {
Toast.makeText(this, "token为空", Toast.LENGTH_SHORT).show();
}
});
// binding.settingTitle.setOnClickListener(v->{
// binding.settingToken.setVisibility(View.VISIBLE);
// if (!token.isEmpty()){
// binding.settingToken.setText(token);
// copyTextToClipboard(token);
// }else {
// Toast.makeText(this, "token为空", Toast.LENGTH_SHORT).show();
// }
// });
}
private void showCustomDialog() {
......
......@@ -210,5 +210,6 @@
android:gravity="center"
android:text="token"
android:textSize="20sp"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/setting_cl3" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment