Fix Codecy Failures

Fix Codecy Failures

Fix Codecy Failures
This commit is contained in:
Dinu Kumarasiri 2017-05-13 17:45:16 +02:00
parent 28ca9ec394
commit 7050efc996
2 changed files with 22 additions and 16 deletions

View file

@ -42,7 +42,8 @@ public class ContributionsActivity
AdapterView.OnItemClickListener,
MediaDetailPagerFragment.MediaDetailProvider,
FragmentManager.OnBackStackChangedListener,
ContributionsListFragment.SourceRefresher {
ContributionsListFragment.SourceRefresher
{
private Cursor allContributions;
private ContributionsListFragment contributionsList;
@ -209,9 +210,12 @@ public class ContributionsActivity
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
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);
return new CursorLoader(this, ContributionsContentProvider.BASE_URI,
Contribution.Table.ALL_FIELDS, CONTRIBUTION_SELECTION, null,
CONTRIBUTION_SORT + "LIMIT " + uploads);
}
@Override

View file

@ -59,7 +59,8 @@ public class SettingsFragment extends PreferenceFragment {
});
final EditTextPreference uploadLimit = (EditTextPreference) findPreference("uploads");
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
SharedPreferences sharedPref = PreferenceManager
.getDefaultSharedPreferences(getActivity().getApplicationContext());
int uploads = sharedPref.getInt(Prefs.UPLOADS_SHOWING, 100);
uploadLimit.setSummary(uploads + "");
uploadLimit.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@ -67,15 +68,16 @@ public class SettingsFragment extends PreferenceFragment {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
int value = Integer.parseInt(newValue.toString());
final SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
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(){
.setPositiveButton(android.R.string.yes,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
})
.setIcon(android.R.drawable.ic_dialog_alert)