mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
use new media_quality core-config-value
This commit is contained in:
@@ -8,12 +8,9 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.CheckBoxPreference;
|
||||
import androidx.preference.EditTextPreference;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.Toast;
|
||||
@@ -25,7 +22,6 @@ import org.thoughtcrime.securesms.BlockedAndShareContactsActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.ScreenLockUtil;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
@@ -37,6 +33,7 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
|
||||
|
||||
|
||||
private ListPreference showEmails;
|
||||
private ListPreference mediaQuality;
|
||||
private CheckBoxPreference readReceiptsCheckbox;
|
||||
|
||||
private ListPreference autoDelDevice;
|
||||
@@ -46,8 +43,12 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
|
||||
public void onCreate(Bundle paramBundle) {
|
||||
super.onCreate(paramBundle);
|
||||
|
||||
findPreference("pref_compression")
|
||||
.setOnPreferenceChangeListener(new ListSummaryListener());
|
||||
mediaQuality = (ListPreference) this.findPreference("pref_compression");
|
||||
mediaQuality.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
updateListSummary(preference, newValue);
|
||||
dcContext.setConfigInt("media_quality", Util.objectToInt(newValue));
|
||||
return true;
|
||||
});
|
||||
|
||||
showEmails = (ListPreference) this.findPreference("pref_show_emails");
|
||||
showEmails.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
@@ -81,11 +82,14 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
|
||||
super.onResume();
|
||||
((ApplicationPreferencesActivity)getActivity()).getSupportActionBar().setTitle(R.string.pref_chats_and_media);
|
||||
|
||||
initializeListSummary((ListPreference) findPreference("pref_compression"));
|
||||
|
||||
String value = Integer.toString(dcContext.getConfigInt("show_emails"));
|
||||
showEmails.setValue(value);
|
||||
updateListSummary(showEmails, value);
|
||||
|
||||
value = Integer.toString(dcContext.getConfigInt("media_quality"));
|
||||
mediaQuality.setValue(value);
|
||||
updateListSummary(mediaQuality, value);
|
||||
|
||||
readReceiptsCheckbox.setChecked(0 != dcContext.getConfigInt("mdns_enabled"));
|
||||
|
||||
initAutodelFromCore();
|
||||
|
||||
@@ -12,8 +12,10 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
|
||||
import com.b44t.messenger.DcContext;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.preferences.widgets.NotificationPrivacyPreference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -173,12 +175,7 @@ public class Prefs {
|
||||
}
|
||||
|
||||
public static boolean isHardCompressionEnabled(Context context) {
|
||||
try {
|
||||
return getStringPreference(context, "pref_compression", "0").equals("1");
|
||||
}
|
||||
catch(Exception e) {
|
||||
return false;
|
||||
}
|
||||
return DcHelper.getContext(context).getConfigInt("media_quality") == DcContext.DC_MEDIA_QUALITY_WORSE;
|
||||
}
|
||||
|
||||
public static boolean isLocationStreamingEnabled(Context context) {
|
||||
|
||||
Reference in New Issue
Block a user