Fix crashing
parent
c4513eee9e
commit
88b9111392
|
@ -31,7 +31,7 @@ android {
|
|||
vectorDrawables.useSupportLibrary = true
|
||||
|
||||
applicationId "code.name.monkey.retromusic"
|
||||
versionCode 323
|
||||
versionCode 324
|
||||
versionName '3.1.700'
|
||||
|
||||
multiDexEnabled true
|
||||
|
|
|
@ -17,7 +17,6 @@ import code.name.monkey.appthemehelper.ThemeStore
|
|||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.App
|
||||
import code.name.monkey.retromusic.Constants.USER_BANNER
|
||||
import code.name.monkey.retromusic.Constants.USER_PROFILE
|
||||
|
@ -132,7 +131,7 @@ class UserInfoActivity : AbsBaseActivity() {
|
|||
if (PreferenceUtil.getInstance().bannerImage.isEmpty()) {
|
||||
val pickImageIntent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
|
||||
pickImageIntent.type = "image/*"
|
||||
pickImageIntent.putExtra("crop", "true")
|
||||
//pickImageIntent.putExtra("crop", "true")
|
||||
pickImageIntent.putExtra("outputX", 1290)
|
||||
pickImageIntent.putExtra("outputY", 720)
|
||||
pickImageIntent.putExtra("aspectX", 16)
|
||||
|
@ -162,10 +161,10 @@ class UserInfoActivity : AbsBaseActivity() {
|
|||
|
||||
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||
when (requestCode) {
|
||||
PICK_IMAGE_REQUEST -> {
|
||||
val uri = data!!.data
|
||||
val uri = data.data
|
||||
try {
|
||||
val bitmap = getResizedBitmap(getBitmap(contentResolver, uri), PROFILE_ICON_SIZE)
|
||||
val profileImagePath = saveToInternalStorage(bitmap, USER_PROFILE)
|
||||
|
@ -176,14 +175,14 @@ class UserInfoActivity : AbsBaseActivity() {
|
|||
}
|
||||
}
|
||||
CROP_IMAGE_REQUEST -> {
|
||||
val extras: Bundle = data?.extras!!
|
||||
val selectedBitmap: Bitmap = extras.getParcelable("data");
|
||||
val extras: Bundle = data.extras!!
|
||||
val selectedBitmap: Bitmap = extras.getParcelable("data")
|
||||
val profileImagePath = saveToInternalStorage(selectedBitmap, USER_PROFILE)
|
||||
PreferenceUtil.getInstance().saveProfileImage(profileImagePath)
|
||||
loadImageFromStorage(profileImagePath)
|
||||
}
|
||||
PICK_BANNER_REQUEST -> {
|
||||
val uri = data?.data
|
||||
val uri = data.data
|
||||
try {
|
||||
val bitmap = getBitmap(contentResolver, uri)
|
||||
val profileImagePath = saveToInternalStorage(bitmap, USER_BANNER)
|
||||
|
@ -194,40 +193,14 @@ class UserInfoActivity : AbsBaseActivity() {
|
|||
}
|
||||
}
|
||||
CROP_BANNER_REQUEST -> {
|
||||
val extras: Bundle = data?.extras!!
|
||||
val selectedBitmap: Bitmap = extras.getParcelable("data");
|
||||
val extras: Bundle = data.extras!!
|
||||
val selectedBitmap: Bitmap = extras.getParcelable("data")
|
||||
val profileImagePath = saveToInternalStorage(selectedBitmap, USER_BANNER)
|
||||
PreferenceUtil.getInstance().saveProfileImage(profileImagePath)
|
||||
loadImageFromStorage(profileImagePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
/*if (requestCode == PICK_IMAGE_REQUEST && resultCode == Activity.RESULT_OK && data != null && data.data != null) {
|
||||
val picturePath = data.data
|
||||
performCrop(picturePath)
|
||||
} else if (requestCode == CROP_IMAGE_REQUEST && resultCode == Activity.RESULT_OK && data != null && data.data != null) {
|
||||
val uri = data.data
|
||||
try {
|
||||
val bitmap = ImageUtil.getResizedBitmap(Media.getBitmap(contentResolver, uri), PROFILE_ICON_SIZE)
|
||||
val profileImagePath = saveToInternalStorage(bitmap, USER_PROFILE)
|
||||
PreferenceUtil.getInstance().saveProfileImage(profileImagePath)
|
||||
loadImageFromStorage(profileImagePath)
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
} else if (requestCode == PICK_BANNER_REQUEST && resultCode == Activity.RESULT_OK && data != null &&
|
||||
data.data != null) {
|
||||
val uri = data.data
|
||||
try {
|
||||
val bitmap = Media.getBitmap(contentResolver, uri)
|
||||
val profileImagePath = saveToInternalStorage(bitmap, USER_BANNER)
|
||||
PreferenceUtil.getInstance().setBannerImagePath(profileImagePath)
|
||||
loadBannerFromStorage(profileImagePath)
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -49,24 +49,22 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_whats_new);
|
||||
|
||||
webView = findViewById(R.id.webView);
|
||||
toolbar = findViewById(R.id.toolbar);
|
||||
appBarLayout = findViewById(R.id.appBarLayout);
|
||||
|
||||
|
||||
setStatusbarColorAuto();
|
||||
setNavigationbarColorAuto();
|
||||
setTaskDescriptionColorAuto();
|
||||
|
||||
webView = findViewById(R.id.webView);
|
||||
toolbar = findViewById(R.id.toolbar);
|
||||
appBarLayout = findViewById(R.id.appBarLayout);
|
||||
|
||||
toolbar.setBackgroundColor(ThemeStore.Companion.primaryColor(this));
|
||||
appBarLayout.setBackgroundColor(ThemeStore.Companion.primaryColor(this));
|
||||
setSupportActionBar(toolbar);
|
||||
//setSupportActionBar(toolbar);
|
||||
|
||||
toolbar.setNavigationOnClickListener(v -> onBackPressed());
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.Companion.textColorSecondary(this));
|
||||
|
||||
try {
|
||||
// Load from phonograph-changelog.html in the assets folder
|
||||
StringBuilder buf = new StringBuilder();
|
||||
InputStream json = getAssets().open("retro-changelog.html");
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(json, StandardCharsets.UTF_8));
|
||||
|
|
|
@ -135,7 +135,7 @@ object MusicPlayerRemote {
|
|||
var cursor: Cursor? = null
|
||||
try {
|
||||
cursor = context.contentResolver.query(uri, projection, null, null, null)
|
||||
cursor.use { it ->
|
||||
cursor.use {
|
||||
if (it.moveToFirst()) {
|
||||
val columnIndex = it.getColumnIndexOrThrow(column)
|
||||
return it.getString(columnIndex)
|
||||
|
@ -405,7 +405,7 @@ object MusicPlayerRemote {
|
|||
)).blockingFirst()
|
||||
}
|
||||
}
|
||||
if (songs != null && !songs.isEmpty()) {
|
||||
if (songs != null && songs.isNotEmpty()) {
|
||||
openQueue(songs, 0, true)
|
||||
} else {
|
||||
//TODO the file is not listed in the media store
|
||||
|
|
|
@ -89,7 +89,7 @@ object SongLoader {
|
|||
|
||||
// Blacklist
|
||||
val paths = BlacklistStore.getInstance(context).paths
|
||||
if (!paths.isEmpty()) {
|
||||
if (paths.isNotEmpty()) {
|
||||
selectionFinal = generateBlacklistSelection(selectionFinal, paths.size)
|
||||
selectionValuesFinal = addBlacklistSelectionValues(selectionValuesFinal, paths)
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class UserImageView extends CircularImageView implements SharedPreference
|
|||
|
||||
@Override
|
||||
public void getSize(@NonNull SizeReadyCallback cb) {
|
||||
cb.onSizeReady(32, 32);
|
||||
cb.onSizeReady(96, 96);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,13 +5,12 @@
|
|||
<solid android:color="?android:colorButtonNormal" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:id="@android:id/progress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="8dp" />
|
||||
<solid android:color="@color/md_black_1000" />
|
||||
</shape>
|
||||
</scale>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
Loading…
Reference in New Issue