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

正式包

parent 369139ae
...@@ -8,6 +8,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; ...@@ -8,6 +8,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import android.Manifest; import android.Manifest;
import android.animation.ValueAnimator; import android.animation.ValueAnimator;
import android.app.Activity; import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
...@@ -121,16 +122,18 @@ public class BatteryInfoActivity extends BaseActivity<ActivityBatteryInfoBinding ...@@ -121,16 +122,18 @@ public class BatteryInfoActivity extends BaseActivity<ActivityBatteryInfoBinding
} }
private void requestFilesAccessPermission() { 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 { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// 在Android 10及以下版本,请求READ_EXTERNAL_STORAGE和WRITE_EXTERNAL_STORAGE权限 try {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_PERMISSION_CODE); 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 @Override
......
...@@ -60,14 +60,15 @@ public class SettingActivity extends AppCompatActivity { ...@@ -60,14 +60,15 @@ public class SettingActivity extends AppCompatActivity {
String token = SPUtils.Companion.getInstance().getString("token", ""); String token = SPUtils.Companion.getInstance().getString("token", "");
Log.d("setting_token",token); Log.d("setting_token",token);
binding.settingTitle.setOnClickListener(v->{ // binding.settingTitle.setOnClickListener(v->{
if (!token.isEmpty()){ // binding.settingToken.setVisibility(View.VISIBLE);
binding.settingToken.setText(token); // if (!token.isEmpty()){
copyTextToClipboard(token); // binding.settingToken.setText(token);
}else { // copyTextToClipboard(token);
Toast.makeText(this, "token为空", Toast.LENGTH_SHORT).show(); // }else {
} // Toast.makeText(this, "token为空", Toast.LENGTH_SHORT).show();
}); // }
// });
} }
private void showCustomDialog() { private void showCustomDialog() {
......
...@@ -210,5 +210,6 @@ ...@@ -210,5 +210,6 @@
android:gravity="center" android:gravity="center"
android:text="token" android:text="token"
android:textSize="20sp" android:textSize="20sp"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/setting_cl3" /> app:layout_constraintTop_toBottomOf="@id/setting_cl3" />
</androidx.constraintlayout.widget.ConstraintLayout> </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