Improved layout and behaviour of itemview
This commit is contained in:
parent
bf1d4cb248
commit
1ae00a0f25
@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical" >
|
||||
android:layout_height="fill_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
@ -13,29 +12,32 @@
|
||||
android:id="@+id/txtvItemname"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16dp" />
|
||||
android:layout_margin="8dp"
|
||||
android:textSize="18dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvPublished"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="italic"
|
||||
android:textColor="@color/gray" />
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:textColor="@color/gray"
|
||||
android:textStyle="italic" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:background="@color/ics_gray" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/description_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@color/gray"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/description_label"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/description_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -43,6 +43,7 @@ public class ItemviewActivity extends SherlockFragmentActivity {
|
||||
StorageUtils.checkStorageAvailability(this);
|
||||
manager = FeedManager.getInstance();
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
extractFeeditem();
|
||||
populateUI();
|
||||
}
|
||||
@ -90,8 +91,8 @@ public class ItemviewActivity extends SherlockFragmentActivity {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
FragmentTransaction fragmentTransaction = fragmentManager
|
||||
.beginTransaction();
|
||||
ItemDescriptionFragment fragment = ItemDescriptionFragment
|
||||
.newInstance(item);
|
||||
ItemDescriptionFragment fragment = ItemDescriptionFragment.newInstance(
|
||||
item, false);
|
||||
fragmentTransaction.add(R.id.description_fragment, fragment);
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
|
@ -702,7 +702,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
||||
return activity.coverFragment;
|
||||
case POS_DESCR:
|
||||
activity.descriptionFragment = ItemDescriptionFragment
|
||||
.newInstance(activity.media.getItem());
|
||||
.newInstance(activity.media.getItem(), true);
|
||||
return activity.descriptionFragment;
|
||||
default:
|
||||
return CoverFragment.newInstance(null);
|
||||
|
@ -26,19 +26,22 @@ 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) {
|
||||
public static ItemDescriptionFragment newInstance(FeedItem item, boolean scrollbarEnabled) {
|
||||
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;
|
||||
}
|
||||
@ -47,6 +50,7 @@ public class ItemDescriptionFragment extends SherlockFragment {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
webvDescription = new WebView(getActivity());
|
||||
webvDescription.setHorizontalScrollBarEnabled(scrollbarEnabled);
|
||||
return webvDescription;
|
||||
}
|
||||
|
||||
@ -82,6 +86,7 @@ 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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user