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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="@drawable/app_widget_background"
|
android:background="@drawable/app_widget_background"
|
||||||
android:clipChildren="false">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<FrameLayout
|
||||||
android:id="@+id/txt_feed_name"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:lines="1"
|
android:padding="8dp">
|
||||||
android:paddingStart="8dp"
|
|
||||||
android:paddingTop="9dp"
|
<ImageView
|
||||||
android:paddingEnd="8dp"
|
android:layout_width="24dp"
|
||||||
android:paddingBottom="9dp"
|
android:layout_height="24dp"
|
||||||
android:textColor="@color/black"
|
android:layout_gravity="center_vertical"
|
||||||
android:textStyle="bold"
|
android:contentDescription="@string/description_login_logo"
|
||||||
tools:text="Coding Horror" />
|
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
|
<ListView
|
||||||
android:id="@+id/widget_list"
|
android:id="@+id/widget_list"
|
||||||
|
|
|
@ -23,35 +23,38 @@
|
||||||
android:id="@+id/story_item_feedicon"
|
android:id="@+id/story_item_feedicon"
|
||||||
android:layout_width="18dp"
|
android:layout_width="18dp"
|
||||||
android:layout_height="18dp"
|
android:layout_height="18dp"
|
||||||
android:layout_marginStart="24dp"
|
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginStart="18dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
android:layout_toRightOf="@+id/story_item_favicon_borderbar_2" />
|
android:layout_toRightOf="@+id/story_item_favicon_borderbar_2" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/story_item_feedtitle"
|
android:id="@+id/story_item_feedtitle"
|
||||||
style="?storyFeedTitleText"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="6dp"
|
android:layout_marginLeft="6dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
android:layout_toRightOf="@id/story_item_feedicon"
|
android:layout_toRightOf="@id/story_item_feedicon"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textColor="@android:color/holo_orange_dark" />
|
android:textColor="@android:color/holo_orange_dark"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/story_item_title"
|
android:id="@+id/story_item_title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/story_item_feedicon"
|
android:layout_below="@id/story_item_feedicon"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_toRightOf="@id/story_item_favicon_borderbar_2"
|
android:layout_marginTop="2dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
android:layout_toLeftOf="@+id/story_item_thumbnail"
|
android:layout_toLeftOf="@+id/story_item_thumbnail"
|
||||||
|
android:layout_toRightOf="@id/story_item_favicon_borderbar_2"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
android:paddingTop="4dp"
|
android:textColor="@color/tag_red"
|
||||||
android:paddingRight="4dp"
|
android:textStyle="bold" />
|
||||||
android:paddingBottom="4dp"
|
|
||||||
android:textColor="@color/tag_red" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/story_item_content"
|
android:id="@+id/story_item_content"
|
||||||
|
@ -59,24 +62,24 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/story_item_title"
|
android:layout_below="@id/story_item_title"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_toRightOf="@id/story_item_favicon_borderbar_2"
|
android:layout_marginRight="8dp"
|
||||||
android:layout_toLeftOf="@+id/story_item_thumbnail"
|
android:layout_toLeftOf="@+id/story_item_thumbnail"
|
||||||
|
android:layout_toRightOf="@id/story_item_favicon_borderbar_2"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
android:paddingRight="4dp"
|
android:textColor="@color/tag_green"
|
||||||
android:paddingBottom="4dp"
|
android:textSize="13sp" />
|
||||||
android:textColor="@color/tag_green" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:src="@drawable/ic_arrow_back_gray46"
|
|
||||||
android:id="@+id/story_item_thumbnail"
|
android:id="@+id/story_item_thumbnail"
|
||||||
android:layout_width="64dp"
|
android:layout_width="64dp"
|
||||||
android:layout_height="64dp"
|
android:layout_height="64dp"
|
||||||
android:layout_marginTop="1dp"
|
|
||||||
android:layout_marginBottom="1dp"
|
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -84,26 +87,28 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/story_item_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:layout_toRightOf="@id/story_item_favicon_borderbar_2"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:paddingBottom="2dp"
|
android:textAllCaps="true"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textColor="@color/story_author_text" />
|
android:textColor="@color/story_author_text"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/story_item_date"
|
android:id="@+id/story_item_date"
|
||||||
style="?storyDateText"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/story_item_content"
|
android:layout_below="@id/story_item_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
android:layout_toRightOf="@id/story_item_author"
|
android:layout_toRightOf="@id/story_item_author"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingRight="8dp"
|
android:textColor="@color/facebook_blue"
|
||||||
android:paddingBottom="2dp"
|
android:textSize="12sp" />
|
||||||
android:textColor="@color/facebook_blue" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -1,10 +1,10 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:minWidth="180dp"
|
android:minWidth="320dp"
|
||||||
android:minHeight="100dp"
|
android:minHeight="100dp"
|
||||||
android:minResizeWidth="100dp"
|
android:minResizeWidth="100dp"
|
||||||
android:minResizeHeight="60dp"
|
android:minResizeHeight="60dp"
|
||||||
android:updatePeriodMillis="3600000"
|
android:updatePeriodMillis="1800000"
|
||||||
android:initialLayout="@layout/view_app_widget"
|
android:initialLayout="@layout/view_app_widget"
|
||||||
android:configure="com.newsblur.widget.WidgetConfigActivity"
|
android:configure="com.newsblur.widget.WidgetConfigActivity"
|
||||||
android:resizeMode="horizontal|vertical"
|
android:resizeMode="horizontal|vertical"
|
||||||
|
|
|
@ -112,11 +112,9 @@ public class WidgetConfigActivity extends NbActivity {
|
||||||
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
|
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
|
||||||
|
|
||||||
PrefsUtils.setWidgetFeed(this, appWidgetId, selectedFeed.feedId, selectedFeed.title);
|
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.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);
|
Intent touchIntent = new Intent(this, WidgetProvider.class);
|
||||||
// Set the action for the intent.
|
// Set the action for the intent.
|
||||||
|
|
|
@ -77,12 +77,7 @@ public class WidgetProvider extends AppWidgetProvider {
|
||||||
//TODO: create and show empty view if/when needed
|
//TODO: create and show empty view if/when needed
|
||||||
// rv.setEmptyView(R.id.widget_list, R.id.empty_view);
|
// 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.
|
// 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
|
// 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
|
// cannot set up their own pending intents. Instead, the collection as a whole sets
|
||||||
|
|
|
@ -1,28 +1,15 @@
|
||||||
package com.newsblur.widget;
|
package com.newsblur.widget;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.support.annotation.ColorInt;
|
import android.support.annotation.ColorInt;
|
||||||
import android.widget.RemoteViews;
|
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);
|
super(packageName, layoutId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WidgetRemoteViews(RemoteViews landscape, RemoteViews portrait) {
|
void setViewBackgroundColor(int viewId, @ColorInt int color) {
|
||||||
super(landscape, portrait);
|
|
||||||
}
|
|
||||||
|
|
||||||
public WidgetRemoteViews(Parcel parcel) {
|
|
||||||
super(parcel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setViewBackgroundColor(int viewId, @ColorInt int color) {
|
|
||||||
setInt(viewId, "setBackgroundColor", color);
|
setInt(viewId, "setBackgroundColor", color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getViewById(int viewId) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue