Implemented Asynchronous description loading in Itemdescriptionfragment
This commit is contained in:
parent
ff8a1219af
commit
6a4abe1e85
|
@ -1320,6 +1320,9 @@ public class FeedManager {
|
||||||
|
|
||||||
public void loadExtraInformationOfItem(final Context context,
|
public void loadExtraInformationOfItem(final Context context,
|
||||||
final FeedItem item, FeedManager.TaskCallback callback) {
|
final FeedItem item, FeedManager.TaskCallback callback) {
|
||||||
|
if (AppConfig.DEBUG)
|
||||||
|
Log.d(TAG,
|
||||||
|
"Loading extra information of item with id " + item.getId());
|
||||||
dbExec.execute(new FeedManager.Task(new Handler(), callback) {
|
dbExec.execute(new FeedManager.Task(new Handler(), callback) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -109,12 +109,20 @@ public class ItemDescriptionFragment extends SherlockFragment {
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
webViewLoader = createLoader();
|
FeedManager.getInstance().loadExtraInformationOfItem(getActivity(),
|
||||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
|
item, new FeedManager.TaskCallback() {
|
||||||
webViewLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
} else {
|
@Override
|
||||||
webViewLoader.execute();
|
public void onCompletion() {
|
||||||
}
|
webViewLoader = createLoader();
|
||||||
|
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||||
|
webViewLoader
|
||||||
|
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
} else {
|
||||||
|
webViewLoader.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "Error in onViewCreated: Item was null");
|
Log.e(TAG, "Error in onViewCreated: Item was null");
|
||||||
}
|
}
|
||||||
|
@ -145,8 +153,10 @@ public class ItemDescriptionFragment extends SherlockFragment {
|
||||||
// /webvDescription.loadData(url, "text/html", "utf-8");
|
// /webvDescription.loadData(url, "text/html", "utf-8");
|
||||||
webvDescription.loadDataWithBaseURL(null, data, "text/html",
|
webvDescription.loadDataWithBaseURL(null, data, "text/html",
|
||||||
"utf-8", "about:blank");
|
"utf-8", "about:blank");
|
||||||
getSherlockActivity()
|
if (getSherlockActivity() != null) {
|
||||||
.setSupportProgressBarIndeterminateVisibility(false);
|
getSherlockActivity()
|
||||||
|
.setSupportProgressBarIndeterminateVisibility(false);
|
||||||
|
}
|
||||||
if (AppConfig.DEBUG)
|
if (AppConfig.DEBUG)
|
||||||
Log.d(TAG, "Webview loaded");
|
Log.d(TAG, "Webview loaded");
|
||||||
webViewLoader = null;
|
webViewLoader = null;
|
||||||
|
@ -155,8 +165,10 @@ public class ItemDescriptionFragment extends SherlockFragment {
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
super.onPreExecute();
|
super.onPreExecute();
|
||||||
getSherlockActivity()
|
if (getSherlockActivity() != null) {
|
||||||
.setSupportProgressBarIndeterminateVisibility(true);
|
getSherlockActivity()
|
||||||
|
.setSupportProgressBarIndeterminateVisibility(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue