Add "Disable playback"
This commit is contained in:
@@ -33,6 +33,7 @@ public class ExteraConfig {
|
||||
|
||||
public static boolean rearVideoMessages;
|
||||
public static boolean pauseOnMinimize;
|
||||
public static boolean disablePlayback;
|
||||
|
||||
private static boolean configLoaded;
|
||||
|
||||
@@ -66,7 +67,8 @@ public class ExteraConfig {
|
||||
dateOfForwardedMsg = preferences.getBoolean("dateOfForwardedMsg", false);
|
||||
|
||||
rearVideoMessages = preferences.getBoolean("rearVideoMessages", false);
|
||||
pauseOnMinimize = preferences.getBoolean("pauseOnMinimize", false);
|
||||
pauseOnMinimize = preferences.getBoolean("pauseOnMinimize", true);
|
||||
disablePlayback = preferences.getBoolean("disablePlayback", true);
|
||||
|
||||
configLoaded = true;
|
||||
}
|
||||
@@ -191,4 +193,11 @@ public class ExteraConfig {
|
||||
editor.putBoolean("pauseOnMinimize", pauseOnMinimize);
|
||||
editor.commit();
|
||||
}
|
||||
public static void toggleDisablePlayback() {
|
||||
disablePlayback = !disablePlayback;
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("exteraconfig", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean("disablePlayback", disablePlayback);
|
||||
editor.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public class ChatsPreferencesEntry extends BaseFragment {
|
||||
private int mediaHeaderRow;
|
||||
private int rearVideoMessagesRow;
|
||||
private int pauseOnMinimizeRow;
|
||||
private int disablePlaybackRow;
|
||||
private int mediaDividerRow;
|
||||
|
||||
private UndoView restartTooltip;
|
||||
@@ -189,6 +190,11 @@ public class ChatsPreferencesEntry extends BaseFragment {
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(ExteraConfig.pauseOnMinimize);
|
||||
}
|
||||
} else if (position == disablePlaybackRow) {
|
||||
ExteraConfig.toggleDisablePlayback();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(ExteraConfig.disablePlayback);
|
||||
}
|
||||
}
|
||||
});
|
||||
restartTooltip = new UndoView(context);
|
||||
@@ -216,6 +222,7 @@ public class ChatsPreferencesEntry extends BaseFragment {
|
||||
mediaHeaderRow = rowCount++;
|
||||
rearVideoMessagesRow = rowCount++;
|
||||
pauseOnMinimizeRow = rowCount++;
|
||||
disablePlaybackRow = rowCount++;
|
||||
mediaDividerRow = rowCount++;
|
||||
|
||||
if (listAdapter != null && notify) {
|
||||
@@ -277,6 +284,8 @@ public class ChatsPreferencesEntry extends BaseFragment {
|
||||
textCheckCell.setTextAndCheck(LocaleController.getString("RearVideoMessages", R.string.RearVideoMessages), ExteraConfig.rearVideoMessages, true);
|
||||
} else if (position == pauseOnMinimizeRow) {
|
||||
textCheckCell.setTextAndValueAndCheck(LocaleController.getString("PauseOnMinimize", R.string.PauseOnMinimize), LocaleController.getString("POMDescription", R.string.POMDescription), ExteraConfig.pauseOnMinimize, true, true);
|
||||
} else if (position == disablePlaybackRow) {
|
||||
textCheckCell.setTextAndValueAndCheck(LocaleController.getString("DisablePlayback", R.string.DisablePlayback), LocaleController.getString("DPDescription", R.string.DPDescription), ExteraConfig.disablePlayback, true, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -321,7 +330,7 @@ public class ChatsPreferencesEntry extends BaseFragment {
|
||||
return 2;
|
||||
} else if (position == hideStickerTimeRow || position == hideSendAsChannelRow || position == hideKeyboardOnScrollRow ||
|
||||
position == archiveOnPullRow || position == dateOfForwardedMsgRow || position == rearVideoMessagesRow ||
|
||||
position == pauseOnMinimizeRow) {
|
||||
position == pauseOnMinimizeRow || position == disablePlaybackRow) {
|
||||
return 3;
|
||||
} else if (position == stickerSizeRow) {
|
||||
return 4;
|
||||
|
||||
@@ -166,6 +166,8 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.exteragram.messenger.ExteraConfig;
|
||||
|
||||
public class LaunchActivity extends BasePermissionsActivity implements ActionBarLayout.ActionBarLayoutDelegate, NotificationCenter.NotificationCenterDelegate, DialogsActivity.DialogsActivityDelegate {
|
||||
|
||||
private static final String EXTRA_ACTION_TOKEN = "actions.fulfillment.extra.ACTION_TOKEN";
|
||||
@@ -5445,7 +5447,7 @@ public class LaunchActivity extends BasePermissionsActivity implements ActionBar
|
||||
showVoiceChatTooltip(mute ? UndoView.ACTION_VOIP_SOUND_MUTED : UndoView.ACTION_VOIP_SOUND_UNMUTED);
|
||||
}
|
||||
}
|
||||
} else if (!mainFragmentsStack.isEmpty() && (!PhotoViewer.hasInstance() || !PhotoViewer.getInstance().isVisible()) && event.getRepeatCount() == 0) {
|
||||
} else if (!ExteraConfig.disablePlayback && (!PhotoViewer.hasInstance() || !PhotoViewer.getInstance().isVisible()) && event.getRepeatCount() == 0) {
|
||||
BaseFragment fragment = mainFragmentsStack.get(mainFragmentsStack.size() - 1);
|
||||
if (fragment instanceof ChatActivity) {
|
||||
if (((ChatActivity) fragment).maybePlayVisibleVideo()) {
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
<string name="RearVideoMessages">Rear Camera in Video Messages</string>
|
||||
<string name="PauseOnMinimize">Autopause</string>
|
||||
<string name="POMDescription">Pauses a video playback when device is locked or exteraGram is minimized</string>
|
||||
<string name="DisablePlayback">Disable playback</string>
|
||||
<string name="DPDescription">Disables playback when volume button is pressed</string>
|
||||
|
||||
<string name="ConfirmCall">Confirm call</string>
|
||||
<string name="CallTo">Call to **%1$s**?</string>
|
||||
|
||||
Reference in New Issue
Block a user