ctx menu: unsub fix; view manager: start activity: remove delay

This commit is contained in:
Yuriy Liskov 2023-12-28 12:59:11 +02:00
parent 842e74c2b0
commit 7620b09a5d
4 changed files with 28 additions and 12 deletions

View File

@ -48,6 +48,7 @@ allprojects {
resolutionStrategy.force 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:' + kotlinVersion
resolutionStrategy.force 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:' + kotlinVersion
resolutionStrategy.force 'org.jetbrains.kotlin:kotlin-stdlib:' + kotlinVersion
resolutionStrategy.force 'org.jetbrains.kotlinx:kotlinx-coroutines-android:' + kotlinxVersion
resolutionStrategy.force 'androidx.annotation:annotation:' + annotationXLibraryVersion
// Downgrade Cronet version for cronet-okhttp
resolutionStrategy.force 'org.chromium.net:cronet-api:' + cronetApiVersion

View File

@ -630,9 +630,11 @@ public class VideoMenuPresenter extends BaseMenuPresenter {
return;
}
mVideo.isSubscribed = mVideo.isSubscribed || mVideo.belongsToSubscriptions() || mVideo.belongsToChannelUploads();
mDialogPresenter.appendSingleButton(
UiOptionItem.from(getContext().getString(
mVideo.isSubscribed || mVideo.belongsToSubscriptions() || mVideo.belongsToChannelUploads() ?
mVideo.isSubscribed ?
R.string.unsubscribe_from_channel : R.string.subscribe_to_channel),
optionItem -> toggleSubscribe()));
}

View File

@ -411,15 +411,6 @@ public class ViewManager {
* View=android.widget.TextView not attached to window manager
*/
private void safeStartActivity(Context context, Intent intent) {
// Small delay to fix PIP bug
Utils.postDelayed(() -> safeStartActivityInt(context, intent), 50);
}
/**
* Fix: java.lang.IllegalArgumentException<br/>
* View=android.widget.TextView not attached to window manager
*/
private void safeStartActivityInt(Context context, Intent intent) {
try {
context.startActivity(intent);
} catch (IllegalArgumentException | ActivityNotFoundException e) {
@ -428,6 +419,28 @@ public class ViewManager {
}
}
///**
// * Fix: java.lang.IllegalArgumentException<br/>
// * View=android.widget.TextView not attached to window manager
// */
//private void safeStartActivity(Context context, Intent intent) {
// // Small delay to fix PIP bug
// Utils.postDelayed(() -> safeStartActivityInt(context, intent), 50);
//}
//
///**
// * Fix: java.lang.IllegalArgumentException<br/>
// * View=android.widget.TextView not attached to window manager
// */
//private void safeStartActivityInt(Context context, Intent intent) {
// try {
// context.startActivity(intent);
// } catch (IllegalArgumentException | ActivityNotFoundException e) {
// Log.e(TAG, "Error when starting activity: %s", e.getMessage());
// MessageHelpers.showLongMessage(context, e.getLocalizedMessage());
// }
//}
public boolean isFinishing() {
return mIsFinishing;
}

View File

@ -59,8 +59,8 @@ android {
applicationId "com.liskovsoft.smarttubetv"
minSdkVersion project.properties.minSdkVersion
targetSdkVersion project.properties.targetSdkVersion
versionCode 1244
versionName "20.54"
versionCode 1245
versionName "20.55"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"