mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Android widget UI
This commit is contained in:
parent
0d52d6e710
commit
42a284e6c2
6 changed files with 144 additions and 41 deletions
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/half_black" />
|
||||
<solid android:color="@color/white" />
|
||||
<corners
|
||||
android:bottomLeftRadius="4dp"
|
||||
android:bottomRightRadius="4dp"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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">
|
||||
|
||||
|
@ -15,7 +16,7 @@
|
|||
android:paddingTop="9dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="9dp"
|
||||
android:textColor="@color/white"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
tools:text="Coding Horror" />
|
||||
|
||||
|
@ -23,10 +24,9 @@
|
|||
android:id="@+id/widget_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="46dp"
|
||||
tools:listitem="@layout/view_widget_item" />
|
||||
tools:listitem="@layout/view_widget_story_item" />
|
||||
|
||||
<!-- Note that empty views must be siblings of the collection view
|
||||
for which the empty view represents empty state.-->
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/view_widget_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_item_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:textColor="@color/white"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="7dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="7dp"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="The Next CEO of Stackoverflow" />
|
||||
|
||||
<TextView
|
||||
android:textColor="@color/white"
|
||||
android:id="@+id/widget_item_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingEnd="8dp"
|
||||
android:textSize="12sp"
|
||||
tools:text="30 min ago" />
|
||||
</LinearLayout>
|
109
clients/android/NewsBlur/res/layout/view_widget_story_item.xml
Normal file
109
clients/android/NewsBlur/res/layout/view_widget_story_item.xml
Normal file
|
@ -0,0 +1,109 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/view_widget_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/story_item_favicon_borderbar_1"
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/story_item_favicon_borderbar_2"
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toRightOf="@id/story_item_favicon_borderbar_1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/story_item_feedicon"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
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_toRightOf="@id/story_item_feedicon"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="@android:color/holo_orange_dark" />
|
||||
|
||||
<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_toLeftOf="@+id/story_item_thumbnail"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:textColor="@color/tag_red" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/story_item_content"
|
||||
style="?storySnippetText"
|
||||
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_toLeftOf="@+id/story_item_thumbnail"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:textColor="@color/tag_green" />
|
||||
|
||||
<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:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/story_item_author"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/story_item_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_toRightOf="@id/story_item_favicon_borderbar_2"
|
||||
android:ellipsize="end"
|
||||
android:paddingBottom="2dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/story_author_text" />
|
||||
|
||||
<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_toRightOf="@id/story_item_author"
|
||||
android:gravity="end"
|
||||
android:maxLines="1"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/facebook_blue" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
|
@ -4,7 +4,7 @@
|
|||
android:minHeight="100dp"
|
||||
android:minResizeWidth="100dp"
|
||||
android:minResizeHeight="60dp"
|
||||
android:updatePeriodMillis="14400000"
|
||||
android:updatePeriodMillis="3600000"
|
||||
android:initialLayout="@layout/view_app_widget"
|
||||
android:configure="com.newsblur.widget.WidgetConfigActivity"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.newsblur.widget;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
public class WidgetRemoteViews extends RemoteViews {
|
||||
|
||||
public 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) {
|
||||
setInt(viewId, "setBackgroundColor", color);
|
||||
}
|
||||
|
||||
public void getViewById(int viewId) {
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue