mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 13:23:58 +01:00
Merge remote-tracking branch 'refs/remotes/commons-app/master'
This commit is contained in:
commit
a17a5c280d
5 changed files with 71 additions and 4 deletions
|
|
@ -5,10 +5,12 @@ import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.DataSetObserver;
|
import android.database.DataSetObserver;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.LoaderManager;
|
import android.support.v4.app.LoaderManager;
|
||||||
import android.support.v4.content.CursorLoader;
|
import android.support.v4.content.CursorLoader;
|
||||||
|
|
@ -30,6 +32,7 @@ import fr.free.nrw.commons.R;
|
||||||
import fr.free.nrw.commons.auth.AuthenticatedActivity;
|
import fr.free.nrw.commons.auth.AuthenticatedActivity;
|
||||||
import fr.free.nrw.commons.auth.WikiAccountAuthenticator;
|
import fr.free.nrw.commons.auth.WikiAccountAuthenticator;
|
||||||
import fr.free.nrw.commons.media.MediaDetailPagerFragment;
|
import fr.free.nrw.commons.media.MediaDetailPagerFragment;
|
||||||
|
import fr.free.nrw.commons.settings.Prefs;
|
||||||
import fr.free.nrw.commons.upload.UploadService;
|
import fr.free.nrw.commons.upload.UploadService;
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
|
|
@ -39,7 +42,8 @@ public class ContributionsActivity
|
||||||
AdapterView.OnItemClickListener,
|
AdapterView.OnItemClickListener,
|
||||||
MediaDetailPagerFragment.MediaDetailProvider,
|
MediaDetailPagerFragment.MediaDetailProvider,
|
||||||
FragmentManager.OnBackStackChangedListener,
|
FragmentManager.OnBackStackChangedListener,
|
||||||
ContributionsListFragment.SourceRefresher {
|
ContributionsListFragment.SourceRefresher
|
||||||
|
{
|
||||||
|
|
||||||
private Cursor allContributions;
|
private Cursor allContributions;
|
||||||
private ContributionsListFragment contributionsList;
|
private ContributionsListFragment contributionsList;
|
||||||
|
|
@ -206,7 +210,12 @@ public class ContributionsActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
|
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
|
||||||
return new CursorLoader(this, ContributionsContentProvider.BASE_URI, Contribution.Table.ALL_FIELDS, CONTRIBUTION_SELECTION, null, CONTRIBUTION_SORT);
|
SharedPreferences sharedPref =
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||||
|
int uploads = sharedPref.getInt(Prefs.UPLOADS_SHOWING, 100);
|
||||||
|
return new CursorLoader(this, ContributionsContentProvider.BASE_URI,
|
||||||
|
Contribution.Table.ALL_FIELDS, CONTRIBUTION_SELECTION, null,
|
||||||
|
CONTRIBUTION_SORT + "LIMIT " + uploads);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ public class Prefs {
|
||||||
|
|
||||||
public static String TRACKING_ENABLED = "eventLogging";
|
public static String TRACKING_ENABLED = "eventLogging";
|
||||||
public static final String DEFAULT_LICENSE = "defaultLicense";
|
public static final String DEFAULT_LICENSE = "defaultLicense";
|
||||||
|
public static final String UPLOADS_SHOWING = "uploadsshowing";
|
||||||
|
|
||||||
public static class Licenses {
|
public static class Licenses {
|
||||||
public static final String CC_BY_SA_3 = "CC BY-SA 3.0";
|
public static final String CC_BY_SA_3 = "CC BY-SA 3.0";
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
package fr.free.nrw.commons.settings;
|
package fr.free.nrw.commons.settings;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
|
import android.preference.EditTextPreference;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
import fr.free.nrw.commons.Utils;
|
import fr.free.nrw.commons.Utils;
|
||||||
|
|
@ -36,7 +41,7 @@ public class SettingsFragment extends PreferenceFragment {
|
||||||
});
|
});
|
||||||
|
|
||||||
licensePreference.setSummary(getString(Utils.licenseNameFor(licensePreference.getValue())));
|
licensePreference.setSummary(getString(Utils.licenseNameFor(licensePreference.getValue())));
|
||||||
licensePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
licensePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
preference.setSummary(getString(Utils.licenseNameFor((String) newValue)));
|
preference.setSummary(getString(Utils.licenseNameFor((String) newValue)));
|
||||||
|
|
@ -52,5 +57,44 @@ public class SettingsFragment extends PreferenceFragment {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final EditTextPreference uploadLimit = (EditTextPreference) findPreference("uploads");
|
||||||
|
SharedPreferences sharedPref = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(getActivity().getApplicationContext());
|
||||||
|
int uploads = sharedPref.getInt(Prefs.UPLOADS_SHOWING, 100);
|
||||||
|
uploadLimit.setSummary(uploads + "");
|
||||||
|
uploadLimit.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
int value = Integer.parseInt(newValue.toString());
|
||||||
|
final SharedPreferences sharedPref = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(getActivity().getApplicationContext());
|
||||||
|
final SharedPreferences.Editor editor = sharedPref.edit();
|
||||||
|
if (value > 500) {
|
||||||
|
new AlertDialog.Builder(getActivity())
|
||||||
|
.setTitle(R.string.maximum_limit)
|
||||||
|
.setMessage(R.string.maximum_limit_alert)
|
||||||
|
.setPositiveButton(android.R.string.yes,
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
|
.show();
|
||||||
|
editor.putInt(Prefs.UPLOADS_SHOWING, 500);
|
||||||
|
uploadLimit.setSummary(500 + "");
|
||||||
|
uploadLimit.setText(500 + "");
|
||||||
|
} else {
|
||||||
|
editor.putInt(Prefs.UPLOADS_SHOWING, Integer.parseInt(newValue.toString()));
|
||||||
|
uploadLimit.setSummary(newValue.toString());
|
||||||
|
}
|
||||||
|
editor.apply();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
<item quantity="one">%d file uploading</item>
|
<item quantity="one">%d file uploading</item>
|
||||||
<item quantity="other">%d files uploading</item>
|
<item quantity="other">%d files uploading</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
<string name="title_activity_contributions">My uploads</string>
|
<string name="title_activity_contributions">My Recent Uploads</string>
|
||||||
<string name="contribution_state_queued">Queued</string>
|
<string name="contribution_state_queued">Queued</string>
|
||||||
<string name="contribution_state_failed">Failed</string>
|
<string name="contribution_state_failed">Failed</string>
|
||||||
<string name="contribution_state_in_progress">%1$d%% complete</string>
|
<string name="contribution_state_in_progress">%1$d%% complete</string>
|
||||||
|
|
@ -173,4 +173,9 @@ Tap this message (or hit back) to skip this step.</string>
|
||||||
<string name="map_theme_light">mapbox://styles/mapbox/traffic-day-v2</string>
|
<string name="map_theme_light">mapbox://styles/mapbox/traffic-day-v2</string>
|
||||||
<string name="map_theme_dark">mapbox://styles/mapbox/traffic-night-v2</string>
|
<string name="map_theme_dark">mapbox://styles/mapbox/traffic-night-v2</string>
|
||||||
<string name="mapbox_commons_app_token">pk.eyJ1IjoibWFza2FyYXZpdmVrIiwiYSI6ImNqMmxvdzFjMTAwMHYzM283ZWM3eW5tcDAifQ.ib5SZ9EVjwJe6GSKve0bcg</string>
|
<string name="mapbox_commons_app_token">pk.eyJ1IjoibWFza2FyYXZpdmVrIiwiYSI6ImNqMmxvdzFjMTAwMHYzM283ZWM3eW5tcDAifQ.ib5SZ9EVjwJe6GSKve0bcg</string>
|
||||||
|
<string name="number_of_uploads">My Recent Upload Limit</string>
|
||||||
|
<string name="maximum_limit">Maximum Limit</string>
|
||||||
|
<string name="maximum_limit_alert">Maximum limit should be 500</string>
|
||||||
|
<string name="set_limit">Set Recent Upload Limit</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,12 @@
|
||||||
android:summary="@string/use_wikidata_summary"
|
android:summary="@string/use_wikidata_summary"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<EditTextPreference
|
||||||
|
android:key="uploads"
|
||||||
|
android:defaultValue="100"
|
||||||
|
android:title= "@string/set_limit"
|
||||||
|
android:inputType="numberDecimal"
|
||||||
|
android:maxLength="3"
|
||||||
|
/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue