mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Using instance to override instead of subclass
This commit is contained in:
parent
a51f4252bb
commit
55675f4428
1 changed files with 41 additions and 46 deletions
|
|
@ -53,8 +53,8 @@ public class CategorizationFragment extends SherlockFragment{
|
||||||
protected HashMap<String, ArrayList<String>> categoriesCache;
|
protected HashMap<String, ArrayList<String>> categoriesCache;
|
||||||
|
|
||||||
private final Set<String> results = new LinkedHashSet<String>();
|
private final Set<String> results = new LinkedHashSet<String>();
|
||||||
PrefixUpdaterSub prefixUpdaterSub = null;
|
//PrefixUpdaterSub prefixUpdaterSub = null;
|
||||||
MethodAUpdaterSub methodAUpdaterSub = null;
|
//MethodAUpdaterSub methodAUpdaterSub = null;
|
||||||
|
|
||||||
private ContentProviderClient client;
|
private ContentProviderClient client;
|
||||||
|
|
||||||
|
|
@ -330,14 +330,11 @@ public class CategorizationFragment extends SherlockFragment{
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void requestSearchResults() {
|
||||||
|
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
|
||||||
class PrefixUpdaterSub extends PrefixUpdater {
|
Utils.executeAsyncTask(new PrefixUpdater(this) {
|
||||||
|
|
||||||
public PrefixUpdaterSub() {
|
|
||||||
super(CategorizationFragment.this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ArrayList<String> doInBackground(Void... voids) {
|
protected ArrayList<String> doInBackground(Void... voids) {
|
||||||
ArrayList<String> result = new ArrayList<String>();
|
ArrayList<String> result = new ArrayList<String>();
|
||||||
|
|
@ -360,15 +357,9 @@ public class CategorizationFragment extends SherlockFragment{
|
||||||
Log.d(TAG, "Prefix result: " + result);
|
Log.d(TAG, "Prefix result: " + result);
|
||||||
categoriesAdapter.notifyDataSetChanged();
|
categoriesAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
|
||||||
class MethodAUpdaterSub extends MethodAUpdater {
|
|
||||||
|
|
||||||
public MethodAUpdaterSub() {
|
|
||||||
super(CategorizationFragment.this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Utils.executeAsyncTask(new MethodAUpdater(this) {
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(ArrayList<String> result) {
|
protected void onPostExecute(ArrayList<String> result) {
|
||||||
results.clear();
|
results.clear();
|
||||||
|
|
@ -380,11 +371,14 @@ public class CategorizationFragment extends SherlockFragment{
|
||||||
|
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startUpdatingCategoryList() {
|
private void startUpdatingCategoryList() {
|
||||||
|
|
||||||
if (prefixUpdaterSub != null) {
|
requestSearchResults();
|
||||||
|
/*
|
||||||
|
if (prefixUpdater != null) {
|
||||||
prefixUpdaterSub.cancel(true);
|
prefixUpdaterSub.cancel(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -398,6 +392,7 @@ public class CategorizationFragment extends SherlockFragment{
|
||||||
Utils.executeAsyncTask(prefixUpdaterSub);
|
Utils.executeAsyncTask(prefixUpdaterSub);
|
||||||
Utils.executeAsyncTask(methodAUpdaterSub);
|
Utils.executeAsyncTask(methodAUpdaterSub);
|
||||||
Log.d(TAG, "Final results: " + results);
|
Log.d(TAG, "Final results: " + results);
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue