Permalink
Browse files

Outline viewer polished

Capture/edit activity has been started
  • Loading branch information...
1 parent 49d1e96 commit 9ff1e5d10683fc1f4966d1ea69517416405a0f29 @kvj committed Dec 13, 2011
View
@@ -10,5 +10,6 @@
<classpathentry kind="lib" path="libs/signpost-core-1.2.1.1.jar"/>
<classpathentry kind="lib" path="libs/dropbox-android-sdk-1.2.2.jar"/>
<classpathentry kind="lib" path="libs/httpmime-4.0.3.jar"/>
+ <classpathentry kind="lib" path="libs/android-support-v4.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
View
@@ -5,8 +5,8 @@
android:versionName="0.6.2" >
<uses-sdk
- android:minSdkVersion="3"
- android:targetSdkVersion="4" />
+ android:minSdkVersion="4"
+ android:targetSdkVersion="11" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
@@ -19,23 +19,26 @@
<service android:name=".service.DataService" />
<receiver android:name="MobileOrgStartupIntentReceiver" >
- <intent-filter >
+ <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
-
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
<activity
android:label="MobileOrg"
android:name=".ui.OutlineViewer"
- android:configChanges="orientation|keyboard"
- >
- <intent-filter >
+ android:configChanges="orientation|keyboardHidden">
+ <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+ <activity
+ android:label="Capture"
+ android:name=".ui.DataEditActivity"
+ android:configChanges="keyboardHidden">
+ </activity>
<activity
android:label="MobileOrg"
android:name="MobileOrgActivity" >
Binary file not shown.
@@ -0,0 +1,36 @@
+<?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="match_parent"
+ android:orientation="vertical" >
+ <fragment class="com.matburt.mobileorg.ui.DataEditOptionsPanel"
+ android:id="@+id/data_edit_panel"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal"
+ android:layout_weight="1">
+ <EditText
+ android:id="@+id/data_edit_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:minLines="1"/>
+ <ImageButton
+ android:id="@+id/data_edit_button"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:src="@drawable/icon"
+ android:background="@android:color/transparent"/>
+ </LinearLayout>
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <Button android:text="Save"
+ android:id="@+id/data_edit_save"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+ </FrameLayout>
+</LinearLayout>
@@ -0,0 +1,34 @@
+<?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"
+ android:orientation="vertical" >
+
+ <TableLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:stretchColumns="0">
+ <TableRow
+ android:gravity="center_vertical">
+ <TextView android:text="TODO:"/>
+ <Spinner
+ android:id="@+id/data_panel_todo"
+ android:layout_width="match_parent"/>
+ </TableRow>
+ <TableRow
+ android:gravity="center_vertical">
+ <TextView android:text="Priority:"/>
+ <Spinner
+ android:id="@+id/data_panel_priority"
+ android:layout_width="match_parent"/>
+ </TableRow>
+ </TableLayout>
+ <TextView android:text="Tags:"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+ <EditText
+ android:id="@+id/data_panel_tags"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:singleLine="true"/>
+</LinearLayout>
@@ -0,0 +1,40 @@
+package org.kvj.bravo7;
+
+import org.kvj.bravo7.ControllerConnector.ControllerReceiver;
+
+import android.support.v4.app.Fragment;
+import android.widget.Toast;
+
+public class SuperFragment<A extends ApplicationContext, T, S extends SuperService<T, A>> extends Fragment implements ControllerReceiver<T>{
+
+ Class<S> serviceClass = null;
+
+ public SuperFragment(Class<S> serviceClass) {
+ this.serviceClass = serviceClass;
+ }
+ private static final String TAG = "SuperFragment";
+ protected T controller = null;
+ ControllerConnector<A, T, S> connector = null;
+
+ public void onController(T controller) {
+ this.controller = controller;
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ connector = new ControllerConnector<A, T, S>(getActivity(), this);
+ connector.connectController(serviceClass);
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ connector.disconnectController();
+ }
+
+ public void notifyUser(String message) {
+ Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();
+ }
+
+}
@@ -248,6 +248,8 @@ public boolean cleanupDB() {
db.getDatabase().beginTransaction();
db.getDatabase().delete("files", null, null);
db.getDatabase().delete("data", null, null);
+ db.getDatabase().delete("todos", null, null);
+ db.getDatabase().delete("priorities", null, null);
db.getDatabase().setTransactionSuccessful();
return true;
} catch (Exception e) {
@@ -278,6 +280,104 @@ public Integer updateFile(String name, String checksum) {
return null;
}
+ public boolean addTodoType(int group, String name, boolean done) {
+ if (null == db) {
+ return false;
+ }
+ try {
+ db.getDatabase().beginTransaction();
+ ContentValues values = new ContentValues();
+ values.put("groupnum", group);
+ values.put("name", name);
+ values.put("isdone", done? 1: 0);
+ db.getDatabase().insert("todos", null, values);
+ db.getDatabase().setTransactionSuccessful();
+ return true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ db.getDatabase().endTransaction();
+ }
+ return false;
+ }
+
+ public boolean addPriorityType(String name) {
+ if (null == db) {
+ return false;
+ }
+ try {
+ db.getDatabase().beginTransaction();
+ ContentValues values = new ContentValues();
+ values.put("name", name);
+ db.getDatabase().insert("priorities", null, values);
+ db.getDatabase().setTransactionSuccessful();
+ return true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ db.getDatabase().endTransaction();
+ }
+ return false;
+ }
+
+ public class TodoState {
+ public int group;
+ public String name;
+ public boolean done;
+ }
+
+ public List<TodoState> getTodoTypes() {
+ if (null == db) {
+ return new ArrayList<TodoState>();
+ }
+ List<TodoState> result = new ArrayList<TodoState>();
+ try {
+ Cursor c = db.getDatabase().query("todos",
+ new String[] {"groupnum", "name", "isdone"},
+ null,
+ null,
+ null, null, "groupnum, isdone, id");
+ if (c.moveToFirst()) {
+ do {
+ TodoState state = new TodoState();
+ state.group = c.getInt(0);
+ state.name = c.getString(1);
+ state.done = c.getInt(2) == 1? true: false;
+ result.add(state);
+ } while (c.moveToNext());
+ }
+ c.close();
+ return result;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return new ArrayList<TodoState>();
+ }
+
+ public List<String> getPrioritiesNG() {
+ if (null == db) {
+ return new ArrayList<String>();
+ }
+ List<String> result = new ArrayList<String>();
+ try {
+ Cursor c = db.getDatabase().query("priorities",
+ new String[] {"name"},
+ null,
+ null,
+ null, null, "id");
+ if (c.moveToFirst()) {
+ do {
+ result.add(c.getString(0));
+ } while (c.moveToNext());
+ }
+ c.close();
+ return result;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return new ArrayList<String>();
+ }
+
public Integer addData(NoteNG note) {
if (null == db) {
return null;
@@ -412,4 +512,26 @@ public NoteNG findNoteByNoteID(String noteID) {
return null;
}
+ public NoteNG findNoteByID(Integer id) {
+ try {
+ if (null == id) {
+ return null;
+ }
+ Cursor c = db.getDatabase().query("data",
+ dataFields,
+ "id=?",
+ new String[] {id.toString()},
+ null, null, "id");
+ NoteNG note = null;
+ if (c.moveToFirst()) {
+ note = cursorToNote(c);
+ }
+ c.close();
+ return note;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
}
@@ -8,7 +8,7 @@
public class MobileOrgDBHelper extends DBHelper{
public MobileOrgDBHelper(Context context, String path) {
- super(context, path, 3);
+ super(context, path, 5);
}
@Override
@@ -36,6 +36,15 @@ public void migrate(SQLiteDatabase db, int version) {
case 3:
db.execSQL("alter table data add file_id integer");
break;
+ case 4:
+ db.execSQL("drop table if exists todos");
+ db.execSQL("drop table if exists priorities");
+ db.execSQL("create table todos (id integer primary key autoincrement, groupnum integer, name text, isdone integer default 0)");
+ db.execSQL("create table priorities (id integer primary key autoincrement, name text)");
+ break;
+ case 5:
+ db.execSQL("create table changes (id integer primary key autoincrement, type text, data_id integer, old_value text, new_value text, changed integer)");
+ break;
}
}
@@ -5,6 +5,7 @@
public static final String TYPE_FILE = "file";
public static final String TYPE_AGENDA = "agenda";
public static final String TYPE_OUTLINE = "outline";
+ public static final String TYPE_AGENDA_OUTLINE = "aoutline";
public static final String TYPE_PROPERTY = "prop";
public static final String TYPE_DRAWER = "drawer";
public static final String TYPE_TEXT = "text";
@@ -36,6 +37,7 @@
public boolean isExpandable() {
return TYPE_AGENDA.equals(type)
+ || TYPE_AGENDA_OUTLINE.equals(type)
|| TYPE_FILE.equals(type)
|| TYPE_OUTLINE.equals(type)
|| TYPE_SUBLIST.equals(type)
Oops, something went wrong.

0 comments on commit 9ff1e5d

Please sign in to comment.