Removed option to disable scrollbar in webview
This commit is contained in:
parent
58ec618276
commit
b93c5c9b63
@ -93,7 +93,7 @@ public class ItemviewActivity extends SherlockFragmentActivity {
|
|||||||
FragmentTransaction fragmentTransaction = fragmentManager
|
FragmentTransaction fragmentTransaction = fragmentManager
|
||||||
.beginTransaction();
|
.beginTransaction();
|
||||||
ItemDescriptionFragment fragment = ItemDescriptionFragment.newInstance(
|
ItemDescriptionFragment fragment = ItemDescriptionFragment.newInstance(
|
||||||
item, false);
|
item);
|
||||||
fragmentTransaction.add(R.id.description_fragment, fragment);
|
fragmentTransaction.add(R.id.description_fragment, fragment);
|
||||||
fragmentTransaction.commit();
|
fragmentTransaction.commit();
|
||||||
}
|
}
|
||||||
|
@ -706,7 +706,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
|||||||
return activity.coverFragment;
|
return activity.coverFragment;
|
||||||
case POS_DESCR:
|
case POS_DESCR:
|
||||||
activity.descriptionFragment = ItemDescriptionFragment
|
activity.descriptionFragment = ItemDescriptionFragment
|
||||||
.newInstance(activity.media.getItem(), true);
|
.newInstance(activity.media.getItem());
|
||||||
return activity.descriptionFragment;
|
return activity.descriptionFragment;
|
||||||
case POS_CHAPTERS:
|
case POS_CHAPTERS:
|
||||||
sCChapterFragment = new SherlockListFragment() {
|
sCChapterFragment = new SherlockListFragment() {
|
||||||
|
@ -28,23 +28,19 @@ public class ItemDescriptionFragment extends SherlockFragment {
|
|||||||
private static final String TAG = "ItemDescriptionFragment";
|
private static final String TAG = "ItemDescriptionFragment";
|
||||||
private static final String ARG_FEED_ID = "arg.feedId";
|
private static final String ARG_FEED_ID = "arg.feedId";
|
||||||
private static final String ARG_FEEDITEM_ID = "arg.feedItemId";
|
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 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 WebView webvDescription;
|
||||||
private FeedItem item;
|
private FeedItem item;
|
||||||
|
|
||||||
private AsyncTask<Void, Void, Void> webViewLoader;
|
private AsyncTask<Void, Void, Void> webViewLoader;
|
||||||
|
|
||||||
public static ItemDescriptionFragment newInstance(FeedItem item,
|
public static ItemDescriptionFragment newInstance(FeedItem item) {
|
||||||
boolean scrollbarEnabled) {
|
|
||||||
ItemDescriptionFragment f = new ItemDescriptionFragment();
|
ItemDescriptionFragment f = new ItemDescriptionFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putLong(ARG_FEED_ID, item.getFeed().getId());
|
args.putLong(ARG_FEED_ID, item.getFeed().getId());
|
||||||
args.putLong(ARG_FEEDITEM_ID, item.getId());
|
args.putLong(ARG_FEEDITEM_ID, item.getId());
|
||||||
args.putBoolean(ARG_SCROLLBAR_ENABLED, scrollbarEnabled);
|
|
||||||
f.setArguments(args);
|
f.setArguments(args);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
@ -53,7 +49,8 @@ public class ItemDescriptionFragment extends SherlockFragment {
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
webvDescription = new WebView(getActivity());
|
webvDescription = new WebView(getActivity());
|
||||||
webvDescription.setHorizontalScrollBarEnabled(scrollbarEnabled);
|
webvDescription.getSettings().setUseWideViewPort(false);
|
||||||
|
|
||||||
return webvDescription;
|
return webvDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +84,7 @@ public class ItemDescriptionFragment extends SherlockFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NewApi")
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -94,7 +92,6 @@ public class ItemDescriptionFragment extends SherlockFragment {
|
|||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
long feedId = args.getLong(ARG_FEED_ID, -1);
|
long feedId = args.getLong(ARG_FEED_ID, -1);
|
||||||
long itemId = args.getLong(ARG_FEEDITEM_ID, -1);
|
long itemId = args.getLong(ARG_FEEDITEM_ID, -1);
|
||||||
scrollbarEnabled = args.getBoolean(ARG_SCROLLBAR_ENABLED, true);
|
|
||||||
if (feedId != -1 && itemId != -1) {
|
if (feedId != -1 && itemId != -1) {
|
||||||
Feed feed = manager.getFeed(feedId);
|
Feed feed = manager.getFeed(feedId);
|
||||||
item = manager.getFeedItem(itemId, feed);
|
item = manager.getFeedItem(itemId, feed);
|
||||||
@ -132,7 +129,8 @@ public class ItemDescriptionFragment extends SherlockFragment {
|
|||||||
"utf-8", "about:blank");
|
"utf-8", "about:blank");
|
||||||
getSherlockActivity()
|
getSherlockActivity()
|
||||||
.setSupportProgressBarIndeterminateVisibility(false);
|
.setSupportProgressBarIndeterminateVisibility(false);
|
||||||
if (AppConfig.DEBUG) Log.d(TAG, "Webview loaded");
|
if (AppConfig.DEBUG)
|
||||||
|
Log.d(TAG, "Webview loaded");
|
||||||
webViewLoader = null;
|
webViewLoader = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +143,8 @@ public class ItemDescriptionFragment extends SherlockFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
if (AppConfig.DEBUG) Log.d(TAG, "Loading Webview");
|
if (AppConfig.DEBUG)
|
||||||
|
Log.d(TAG, "Loading Webview");
|
||||||
data = "";
|
data = "";
|
||||||
if (item.getContentEncoded() == null
|
if (item.getContentEncoded() == null
|
||||||
&& item.getDescription() != null) {
|
&& item.getDescription() != null) {
|
||||||
@ -156,10 +155,11 @@ public class ItemDescriptionFragment extends SherlockFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = WEBVIEW_STYLE + data;
|
data = WEBVIEW_STYLE + data;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user