Permalink
Browse files

Merge pull request #285 from matburt/expandable_outline

Expandable outline bug fixes & theme support
  • Loading branch information...
2 parents 5c61e34 + 68bc4e0 commit 2c6075cb7dfae900423e94be946fea2426eb4ad3 @matburt committed Sep 25, 2012
Showing with 467 additions and 223 deletions.
  1. +1 −1 AndroidManifest.xml
  2. +1 −0 res/drawable/border.xml
  3. +13 −0 res/drawable/outline_item_selected.xml
  4. +0 −5 res/drawable/outline_selection.xml
  5. +0 −1 res/layout/edit.xml
  6. +1 −0 res/layout/edit_payload.xml
  7. +26 −21 res/layout/timeclock_notification.xml
  8. +5 −0 res/menu/outline_file.xml
  9. +6 −1 res/values/arrays.xml
  10. +1 −4 res/values/strings.xml
  11. +15 −2 res/values/themes.xml
  12. +7 −5 res/xml/preferences.xml
  13. +1 −1 src/com/matburt/mobileorg/Gui/Capture/DatesFragment.java
  14. +19 −3 src/com/matburt/mobileorg/Gui/Capture/EditActivity.java
  15. +10 −1 src/com/matburt/mobileorg/Gui/Capture/HeadingFragment.java
  16. +20 −11 src/com/matburt/mobileorg/Gui/Capture/PayloadFragment.java
  17. +1 −1 src/com/matburt/mobileorg/Gui/Capture/TagsFragment.java
  18. +2 −0 src/com/matburt/mobileorg/Gui/CertificateConflictActivity.java
  19. +1 −0 src/com/matburt/mobileorg/Gui/Outline/OutlineActivity.java
  20. +7 −1 src/com/matburt/mobileorg/Gui/Outline/OutlineAdapter.java
  21. +1 −1 src/com/matburt/mobileorg/Gui/Outline/OutlineItem.java
  22. +34 −14 src/com/matburt/mobileorg/Gui/Outline/OutlineListView.java
  23. +12 −4 src/com/matburt/mobileorg/Gui/SearchActivity.java
  24. +20 −3 src/com/matburt/mobileorg/Gui/Theme/DefaultTheme.java
  25. +4 −2 src/com/matburt/mobileorg/Gui/Theme/MonoTheme.java
  26. +4 −0 src/com/matburt/mobileorg/Gui/Theme/WhiteTheme.java
  27. +1 −0 src/com/matburt/mobileorg/Gui/ViewActivity.java
  28. +9 −2 src/com/matburt/mobileorg/Gui/ViewFragment.java
  29. +18 −26 src/com/matburt/mobileorg/OrgData/OrgFileParser.java
  30. +0 −57 src/com/matburt/mobileorg/OrgData/OrgNode.java
  31. +74 −0 src/com/matburt/mobileorg/OrgData/OrgNodeParser.java
  32. +17 −17 src/com/matburt/mobileorg/Services/CalendarSyncService.java
  33. +1 −0 src/com/matburt/mobileorg/Settings/SettingsActivity.java
  34. +2 −0 src/com/matburt/mobileorg/Settings/WizardActivity.java
  35. +8 −4 src/com/matburt/mobileorg/util/OrgNode2Html.java
  36. +30 −5 src/com/matburt/mobileorg/util/OrgUtils.java
  37. +20 −0 tests/src/com/matburt/mobileorg/test/OrgData/OrgFileParserTest.java
  38. +61 −27 tests/src/com/matburt/mobileorg/test/OrgData/OrgNodeParserTest.java
  39. +14 −3 tests/src/com/matburt/mobileorg/test/util/OrgTestFiles.java
View
@@ -18,7 +18,7 @@
android:debuggable="true"
android:icon="@drawable/icon"
android:label="MobileOrg"
- android:theme="@style/Theme.Styled" >
+ android:theme="@style/Theme.MobileOrg.Dark" >
<meta-data
android:name="android.app.default_searchable"
android:value=".Gui.SearchActivity" />
View
@@ -2,4 +2,5 @@
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="1dp" android:color="#ADADAD" />
<corners android:radius="5dp" />
+ <solid android:color="@android:color/transparent" />
</shape>
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle" >
+
+ <stroke
+ android:width="1px"
+ android:color="#ADADAD" />
+
+ <corners android:radius="2px" />
+
+ <solid android:color="@android:color/transparent" />
+
+</shape>
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
- <stroke android:width="1px" android:color="#ADADAD" />
- <corners android:radius="2px" />
-</shape>
View
@@ -4,7 +4,6 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:background="#00000000"
android:scrollbars="vertical" >
<LinearLayout
@@ -15,6 +15,7 @@
android:id="@+id/edit_payload_edittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
+ android:layout_below="@+id/edit_payload_save"
android:visibility="gone" >
</EditText>
@@ -1,32 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:padding="5dp" >
<ImageView
android:id="@+id/timeclock_notification_icon"
- android:layout_width="wrap_content"
- android:layout_height="fill_parent"
- android:layout_alignParentLeft="true" />
+ android:layout_width="40dp"
+ android:layout_height="40dp"
+ android:layout_alignParentLeft="true"
+ android:layout_marginRight="5dp"
+ android:contentDescription="Icon"
+ android:scaleType="fitCenter"
+ android:src="@drawable/icon"
+ tools:ignore="HardcodedText" />
- <RelativeLayout
+ <TextView
+ android:id="@+id/timeclock_notification_text"
+ style="@android:style/TextAppearance.Small"
android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_toRightOf="@id/timeclock_notification_icon" >
-
- <TextView
- android:id="@+id/timeclock_notification_text"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true" />
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_marginRight="5dp"
+ android:layout_marginTop="3dp"
+ android:layout_toRightOf="@id/timeclock_notification_icon" />
- <TextView
- android:id="@+id/timeclock_notification_time"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_alignParentRight="true" />
- </RelativeLayout>
+ <TextView
+ android:id="@+id/timeclock_notification_time"
+ style="@android:style/TextAppearance.Small"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentRight="true" />
</RelativeLayout>
@@ -23,6 +23,11 @@
android:showAsAction="ifRoom"
android:title="@string/menu_delete_file"/>
<item
+ android:id="@+id/menu_clockin"
+ android:icon="@drawable/ic_menu_today"
+ android:showAsAction="ifRoom"
+ android:title="@string/menu_clockin"/>
+ <item
android:id="@+id/menu_recover"
android:icon="@drawable/ic_menu_archive"
android:showAsAction="ifRoom"
View
@@ -61,5 +61,10 @@
<item>3 levels of recursion</item>
<item>4 levels of recursion</item>
</string-array>
+ <string-array name="themes">
+ <item>Light</item>
+ <item>Dark</item>
+ <item>Monochrome</item>
+ </string-array>
-</resources>
+</resources>
View
@@ -169,8 +169,7 @@
<string name="preference_calendar_show_habits">Show habits</string>
<string name="preference_calendar_show_done_summary">Show done items in the calendar</string>
<string name="preference_calendar_show_done">Show done</string>
- <string name="preference_fullscreen_title">Fullscreen</string>
- <string name="preference_fullscreen_summary">Toggle fullscreen.</string>
+ <string name="preference_theme_title">Theme</string>
<string name="preference_capture_advanced_title">Advanced capture</string>
<string name="preference_capture_advanced">Advanced capturing mechanism that allows capturing files under arbitrary headings.</string>
<string name="edit_date_start">Start</string>
@@ -184,8 +183,6 @@
<string name="example_webURL">http://example.com/index.org</string>
<string name="rerun_setup_wizard">Re-run setup wizard</string>
<string name="configure_synchronizer_settings">Synchronizer settings</string>
- <string name="summary_view_default_edit">When checked, the default behaviour for long clicking on nodes will be editing. If disabled, the default behavior will be viewing.</string>
- <string name="title_view_default_edit">Edit on long click</string>
<string name="summary_view_apply_formatting">Apply formatting of orgmode emphasis, bold, underline and strike-through when viewing.</string>
<string name="title_view_apply_formatting">Apply view formatting</string>
<string name="title_scp_host">Host</string>
View
@@ -1,11 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
- <style name="Theme.Styled" parent="Theme.Sherlock">
+
+ <style name="Theme.MobileOrg.Dark" parent="Theme.Sherlock">
<item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
- <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
+ <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
</style>
+
<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.ActionBar.Solid">
<item name="background">@drawable/actionbar_background</item>
<item name="android:background">@drawable/actionbar_background</item>
</style>
+
+ <style name="Theme.MobileOrg.Light" parent="Theme.Sherlock.Light.DarkActionBar">
+ <item name="actionBarStyle">@style/Widget.Styled.ActionBar.Light</item>
+ <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar.Light</item>
+ </style>
+
+ <style name="Widget.Styled.ActionBar.Light" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
+ <item name="background">@drawable/actionbar_background</item>
+ <item name="android:background">@drawable/actionbar_background</item>
+ </style>
+
</resources>
View
@@ -33,6 +33,13 @@
android:title="@string/title_auto_sync_interval" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/preference_viewing" >
+ <ListPreference
+ android:defaultValue="Dark"
+ android:entries="@array/themes"
+ android:entryValues="@array/themes"
+ android:key="theme"
+ android:title="@string/preference_theme_title" />
+
<CheckBoxPreference
android:key="combineBlockAgendas"
android:summary="@string/preference_combine_block_agenda_summary"
@@ -43,11 +50,6 @@
android:title="@string/title_view_wrap_lines" />
<CheckBoxPreference
android:defaultValue="true"
- android:key="viewDefaultEdit"
- android:summary="@string/summary_view_default_edit"
- android:title="@string/title_view_default_edit" />
- <CheckBoxPreference
- android:defaultValue="true"
android:key="viewApplyFormatting"
android:summary="@string/summary_view_apply_formatting"
android:title="@string/title_view_apply_formatting" />
@@ -68,7 +68,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
else
setupDates();
- setModifable(editActivity.isNodeModifiable());
+ setModifable(editActivity.isPayloadEditable());
editActivity.invalidateOptionsMenu();
}
@@ -13,6 +13,7 @@
import com.actionbarsherlock.view.MenuItem;
import com.matburt.mobileorg.R;
import com.matburt.mobileorg.OrgData.OrgEdit;
+import com.matburt.mobileorg.OrgData.OrgFile;
import com.matburt.mobileorg.OrgData.OrgNode;
import com.matburt.mobileorg.OrgData.OrgProviderUtils;
import com.matburt.mobileorg.Services.SyncService;
@@ -40,9 +41,11 @@
@Override
public void onCreate(Bundle savedInstanceState) {
+ OrgUtils.setTheme(this);
super.onCreate(savedInstanceState);
-
setContentView(R.layout.edit);
+ getSupportActionBar().setTitle(R.string.menu_capture);
+
this.resolver = getContentResolver();
SyncService.stopAlarm(this); // Don't run background sync while editing node
@@ -123,10 +126,23 @@ public OrgNode getOrgNode() {
return this.node;
}
- public boolean isNodeModifiable() {
+ public String getActionMode() {
+ return this.actionMode;
+ }
+
+ public boolean isNodeEditable() {
return getOrgNode().isNodeEditable(resolver);
}
+ public boolean isPayloadEditable() {
+ OrgNode node = getOrgNode();
+
+ if(node.level == 0 && !node.name.equals(OrgFile.AGENDA_FILE_ALIAS))
+ return true;
+ else
+ return isNodeEditable();
+ }
+
public boolean isNodeRefilable() {
if(this.actionMode.equals(ACTIONMODE_CREATE))
return false;
@@ -138,7 +154,7 @@ public boolean isNodeRefilable() {
public boolean onCreateOptionsMenu(Menu menu) {
getSupportMenuInflater().inflate(R.menu.edit, menu);
- if(isNodeModifiable() == false)
+ if(isNodeEditable() == false)
menu.findItem(R.id.nodeedit_save).setVisible(false);
return super.onCreateOptionsMenu(menu);
@@ -5,6 +5,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.WindowManager;
import android.widget.EditText;
import android.widget.Spinner;
@@ -55,7 +56,15 @@ public void onActivityCreated(Bundle savedInstanceState) {
else
updateDisplay(this.node);
- setModifiable(activity.isNodeModifiable());
+ setModifiable(activity.isNodeEditable());
+
+ String actionMode = activity.getActionMode();
+
+ if(actionMode.equals(EditActivity.ACTIONMODE_ADDCHILD) || actionMode.equals(EditActivity.ACTIONMODE_CREATE)) {
+ this.titleView.requestFocus();
+ getActivity().getWindow().setSoftInputMode(
+ WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+ }
}
@Override
@@ -1,10 +1,12 @@
package com.matburt.mobileorg.Gui.Capture;
import android.app.Activity;
+import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
+import android.view.inputmethod.InputMethodManager;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.EditText;
@@ -29,12 +31,6 @@
private OnPayloadModifiedListener mListener;
- public interface OnPayloadModifiedListener {
- public void onPayloadStartedEdit();
- public void onPayloadEndedEdit();
- public void onPayloadModified();
- }
-
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
@@ -89,8 +85,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
else
switchToView();
- if(editActivity.isNodeModifiable() == false)
- setUnmodifiable();
+ setModifiable(editActivity.isPayloadEditable());
}
@Override
@@ -112,8 +107,11 @@ public void restoreInstanceState(Bundle savedInstanceState) {
}
}
- public void setUnmodifiable() {
- this.editButton.setVisibility(View.GONE);
+ public void setModifiable(boolean enabled) {
+ if(enabled)
+ this.editButton.setVisibility(View.VISIBLE);
+ else
+ this.editButton.setVisibility(View.GONE);
}
public void setPayload(String payload) {
@@ -132,9 +130,9 @@ private void switchToEdit(String payloadString) {
if(payloadString != null)
payloadEdit.setText(payloadString);
- payloadEdit.setVisibility(View.VISIBLE);
cancelButton.setVisibility(View.VISIBLE);
saveButton.setVisibility(View.VISIBLE);
+ payloadEdit.setVisibility(View.VISIBLE);
mListener.onPayloadStartedEdit();
}
@@ -158,6 +156,10 @@ public void switchToView() {
public void onClick(View v) {
switchToEdit();
payloadEdit.requestFocus();
+ payloadEdit.setSelection(payloadEdit.length());
+ InputMethodManager keyboard = (InputMethodManager)
+ getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
+ keyboard.showSoftInput(payloadEdit, 0);
}
};
@@ -179,4 +181,11 @@ public void onClick(View v) {
webView.requestFocus();
}
};
+
+
+ public interface OnPayloadModifiedListener {
+ public void onPayloadStartedEdit();
+ public void onPayloadEndedEdit();
+ public void onPayloadModified();
+ }
}
@@ -52,7 +52,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
setupTagEntries(node.getTags());
}
- setModifiable(activity.isNodeModifiable());
+ setModifiable(activity.isNodeEditable());
activity.invalidateOptionsMenu();
}
Oops, something went wrong.

0 comments on commit 2c6075c

Please sign in to comment.