aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjruesga <jorge@ruesga.com>2012-10-28 16:22:59 +0100
committerjruesga <jorge@ruesga.com>2012-10-28 16:22:59 +0100
commitfdd6d8fa3473e4060999f8b446c6617b78ac4ad1 (patch)
tree77808f72d3b8cf0c08253c445616daff9e959a48
parentaf12854b5d435a8e6a7fc2a5a3cbed51cd4ac0e4 (diff)
downloadandroid_packages_apps_CMFileManager-fdd6d8fa3473e4060999f8b446c6617b78ac4ad1.tar.gz
android_packages_apps_CMFileManager-fdd6d8fa3473e4060999f8b446c6617b78ac4ad1.tar.bz2
android_packages_apps_CMFileManager-fdd6d8fa3473e4060999f8b446c6617b78ac4ad1.zip
Show changelog inside the application (issue #6)
Accessible from about preference setting
-rw-r--r--AndroidManifest.xml11
-rw-r--r--res/layout/dialog_scrolled_message.xml43
-rw-r--r--res/raw/changelog32
-rw-r--r--res/values/strings.xml3
-rw-r--r--src/com/cyanogenmod/filemanager/activities/ChangeLogActivity.java115
-rw-r--r--src/com/cyanogenmod/filemanager/activities/NavigationActivity.java3
-rw-r--r--src/com/cyanogenmod/filemanager/activities/preferences/SettingsPreferences.java2
-rw-r--r--src/com/cyanogenmod/filemanager/util/DialogHelper.java33
8 files changed, 234 insertions, 8 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ef2f23ab..1ebb6b11 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -132,6 +132,17 @@
</activity>
<activity
+ android:name=".activities.ChangeLogActivity"
+ android:label="@string/app_name"
+ android:uiOptions="none"
+ android:theme="@style/FileManager.Theme.Holo.Light.Overlay"
+ android:exported="false">
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ </intent-filter>
+ </activity>
+
+ <activity
android:name=".activities.EditorActivity"
android:label="@string/editor"
android:icon="@drawable/ic_launcher_editor"
diff --git a/res/layout/dialog_scrolled_message.xml b/res/layout/dialog_scrolled_message.xml
new file mode 100644
index 00000000..400ce1ec
--- /dev/null
+++ b/res/layout/dialog_scrolled_message.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ** Copyright (C) 2012 The CyanogenMod 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. -->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+
+ <ScrollView
+ android:id="@+id/editor_scroller"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentBottom="true"
+ android:layout_margin="@dimen/extra_large_margin"
+ android:scrollbars="vertical"
+ android:fillViewport="true">
+
+ <TextView
+ android:id="@+id/dialog_message"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:singleLine="false"
+ android:gravity="left|center_vertical"
+ android:textAppearance="@style/primary_text_appearance"
+ android:textStyle="normal" />
+
+ </ScrollView>
+
+</RelativeLayout> \ No newline at end of file
diff --git a/res/raw/changelog b/res/raw/changelog
new file mode 100644
index 00000000..6b2e63b7
--- /dev/null
+++ b/res/raw/changelog
@@ -0,0 +1,32 @@
+CyanogenMod File Manager
+========================
+
+Version 1.0.0
+-------------
+Initial release.
+
+Features:
+
+* 3 navigation modes:
+ · Safe mode (by default)
+ · Prompt user mode
+ · Root mode
+* History
+* Bookmarks
+* Search
+* Pick browsing
+* Breadcrumb browsing
+* Multiple selection
+* Layout view selection
+* Sort order selection
+* Show/Hide system files
+* Compression and uncompression
+* Add shortcuts to desktop
+* Mount and unmount file systems
+* Change file permissions
+* File system information
+* File information
+* Open and Open With
+* Send to
+* Internal editor
+* Swipe support \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a9193654..cac09df7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -697,6 +697,9 @@
by overwriting system files.\n\n
Do you want to continue?</string>
+ <!-- ChangeLog * Dialog title -->
+ <string name="changelog_title">Changelog</string>
+
<!-- Welcome Dialog * Title -->
<string name="welcome_title">Welcome</string>
<!-- Welcome Dialog * Message -->
diff --git a/src/com/cyanogenmod/filemanager/activities/ChangeLogActivity.java b/src/com/cyanogenmod/filemanager/activities/ChangeLogActivity.java
new file mode 100644
index 00000000..08e46cbb
--- /dev/null
+++ b/src/com/cyanogenmod/filemanager/activities/ChangeLogActivity.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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.
+ */
+
+package com.cyanogenmod.filemanager.activities;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnCancelListener;
+import android.content.DialogInterface.OnDismissListener;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.cyanogenmod.filemanager.R;
+import com.cyanogenmod.filemanager.util.DialogHelper;
+
+import java.io.InputStream;
+
+/**
+ * The activity for show the changelog of the application
+ */
+public class ChangeLogActivity extends Activity implements OnCancelListener, OnDismissListener {
+
+ private static final String TAG = "ChangeLogActivity"; //$NON-NLS-1$
+
+ private static boolean DEBUG = false;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onCreate(Bundle state) {
+ if (DEBUG) {
+ Log.d(TAG, "ChangeLogActivity.onCreate"); //$NON-NLS-1$
+ }
+
+ //Save state
+ super.onCreate(state);
+
+ init();
+ }
+
+ /**
+ * Initialize the activity. This method handles the passed intent, opens
+ * the appropriate activity and ends.
+ */
+ private void init() {
+ InputStream is = getApplicationContext().getResources().openRawResource(R.raw.changelog);
+ if (is == null) {
+ Log.e(TAG, "Changelog file not exists"); //$NON-NLS-1$
+ finish();
+ return;
+ }
+
+ try {
+ // Read the changelog
+ StringBuilder sb = new StringBuilder();
+ int read = 0;
+ byte[] data = new byte[512];
+ while ((read = is.read(data, 0, 512)) != -1) {
+ sb.append(new String(data, 0, read));
+ }
+
+ // Show a dialog
+ AlertDialog dialog = DialogHelper.createAlertDialog(
+ this, R.drawable.ic_launcher,
+ R.string.changelog_title, sb.toString(), false, true);
+ dialog.setOnCancelListener(this);
+ dialog.setOnDismissListener(this);
+ dialog.show();
+
+ } catch (Exception e) {
+ Log.e(TAG, "Failed to read changelog file", e); //$NON-NLS-1$
+ finish();
+
+ } finally {
+ try {
+ is.close();
+ } catch (Exception e) {/**NON BLOCK**/}
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ // We have to finish here; this activity is only a wrapper
+ finish();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ // We have to finish here; this activity is only a wrapper
+ finish();
+ }
+
+
+}
diff --git a/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java b/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
index ad402c3c..63f707b1 100644
--- a/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
+++ b/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
@@ -395,7 +395,8 @@ public class NavigationActivity extends Activity
//Display the welcome message?
if (firstUse) {
AlertDialog dialog = DialogHelper.createAlertDialog(
- this, R.drawable.ic_launcher, R.string.welcome_title, R.string.welcome_msg, false);
+ this, R.drawable.ic_launcher,
+ R.string.welcome_title, getString(R.string.welcome_msg), false, true);
dialog.show();
// Don't display again this dialog
diff --git a/src/com/cyanogenmod/filemanager/activities/preferences/SettingsPreferences.java b/src/com/cyanogenmod/filemanager/activities/preferences/SettingsPreferences.java
index 53dc9d49..40e561f3 100644
--- a/src/com/cyanogenmod/filemanager/activities/preferences/SettingsPreferences.java
+++ b/src/com/cyanogenmod/filemanager/activities/preferences/SettingsPreferences.java
@@ -36,6 +36,7 @@ import android.widget.Toast;
import com.cyanogenmod.filemanager.FileManagerApplication;
import com.cyanogenmod.filemanager.R;
+import com.cyanogenmod.filemanager.activities.ChangeLogActivity;
import com.cyanogenmod.filemanager.console.ConsoleBuilder;
import com.cyanogenmod.filemanager.preferences.AccessMode;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
@@ -99,6 +100,7 @@ public class SettingsPreferences extends PreferenceActivity {
} catch (Exception e) {
aboutHeader.summary = getString(R.string.pref_about_summary, ""); //$NON-NLS-1$
}
+ aboutHeader.intent = new Intent(getApplicationContext(), ChangeLogActivity.class);
}
/**
diff --git a/src/com/cyanogenmod/filemanager/util/DialogHelper.java b/src/com/cyanogenmod/filemanager/util/DialogHelper.java
index 1cab4d1e..ef2e3366 100644
--- a/src/com/cyanogenmod/filemanager/util/DialogHelper.java
+++ b/src/com/cyanogenmod/filemanager/util/DialogHelper.java
@@ -153,10 +153,27 @@ public final class DialogHelper {
*/
public static AlertDialog createAlertDialog(
Context context, int icon, int title, String message, boolean allCaps) {
+ return createAlertDialog(context, icon, title, message, allCaps, false);
+ }
+
+ /**
+ * Method that creates a new {@link AlertDialog}.
+ *
+ * @param context The current context
+ * @param icon The icon resource
+ * @param title The resource identifier of the title of the alert dialog
+ * @param message The message of the alert dialog
+ * @param allCaps If the title must have his text in caps or not
+ * @param scrolled If message need to be scrolled
+ * @return AlertDialog The alert dialog reference
+ */
+ public static AlertDialog createAlertDialog(
+ Context context, int icon, int title, String message,
+ boolean allCaps, boolean scrolled) {
//Create the alert dialog
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setCustomTitle(createTitle(context, icon, context.getString(title), allCaps));
- builder.setView(createMessage(context, message));
+ builder.setView(createMessage(context, message, scrolled));
builder.setPositiveButton(context.getString(R.string.ok), null);
return builder.create();
}
@@ -259,7 +276,7 @@ public final class DialogHelper {
0,
context.getString(title),
false));
- builder.setView(createMessage(context, message));
+ builder.setView(createMessage(context, message, false));
AlertDialog dialog = builder.create();
dialog.setButton(
DialogInterface.BUTTON_POSITIVE, context.getString(R.string.yes), onClickListener);
@@ -301,7 +318,7 @@ public final class DialogHelper {
0,
context.getString(title),
false));
- builder.setView(createMessage(context, message));
+ builder.setView(createMessage(context, message, false));
AlertDialog dialog = builder.create();
dialog.setButton(
DialogInterface.BUTTON_POSITIVE, context.getString(R.string.yes), onClickListener);
@@ -334,7 +351,7 @@ public final class DialogHelper {
0,
context.getString(title),
false));
- builder.setView(createMessage(context, message));
+ builder.setView(createMessage(context, message, false));
AlertDialog dialog = builder.create();
dialog.setButton(
DialogInterface.BUTTON_POSITIVE, context.getString(button1), onClickListener);
@@ -366,7 +383,7 @@ public final class DialogHelper {
0,
context.getString(title),
false));
- builder.setView(createMessage(context, message));
+ builder.setView(createMessage(context, message, false));
AlertDialog dialog = builder.create();
dialog.setButton(
DialogInterface.BUTTON_POSITIVE, context.getString(button1), onClickListener);
@@ -442,11 +459,13 @@ public final class DialogHelper {
* @param message The the message of the alert dialog
* @return The title view
*/
- private static View createMessage(Context context, String message) {
+ private static View createMessage(Context context, String message, boolean scrolled) {
//Inflate the dialog layouts
LayoutInflater li =
(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View lyMessage = li.inflate(R.layout.dialog_message, null);
+ View lyMessage = li.inflate(
+ scrolled ? R.layout.dialog_scrolled_message : R.layout.dialog_message,
+ null);
TextView vMsg = (TextView)lyMessage.findViewById(R.id.dialog_message);
vMsg.setText(message);
return lyMessage;