Add missing @Override annotations

This commit is contained in:
veyndan 2017-02-26 02:38:05 +00:00
parent f5892ca34b
commit c1bcd921e3
22 changed files with 98 additions and 0 deletions

View file

@ -13,6 +13,7 @@ public class AboutActivity extends Activity {
private TextView privacyPolicyText; private TextView privacyPolicyText;
private TextView uploadsToText; private TextView uploadsToText;
@Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about); setContentView(R.layout.activity_about);

View file

@ -157,10 +157,12 @@ public class CommonsApplication extends Application {
public com.android.volley.toolbox.ImageLoader getImageLoader() { public com.android.volley.toolbox.ImageLoader getImageLoader() {
if(imageLoader == null) { if(imageLoader == null) {
imageLoader = new com.android.volley.toolbox.ImageLoader(volleyQueue, new com.android.volley.toolbox.ImageLoader.ImageCache() { imageLoader = new com.android.volley.toolbox.ImageLoader(volleyQueue, new com.android.volley.toolbox.ImageLoader.ImageCache() {
@Override
public Bitmap getBitmap(String key) { public Bitmap getBitmap(String key) {
return imageCache.get(key); return imageCache.get(key);
} }
@Override
public void putBitmap(String key, Bitmap bitmap) { public void putBitmap(String key, Bitmap bitmap) {
imageCache.put(key, bitmap); imageCache.put(key, bitmap);
} }

View file

@ -15,10 +15,12 @@ import java.util.regex.Pattern;
public class Media implements Parcelable { public class Media implements Parcelable {
public static Creator<Media> CREATOR = new Creator<Media>() { public static Creator<Media> CREATOR = new Creator<Media>() {
@Override
public Media createFromParcel(Parcel parcel) { public Media createFromParcel(Parcel parcel) {
return new Media(parcel); return new Media(parcel);
} }
@Override
public Media[] newArray(int i) { public Media[] newArray(int i) {
return new Media[0]; return new Media[0];
} }
@ -204,10 +206,12 @@ public class Media implements Parcelable {
this.creator = creator; this.creator = creator;
} }
@Override
public int describeContents() { public int describeContents() {
return 0; return 0;
} }
@Override
public void writeToParcel(Parcel parcel, int flags) { public void writeToParcel(Parcel parcel, int flags) {
parcel.writeParcelable(localUri, flags); parcel.writeParcelable(localUri, flags);
parcel.writeString(imageUrl); parcel.writeString(imageUrl);

View file

@ -154,6 +154,7 @@ public class MediaWikiImageView extends ImageView {
public void onErrorResponse(final VolleyError error) { public void onErrorResponse(final VolleyError error) {
if(!tryOriginal) { if(!tryOriginal) {
post(new Runnable() { post(new Runnable() {
@Override
public void run() { public void run() {
loadImageIfNecessary(false, true); loadImageIfNecessary(false, true);
} }

View file

@ -38,6 +38,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
licensePreference.setSummary(getString(fr.free.nrw.commons.Utils.licenseNameFor(licensePreference.getValue()))); licensePreference.setSummary(getString(fr.free.nrw.commons.Utils.licenseNameFor(licensePreference.getValue())));
licensePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { licensePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
preference.setSummary(getString(fr.free.nrw.commons.Utils.licenseNameFor((String)newValue))); preference.setSummary(getString(fr.free.nrw.commons.Utils.licenseNameFor((String)newValue)));
return true; return true;
@ -61,6 +62,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
.unregisterOnSharedPreferenceChangeListener(this); .unregisterOnSharedPreferenceChangeListener(this);
} }
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
} }
@ -128,6 +130,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
getDelegate().onDestroy(); getDelegate().onDestroy();
} }
@Override
public void invalidateOptionsMenu() { public void invalidateOptionsMenu() {
getDelegate().invalidateOptionsMenu(); getDelegate().invalidateOptionsMenu();
} }

View file

@ -51,6 +51,7 @@ public class WelcomeActivity extends Activity {
if (position == PAGE_FINAL) { if (position == PAGE_FINAL) {
yesButton = (Button)view.findViewById(R.id.welcomeYesButton); yesButton = (Button)view.findViewById(R.id.welcomeYesButton);
yesButton.setOnClickListener(new View.OnClickListener() { yesButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) { public void onClick(View view) {
finish(); finish();
} }

View file

@ -161,10 +161,13 @@ public class LoginActivity extends AccountAuthenticatorActivity {
prefs = getSharedPreferences("fr.free.nrw.commons", MODE_PRIVATE); prefs = getSharedPreferences("fr.free.nrw.commons", MODE_PRIVATE);
TextWatcher loginEnabler = new TextWatcher() { TextWatcher loginEnabler = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int start, int count, int after) { } public void beforeTextChanged(CharSequence charSequence, int start, int count, int after) { }
@Override
public void onTextChanged(CharSequence charSequence, int start, int count, int after) { } public void onTextChanged(CharSequence charSequence, int start, int count, int after) { }
@Override
public void afterTextChanged(Editable editable) { public void afterTextChanged(Editable editable) {
if(usernameEdit.getText().length() != 0 && passwordEdit.getText().length() != 0) { if(usernameEdit.getText().length() != 0 && passwordEdit.getText().length() != 0) {
loginButton.setEnabled(true); loginButton.setEnabled(true);
@ -177,6 +180,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
usernameEdit.addTextChangedListener(loginEnabler); usernameEdit.addTextChangedListener(loginEnabler);
passwordEdit.addTextChangedListener(loginEnabler); passwordEdit.addTextChangedListener(loginEnabler);
passwordEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() { passwordEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) { public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
if (loginButton.isEnabled()) { if (loginButton.isEnabled()) {
if (actionId == EditorInfo.IME_ACTION_DONE) { if (actionId == EditorInfo.IME_ACTION_DONE) {
@ -192,6 +196,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
}); });
loginButton.setOnClickListener(new View.OnClickListener() { loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
that.performLogin(); that.performLogin();
} }

View file

@ -27,10 +27,12 @@ public class CategoriesAdapter extends BaseAdapter {
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
} }
@Override
public int getCount() { public int getCount() {
return items.size(); return items.size();
} }
@Override
public Object getItem(int i) { public Object getItem(int i) {
return items.get(i); return items.get(i);
} }
@ -43,10 +45,12 @@ public class CategoriesAdapter extends BaseAdapter {
this.items = items; this.items = items;
} }
@Override
public long getItemId(int i) { public long getItemId(int i) {
return i; return i;
} }
@Override
public View getView(int i, View view, ViewGroup viewGroup) { public View getView(int i, View view, ViewGroup viewGroup) {
CheckedTextView checkedView; CheckedTextView checkedView;

View file

@ -89,10 +89,12 @@ public class CategorizationFragment extends Fragment {
public boolean selected; public boolean selected;
public static Creator<CategoryItem> CREATOR = new Creator<CategoryItem>() { public static Creator<CategoryItem> CREATOR = new Creator<CategoryItem>() {
@Override
public CategoryItem createFromParcel(Parcel parcel) { public CategoryItem createFromParcel(Parcel parcel) {
return new CategoryItem(parcel); return new CategoryItem(parcel);
} }
@Override
public CategoryItem[] newArray(int i) { public CategoryItem[] newArray(int i) {
return new CategoryItem[0]; return new CategoryItem[0];
} }
@ -108,10 +110,12 @@ public class CategorizationFragment extends Fragment {
selected = in.readInt() == 1; selected = in.readInt() == 1;
} }
@Override
public int describeContents() { public int describeContents() {
return 0; return 0;
} }
@Override
public void writeToParcel(Parcel parcel, int flags) { public void writeToParcel(Parcel parcel, int flags) {
parcel.writeString(name); parcel.writeString(name);
parcel.writeInt(selected ? 1 : 0); parcel.writeInt(selected ? 1 : 0);
@ -411,6 +415,7 @@ public class CategorizationFragment extends Fragment {
categoriesSkip = (TextView) rootView.findViewById(R.id.categoriesExplanation); categoriesSkip = (TextView) rootView.findViewById(R.id.categoriesExplanation);
categoriesSkip.setOnClickListener(new View.OnClickListener() { categoriesSkip.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) { public void onClick(View view) {
getActivity().onBackPressed(); getActivity().onBackPressed();
getActivity().finish(); getActivity().finish();
@ -430,6 +435,7 @@ public class CategorizationFragment extends Fragment {
categoriesList.setAdapter(categoriesAdapter); categoriesList.setAdapter(categoriesAdapter);
categoriesList.setOnItemClickListener(new AdapterView.OnItemClickListener() { categoriesList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int index, long id) { public void onItemClick(AdapterView<?> adapterView, View view, int index, long id) {
CheckedTextView checkedView = (CheckedTextView) view; CheckedTextView checkedView = (CheckedTextView) view;
CategoryItem item = (CategoryItem) adapterView.getAdapter().getItem(index); CategoryItem item = (CategoryItem) adapterView.getAdapter().getItem(index);
@ -442,13 +448,16 @@ public class CategorizationFragment extends Fragment {
}); });
categoriesFilter.addTextChangedListener(new TextWatcher() { categoriesFilter.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
} }
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
startUpdatingCategoryList(); startUpdatingCategoryList();
} }
@Override
public void afterTextChanged(Editable editable) { public void afterTextChanged(Editable editable) {
} }
@ -500,11 +509,13 @@ public class CategorizationFragment extends Fragment {
builder.setMessage("Are you sure you want to go back? The image will not have any categories saved.") builder.setMessage("Are you sure you want to go back? The image will not have any categories saved.")
.setTitle("Warning"); .setTitle("Warning");
builder.setPositiveButton("No", new DialogInterface.OnClickListener() { builder.setPositiveButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
//No need to do anything, user remains on categorization screen //No need to do anything, user remains on categorization screen
} }
}); });
builder.setNegativeButton("Yes", new DialogInterface.OnClickListener() { builder.setNegativeButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
getActivity().finish(); getActivity().finish();
} }
@ -548,12 +559,14 @@ public class CategorizationFragment extends Fragment {
builder.setMessage("Images without categories are rarely usable. Are you sure you want to submit without selecting categories?") builder.setMessage("Images without categories are rarely usable. Are you sure you want to submit without selecting categories?")
.setTitle("No Categories Selected"); .setTitle("No Categories Selected");
builder.setPositiveButton("No, go back", new DialogInterface.OnClickListener() { builder.setPositiveButton("No, go back", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
//Exit menuItem so user can select their categories //Exit menuItem so user can select their categories
return; return;
} }
}); });
builder.setNegativeButton("Yes, submit", new DialogInterface.OnClickListener() { builder.setNegativeButton("Yes, submit", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
//Proceed to submission //Proceed to submission
onCategoriesSaveHandler.onCategoriesSave(selectedCategories); onCategoriesSaveHandler.onCategoriesSave(selectedCategories);

View file

@ -21,10 +21,12 @@ import fr.free.nrw.commons.Utils;
public class Contribution extends Media { public class Contribution extends Media {
public static Creator<Contribution> CREATOR = new Creator<Contribution>() { public static Creator<Contribution> CREATOR = new Creator<Contribution>() {
@Override
public Contribution createFromParcel(Parcel parcel) { public Contribution createFromParcel(Parcel parcel) {
return new Contribution(parcel); return new Contribution(parcel);
} }
@Override
public Contribution[] newArray(int i) { public Contribution[] newArray(int i) {
return new Contribution[0]; return new Contribution[0];
} }
@ -212,6 +214,7 @@ public class Contribution extends Media {
return cv; return cv;
} }
@Override
public void setFilename(String filename) { public void setFilename(String filename) {
this.filename = filename; this.filename = filename;
} }

View file

@ -63,11 +63,13 @@ public class ContributionsActivity
} }
private ServiceConnection uploadServiceConnection = new ServiceConnection() { private ServiceConnection uploadServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName componentName, IBinder binder) { public void onServiceConnected(ComponentName componentName, IBinder binder) {
uploadService = (UploadService) ((HandlerService.HandlerServiceLocalBinder)binder).getService(); uploadService = (UploadService) ((HandlerService.HandlerServiceLocalBinder)binder).getService();
isUploadServiceConnected = true; isUploadServiceConnected = true;
} }
@Override
public void onServiceDisconnected(ComponentName componentName) { public void onServiceDisconnected(ComponentName componentName) {
// this should never happen // this should never happen
throw new RuntimeException("UploadService died but the rest of the process did not!"); throw new RuntimeException("UploadService died but the rest of the process did not!");
@ -191,6 +193,7 @@ public class ContributionsActivity
finish(); // If authentication failed, we just exit finish(); // If authentication failed, we just exit
} }
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long item) { public void onItemClick(AdapterView<?> adapterView, View view, int position, long item) {
showDetail(position); showDetail(position);
} }
@ -200,10 +203,12 @@ public class ContributionsActivity
return super.onCreateOptionsMenu(menu); return super.onCreateOptionsMenu(menu);
} }
@Override
public Loader onCreateLoader(int i, Bundle bundle) { public Loader onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this, ContributionsContentProvider.BASE_URI, Contribution.Table.ALL_FIELDS, CONTRIBUTION_SELECTION, null, CONTRIBUTION_SORT); return new CursorLoader(this, ContributionsContentProvider.BASE_URI, Contribution.Table.ALL_FIELDS, CONTRIBUTION_SELECTION, null, CONTRIBUTION_SORT);
} }
@Override
public void onLoadFinished(Loader cursorLoader, Object result) { public void onLoadFinished(Loader cursorLoader, Object result) {
Cursor cursor = (Cursor) result; Cursor cursor = (Cursor) result;
@ -219,11 +224,13 @@ public class ContributionsActivity
notifyAndMigrateDataSetObservers(); notifyAndMigrateDataSetObservers();
} }
@Override
public void onLoaderReset(Loader cursorLoader) { public void onLoaderReset(Loader cursorLoader) {
((CursorAdapter) contributionsList.getAdapter()).swapCursor(null); ((CursorAdapter) contributionsList.getAdapter()).swapCursor(null);
} }
//FIXME: Potential cause of wrong image display bug //FIXME: Potential cause of wrong image display bug
@Override
public Media getMediaAtPosition(int i) { public Media getMediaAtPosition(int i) {
if (contributionsList.getAdapter() == null) { if (contributionsList.getAdapter() == null) {
// not yet ready to return data // not yet ready to return data
@ -233,6 +240,7 @@ public class ContributionsActivity
} }
} }
@Override
public int getTotalMediaCount() { public int getTotalMediaCount() {
if(contributionsList.getAdapter() == null) { if(contributionsList.getAdapter() == null) {
return 0; return 0;
@ -240,6 +248,7 @@ public class ContributionsActivity
return contributionsList.getAdapter().getCount(); return contributionsList.getAdapter().getCount();
} }
@Override
public void notifyDatasetChanged() { public void notifyDatasetChanged() {
// Do nothing for now // Do nothing for now
} }
@ -259,6 +268,7 @@ public class ContributionsActivity
} }
} }
@Override
public void registerDataSetObserver(DataSetObserver observer) { public void registerDataSetObserver(DataSetObserver observer) {
Adapter adapter = contributionsList.getAdapter(); Adapter adapter = contributionsList.getAdapter();
if (adapter == null) { if (adapter == null) {
@ -268,6 +278,7 @@ public class ContributionsActivity
} }
} }
@Override
public void unregisterDataSetObserver(DataSetObserver observer) { public void unregisterDataSetObserver(DataSetObserver observer) {
Adapter adapter = contributionsList.getAdapter(); Adapter adapter = contributionsList.getAdapter();
if (adapter == null) { if (adapter == null) {
@ -277,6 +288,7 @@ public class ContributionsActivity
} }
} }
@Override
public void onBackStackChanged() { public void onBackStackChanged() {
if(mediaDetails != null && mediaDetails.isVisible()) { if(mediaDetails != null && mediaDetails.isVisible()) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@ -285,6 +297,7 @@ public class ContributionsActivity
} }
} }
@Override
public void refreshSource() { public void refreshSource() {
getSupportLoaderManager().restartLoader(0, null, this); getSupportLoaderManager().restartLoader(0, null, this);
} }

View file

@ -35,18 +35,22 @@ public class MediaListAdapter extends BaseAdapter {
} }
} }
} }
@Override
public int getCount() { public int getCount() {
return mediaList.size(); return mediaList.size();
} }
@Override
public Object getItem(int i) { public Object getItem(int i) {
return mediaList.get(i); return mediaList.get(i);
} }
@Override
public long getItemId(int i) { public long getItemId(int i) {
return i; return i;
} }
@Override
public View getView(int i, View view, ViewGroup viewGroup) { public View getView(int i, View view, ViewGroup viewGroup) {
if(view == null) { if(view == null) {
view = activity.getLayoutInflater().inflate(R.layout.layout_contribution, null, false); view = activity.getLayoutInflater().inflate(R.layout.layout_contribution, null, false);

View file

@ -132,6 +132,7 @@ public class MediaDetailFragment extends Fragment {
// Ask the detail provider to ping us when we're ready // Ask the detail provider to ping us when we're ready
Log.d("Commons", "MediaDetailFragment not yet ready to display details; registering observer"); Log.d("Commons", "MediaDetailFragment not yet ready to display details; registering observer");
dataObserver = new DataSetObserver() { dataObserver = new DataSetObserver() {
@Override
public void onChanged() { public void onChanged() {
Log.d("Commons", "MediaDetailFragment ready to display delayed details!"); Log.d("Commons", "MediaDetailFragment ready to display delayed details!");
detailProvider.unregisterDataSetObserver(dataObserver); detailProvider.unregisterDataSetObserver(dataObserver);
@ -147,6 +148,7 @@ public class MediaDetailFragment extends Fragment {
// Progressively darken the image in the background when we scroll detail pane up // Progressively darken the image in the background when we scroll detail pane up
scrollListener = new ViewTreeObserver.OnScrollChangedListener() { scrollListener = new ViewTreeObserver.OnScrollChangedListener() {
@Override
public void onScrollChanged() { public void onScrollChanged() {
updateTheDarkness(); updateTheDarkness();
} }
@ -158,6 +160,7 @@ public class MediaDetailFragment extends Fragment {
layoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { layoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
private int currentHeight = -1; private int currentHeight = -1;
@Override
public void onGlobalLayout() { public void onGlobalLayout() {
int viewHeight = view.getHeight(); int viewHeight = view.getHeight();
//int textHeight = title.getLineHeight(); //int textHeight = title.getLineHeight();
@ -245,15 +248,18 @@ public class MediaDetailFragment extends Fragment {
//Even if image is loaded from device storage, it will display, albeit with empty desc and cat. //Even if image is loaded from device storage, it will display, albeit with empty desc and cat.
Log.d("Volley", "Actual URL does not start with http and is: " + actualUrl); Log.d("Volley", "Actual URL does not start with http and is: " + actualUrl);
com.nostra13.universalimageloader.core.ImageLoader.getInstance().displayImage(actualUrl, image, displayOptions, new ImageLoadingListener() { com.nostra13.universalimageloader.core.ImageLoader.getInstance().displayImage(actualUrl, image, displayOptions, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String s, View view) { public void onLoadingStarted(String s, View view) {
loadingProgress.setVisibility(View.VISIBLE); loadingProgress.setVisibility(View.VISIBLE);
} }
@Override
public void onLoadingFailed(String s, View view, FailReason failReason) { public void onLoadingFailed(String s, View view, FailReason failReason) {
loadingProgress.setVisibility(View.GONE); loadingProgress.setVisibility(View.GONE);
loadingFailed.setVisibility(View.VISIBLE); loadingFailed.setVisibility(View.VISIBLE);
} }
@Override
public void onLoadingComplete(String s, View view, Bitmap bitmap) { public void onLoadingComplete(String s, View view, Bitmap bitmap) {
loadingProgress.setVisibility(View.GONE); loadingProgress.setVisibility(View.GONE);
loadingFailed.setVisibility(View.GONE); loadingFailed.setVisibility(View.GONE);
@ -278,6 +284,7 @@ public class MediaDetailFragment extends Fragment {
rebuildCatList(); rebuildCatList();
} }
@Override
public void onLoadingCancelled(String s, View view) { public void onLoadingCancelled(String s, View view) {
Log.e("Volley", "Image loading cancelled. But why?"); Log.e("Volley", "Image loading cancelled. But why?");
} }
@ -333,6 +340,7 @@ public class MediaDetailFragment extends Fragment {
textView.setText(cat); textView.setText(cat);
if (categoriesLoaded && categoriesPresent) { if (categoriesLoaded && categoriesPresent) {
textView.setOnClickListener(new View.OnClickListener() { textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) { public void onClick(View view) {
String selectedCategoryTitle = "Category:" + catName; String selectedCategoryTitle = "Category:" + catName;
Intent viewIntent = new Intent(); Intent viewIntent = new Intent();

View file

@ -65,6 +65,7 @@ public class MediaDetailPagerFragment extends Fragment implements ViewPager.OnPa
if(i == 0) { if(i == 0) {
// See bug https://code.google.com/p/android/issues/detail?id=27526 // See bug https://code.google.com/p/android/issues/detail?id=27526
pager.postDelayed(new Runnable() { pager.postDelayed(new Runnable() {
@Override
public void run() { public void run() {
getActivity().supportInvalidateOptionsMenu(); getActivity().supportInvalidateOptionsMenu();
} }
@ -92,6 +93,7 @@ public class MediaDetailPagerFragment extends Fragment implements ViewPager.OnPa
// Adapter doesn't seem to be loading immediately. // Adapter doesn't seem to be loading immediately.
// Dear God, please forgive us for our sins // Dear God, please forgive us for our sins
view.postDelayed(new Runnable() { view.postDelayed(new Runnable() {
@Override
public void run() { public void run() {
pager.setAdapter(adapter); pager.setAdapter(adapter);
pager.setCurrentItem(pageNumber, false); pager.setCurrentItem(pageNumber, false);
@ -280,13 +282,16 @@ public class MediaDetailPagerFragment extends Fragment implements ViewPager.OnPa
pager.setCurrentItem(i); pager.setCurrentItem(i);
} }
@Override
public void onPageScrolled(int i, float v, int i2) { public void onPageScrolled(int i, float v, int i2) {
getActivity().supportInvalidateOptionsMenu(); getActivity().supportInvalidateOptionsMenu();
} }
@Override
public void onPageSelected(int i) { public void onPageSelected(int i) {
} }
@Override
public void onPageScrollStateChanged(int i) { public void onPageScrollStateChanged(int i) {
} }

View file

@ -160,6 +160,7 @@ public class NearbyListFragment extends ListFragment implements TaskListener {
listview.setAdapter(mAdapter); listview.setAdapter(mAdapter);
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Place place = places.get(position); Place place = places.get(position);

View file

@ -83,6 +83,7 @@ public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> {
builder.setMessage(R.string.file_exists) builder.setMessage(R.string.file_exists)
.setTitle(R.string.warning); .setTitle(R.string.warning);
builder.setPositiveButton(R.string.no, new DialogInterface.OnClickListener() { builder.setPositiveButton(R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
//Go back to ContributionsActivity //Go back to ContributionsActivity
Intent intent = new Intent(context, ContributionsActivity.class); Intent intent = new Intent(context, ContributionsActivity.class);
@ -90,6 +91,7 @@ public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> {
} }
}); });
builder.setNegativeButton(R.string.yes, new DialogInterface.OnClickListener() { builder.setNegativeButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
//No need to do anything, user remains on upload screen //No need to do anything, user remains on upload screen
} }

View file

@ -57,10 +57,12 @@ public class MultipleShareActivity
super(WikiAccountAuthenticator.COMMONS_ACCOUNT_TYPE); super(WikiAccountAuthenticator.COMMONS_ACCOUNT_TYPE);
} }
@Override
public Media getMediaAtPosition(int i) { public Media getMediaAtPosition(int i) {
return photosList.get(i); return photosList.get(i);
} }
@Override
public int getTotalMediaCount() { public int getTotalMediaCount() {
if(photosList == null) { if(photosList == null) {
return 0; return 0;
@ -68,24 +70,29 @@ public class MultipleShareActivity
return photosList.size(); return photosList.size();
} }
@Override
public void notifyDatasetChanged() { public void notifyDatasetChanged() {
if(uploadsList != null) { if(uploadsList != null) {
uploadsList.notifyDatasetChanged(); uploadsList.notifyDatasetChanged();
} }
} }
@Override
public void registerDataSetObserver(DataSetObserver observer) { public void registerDataSetObserver(DataSetObserver observer) {
// fixme implement me if needed // fixme implement me if needed
} }
@Override
public void unregisterDataSetObserver(DataSetObserver observer) { public void unregisterDataSetObserver(DataSetObserver observer) {
// fixme implement me if needed // fixme implement me if needed
} }
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int index, long item) { public void onItemClick(AdapterView<?> adapterView, View view, int index, long item) {
showDetail(index); showDetail(index);
} }
@Override
public void OnMultipleUploadInitiated() { public void OnMultipleUploadInitiated() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
@ -125,6 +132,7 @@ public class MultipleShareActivity
final int uploadCount = i + 1; // Goddamn Java final int uploadCount = i + 1; // Goddamn Java
uploadController.startUpload(up, new UploadController.ContributionUploadProgress() { uploadController.startUpload(up, new UploadController.ContributionUploadProgress() {
@Override
public void onUploadStarted(Contribution contribution) { public void onUploadStarted(Contribution contribution) {
dialog.setProgress(uploadCount); dialog.setProgress(uploadCount);
if(uploadCount == photosList.size()) { if(uploadCount == photosList.size()) {
@ -154,6 +162,7 @@ public class MultipleShareActivity
//See http://stackoverflow.com/questions/7469082/getting-exception-illegalstateexception-can-not-perform-this-action-after-onsa //See http://stackoverflow.com/questions/7469082/getting-exception-illegalstateexception-can-not-perform-this-action-after-onsa
} }
@Override
public void onCategoriesSave(ArrayList<String> categories) { public void onCategoriesSave(ArrayList<String> categories) {
if(categories.size() > 0) { if(categories.size() > 0) {
ContentProviderClient client = getContentResolver().acquireContentProviderClient(ModificationsContentProvider.AUTHORITY); ContentProviderClient client = getContentResolver().acquireContentProviderClient(ModificationsContentProvider.AUTHORITY);
@ -295,6 +304,7 @@ public class MultipleShareActivity
} }
} }
@Override
public void onBackStackChanged() { public void onBackStackChanged() {
if(mediaDetails != null && mediaDetails.isVisible()) { if(mediaDetails != null && mediaDetails.isVisible()) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);

View file

@ -62,18 +62,22 @@ public class MultipleUploadListFragment extends Fragment {
private class PhotoDisplayAdapter extends BaseAdapter { private class PhotoDisplayAdapter extends BaseAdapter {
@Override
public int getCount() { public int getCount() {
return detailProvider.getTotalMediaCount(); return detailProvider.getTotalMediaCount();
} }
@Override
public Object getItem(int i) { public Object getItem(int i) {
return detailProvider.getMediaAtPosition(i); return detailProvider.getMediaAtPosition(i);
} }
@Override
public long getItemId(int i) { public long getItemId(int i) {
return i; return i;
} }
@Override
public View getView(int i, View view, ViewGroup viewGroup) { public View getView(int i, View view, ViewGroup viewGroup) {
UploadHolderView holder; UploadHolderView holder;
@ -165,10 +169,12 @@ public class MultipleUploadListFragment extends Fragment {
photosGrid.setColumnWidth(photoSize.x); photosGrid.setColumnWidth(photoSize.x);
baseTitle.addTextChangedListener(new TextWatcher() { baseTitle.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i1, int i2, int i3) { public void beforeTextChanged(CharSequence charSequence, int i1, int i2, int i3) {
} }
@Override
public void onTextChanged(CharSequence charSequence, int i1, int i2, int i3) { public void onTextChanged(CharSequence charSequence, int i1, int i2, int i3) {
for(int i = 0; i < detailProvider.getTotalMediaCount(); i++) { for(int i = 0; i < detailProvider.getTotalMediaCount(); i++) {
Contribution up = (Contribution) detailProvider.getMediaAtPosition(i); Contribution up = (Contribution) detailProvider.getMediaAtPosition(i);
@ -184,6 +190,7 @@ public class MultipleUploadListFragment extends Fragment {
detailProvider.notifyDatasetChanged(); detailProvider.notifyDatasetChanged();
} }
@Override
public void afterTextChanged(Editable editable) { public void afterTextChanged(Editable editable) {
} }

View file

@ -88,6 +88,7 @@ public class ShareActivity
/** /**
* Called when user taps the submit button * Called when user taps the submit button
*/ */
@Override
public void uploadActionInitiated(String title, String description) { public void uploadActionInitiated(String title, String description) {
this.title = title; this.title = title;
@ -123,6 +124,7 @@ public class ShareActivity
} }
uploadController.startUpload(title, mediaUri, description, mimeType, source, decimalCoords, new UploadController.ContributionUploadProgress() { uploadController.startUpload(title, mediaUri, description, mimeType, source, decimalCoords, new UploadController.ContributionUploadProgress() {
@Override
public void onUploadStarted(Contribution contribution) { public void onUploadStarted(Contribution contribution) {
ShareActivity.this.contribution = contribution; ShareActivity.this.contribution = contribution;
showPostUpload(); showPostUpload();
@ -139,6 +141,7 @@ public class ShareActivity
.commit(); .commit();
} }
@Override
public void onCategoriesSave(ArrayList<String> categories) { public void onCategoriesSave(ArrayList<String> categories) {
if(categories.size() > 0) { if(categories.size() > 0) {
ModifierSequence categoriesSequence = new ModifierSequence(contribution.getContentUri()); ModifierSequence categoriesSequence = new ModifierSequence(contribution.getContentUri());

View file

@ -82,6 +82,7 @@ public class SingleUploadFragment extends Fragment {
titleDescButton.setOnClickListener(new View.OnClickListener() titleDescButton.setOnClickListener(new View.OnClickListener()
{ {
@Override
public void onClick(View v) public void onClick(View v)
{ {
//Retrieve last title and desc entered //Retrieve last title and desc entered
@ -98,10 +99,13 @@ public class SingleUploadFragment extends Fragment {
licenseSummaryView = (TextView)rootView.findViewById(R.id.share_license_summary); licenseSummaryView = (TextView)rootView.findViewById(R.id.share_license_summary);
TextWatcher uploadEnabler = new TextWatcher() { TextWatcher uploadEnabler = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { }
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {} public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {}
@Override
public void afterTextChanged(Editable editable) { public void afterTextChanged(Editable editable) {
if(getActivity() != null) { if(getActivity() != null) {
getActivity().invalidateOptionsMenu(); getActivity().invalidateOptionsMenu();
@ -117,6 +121,7 @@ public class SingleUploadFragment extends Fragment {
// Open license page on touch // Open license page on touch
licenseSummaryView.setOnTouchListener(new View.OnTouchListener() { licenseSummaryView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) { public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getActionMasked() == MotionEvent.ACTION_DOWN) { if (motionEvent.getActionMasked() == MotionEvent.ACTION_DOWN) {
Intent intent = new Intent(); Intent intent = new Intent();

View file

@ -41,11 +41,13 @@ public class UploadController {
private boolean isUploadServiceConnected; private boolean isUploadServiceConnected;
private ServiceConnection uploadServiceConnection = new ServiceConnection() { private ServiceConnection uploadServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName componentName, IBinder binder) { public void onServiceConnected(ComponentName componentName, IBinder binder) {
uploadService = (UploadService) ((HandlerService.HandlerServiceLocalBinder)binder).getService(); uploadService = (UploadService) ((HandlerService.HandlerServiceLocalBinder)binder).getService();
isUploadServiceConnected = true; isUploadServiceConnected = true;
} }
@Override
public void onServiceDisconnected(ComponentName componentName) { public void onServiceDisconnected(ComponentName componentName) {
// this should never happen // this should never happen
throw new RuntimeException("UploadService died but the rest of the process did not!"); throw new RuntimeException("UploadService died but the rest of the process did not!");

View file

@ -85,6 +85,7 @@ public class UploadService extends HandlerService<Contribution> {
this.contribution = contribution; this.contribution = contribution;
} }
@Override
public void onProgress(long transferred, long total) { public void onProgress(long transferred, long total) {
Log.d("Commons", String.format("Uploaded %d of %d", transferred, total)); Log.d("Commons", String.format("Uploaded %d of %d", transferred, total));
if(!notificationTitleChanged) { if(!notificationTitleChanged) {