diff --git a/core/res/layout/activity_dialogholder.xml b/core/res/layout/activity_dialogholder.xml
deleted file mode 100644
index 02cd3f98..00000000
--- a/core/res/layout/activity_dialogholder.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
diff --git a/core/res/layout/fragment_about.xml b/core/res/layout/dialog_about.xml
similarity index 78%
rename from core/res/layout/fragment_about.xml
rename to core/res/layout/dialog_about.xml
index 56bf496b..8866f1f0 100644
--- a/core/res/layout/fragment_about.xml
+++ b/core/res/layout/dialog_about.xml
@@ -3,46 +3,46 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:layout_margin="@dimen/margin_default" >
-
+ android:padding="@dimen/margin_default" >
+
-
+ android:fontFamily="sans-serif-condensed"
+ android:text="@string/app_name"
+ android:textColor="@android:color/white"
+ android:textSize="36sp" />
+
-
+ android:gravity="center"
+ android:text="@string/system_description" />
+
-
+ android:textSize="18sp" />
+
-
+ android:layout_marginTop="4dip"
+ android:gravity="center"
+ android:text="@string/app_license" />
+
\ No newline at end of file
diff --git a/core/res/layout/dialog_changelog.xml b/core/res/layout/dialog_changelog.xml
new file mode 100644
index 00000000..dc51afd1
--- /dev/null
+++ b/core/res/layout/dialog_changelog.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/core/res/menu/fragment_about.xml b/core/res/menu/dialog_about.xml
similarity index 100%
rename from core/res/menu/fragment_about.xml
rename to core/res/menu/dialog_about.xml
diff --git a/core/res/values/changelog.xml b/core/res/values/changelog.xml
new file mode 100644
index 00000000..2966749d
--- /dev/null
+++ b/core/res/values/changelog.xml
@@ -0,0 +1,11 @@
+
+
+
+Transdroid 2.0.0-alpha1\n
+- Totally reworked Holo-style interface\n
+- Provide tablet interface on smaller tablets\n
+- Automatically switch between local and remote IP configurations\n
+\n
+Older changes: http://www.transdroid.org/about/changelog/
+
+
\ No newline at end of file
diff --git a/core/src/org/transdroid/core/gui/AboutFragment.java b/core/src/org/transdroid/core/gui/AboutFragment.java
deleted file mode 100644
index 6a336bc5..00000000
--- a/core/src/org/transdroid/core/gui/AboutFragment.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.transdroid.core.gui;
-
-import org.androidannotations.annotations.AfterViews;
-import org.androidannotations.annotations.EFragment;
-import org.androidannotations.annotations.OptionsItem;
-import org.androidannotations.annotations.OptionsMenu;
-
-import android.app.Dialog;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.view.Window;
-
-import com.actionbarsherlock.app.SherlockDialogFragment;
-
-/**
- * Fragment that shows info about the application developer and used open source libraries.
- * @author Eric Kok
- */
-@EFragment(resName="fragment_about")
-@OptionsMenu(resName="fragment_about")
-public class AboutFragment extends SherlockDialogFragment {
-
- @AfterViews
- protected void init() {
- // TODO: Add list of used open source libraries
- }
-
- @OptionsItem(resName="action_visitwebsite")
- protected void visitWebsite() {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://transdroid.org")));
- }
-
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- // Allow presenting of this fragment as a dialog
- Dialog dialog = super.onCreateDialog(savedInstanceState);
- dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
- return dialog;
- }
-
-}
diff --git a/core/src/org/transdroid/core/gui/navigation/DialogHelper.java b/core/src/org/transdroid/core/gui/navigation/DialogHelper.java
new file mode 100644
index 00000000..226faed6
--- /dev/null
+++ b/core/src/org/transdroid/core/gui/navigation/DialogHelper.java
@@ -0,0 +1,91 @@
+package org.transdroid.core.gui.navigation;
+
+import java.io.Serializable;
+
+import org.androidannotations.annotations.EActivity;
+import org.androidannotations.annotations.Extra;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.Window;
+
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuInflater;
+import com.actionbarsherlock.view.MenuItem;
+
+/**
+ * Helper class that show a dialog either as pop-up or as full screen activity. Should be used by calling
+ * {@link #showDialog(Context, DialogSpecification)} with in instance of the dialog specification that should be shown,
+ * from the calling activity's {@link Activity#onCreateDialog(int)}.
+ * @author Eric Kok
+ */
+@EActivity
+public class DialogHelper extends SherlockActivity {
+
+ @Extra
+ protected DialogSpecification dialog;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(dialog.getDialogLayoutId());
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater menuInflater = getSupportMenuInflater();
+ menuInflater.inflate(dialog.getDialogMenuId(), menu);
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ return dialog.onMenuItemSelected(this, item.getItemId());
+ }
+
+ /**
+ * Call this from {@link Activity#onCreateDialog(int)}, supplying an instance of the {@link DialogSpecification}
+ * that should be shown to the user.
+ * @param context The activity that calls this method and which will own the constructed dialog
+ * @param dialog An instance of the specification for the dialog that needs to be shown
+ * @return Either an instance of a {@link Dialog} that the activity should further control or null if the dialog
+ * will instead be opened as a full screen activity
+ */
+ public static Dialog showDialog(Context context, DialogSpecification dialog) {
+
+ // If the device is large (i.e. a tablet) then return a dialog to show
+ if (!NavigationHelper_.getInstance_(context).isSmallScreen())
+ return new PopupDialog(context, dialog);
+
+ // This is a small device; create a full screen dialog (which is just an activity)
+ DialogHelper_.intent(context).dialog(dialog).start();
+ return null;
+
+ }
+
+ /**
+ * A specific dialog that shows some layout (resource) as contents. It has no buttons or other chrome.
+ */
+ protected static class PopupDialog extends Dialog {
+ public PopupDialog(Context context, DialogSpecification dialog) {
+ super(context);
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ setContentView(dialog.getDialogLayoutId());
+ }
+ }
+
+ /**
+ * Specification for some dialog that can be show to the user, consisting of a custom layout and possibly an action
+ * bar menu. Warning: the action bar, and thus the menu options, is only shown when the dialog is presented as full
+ * screen activity. Use only for unimportant actions.
+ */
+ public interface DialogSpecification extends Serializable {
+ int getDialogLayoutId();
+ int getDialogMenuId();
+ boolean onMenuItemSelected(Activity ownerActivity, int selectedItemId);
+ }
+
+}
diff --git a/core/src/org/transdroid/core/gui/navigation/DialogHolderActivity.java b/core/src/org/transdroid/core/gui/navigation/DialogHolderActivity.java
deleted file mode 100644
index 55f94950..00000000
--- a/core/src/org/transdroid/core/gui/navigation/DialogHolderActivity.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.transdroid.core.gui.navigation;
-
-import org.androidannotations.annotations.AfterViews;
-import org.androidannotations.annotations.EActivity;
-import org.androidannotations.annotations.Extra;
-import org.transdroid.core.gui.log.Log;
-
-import android.content.Context;
-import android.support.v4.app.DialogFragment;
-import android.support.v4.app.FragmentTransaction;
-
-import com.actionbarsherlock.app.SherlockFragmentActivity;
-
-@EActivity(resName = "activity_dialogholder")
-public class DialogHolderActivity extends SherlockFragmentActivity {
-
- @Extra
- protected String dialogType;
-
- /**
- * Use this method to show some dialog; it will show the dialog as full screen fragment on smaller devices. Use the
- * DialogFragment's class here only; a new instance will be created by this holder activity.
- */
- public static void showDialog(Context context, Class extends DialogFragment> dialogType) {
- DialogHolderActivity_.intent(context).dialogType(dialogType.getName()).start();
- }
-
- @AfterViews
- public void init() {
- try {
- // Instantiate an instance of the requested dialog
- DialogFragment dialog = (DialogFragment) Class.forName(dialogType).newInstance();
- // Determine if the dialog should be shown as full size screen
- boolean isSmall = NavigationHelper_.getInstance_(this).isSmallScreen();
- if (!isSmall) {
- // Show as normal dialog
- dialog.show(this.getSupportFragmentManager(), "about_dialog");
- } else {
- // Small device, so show the fragment full screen
- FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction();
- // Note: the fragment is not added to the back stack, as this activity already is
- ft.add(android.R.id.content, dialog).commit();
- }
- } catch (InstantiationException e) {
- Log.e(this, "Tried to show a dialog of type " + dialogType + ", but that cannot be instantiated.");
- } catch (IllegalAccessException e) {
- Log.e(this, "Tried to show a dialog of type " + dialogType + ", but it is not accessible.");
- } catch (ClassNotFoundException e) {
- Log.e(this, "Tried to show a dialog of type " + dialogType + ", but that class doesn't exist.");
- }
- }
-
-}
diff --git a/core/src/org/transdroid/core/gui/settings/AboutDialog.java b/core/src/org/transdroid/core/gui/settings/AboutDialog.java
new file mode 100644
index 00000000..72ccfe95
--- /dev/null
+++ b/core/src/org/transdroid/core/gui/settings/AboutDialog.java
@@ -0,0 +1,37 @@
+package org.transdroid.core.gui.settings;
+
+import org.transdroid.core.R;
+import org.transdroid.core.gui.navigation.DialogHelper;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+
+/**
+ * Fragment that shows info about the application developer and used open source libraries.
+ * @author Eric Kok
+ */
+public class AboutDialog implements DialogHelper.DialogSpecification {
+
+ private static final long serialVersionUID = -4711432869714292985L;
+
+ @Override
+ public int getDialogLayoutId() {
+ return R.layout.dialog_about;
+ }
+
+ @Override
+ public int getDialogMenuId() {
+ return R.menu.dialog_about;
+ }
+
+ @Override
+ public boolean onMenuItemSelected(Activity ownerActivity, int selectedItemId) {
+ if (selectedItemId == R.id.action_visitwebsite) {
+ ownerActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://transdroid.org")));
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/core/src/org/transdroid/core/gui/settings/ChangelogDialog.java b/core/src/org/transdroid/core/gui/settings/ChangelogDialog.java
new file mode 100644
index 00000000..c777598c
--- /dev/null
+++ b/core/src/org/transdroid/core/gui/settings/ChangelogDialog.java
@@ -0,0 +1,37 @@
+package org.transdroid.core.gui.settings;
+
+import org.transdroid.core.R;
+import org.transdroid.core.gui.navigation.DialogHelper;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+
+/**
+ * Fragment that shows recent app changes.
+ * @author Eric Kok
+ */
+public class ChangelogDialog implements DialogHelper.DialogSpecification {
+
+ private static final long serialVersionUID = -4563410777022941124L;
+
+ @Override
+ public int getDialogLayoutId() {
+ return R.layout.dialog_changelog;
+ }
+
+ @Override
+ public int getDialogMenuId() {
+ return R.menu.dialog_about;
+ }
+
+ @Override
+ public boolean onMenuItemSelected(Activity ownerActivity, int selectedItemId) {
+ if (selectedItemId == R.id.action_visitwebsite) {
+ ownerActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://transdroid.org/about/changelog/")));
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/core/src/org/transdroid/core/gui/settings/MainSettingsActivity.java b/core/src/org/transdroid/core/gui/settings/MainSettingsActivity.java
index 7abf5e11..66deaa4d 100644
--- a/core/src/org/transdroid/core/gui/settings/MainSettingsActivity.java
+++ b/core/src/org/transdroid/core/gui/settings/MainSettingsActivity.java
@@ -36,15 +36,13 @@ public class MainSettingsActivity extends SherlockPreferenceActivity {
@Bean
protected SearchHelper searchHelper;
- @SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
// Note: Settings are loaded in onResume()
-
}
+ @SuppressWarnings("deprecation")
@Override
protected void onResume() {
super.onResume();
diff --git a/core/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java b/core/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java
index bcb29689..61768852 100644
--- a/core/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java
+++ b/core/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java
@@ -4,22 +4,23 @@ import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EActivity;
import org.transdroid.core.R;
import org.transdroid.core.app.settings.ApplicationSettings;
-import org.transdroid.core.gui.AboutFragment;
import org.transdroid.core.gui.log.ErrorLogSender;
-import org.transdroid.core.gui.navigation.DialogHolderActivity;
+import org.transdroid.core.gui.navigation.DialogHelper;
+import android.app.Dialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
-import android.widget.Toast;
import com.actionbarsherlock.app.SherlockPreferenceActivity;
@EActivity
public class SystemSettingsActivity extends SherlockPreferenceActivity {
+ protected static final int DIALOG_CHANGELOG = 0;
+ protected static final int DIALOG_ABOUT = 1;
protected static final String INSTALLHELP_URI = "http://www.transdroid.org/download/";
@Bean
@@ -59,20 +60,30 @@ public class SystemSettingsActivity extends SherlockPreferenceActivity {
};
private OnPreferenceClickListener onChangeLogClick = new OnPreferenceClickListener() {
+ @SuppressWarnings("deprecation")
@Override
public boolean onPreferenceClick(Preference preference) {
- // TODO: Implement change log screen
- Toast.makeText(SystemSettingsActivity.this, "TODO: Implement change log screen", Toast.LENGTH_LONG).show();
+ showDialog(DIALOG_CHANGELOG);
return true;
}
};
private OnPreferenceClickListener onAboutClick = new OnPreferenceClickListener() {
+ @SuppressWarnings("deprecation")
@Override
public boolean onPreferenceClick(Preference preference) {
- DialogHolderActivity.showDialog(SystemSettingsActivity.this, AboutFragment.class);
+ showDialog(DIALOG_ABOUT);
return true;
}
};
+ protected Dialog onCreateDialog(int id) {
+ switch (id) {
+ case DIALOG_CHANGELOG:
+ return DialogHelper.showDialog(this, new ChangelogDialog());
+ case DIALOG_ABOUT:
+ return DialogHelper.showDialog(this, new AboutDialog());
+ }
+ return null;
+ };
}
diff --git a/full/AndroidManifest.xml b/full/AndroidManifest.xml
index 17aff8b2..356bca80 100644
--- a/full/AndroidManifest.xml
+++ b/full/AndroidManifest.xml
@@ -61,7 +61,7 @@
-
+
+