Widget updates

* Rename widget to 'Tasks'
* Make widget resizable (Closes #18)
* Rename 'list or filter' widget (Closes #19)
pull/25/head
Alex Baker 11 years ago
parent 5e7e761447
commit 2d733a912e

@ -56,6 +56,8 @@ import com.todoroo.astrid.utility.Constants;
public class TasksWidget extends AppWidgetProvider {
private static final int NUM_VISIBLE_TASKS = 25;
public static final int THEME_LEGACY = -1;
public static long suppressUpdateFlag = 0; // Timestamp--don't update widgets if this flag is non-zero and now() is within 5 minutes
@ -174,7 +176,7 @@ public class TasksWidget extends AppWidgetProvider {
RemoteViews views = getThemedRemoteViews(context);
int numberOfTasks = getNumberOfTasks();
int numberOfTasks = NUM_VISIBLE_TASKS;
TodorooCursor<Task> cursor = null;
Filter filter = null;
@ -374,20 +376,6 @@ public class TasksWidget extends AppWidgetProvider {
return views;
}
private int getNumberOfTasks() {
Display display = ((WindowManager) this.getSystemService(
Context.WINDOW_SERVICE)).getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
if(metrics.density <= 0.75) {
return 4;
} else {
return 5;
}
}
private Filter getFilter(Context context, int widgetId) {
// base our filter off the inbox filter, replace stuff if we have it

@ -7,14 +7,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget"
android:layout_width="wrap_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@android:color/transparent">
<LinearLayout
android:id="@+id/widget_header"
android:layout_width="200dip"
android:layout_width="fill_parent"
android:layout_height="39dip"
android:orientation="horizontal"
android:padding="3dp"

@ -7,14 +7,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget"
android:layout_width="wrap_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@android:color/transparent">
<LinearLayout
android:id="@+id/widget_header"
android:layout_width="150dip"
android:layout_width="fill_parent"
android:layout_height="39dip"
android:orientation="horizontal"
android:padding="3dp"

@ -7,14 +7,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget"
android:layout_width="wrap_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@android:color/transparent">
<LinearLayout
android:id="@+id/widget_header"
android:layout_width="150dip"
android:layout_width="fill_parent"
android:layout_height="39dip"
android:orientation="horizontal"
android:padding="3dp"

@ -7,14 +7,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget"
android:layout_width="wrap_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@android:color/transparent">
<LinearLayout
android:id="@+id/widget_header"
android:layout_width="150dip"
android:layout_width="fill_parent"
android:layout_height="39dip"
android:orientation="horizontal"
android:padding="3dp"

@ -7,14 +7,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget"
android:layout_width="wrap_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@android:color/transparent">
<LinearLayout
android:id="@+id/widget_header"
android:layout_width="150dip"
android:layout_width="fill_parent"
android:layout_height="39dip"
android:orientation="horizontal"
android:padding="3dp"

@ -7,14 +7,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget"
android:layout_width="wrap_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@android:color/transparent">
<LinearLayout
android:id="@+id/widget_header"
android:layout_width="150dip"
android:layout_width="fill_parent"
android:layout_height="39dip"
android:orientation="horizontal"
android:padding="3dp"

@ -7,14 +7,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget"
android:layout_width="wrap_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@android:color/transparent">
<LinearLayout
android:id="@+id/widget_header"
android:layout_width="150dip"
android:layout_width="fill_parent"
android:layout_height="39dip"
android:orientation="horizontal"
android:padding="3dp"

@ -7,14 +7,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget"
android:layout_width="wrap_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@android:color/transparent">
<LinearLayout
android:id="@+id/widget_header"
android:layout_width="150dip"
android:layout_width="fill_parent"
android:layout_height="39dip"
android:orientation="horizontal"
android:padding="3dp"

@ -5,7 +5,7 @@
** See the file "LICENSE" for the full license governing this code.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/text"
android:background="@android:color/transparent"

@ -242,7 +242,7 @@
<!-- =============================================== FilterListActivity == -->
<!-- Tasks Filter Shortcut -->
<string name="FSA_label">List or Filter</string>
<string name="FSA_label">Tasks List or Filter</string>
<!-- Filter List Activity Title -->

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<string name="widget_mini">Tasks Mini</string>
<string name="widget_mini">Tasks</string>
</resources>

@ -9,5 +9,8 @@
android:configure="com.todoroo.astrid.widget.TasksWidget$ConfigActivity"
android:minWidth="142dip"
android:minHeight="142dip"
android:minResizeWidth="142dip"
android:minResizeHeight="142dip"
android:updatePeriodMillis="86400000"
android:initialLayout="@layout/widget_loading" />
android:initialLayout="@layout/widget_loading"
android:resizeMode="horizontal|vertical"/>

Loading…
Cancel
Save