Permalink
Browse files

Merge branch 'master' into dynamic_agenda

Conflicts:
	AndroidManifest.xml
	src/com/matburt/mobileorg/Gui/Outline/OutlineActivity.java
  • Loading branch information...
2 parents bf8d71b + bbf9155 commit 579dfeacc312190eb6db3e58675449069b9b7b1f @hdweiss hdweiss committed Dec 10, 2012
Showing with 1,626 additions and 1,295 deletions.
  1. +32 −17 AndroidManifest.xml
  2. +39 −35 res/layout/wizard.xml
  3. +4 −3 res/xml/preferences.xml
  4. +1 −1 src/com/matburt/mobileorg/Gui/Outline/OutlineActivity.java
  5. +53 −0 src/com/matburt/mobileorg/Gui/Wizard/DirectoryBrowser.java
  6. +95 −0 src/com/matburt/mobileorg/Gui/Wizard/FolderAdapter.java
  7. +46 −0 src/com/matburt/mobileorg/Gui/Wizard/LocalDirectoryBrowser.java
  8. +40 −0 src/com/matburt/mobileorg/Gui/Wizard/WideLinearLayout.java
  9. +97 −0 src/com/matburt/mobileorg/Gui/Wizard/WizardActivity.java
  10. +312 −0 src/com/matburt/mobileorg/Gui/Wizard/WizardView.java
  11. +65 −0 src/com/matburt/mobileorg/Gui/Wizard/Wizards/DropboxDirectoryBrowser.java
  12. +164 −0 src/com/matburt/mobileorg/Gui/Wizard/Wizards/DropboxWizard.java
  13. +43 −0 src/com/matburt/mobileorg/Gui/Wizard/Wizards/NullWizard.java
  14. +62 −0 src/com/matburt/mobileorg/Gui/Wizard/Wizards/SDCardWizard.java
  15. +144 −0 src/com/matburt/mobileorg/Gui/Wizard/Wizards/SSHWizard.java
  16. +56 −0 src/com/matburt/mobileorg/Gui/Wizard/Wizards/UbuntuOneDirectoryBrowser.java
  17. +130 −0 src/com/matburt/mobileorg/Gui/Wizard/Wizards/UbuntuOneWizard.java
  18. +100 −0 src/com/matburt/mobileorg/Gui/Wizard/Wizards/WebDAVWizard.java
  19. +123 −0 src/com/matburt/mobileorg/Gui/Wizard/Wizards/Wizard.java
  20. +4 −0 src/com/matburt/mobileorg/Services/CalendarSyncService.java
  21. +1 −1 src/com/matburt/mobileorg/Settings/SettingsActivity.java
  22. +0 −678 src/com/matburt/mobileorg/Settings/WizardActivity.java
  23. +0 −57 src/com/matburt/mobileorg/Settings/WizardPreferences.java
  24. +15 −15 src/com/matburt/mobileorg/Synchronizers/DropboxSynchronizer.java
  25. +0 −328 src/com/matburt/mobileorg/Views/PageFlipView.java
  26. +0 −120 src/com/matburt/mobileorg/Views/PageView.java
  27. +0 −40 src/com/matburt/mobileorg/Views/WideLinearLayout.java
View
@@ -120,8 +120,13 @@
android:label="MobileOrg Settings" >
</activity>
<activity
- android:name=".Settings.WizardActivity"
+ android:name=".Gui.Wizard.WizardActivity"
android:label="MobileOrg Wizard" >
+ <intent-filter>
+ <action android:name="com.matburt.mobileorg.Settings.SETUP_WIZARD" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
</activity>
<activity
android:name=".Gui.CertificateConflictActivity"
@@ -161,23 +166,33 @@
android:name=".Services.TimeclockDialog"
android:theme="@android:style/Theme.Dialog" >
</activity>
- <activity android:name=".Gui.Agenda.AgendaSettings"></activity>
- <activity android:name=".Gui.Agenda.AgendaEntrySetting"></activity>
+ <activity android:name=".Gui.Agenda.AgendaSettings" >
+ </activity>
+ <activity android:name=".Gui.Agenda.AgendaEntrySetting" >
+ </activity>
<activity
android:name="com.dropbox.client2.android.AuthActivity"
- android:launchMode="singleTask"
- android:configChanges="orientation|keyboard">
- <intent-filter>
- <!-- Change this to be db- followed by your app key -->
- <data android:scheme="db-2y6mph4a6httm78" />
- <action android:name="android.intent.action.VIEW" />
- <category android:name="android.intent.category.BROWSABLE"/>
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- </activity>
- <service android:name=".Services.CalendarSyncService"></service>
- <activity android:name=".Gui.Agenda.AgendasActivity"></activity>
- <activity android:name=".Gui.Agenda.AgendaActivity"></activity>
+ android:configChanges="orientation|keyboard"
+ android:launchMode="singleTask" >
+ <intent-filter>
+
+ <!-- Change this to be db- followed by your app key -->
+ <data android:scheme="db-2y6mph4a6httm78" />
+
+ <action android:name="android.intent.action.VIEW" />
+
+ <category android:name="android.intent.category.BROWSABLE" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+
+ <service android:name=".Services.CalendarSyncService" >
+ </service>
+
+ <activity android:name=".Gui.Agenda.AgendasActivity" >
+ </activity>
+ <activity android:name=".Gui.Agenda.AgendaActivity" >
+ </activity>
</application>
-</manifest>
+</manifest>
View
@@ -1,37 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.matburt.mobileorg.Views.PageFlipView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/wizard_parent"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:fillViewport="true"
- android:layout_alignParentTop="true">
- <com.matburt.mobileorg.Views.WideLinearLayout
- android:id="@+id/wizard_container"
- android:layout_width="wrap_content"
- android:layout_height="fill_parent"
- android:orientation="horizontal">
- <!-- page 1 -->
- <ScrollView
- android:id="@+id/wizard_page1_container"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:fillViewport="true">
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <include
- android:layout_marginTop="10dp"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1.0"
- android:id="@+id/wizard_page1"
- layout="@layout/wizard_page1" />
- <include
- layout="@layout/wizard_navbar_first" />
- </LinearLayout>
- </ScrollView>
- </com.matburt.mobileorg.Views.WideLinearLayout>
-</com.matburt.mobileorg.Views.PageFlipView>
+<com.matburt.mobileorg.Gui.Wizard.WizardView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/wizard_parent"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_alignParentTop="true"
+ android:fillViewport="true" >
+ <com.matburt.mobileorg.Gui.Wizard.WideLinearLayout
+ android:id="@+id/wizard_container"
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+ android:orientation="horizontal" >
+
+ <!-- page 1 -->
+
+ <ScrollView
+ android:id="@+id/wizard_page1_container"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:fillViewport="true" >
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical" >
+
+ <include
+ android:id="@+id/wizard_page1"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:layout_weight="1.0"
+ layout="@layout/wizard_page1" />
+
+ <include layout="@layout/wizard_navbar_first" />
+ </LinearLayout>
+ </ScrollView>
+ </com.matburt.mobileorg.Gui.Wizard.WideLinearLayout>
+
+</com.matburt.mobileorg.Gui.Wizard.WizardView>
View
@@ -2,9 +2,10 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory android:title="@string/preference_synchronization" >
- <com.matburt.mobileorg.Settings.WizardPreferences
- android:key="wizardPref"
- android:title="Wizard Preference" />
+ <Preference
+ android:title="@string/rerun_setup_wizard" >
+ <intent android:action="com.matburt.mobileorg.Settings.SETUP_WIZARD" />
+ </Preference>
<ListPreference
android:defaultValue="webdav"
@@ -18,10 +18,10 @@
import com.actionbarsherlock.view.Window;
import com.matburt.mobileorg.R;
import com.matburt.mobileorg.Gui.Agenda.AgendasActivity;
+import com.matburt.mobileorg.Gui.Wizard.WizardActivity;
import com.matburt.mobileorg.OrgData.OrgProviderUtils;
import com.matburt.mobileorg.Services.SyncService;
import com.matburt.mobileorg.Settings.SettingsActivity;
-import com.matburt.mobileorg.Settings.WizardActivity;
import com.matburt.mobileorg.Synchronizers.Synchronizer;
import com.matburt.mobileorg.util.OrgUtils;
@@ -0,0 +1,53 @@
+package com.matburt.mobileorg.Gui.Wizard;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import android.content.Context;
+
+import com.matburt.mobileorg.R;
+
+public abstract class DirectoryBrowser<T> {
+
+ protected Context context;
+
+ protected T currentDirectory;
+ protected ArrayList<T> directoryListing = new ArrayList<T>();
+ protected ArrayList<String> directoryNames = new ArrayList<String>();
+
+ protected String upOneLevel;
+
+ public abstract void browseTo(int position);
+ protected abstract void browseTo(String directory);
+ public abstract boolean isCurrentDirectoryRoot();
+
+ public DirectoryBrowser(Context context) {
+ this.context = context;
+ this.upOneLevel = context.getString(R.string.up_one_level);
+ }
+
+
+ public ArrayList<String> listFiles() {
+ return directoryNames;
+ }
+
+ public String getDirectoryName(int position) {
+ return directoryNames.get(position);
+ }
+
+ protected T getDir(int position) {
+ return directoryListing.get(position);
+ }
+
+ public String getAbsolutePath(int position) {
+ T directory = directoryListing.get(position);
+
+ if (directory instanceof String)
+ return (String) directory;
+
+ if (directory instanceof File)
+ return ((File) directory).getAbsolutePath();
+
+ return "";
+ }
+}
@@ -0,0 +1,95 @@
+package com.matburt.mobileorg.Gui.Wizard;
+
+import java.util.ArrayList;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.TextView;
+
+import com.matburt.mobileorg.R;
+
+public class FolderAdapter extends ArrayAdapter<String> {
+ private int currentChecked = -1;
+ private DirectoryBrowser<?> directory;
+ private Button doneButton;
+
+ public FolderAdapter(Context context, int resource, ArrayList<String> list) {
+ super(context, resource, list);
+ }
+
+ public void setDirectoryBrowser(DirectoryBrowser<?> d) {
+ directory = d;
+ }
+
+ public String getCheckedDirectory() {
+ if (currentChecked == -1)
+ return "";
+ // (Toast.makeText(context, directory.getAbsolutePath(currentChecked),
+ // Toast.LENGTH_LONG)).show();
+ return directory.getAbsolutePath(currentChecked);
+ }
+
+ public void setDoneButton(Button b) {
+ doneButton = b;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View row = convertView;
+ TextView folder = null;
+ CheckBox check = null;
+ if (row == null) {
+ LayoutInflater inflater = LayoutInflater.from(getContext());
+ row = inflater.inflate(R.layout.folder_adapter_row, parent, false);
+ folder = (TextView) row.findViewById(R.id.folder);
+ folder.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View folder) {
+ int position = (Integer) folder.getTag();
+ // FolderAdapter.this.clear();
+ directory.browseTo(position);
+ currentChecked = -1;
+ FolderAdapter.this.notifyDataSetChanged();
+ doneButton.setEnabled(false);
+ }
+ });
+ check = (CheckBox) row.findViewById(R.id.checkbox);
+ check.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+
+ public void onCheckedChanged(CompoundButton buttonView,
+ boolean isChecked) {
+ // update last checked position
+ int position = (Integer) buttonView.getTag();
+ if (isChecked)
+ currentChecked = position;
+ else if (currentChecked == position)
+ currentChecked = -1;
+ FolderAdapter.this.notifyDataSetChanged();
+ if (isChecked)
+ doneButton.setEnabled(true);
+ }
+ });
+ }
+ folder = (TextView) row.findViewById(R.id.folder);
+ folder.setText(directory.getDirectoryName(position));
+ folder.setTag(Integer.valueOf(position));
+ check = (CheckBox) row.findViewById(R.id.checkbox);
+ // disable the "Up one level" checkbox; otherwise make sure its enabled
+ if (position == 0 && !directory.isCurrentDirectoryRoot())
+ check.setEnabled(false);
+ else
+ check.setEnabled(true);
+ check.setTag(Integer.valueOf(position));
+ // set check state. only one can be checked
+ boolean status = (currentChecked == position) ? true : false;
+ check.setChecked(status);
+ return (row);
+ }
+}
@@ -0,0 +1,46 @@
+package com.matburt.mobileorg.Gui.Wizard;
+
+import java.io.File;
+import java.util.Arrays;
+
+import android.content.Context;
+
+public class LocalDirectoryBrowser extends DirectoryBrowser<File> {
+
+ public LocalDirectoryBrowser(Context context) {
+ super(context);
+
+ browseTo(File.separator);
+ }
+
+ @Override
+ public boolean isCurrentDirectoryRoot() {
+ return currentDirectory.getParent() == null;
+ }
+
+ @Override
+ public void browseTo(int position) {
+ File newdir = getDir(position);
+ browseTo(newdir.getAbsolutePath());
+ }
+
+ @Override
+ public void browseTo(String directory) {
+ currentDirectory = new File(directory);
+ directoryNames.clear();
+ directoryListing.clear();
+ if (currentDirectory.getParent() != null) {
+ directoryNames.add(upOneLevel);
+ directoryListing.add(currentDirectory.getParentFile());
+ }
+ File[] tmpListing = currentDirectory.listFiles();
+ // default list order doesn't seem to be alpha
+ Arrays.sort(tmpListing);
+ for (File dir : tmpListing) {
+ if (dir.isDirectory() && dir.canWrite()) {
+ directoryNames.add(dir.getName());
+ directoryListing.add(dir);
+ }
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit 579dfea

Please sign in to comment.