@Override decorator on every method that overrides

This marks a method as overriding another method, and makes sure that it
matches the signature of the method it is supposed to be overriding,
otherwise it gives a warning.

Its a bit verbose, but can catch mistakes and save time. And the default
Android profile for Eclipse always adds them automatically...
This commit is contained in:
Hans-Christoph Steiner 2014-02-19 20:01:39 -05:00
parent 301ac10515
commit 888d28aed6
13 changed files with 24 additions and 0 deletions

View File

@ -66,10 +66,12 @@ public interface ProgressListener {
}
public static final Parcelable.Creator<Event> CREATOR = new Parcelable.Creator<Event>() {
@Override
public Event createFromParcel(Parcel in) {
return new Event(in.readInt(), in.readInt(), in.readInt(), in.readBundle());
}
@Override
public Event[] newArray(int size) {
return new Event[size];
}

View File

@ -66,6 +66,7 @@ class OldTabManagerImpl extends TabManager {
* and giving it a FrameLayout as a child. This will make the tabs have
* dummy empty contents and then hook them up to our ViewPager.
*/
@Override
public void createTabs() {
tabHost = new TabHost(parent, null);
tabHost.setLayoutParams(new TabHost.LayoutParams(
@ -128,12 +129,14 @@ class OldTabManagerImpl extends TabManager {
}
@Override
public void selectTab(int index) {
tabHost.setCurrentTab(index);
if (index == INDEX_CAN_UPDATE)
removeNotification(1);
}
@Override
public void refreshTabLabel(int index) {
CharSequence text = getLabel(index);
@ -166,6 +169,7 @@ class HoneycombTabManagerImpl extends TabManager {
actionBar = parent.getActionBar();
}
@Override
public void createTabs() {
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
for (int i = 0; i < pager.getAdapter().getCount(); i ++) {
@ -174,6 +178,7 @@ class HoneycombTabManagerImpl extends TabManager {
actionBar.newTab()
.setText(label)
.setTabListener(new ActionBar.TabListener() {
@Override
public void onTabSelected(ActionBar.Tab tab,
FragmentTransaction ft) {
int pos = tab.getPosition();
@ -193,6 +198,7 @@ class HoneycombTabManagerImpl extends TabManager {
}
}
@Override
public void selectTab(int index) {
actionBar.setSelectedNavigationItem(index);
Spinner actionBarSpinner = getActionBarSpinner();
@ -203,6 +209,7 @@ class HoneycombTabManagerImpl extends TabManager {
removeNotification(1);
}
@Override
public void refreshTabLabel(int index) {
CharSequence text = getLabel(index);
actionBar.getTabAt(index).setText(text);

View File

@ -255,6 +255,7 @@ public class ApkProvider extends FDroidProvider {
return PROVIDER_NAME;
}
@Override
protected UriMatcher getMatcher() {
return matcher;
}
@ -323,6 +324,7 @@ public class ApkProvider extends FDroidProvider {
this.orderBy = orderBy;
}
@Override
public String toString() {
StringBuilder suffix = new StringBuilder();

View File

@ -266,6 +266,7 @@ public class AppProvider extends FDroidProvider {
return AUTHORITY + "." + PROVIDER_NAME;
}
@Override
protected UriMatcher getMatcher() {
return matcher;
}

View File

@ -72,6 +72,7 @@ public class Repo extends ValueObject {
return name;
}
@Override
public String toString() {
return address;
}

View File

@ -234,6 +234,7 @@ public class RepoProvider extends FDroidProvider {
return "RepoProvider";
}
@Override
protected UriMatcher getMatcher() {
return matcher;
}

View File

@ -202,6 +202,7 @@ public class NsdHelper {
//in order for it to update the ListView without error
Handler refresh = new Handler(Looper.getMainLooper());
refresh.post(new Runnable() {
@Override
public void run()
{
notifyDataSetChanged();

View File

@ -84,6 +84,7 @@ public class SignedRepoUpdater extends RepoUpdater {
return indexFile;
}
@Override
protected String getIndexAddress() {
return repo.address + "/index.jar?client_version=" + context.getString(R.string.version_name);
}

View File

@ -45,6 +45,7 @@ public class RepoAdapter extends CursorAdapter {
enabledListener = listener;
}
@Override
public boolean hasStableIds() {
return true;
}

View File

@ -37,6 +37,7 @@ public class AvailableAppsFragment extends AppListFragment implements
return "Available";
}
@Override
protected AppListAdapter getAppListAdapter() {
if (adapter == null) {
final AppListAdapter a = new AvailableAppListAdapter(getActivity(), null);

View File

@ -62,6 +62,7 @@ public class RepoDetailsFragment extends Fragment {
// best way to go about this...
private Repo repo;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
}
@ -80,6 +81,7 @@ public class RepoDetailsFragment extends Fragment {
return RepoProvider.Helper.findById(getActivity(), getRepoId());
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
repo = loadRepoDetails();
@ -346,11 +348,13 @@ public class RepoDetailsFragment extends Fragment {
repoFingerprintView.setTextColor(repoFingerprintColor);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}

View File

@ -20,6 +20,7 @@ public class ApkProviderTest extends FDroidProviderTest<ApkProvider> {
super(ApkProvider.class, ApkProvider.getAuthority());
}
@Override
protected String[] getMinimalProjection() {
return new String[] {
ApkProvider.DataColumns.APK_ID,

View File

@ -25,6 +25,7 @@ public class AppProviderTest extends FDroidProviderTest<AppProvider> {
getSwappableContext().setResources(new MockCategoryResources());
}
@Override
protected String[] getMinimalProjection() {
return new String[] {
AppProvider.DataColumns.APP_ID,