Removed option to disable scrollbar in webview

This commit is contained in:
daniel oeh 2012-07-26 20:51:29 +02:00
parent 58ec618276
commit b93c5c9b63
3 changed files with 12 additions and 12 deletions

View File

@ -93,7 +93,7 @@ public class ItemviewActivity extends SherlockFragmentActivity {
FragmentTransaction fragmentTransaction = fragmentManager
.beginTransaction();
ItemDescriptionFragment fragment = ItemDescriptionFragment.newInstance(
item, false);
item);
fragmentTransaction.add(R.id.description_fragment, fragment);
fragmentTransaction.commit();
}

View File

@ -706,7 +706,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
return activity.coverFragment;
case POS_DESCR:
activity.descriptionFragment = ItemDescriptionFragment
.newInstance(activity.media.getItem(), true);
.newInstance(activity.media.getItem());
return activity.descriptionFragment;
case POS_CHAPTERS:
sCChapterFragment = new SherlockListFragment() {

View File

@ -28,23 +28,19 @@ public class ItemDescriptionFragment extends SherlockFragment {
private static final String TAG = "ItemDescriptionFragment";
private static final String ARG_FEED_ID = "arg.feedId";
private static final String ARG_FEEDITEM_ID = "arg.feedItemId";
private static final String ARG_SCROLLBAR_ENABLED = "arg.scrollbarEnabled";
private static final String WEBVIEW_STYLE = "<head><style type=\"text/css\"> * { font-family: Helvetica; line-height: 1.5em; font-size: 12pt; } a { font-style: normal; text-decoration: none; font-weight: normal; color: #00A8DF; }</style></head>";
private boolean scrollbarEnabled;
private WebView webvDescription;
private FeedItem item;
private AsyncTask<Void, Void, Void> webViewLoader;
public static ItemDescriptionFragment newInstance(FeedItem item,
boolean scrollbarEnabled) {
public static ItemDescriptionFragment newInstance(FeedItem item) {
ItemDescriptionFragment f = new ItemDescriptionFragment();
Bundle args = new Bundle();
args.putLong(ARG_FEED_ID, item.getFeed().getId());
args.putLong(ARG_FEEDITEM_ID, item.getId());
args.putBoolean(ARG_SCROLLBAR_ENABLED, scrollbarEnabled);
f.setArguments(args);
return f;
}
@ -53,7 +49,8 @@ public class ItemDescriptionFragment extends SherlockFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
webvDescription = new WebView(getActivity());
webvDescription.setHorizontalScrollBarEnabled(scrollbarEnabled);
webvDescription.getSettings().setUseWideViewPort(false);
return webvDescription;
}
@ -87,6 +84,7 @@ public class ItemDescriptionFragment extends SherlockFragment {
}
}
@SuppressLint("NewApi")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -94,7 +92,6 @@ public class ItemDescriptionFragment extends SherlockFragment {
Bundle args = getArguments();
long feedId = args.getLong(ARG_FEED_ID, -1);
long itemId = args.getLong(ARG_FEEDITEM_ID, -1);
scrollbarEnabled = args.getBoolean(ARG_SCROLLBAR_ENABLED, true);
if (feedId != -1 && itemId != -1) {
Feed feed = manager.getFeed(feedId);
item = manager.getFeedItem(itemId, feed);
@ -132,7 +129,8 @@ public class ItemDescriptionFragment extends SherlockFragment {
"utf-8", "about:blank");
getSherlockActivity()
.setSupportProgressBarIndeterminateVisibility(false);
if (AppConfig.DEBUG) Log.d(TAG, "Webview loaded");
if (AppConfig.DEBUG)
Log.d(TAG, "Webview loaded");
webViewLoader = null;
}
@ -145,7 +143,8 @@ public class ItemDescriptionFragment extends SherlockFragment {
@Override
protected Void doInBackground(Void... params) {
if (AppConfig.DEBUG) Log.d(TAG, "Loading Webview");
if (AppConfig.DEBUG)
Log.d(TAG, "Loading Webview");
data = "";
if (item.getContentEncoded() == null
&& item.getDescription() != null) {
@ -156,10 +155,11 @@ public class ItemDescriptionFragment extends SherlockFragment {
}
data = WEBVIEW_STYLE + data;
return null;
}
};
}
}