mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Android widget header and stories list UI
This commit is contained in:
parent
abd6037b5a
commit
0c439cae45
6 changed files with 58 additions and 62 deletions
|
@ -3,22 +3,33 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/app_widget_background"
|
||||
android:clipChildren="false">
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_feed_name"
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="9dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="9dp"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
tools:text="Coding Horror" />
|
||||
android:padding="8dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:contentDescription="@string/description_login_logo"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/logo" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="32dp"
|
||||
android:lines="1"
|
||||
android:text="@string/newsblur"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/widget_list"
|
||||
|
|
|
@ -23,35 +23,38 @@
|
|||
android:id="@+id/story_item_feedicon"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginStart="18dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_toRightOf="@+id/story_item_favicon_borderbar_2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/story_item_feedtitle"
|
||||
style="?storyFeedTitleText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_toRightOf="@id/story_item_feedicon"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="@android:color/holo_orange_dark" />
|
||||
android:textColor="@android:color/holo_orange_dark"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/story_item_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/story_item_feedicon"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_toRightOf="@id/story_item_favicon_borderbar_2"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_toLeftOf="@+id/story_item_thumbnail"
|
||||
android:layout_toRightOf="@id/story_item_favicon_borderbar_2"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:textColor="@color/tag_red" />
|
||||
android:textColor="@color/tag_red"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/story_item_content"
|
||||
|
@ -59,24 +62,24 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/story_item_title"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_toRightOf="@id/story_item_favicon_borderbar_2"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_toLeftOf="@+id/story_item_thumbnail"
|
||||
android:layout_toRightOf="@id/story_item_favicon_borderbar_2"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:textColor="@color/tag_green" />
|
||||
android:textColor="@color/tag_green"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/ic_arrow_back_gray46"
|
||||
android:id="@+id/story_item_thumbnail"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
|
@ -84,26 +87,28 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/story_item_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:layout_toRightOf="@id/story_item_favicon_borderbar_2"
|
||||
android:ellipsize="end"
|
||||
android:paddingBottom="2dp"
|
||||
android:textAllCaps="true"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/story_author_text" />
|
||||
android:textColor="@color/story_author_text"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/story_item_date"
|
||||
style="?storyDateText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/story_item_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:layout_toRightOf="@id/story_item_author"
|
||||
android:gravity="end"
|
||||
android:maxLines="1"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/facebook_blue" />
|
||||
android:textColor="@color/facebook_blue"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:minWidth="180dp"
|
||||
android:minWidth="320dp"
|
||||
android:minHeight="100dp"
|
||||
android:minResizeWidth="100dp"
|
||||
android:minResizeHeight="60dp"
|
||||
android:updatePeriodMillis="3600000"
|
||||
android:updatePeriodMillis="1800000"
|
||||
android:initialLayout="@layout/view_app_widget"
|
||||
android:configure="com.newsblur.widget.WidgetConfigActivity"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
|
|
|
@ -112,11 +112,9 @@ public class WidgetConfigActivity extends NbActivity {
|
|||
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
|
||||
|
||||
PrefsUtils.setWidgetFeed(this, appWidgetId, selectedFeed.feedId, selectedFeed.title);
|
||||
String title = selectedFeed.title;
|
||||
|
||||
rv.setTextViewText(R.id.txt_feed_name, title);
|
||||
rv.setRemoteAdapter(R.id.widget_list, intent);
|
||||
rv.setEmptyView(R.id.widget_list, R.id.empty_view);
|
||||
// rv.setEmptyView(R.id.widget_list, R.id.empty_view);
|
||||
|
||||
Intent touchIntent = new Intent(this, WidgetProvider.class);
|
||||
// Set the action for the intent.
|
||||
|
|
|
@ -77,12 +77,7 @@ public class WidgetProvider extends AppWidgetProvider {
|
|||
//TODO: create and show empty view if/when needed
|
||||
// rv.setEmptyView(R.id.widget_list, R.id.empty_view);
|
||||
|
||||
rv.setTextViewText(R.id.txt_feed_name,
|
||||
PrefsUtils.getWidgetFeedName(context, appWidgetIds[i]));
|
||||
|
||||
//
|
||||
// Do additional processing specific to this app widget...
|
||||
//
|
||||
// This section makes it possible for items to have individualized behavior.
|
||||
// It does this by setting up a pending intent template. Individuals items of a collection
|
||||
// cannot set up their own pending intents. Instead, the collection as a whole sets
|
||||
|
|
|
@ -1,28 +1,15 @@
|
|||
package com.newsblur.widget;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
public class WidgetRemoteViews extends RemoteViews {
|
||||
class WidgetRemoteViews extends RemoteViews {
|
||||
|
||||
public WidgetRemoteViews(String packageName, int layoutId) {
|
||||
WidgetRemoteViews(String packageName, int layoutId) {
|
||||
super(packageName, layoutId);
|
||||
}
|
||||
|
||||
public WidgetRemoteViews(RemoteViews landscape, RemoteViews portrait) {
|
||||
super(landscape, portrait);
|
||||
}
|
||||
|
||||
public WidgetRemoteViews(Parcel parcel) {
|
||||
super(parcel);
|
||||
}
|
||||
|
||||
public void setViewBackgroundColor(int viewId, @ColorInt int color) {
|
||||
void setViewBackgroundColor(int viewId, @ColorInt int color) {
|
||||
setInt(viewId, "setBackgroundColor", color);
|
||||
}
|
||||
|
||||
public void getViewById(int viewId) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue