Merge branch 'issue-490' into 'master'
Fix Cursor initialization deprecation Closes Issue #490, Avoids usage of `deprecated` constructors and suppresses deprecation warnings. See merge request !242
This commit is contained in:
commit
44f39793be
@ -22,6 +22,7 @@ public abstract class AppListAdapter extends CursorAdapter {
|
||||
private DisplayImageOptions displayImageOptions;
|
||||
private String upgradeFromTo;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public AppListAdapter(Context context, Cursor c) {
|
||||
super(context, c);
|
||||
init(context);
|
||||
|
@ -2,10 +2,19 @@ package org.fdroid.fdroid.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.os.Build;
|
||||
|
||||
public class AvailableAppListAdapter extends AppListAdapter {
|
||||
|
||||
public AvailableAppListAdapter(Context context, Cursor c) {
|
||||
public static AvailableAppListAdapter create(Context context, Cursor cursor, int flags) {
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
return new AvailableAppListAdapter(context, cursor, flags);
|
||||
} else {
|
||||
return new AvailableAppListAdapter(context, cursor);
|
||||
}
|
||||
}
|
||||
|
||||
private AvailableAppListAdapter(Context context, Cursor c) {
|
||||
super(context, c);
|
||||
}
|
||||
|
||||
@ -13,7 +22,7 @@ public class AvailableAppListAdapter extends AppListAdapter {
|
||||
super(context, c, autoRequery);
|
||||
}
|
||||
|
||||
public AvailableAppListAdapter(Context context, Cursor c, int flags) {
|
||||
private AvailableAppListAdapter(Context context, Cursor c, int flags) {
|
||||
super(context, c, flags);
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,19 @@ package org.fdroid.fdroid.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.os.Build;
|
||||
|
||||
public class CanUpdateAppListAdapter extends AppListAdapter {
|
||||
|
||||
public CanUpdateAppListAdapter(Context context, Cursor c) {
|
||||
public static CanUpdateAppListAdapter create(Context context, Cursor cursor, int flags) {
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
return new CanUpdateAppListAdapter(context, cursor, flags);
|
||||
} else {
|
||||
return new CanUpdateAppListAdapter(context, cursor);
|
||||
}
|
||||
}
|
||||
|
||||
private CanUpdateAppListAdapter(Context context, Cursor c) {
|
||||
super(context, c);
|
||||
}
|
||||
|
||||
@ -13,7 +22,7 @@ public class CanUpdateAppListAdapter extends AppListAdapter {
|
||||
super(context, c, autoRequery);
|
||||
}
|
||||
|
||||
public CanUpdateAppListAdapter(Context context, Cursor c, int flags) {
|
||||
private CanUpdateAppListAdapter(Context context, Cursor c, int flags) {
|
||||
super(context, c, flags);
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,19 @@ package org.fdroid.fdroid.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.os.Build;
|
||||
|
||||
public class InstalledAppListAdapter extends AppListAdapter {
|
||||
|
||||
public InstalledAppListAdapter(Context context, Cursor c) {
|
||||
public static InstalledAppListAdapter create(Context context, Cursor cursor, int flags) {
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
return new InstalledAppListAdapter(context, cursor, flags);
|
||||
} else {
|
||||
return new InstalledAppListAdapter(context, cursor);
|
||||
}
|
||||
}
|
||||
|
||||
private InstalledAppListAdapter(Context context, Cursor c) {
|
||||
super(context, c);
|
||||
}
|
||||
|
||||
@ -13,7 +22,7 @@ public class InstalledAppListAdapter extends AppListAdapter {
|
||||
super(context, c, autoRequery);
|
||||
}
|
||||
|
||||
public InstalledAppListAdapter(Context context, Cursor c, int flags) {
|
||||
private InstalledAppListAdapter(Context context, Cursor c, int flags) {
|
||||
super(context, c, flags);
|
||||
}
|
||||
|
||||
|
@ -767,7 +767,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
||||
setRetainInstance(true);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
repoAdapter = new RepoAdapter(getActivity(), null);
|
||||
repoAdapter = RepoAdapter.create(getActivity(), null, 0);
|
||||
repoAdapter.setEnabledListener(this);
|
||||
setListAdapter(repoAdapter);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package org.fdroid.fdroid.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.os.Build;
|
||||
import android.support.v4.widget.CursorAdapter;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -22,7 +23,15 @@ public class RepoAdapter extends CursorAdapter {
|
||||
|
||||
private EnabledListener enabledListener;
|
||||
|
||||
public RepoAdapter(Context context, Cursor c, int flags) {
|
||||
public static RepoAdapter create(Context context, Cursor cursor, int flags) {
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
return new RepoAdapter(context, cursor, flags);
|
||||
} else {
|
||||
return new RepoAdapter(context, cursor);
|
||||
}
|
||||
}
|
||||
|
||||
private RepoAdapter(Context context, Cursor c, int flags) {
|
||||
super(context, c, flags);
|
||||
inflater = LayoutInflater.from(context);
|
||||
}
|
||||
@ -32,7 +41,8 @@ public class RepoAdapter extends CursorAdapter {
|
||||
inflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
public RepoAdapter(Context context, Cursor c) {
|
||||
@SuppressWarnings("deprecation")
|
||||
private RepoAdapter(Context context, Cursor c) {
|
||||
super(context, c);
|
||||
inflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class AvailableAppsFragment extends AppListFragment implements
|
||||
@Override
|
||||
protected AppListAdapter getAppListAdapter() {
|
||||
if (adapter == null) {
|
||||
final AppListAdapter a = new AvailableAppListAdapter(getActivity(), null);
|
||||
final AppListAdapter a = AvailableAppListAdapter.create(getActivity(), null, 0);
|
||||
Preferences.get().registerUpdateHistoryListener(new Preferences.ChangeListener() {
|
||||
@Override
|
||||
public void onPreferenceChange() {
|
||||
|
@ -15,7 +15,7 @@ public class CanUpdateAppsFragment extends AppListFragment {
|
||||
|
||||
@Override
|
||||
protected AppListAdapter getAppListAdapter() {
|
||||
return new CanUpdateAppListAdapter(getActivity(), null);
|
||||
return CanUpdateAppListAdapter.create(getActivity(), null, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,7 +15,7 @@ public class InstalledAppsFragment extends AppListFragment {
|
||||
|
||||
@Override
|
||||
protected AppListAdapter getAppListAdapter() {
|
||||
return new InstalledAppListAdapter(getActivity(), null);
|
||||
return InstalledAppListAdapter.create(getActivity(), null, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user