mirror of https://github.com/tasks/tasks
Various improvements. All over, improvements.
parent
8314bb97f7
commit
34ee32f5dd
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2006 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- Layout for a visually child-like Preference in a PreferenceActivity. -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/status"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingRight="?android:attr/scrollbarSize">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_marginTop="6dip"
|
||||
android:layout_marginBottom="6dip"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView android:id="@+android:id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal" />
|
||||
|
||||
<TextView android:id="@+android:id/summary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@android:id/title"
|
||||
android:layout_alignLeft="@android:id/title"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:maxLines="2"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- Preference should place its actual preference widget here. -->
|
||||
<LinearLayout android:id="@+android:id/widget_frame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical" />
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* ASTRID: Android's Simple Task Recording Dashboard
|
||||
*
|
||||
* Copyright (c) 2009 Tim Su
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
package com.todoroo.astrid.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.todoroo.andlib.sql.QueryTemplate;
|
||||
import com.todoroo.andlib.utility.AndroidUtilities;
|
||||
import com.todoroo.astrid.api.Filter;
|
||||
|
||||
/**
|
||||
* This activity is launched when a user opens up a notification from the
|
||||
* tray. It launches the appropriate activity based on the passed in parameters.
|
||||
*
|
||||
* @author timsu
|
||||
*
|
||||
*/
|
||||
public class ShortcutActivity extends Activity {
|
||||
|
||||
// --- constants
|
||||
|
||||
/** token for passing a {@link Filter}'s title through extras */
|
||||
public static final String TOKEN_FILTER_TITLE = "title"; //$NON-NLS-1$
|
||||
|
||||
/** token for passing a {@link Filter}'s sql through extras */
|
||||
public static final String TOKEN_FILTER_SQL = "sql"; //$NON-NLS-1$
|
||||
|
||||
/** token for passing a {@link Filter}'s values for new tasks through extras */
|
||||
public static final String TOKEN_FILTER_VALUES = "v4nt"; //$NON-NLS-1$
|
||||
|
||||
/** token for passing a {@link Filter}'s values for new tasks through extras (keys) */
|
||||
public static final String TOKEN_FILTER_VALUES_KEYS = "v4ntk"; //$NON-NLS-1$
|
||||
|
||||
/** token for passing a {@link Filter}'s values for new tasks through extras (values) */
|
||||
public static final String TOKEN_FILTER_VALUES_VALUES = "v4ntv"; //$NON-NLS-1$
|
||||
|
||||
// --- implementation
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
launchTaskList(getIntent());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
|
||||
launchTaskList(intent);
|
||||
}
|
||||
|
||||
private void launchTaskList(Intent intent) {
|
||||
Bundle extras = intent.getExtras();
|
||||
|
||||
if(extras != null && extras.containsKey(TOKEN_FILTER_SQL)) {
|
||||
// launched from desktop shortcut, must create a fake filter
|
||||
String title = extras.getString(TOKEN_FILTER_TITLE);
|
||||
String sql = extras.getString(TOKEN_FILTER_SQL);
|
||||
ContentValues values = null;
|
||||
if(extras.containsKey(TOKEN_FILTER_VALUES))
|
||||
values = AndroidUtilities.contentValuesFromString(extras.getString(TOKEN_FILTER_VALUES));
|
||||
|
||||
Filter filter = new Filter("", title, new QueryTemplate(), values); //$NON-NLS-1$
|
||||
filter.sqlQuery = sql;
|
||||
|
||||
Intent taskListIntent = new Intent(this, TaskListActivity.class);
|
||||
taskListIntent.putExtra(TaskListActivity.TOKEN_FILTER, filter);
|
||||
startActivity(taskListIntent);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue