mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
* [WIP] Fixes #3465 Use AndroidX Pref * Deleted Unused Files * Added singleLineTitle * Updated Gradle Properties * Migrated to Androidx * Inline Variable change * optimise imports * Fixed Crash on empty input
This commit is contained in:
parent
e55b5495a1
commit
15bccdf650
12 changed files with 156 additions and 389 deletions
|
|
@ -106,12 +106,17 @@ dependencies {
|
||||||
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
|
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
|
||||||
|
|
||||||
//Room
|
//Room
|
||||||
def room_version= '2.2.3'
|
implementation "androidx.room:room-runtime:$ROOM_VERSION"
|
||||||
implementation "androidx.room:room-runtime:$room_version"
|
kapt "androidx.room:room-compiler:$ROOM_VERSION" // For Kotlin use kapt instead of annotationProcessor
|
||||||
kapt "androidx.room:room-compiler:$room_version" // For Kotlin use kapt instead of annotationProcessor
|
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.7.1'
|
implementation 'com.squareup.retrofit2:retrofit:2.7.1'
|
||||||
implementation "androidx.room:room-rxjava2:$room_version"
|
implementation "androidx.room:room-rxjava2:$ROOM_VERSION"
|
||||||
testImplementation "androidx.arch.core:core-testing:2.1.0"
|
testImplementation "androidx.arch.core:core-testing:2.1.0"
|
||||||
|
|
||||||
|
// Pref
|
||||||
|
// Java language implementation
|
||||||
|
implementation "androidx.preference:preference:$PREFERENCE_VERSION"
|
||||||
|
// Kotlin
|
||||||
|
implementation "androidx.preference:preference-ktx:$PREFERENCE_VERSION"
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package fr.free.nrw.commons.filepicker;
|
package fr.free.nrw.commons.filepicker;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
public class FilePickerConfiguration implements Constants {
|
public class FilePickerConfiguration implements Constants {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,28 +3,17 @@ package fr.free.nrw.commons.settings;
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.EditTextPreference;
|
import android.text.InputFilter;
|
||||||
import android.preference.ListPreference;
|
import android.text.InputType;
|
||||||
import android.preference.MultiSelectListPreference;
|
import androidx.preference.EditTextPreference;
|
||||||
import android.preference.Preference;
|
import androidx.preference.ListPreference;
|
||||||
import android.preference.PreferenceFragment;
|
import androidx.preference.MultiSelectListPreference;
|
||||||
import android.preference.SwitchPreference;
|
import androidx.preference.Preference;
|
||||||
import android.text.Editable;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
import android.text.TextWatcher;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
|
||||||
import com.karumi.dexter.Dexter;
|
import com.karumi.dexter.Dexter;
|
||||||
import com.karumi.dexter.listener.PermissionGrantedResponse;
|
import com.karumi.dexter.listener.PermissionGrantedResponse;
|
||||||
import com.karumi.dexter.listener.single.BasePermissionListener;
|
import com.karumi.dexter.listener.single.BasePermissionListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
|
||||||
|
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
import fr.free.nrw.commons.Utils;
|
import fr.free.nrw.commons.Utils;
|
||||||
import fr.free.nrw.commons.di.ApplicationlessInjection;
|
import fr.free.nrw.commons.di.ApplicationlessInjection;
|
||||||
|
|
@ -33,10 +22,15 @@ import fr.free.nrw.commons.logging.CommonsLogSender;
|
||||||
import fr.free.nrw.commons.upload.Language;
|
import fr.free.nrw.commons.upload.Language;
|
||||||
import fr.free.nrw.commons.utils.PermissionUtils;
|
import fr.free.nrw.commons.utils.PermissionUtils;
|
||||||
import fr.free.nrw.commons.utils.ViewUtil;
|
import fr.free.nrw.commons.utils.ViewUtil;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
import static fr.free.nrw.commons.utils.SystemThemeUtils.THEME_MODE_DEFAULT;
|
public class SettingsFragment extends PreferenceFragmentCompat {
|
||||||
|
|
||||||
public class SettingsFragment extends PreferenceFragment {
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named("default_preferences")
|
@Named("default_preferences")
|
||||||
|
|
@ -49,29 +43,19 @@ public class SettingsFragment extends PreferenceFragment {
|
||||||
private ListPreference langListPreference;
|
private ListPreference langListPreference;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
ApplicationlessInjection
|
ApplicationlessInjection
|
||||||
.getInstance(getActivity().getApplicationContext())
|
.getInstance(getActivity().getApplicationContext())
|
||||||
.getCommonsApplicationComponent()
|
.getCommonsApplicationComponent()
|
||||||
.inject(this);
|
.inject(this);
|
||||||
|
|
||||||
// Load the preferences from an XML resource
|
// Set the preferences from an XML resource
|
||||||
addPreferencesFromResource(R.xml.preferences);
|
setPreferencesFromResource(R.xml.preferences, rootKey);
|
||||||
|
|
||||||
themeListPreference = (ListPreference) findPreference(Prefs.KEY_THEME_VALUE);
|
themeListPreference = findPreference(Prefs.KEY_THEME_VALUE);
|
||||||
prepareTheme();
|
prepareTheme();
|
||||||
|
|
||||||
//Check if the Author Name switch is enabled and appropriately handle the author name usage
|
MultiSelectListPreference multiSelectListPref = findPreference(Prefs.MANAGED_EXIF_TAGS);
|
||||||
SwitchPreference useAuthorName = (SwitchPreference) findPreference("useAuthorName");
|
|
||||||
EditTextPreference authorName = (EditTextPreference) findPreference("authorName");
|
|
||||||
authorName.setEnabled(defaultKvStore.getBoolean("useAuthorName", false));
|
|
||||||
useAuthorName.setOnPreferenceChangeListener((preference, newValue) -> {
|
|
||||||
authorName.setEnabled((Boolean)newValue);
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
MultiSelectListPreference multiSelectListPref = (MultiSelectListPreference) findPreference(Prefs.MANAGED_EXIF_TAGS);
|
|
||||||
if (multiSelectListPref != null) {
|
if (multiSelectListPref != null) {
|
||||||
multiSelectListPref.setOnPreferenceChangeListener((preference, newValue) -> {
|
multiSelectListPref.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
if (newValue instanceof HashSet && !((HashSet) newValue).contains(getString(R.string.exif_tag_location))) {
|
if (newValue instanceof HashSet && !((HashSet) newValue).contains(getString(R.string.exif_tag_location))) {
|
||||||
|
|
@ -81,42 +65,44 @@ public class SettingsFragment extends PreferenceFragment {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
final EditTextPreference uploadLimit = (EditTextPreference) findPreference("uploads");
|
final EditTextPreference uploadLimit = findPreference("uploads");
|
||||||
int currentUploadLimit = defaultKvStore.getInt(Prefs.UPLOADS_SHOWING, 100);
|
int currentUploadLimit = defaultKvStore.getInt(Prefs.UPLOADS_SHOWING, 100);
|
||||||
uploadLimit.setText(Integer.toString(currentUploadLimit));
|
uploadLimit.setText(String.valueOf(currentUploadLimit));
|
||||||
uploadLimit.setSummary(Integer.toString(currentUploadLimit));
|
|
||||||
uploadLimit.getEditText().addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
|
|
||||||
|
uploadLimit.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
|
|
||||||
|
if (newValue.toString().length() == 0) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
int value = Integer.parseInt(newValue.toString());
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
if (value > 500) {
|
||||||
}
|
Snackbar error = Snackbar.make(getView(), R.string.maximum_limit_alert, Snackbar.LENGTH_LONG);
|
||||||
|
error.show();
|
||||||
@Override
|
return false;
|
||||||
public void afterTextChanged(Editable s) {
|
} else if (value == 0) {
|
||||||
if (s.length() == 0) return;
|
Snackbar error = Snackbar.make(getView(), R.string.cannot_be_zero, Snackbar.LENGTH_LONG);
|
||||||
|
error.show();
|
||||||
int value = Integer.parseInt(s.toString());
|
return false;
|
||||||
|
|
||||||
if (value > 500) {
|
|
||||||
uploadLimit.getEditText().setError(getString(R.string.maximum_limit_alert));
|
|
||||||
value = 500;
|
|
||||||
} else if (value == 0) {
|
|
||||||
uploadLimit.getEditText().setError(getString(R.string.cannot_be_zero));
|
|
||||||
value = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultKvStore.putInt(Prefs.UPLOADS_SHOWING, value);
|
|
||||||
defaultKvStore.putBoolean(Prefs.IS_CONTRIBUTION_COUNT_CHANGED, true);
|
|
||||||
uploadLimit.setText(Integer.toString(value));
|
|
||||||
uploadLimit.setSummary(Integer.toString(value));
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
langListPreference = (ListPreference) findPreference("descriptionDefaultLanguagePref");
|
uploadLimit.setOnBindEditTextListener(editText -> {
|
||||||
|
|
||||||
|
editText.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
|
editText.selectAll();
|
||||||
|
int maxLength = 3; // set maxLength to 3
|
||||||
|
editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)});
|
||||||
|
|
||||||
|
int value = Integer.parseInt(editText.getText().toString());
|
||||||
|
|
||||||
|
defaultKvStore.putInt(Prefs.UPLOADS_SHOWING, value);
|
||||||
|
defaultKvStore.putBoolean(Prefs.IS_CONTRIBUTION_COUNT_CHANGED, true);
|
||||||
|
uploadLimit.setText(Integer.toString(value));
|
||||||
|
});
|
||||||
|
|
||||||
|
langListPreference = findPreference("descriptionDefaultLanguagePref");
|
||||||
prepareLanguages();
|
prepareLanguages();
|
||||||
Preference betaTesterPreference = findPreference("becomeBetaTester");
|
Preference betaTesterPreference = findPreference("becomeBetaTester");
|
||||||
betaTesterPreference.setOnPreferenceClickListener(preference -> {
|
betaTesterPreference.setOnPreferenceClickListener(preference -> {
|
||||||
|
|
@ -129,42 +115,26 @@ public class SettingsFragment extends PreferenceFragment {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
// Disable some settings when not logged in.
|
// Disable some settings when not logged in.
|
||||||
if (defaultKvStore.getBoolean("login_skipped", false)){
|
if (defaultKvStore.getBoolean("login_skipped", false)) {
|
||||||
SwitchPreference useExternalStorage = (SwitchPreference) findPreference("useExternalStorage");
|
findPreference("useExternalStorage").setEnabled(false);
|
||||||
SwitchPreference displayNearbyCardView = (SwitchPreference) findPreference("displayNearbyCardView");
|
findPreference("useAuthorName").setEnabled(false);
|
||||||
SwitchPreference displayLocationPermissionForCardView = (SwitchPreference) findPreference("displayLocationPermissionForCardView");
|
findPreference("displayNearbyCardView").setEnabled(false);
|
||||||
SwitchPreference displayCampaignsCardView = (SwitchPreference) findPreference("displayCampaignsCardView");
|
findPreference("displayLocationPermissionForCardView").setEnabled(false);
|
||||||
useExternalStorage.setEnabled(false);
|
findPreference("displayCampaignsCardView").setEnabled(false);
|
||||||
uploadLimit.setEnabled(false);
|
uploadLimit.setEnabled(false);
|
||||||
useAuthorName.setEnabled(false);
|
|
||||||
displayNearbyCardView.setEnabled(false);
|
|
||||||
displayLocationPermissionForCardView.setEnabled(false);
|
|
||||||
displayCampaignsCardView.setEnabled(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses previously saved theme if there is any, if not then uses default.
|
* Sets the theme pref
|
||||||
*/
|
*/
|
||||||
private void prepareTheme() {
|
private void prepareTheme() {
|
||||||
|
|
||||||
themeListPreference.setSummary(getThemeSummary(getCurrentTheme()));
|
|
||||||
|
|
||||||
themeListPreference.setOnPreferenceChangeListener((preference, newValue) -> {
|
themeListPreference.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
getActivity().recreate();
|
getActivity().recreate();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private CharSequence getThemeSummary(String value) {
|
|
||||||
int prefIndex = themeListPreference.findIndexOfValue(value);
|
|
||||||
return themeListPreference.getEntries()[prefIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getCurrentTheme() {
|
|
||||||
return defaultKvStore.getString(Prefs.KEY_THEME_VALUE, THEME_MODE_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepares language summary and language codes list and adds them to list preference as pairs.
|
* Prepares language summary and language codes list and adds them to list preference as pairs.
|
||||||
* Uses previously saved language if there is any, if not uses phone local as initial language.
|
* Uses previously saved language if there is any, if not uses phone local as initial language.
|
||||||
|
|
@ -195,19 +165,14 @@ public class SettingsFragment extends PreferenceFragment {
|
||||||
String languageCode = getCurrentLanguageCode();
|
String languageCode = getCurrentLanguageCode();
|
||||||
if (languageCode.equals("")){
|
if (languageCode.equals("")){
|
||||||
// If current language code is empty, means none selected by user yet so use phone local
|
// If current language code is empty, means none selected by user yet so use phone local
|
||||||
langListPreference.setSummary(Locale.getDefault().getDisplayLanguage());
|
|
||||||
langListPreference.setValue(Locale.getDefault().getLanguage());
|
langListPreference.setValue(Locale.getDefault().getLanguage());
|
||||||
} else {
|
} else {
|
||||||
// If any language is selected by user previously, use it
|
// If any language is selected by user previously, use it
|
||||||
int prefIndex = langListPreference.findIndexOfValue(languageCode);
|
|
||||||
langListPreference.setSummary(langListPreference.getEntries()[prefIndex]);
|
|
||||||
langListPreference.setValue(languageCode);
|
langListPreference.setValue(languageCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
langListPreference.setOnPreferenceChangeListener((preference, newValue) -> {
|
langListPreference.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
String userSelectedValue = (String) newValue;
|
String userSelectedValue = (String) newValue;
|
||||||
int prefIndex = langListPreference.findIndexOfValue(userSelectedValue);
|
|
||||||
langListPreference.setSummary(langListPreference.getEntries()[prefIndex]);
|
|
||||||
saveLanguageValue(userSelectedValue);
|
saveLanguageValue(userSelectedValue);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
package fr.free.nrw.commons.ui.LongTitlePreferences;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.preference.EditTextPreference;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by seannemann on 6/27/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class LongTitleEditTextPreference extends EditTextPreference {
|
|
||||||
public LongTitleEditTextPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LongTitleEditTextPreference(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LongTitleEditTextPreference(Context context) {
|
|
||||||
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onBindView(View view)
|
|
||||||
{
|
|
||||||
super.onBindView(view);
|
|
||||||
|
|
||||||
TextView title= view.findViewById(android.R.id.title);
|
|
||||||
if (title != null) {
|
|
||||||
title.setSingleLine(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
package fr.free.nrw.commons.ui.LongTitlePreferences;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.preference.ListPreference;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by seannemann on 6/27/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class LongTitleListPreference extends ListPreference {
|
|
||||||
public LongTitleListPreference(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LongTitleListPreference(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onBindView(View view)
|
|
||||||
{
|
|
||||||
super.onBindView(view);
|
|
||||||
|
|
||||||
TextView title= view.findViewById(android.R.id.title);
|
|
||||||
if (title != null) {
|
|
||||||
title.setSingleLine(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
package fr.free.nrw.commons.ui.LongTitlePreferences;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.preference.MultiSelectListPreference;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
public class LongTitleMultiSelectListPreference extends MultiSelectListPreference {
|
|
||||||
/*
|
|
||||||
public LongTitleMultiSelectListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LongTitleMultiSelectListPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
public LongTitleMultiSelectListPreference(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LongTitleMultiSelectListPreference(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onBindView(View view)
|
|
||||||
{
|
|
||||||
super.onBindView(view);
|
|
||||||
|
|
||||||
TextView title= view.findViewById(android.R.id.title);
|
|
||||||
if (title != null) {
|
|
||||||
title.setSingleLine(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
package fr.free.nrw.commons.ui.LongTitlePreferences;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.preference.Preference;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by seannemann on 6/27/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class LongTitlePreference extends Preference {
|
|
||||||
public LongTitlePreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LongTitlePreference(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LongTitlePreference(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onBindView(View view)
|
|
||||||
{
|
|
||||||
super.onBindView(view);
|
|
||||||
|
|
||||||
TextView title= view.findViewById(android.R.id.title);
|
|
||||||
if (title != null) {
|
|
||||||
title.setSingleLine(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
package fr.free.nrw.commons.ui.LongTitlePreferences;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.preference.PreferenceCategory;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by seannemann on 6/27/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class LongTitlePreferenceCategory extends PreferenceCategory {
|
|
||||||
public LongTitlePreferenceCategory(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LongTitlePreferenceCategory(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LongTitlePreferenceCategory(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onBindView(View view)
|
|
||||||
{
|
|
||||||
super.onBindView(view);
|
|
||||||
|
|
||||||
TextView title= view.findViewById(android.R.id.title);
|
|
||||||
if (title != null) {
|
|
||||||
title.setSingleLine(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
package fr.free.nrw.commons.ui.LongTitlePreferences;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.preference.SwitchPreference;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by seannemann on 6/27/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class LongTitleSwitchPreference extends SwitchPreference {
|
|
||||||
public LongTitleSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LongTitleSwitchPreference(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LongTitleSwitchPreference(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onBindView(View view)
|
|
||||||
{
|
|
||||||
super.onBindView(view);
|
|
||||||
|
|
||||||
TextView title= view.findViewById(android.R.id.title);
|
|
||||||
if (title != null) {
|
|
||||||
title.setSingleLine(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,99 +1,109 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen
|
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitlePreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/preference_category_appearance">
|
android:title="@string/preference_category_appearance">
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitleListPreference
|
<ListPreference
|
||||||
android:key="appThemePref"
|
android:key="appThemePref"
|
||||||
android:title= "@string/preference_theme"
|
android:title= "@string/preference_theme"
|
||||||
|
app:singleLineTitle="false"
|
||||||
android:entries="@array/pref_theme_entries"
|
android:entries="@array/pref_theme_entries"
|
||||||
android:entryValues="@array/pref_theme_entries_values"
|
android:entryValues="@array/pref_theme_entries_values"
|
||||||
android:defaultValue="0"
|
app:useSimpleSummaryProvider="true"
|
||||||
android:summary="@string/theme_default_name" />
|
android:defaultValue="0" />
|
||||||
|
|
||||||
</fr.free.nrw.commons.ui.LongTitlePreferences.LongTitlePreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitlePreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/preference_category_general">
|
android:title="@string/preference_category_general">
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitleSwitchPreference
|
<SwitchPreference
|
||||||
android:key="useExternalStorage"
|
android:defaultValue="true"
|
||||||
android:title="@string/use_external_storage"
|
android:key="useExternalStorage"
|
||||||
android:defaultValue="true"
|
app:singleLineTitle="false"
|
||||||
android:summary="@string/use_external_storage_summary" />
|
android:summary="@string/use_external_storage_summary"
|
||||||
|
android:title="@string/use_external_storage" />
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitleEditTextPreference
|
<EditTextPreference
|
||||||
android:key="uploads"
|
android:defaultValue="100"
|
||||||
android:defaultValue="100"
|
android:key="uploads"
|
||||||
android:title= "@string/set_limit"
|
app:useSimpleSummaryProvider="true"
|
||||||
android:inputType="number"
|
app:singleLineTitle="false"
|
||||||
android:maxLength="3" />
|
android:title="@string/set_limit" />
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitleListPreference
|
<ListPreference
|
||||||
android:key="descriptionDefaultLanguagePref"
|
android:key="descriptionDefaultLanguagePref"
|
||||||
android:title= "@string/default_description_language"
|
app:useSimpleSummaryProvider="true"
|
||||||
android:summary="English" />
|
app:singleLineTitle="false"
|
||||||
|
android:title="@string/default_description_language" />
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitleSwitchPreference
|
<SwitchPreference
|
||||||
android:key="useAuthorName"
|
android:key="useAuthorName"
|
||||||
android:title="@string/preference_author_name_toggle"
|
app:singleLineTitle="false"
|
||||||
android:summary="@string/preference_author_name_toggle_summary"/>
|
android:summary="@string/preference_author_name_toggle_summary"
|
||||||
|
android:title="@string/preference_author_name_toggle" />
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitleEditTextPreference
|
<EditTextPreference
|
||||||
android:key="authorName"
|
android:key="authorName"
|
||||||
android:title="@string/preference_author_name"
|
app:singleLineTitle="false"
|
||||||
android:summary="@string/preference_author_name_summary"
|
app:dependency="useAuthorName"
|
||||||
/>
|
android:summary="@string/preference_author_name_summary"
|
||||||
|
android:title="@string/preference_author_name" />
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitleSwitchPreference
|
<SwitchPreference
|
||||||
android:key="displayNearbyCardView"
|
android:defaultValue="true"
|
||||||
android:title="@string/display_nearby_notification"
|
android:key="displayNearbyCardView"
|
||||||
android:defaultValue="true"
|
app:singleLineTitle="false"
|
||||||
android:summary="@string/display_nearby_notification_summary" />
|
android:summary="@string/display_nearby_notification_summary"
|
||||||
|
android:title="@string/display_nearby_notification" />
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitleSwitchPreference
|
<SwitchPreference
|
||||||
android:key="displayLocationPermissionForCardView"
|
android:defaultValue="true"
|
||||||
android:title="@string/display_location_permission_title"
|
android:key="displayLocationPermissionForCardView"
|
||||||
android:defaultValue="true"
|
app:singleLineTitle="false"
|
||||||
android:summary="@string/display_location_permission_explanation" />
|
android:summary="@string/display_location_permission_explanation"
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitleSwitchPreference
|
android:title="@string/display_location_permission_title" />
|
||||||
android:key="displayCampaignsCardView"
|
<SwitchPreference
|
||||||
android:title="@string/display_campaigns"
|
android:defaultValue="true"
|
||||||
android:defaultValue="true"
|
android:key="displayCampaignsCardView"
|
||||||
android:summary="@string/display_campaigns_explanation" />
|
app:singleLineTitle="false"
|
||||||
|
android:summary="@string/display_campaigns_explanation"
|
||||||
|
android:title="@string/display_campaigns" />
|
||||||
|
|
||||||
</fr.free.nrw.commons.ui.LongTitlePreferences.LongTitlePreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitlePreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/preference_category_privacy">
|
android:title="@string/preference_category_privacy">
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitleMultiSelectListPreference
|
<MultiSelectListPreference
|
||||||
android:entries="@array/pref_exifTag_entries"
|
android:entries="@array/pref_exifTag_entries"
|
||||||
android:entryValues="@array/pref_exifTag_values"
|
android:entryValues="@array/pref_exifTag_values"
|
||||||
android:key="managed_exif_tags"
|
android:key="managed_exif_tags"
|
||||||
android:title="@string/manage_exif_tags"
|
app:singleLineTitle="false"
|
||||||
android:summary="@string/manage_exif_tags_summary"/>
|
android:summary="@string/manage_exif_tags_summary"
|
||||||
|
android:title="@string/manage_exif_tags" />
|
||||||
|
|
||||||
</fr.free.nrw.commons.ui.LongTitlePreferences.LongTitlePreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<!-- The key 'allowGps' was used before and has since been removed based on the discussion at #1599.
|
<!-- The key 'allowGps' was used before and has since been removed based on the discussion at #1599.
|
||||||
Do not reuse this key unless you revive the same feature with the changes mentioned at #1599.-->
|
Do not reuse this key unless you revive the same feature with the changes mentioned at #1599.-->
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitlePreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/preference_category_feedback">
|
android:title="@string/preference_category_feedback">
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitlePreference
|
<Preference
|
||||||
android:key="becomeBetaTester"
|
android:key="becomeBetaTester"
|
||||||
android:title="@string/become_a_tester_title"
|
android:summary="@string/become_a_tester_description"
|
||||||
android:summary="@string/become_a_tester_description">
|
app:singleLineTitle="false"
|
||||||
</fr.free.nrw.commons.ui.LongTitlePreferences.LongTitlePreference>
|
android:title="@string/become_a_tester_title"/>
|
||||||
|
|
||||||
<fr.free.nrw.commons.ui.LongTitlePreferences.LongTitlePreference
|
<Preference
|
||||||
android:key="sendLogFile"
|
android:key="sendLogFile"
|
||||||
android:title="@string/send_log_file"
|
android:summary="@string/send_log_file_description"
|
||||||
android:summary="@string/send_log_file_description"/>
|
app:singleLineTitle="false"
|
||||||
|
android:title="@string/send_log_file" />
|
||||||
|
|
||||||
</fr.free.nrw.commons.ui.LongTitlePreferences.LongTitlePreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
@ -20,6 +20,8 @@ KOTLIN_VERSION=1.3.21
|
||||||
BUTTERKNIFE_VERSION=10.1.0
|
BUTTERKNIFE_VERSION=10.1.0
|
||||||
LEAK_CANARY_VERSION=1.6.2
|
LEAK_CANARY_VERSION=1.6.2
|
||||||
DAGGER_VERSION=2.21
|
DAGGER_VERSION=2.21
|
||||||
|
ROOM_VERSION=2.2.3
|
||||||
|
PREFERENCE_VERSION=1.1.0
|
||||||
|
|
||||||
systemProp.http.proxyPort=0
|
systemProp.http.proxyPort=0
|
||||||
systemProp.http.proxyHost=
|
systemProp.http.proxyHost=
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue