Merge branch 'file_icons' into workaround_integration
authorDavid A. Velasco <dvelasco@solidgear.es>
Wed, 30 Jan 2013 12:49:36 +0000 (13:49 +0100)
committerDavid A. Velasco <dvelasco@solidgear.es>
Wed, 30 Jan 2013 12:49:36 +0000 (13:49 +0100)
30 files changed:
oc_jb_workaround/.classpath [new file with mode: 0644]
oc_jb_workaround/.gitignore [new file with mode: 0644]
oc_jb_workaround/.project [new file with mode: 0644]
oc_jb_workaround/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
oc_jb_workaround/AndroidManifest.xml [new file with mode: 0644]
oc_jb_workaround/README.md [new file with mode: 0644]
oc_jb_workaround/proguard-project.txt [new file with mode: 0644]
oc_jb_workaround/project.properties [new file with mode: 0644]
oc_jb_workaround/res/drawable-hdpi/oc_icon.png [new file with mode: 0644]
oc_jb_workaround/res/drawable-hdpi/oc_workaround_icon.png [new file with mode: 0644]
oc_jb_workaround/res/drawable-ldpi/oc_icon.png [new file with mode: 0644]
oc_jb_workaround/res/drawable-ldpi/oc_workaround_icon.png [new file with mode: 0644]
oc_jb_workaround/res/drawable-mdpi/oc_icon.png [new file with mode: 0644]
oc_jb_workaround/res/drawable-mdpi/oc_workaround_icon.png [new file with mode: 0644]
oc_jb_workaround/res/drawable-xhdpi/oc_icon.png [new file with mode: 0644]
oc_jb_workaround/res/drawable-xhdpi/oc_workaround_icon.png [new file with mode: 0644]
oc_jb_workaround/res/values-v11/styles.xml [new file with mode: 0644]
oc_jb_workaround/res/values-v14/styles.xml [new file with mode: 0644]
oc_jb_workaround/res/values/strings.xml [new file with mode: 0644]
oc_jb_workaround/res/values/styles.xml [new file with mode: 0644]
oc_jb_workaround/res/xml/authenticator.xml [new file with mode: 0644]
oc_jb_workaround/src/com/owncloud/android/workaround/accounts/AccountAuthenticatorService.java [new file with mode: 0644]
project.properties
res/layout/fragment_changelog.xml [new file with mode: 0644]
res/raw-de/changelog.html [new file with mode: 0644]
res/raw-es/changelog.html [new file with mode: 0644]
res/raw/changelog.html [new file with mode: 0644]
res/values/strings.xml
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
src/com/owncloud/android/ui/dialog/ChangelogDialog.java [new file with mode: 0644]

diff --git a/oc_jb_workaround/.classpath b/oc_jb_workaround/.classpath
new file mode 100644 (file)
index 0000000..3f9691c
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+       <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="src" path="gen"/>
+       <classpathentry kind="output" path="bin/classes"/>
+</classpath>
diff --git a/oc_jb_workaround/.gitignore b/oc_jb_workaround/.gitignore
new file mode 100644 (file)
index 0000000..0105cb3
--- /dev/null
@@ -0,0 +1,19 @@
+# built application files
+*.apk
+*.ap_
+
+# files for the dex VM
+*.dex
+
+# Java class files
+*.class
+
+# generated files
+bin/
+gen/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Mac .DS_Store files
+.DS_Store
diff --git a/oc_jb_workaround/.project b/oc_jb_workaround/.project
new file mode 100644 (file)
index 0000000..54714bb
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>owncloud-android-workaround-accounts</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/oc_jb_workaround/.settings/org.eclipse.jdt.core.prefs b/oc_jb_workaround/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..b080d2d
--- /dev/null
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/oc_jb_workaround/AndroidManifest.xml b/oc_jb_workaround/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..af29747
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.owncloud.android.workaround.accounts"
+    android:versionCode="0100000"
+    android:versionName="1.0" >
+
+    <uses-sdk
+        android:minSdkVersion="16"
+        android:targetSdkVersion="16" />
+
+    <application
+        android:allowBackup="false"
+        android:icon="@drawable/oc_workaround_icon"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+        <service
+            android:name=".AccountAuthenticatorService"
+            android:exported="false">
+            <intent-filter android:priority="1">
+                <action android:name="android.accounts.AccountAuthenticator" />
+            </intent-filter>
+            <meta-data
+                android:name="android.accounts.AccountAuthenticator"
+                android:resource="@xml/authenticator" />
+        </service>
+    </application>
+
+</manifest>
\ No newline at end of file
diff --git a/oc_jb_workaround/README.md b/oc_jb_workaround/README.md
new file mode 100644 (file)
index 0000000..cddf3bd
--- /dev/null
@@ -0,0 +1,10 @@
+ownCloud Jelly Bean Workaround
+==============================
+
+Helper app to work around the problem of lost credentials at reboot time found
+in devices with Android 4.1.x. 
+
+Only needed for ownCloud apps installed from the Google Play Store.
+
+See more information about the bug here: 
+http://code.google.com/p/android/issues/detail?id=34880
\ No newline at end of file
diff --git a/oc_jb_workaround/proguard-project.txt b/oc_jb_workaround/proguard-project.txt
new file mode 100644 (file)
index 0000000..f2fe155
--- /dev/null
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
diff --git a/oc_jb_workaround/project.properties b/oc_jb_workaround/project.properties
new file mode 100644 (file)
index 0000000..9b84a6b
--- /dev/null
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-16
diff --git a/oc_jb_workaround/res/drawable-hdpi/oc_icon.png b/oc_jb_workaround/res/drawable-hdpi/oc_icon.png
new file mode 100644 (file)
index 0000000..e388c7b
Binary files /dev/null and b/oc_jb_workaround/res/drawable-hdpi/oc_icon.png differ
diff --git a/oc_jb_workaround/res/drawable-hdpi/oc_workaround_icon.png b/oc_jb_workaround/res/drawable-hdpi/oc_workaround_icon.png
new file mode 100644 (file)
index 0000000..32985e3
Binary files /dev/null and b/oc_jb_workaround/res/drawable-hdpi/oc_workaround_icon.png differ
diff --git a/oc_jb_workaround/res/drawable-ldpi/oc_icon.png b/oc_jb_workaround/res/drawable-ldpi/oc_icon.png
new file mode 100644 (file)
index 0000000..11cf0ab
Binary files /dev/null and b/oc_jb_workaround/res/drawable-ldpi/oc_icon.png differ
diff --git a/oc_jb_workaround/res/drawable-ldpi/oc_workaround_icon.png b/oc_jb_workaround/res/drawable-ldpi/oc_workaround_icon.png
new file mode 100644 (file)
index 0000000..03fa38b
Binary files /dev/null and b/oc_jb_workaround/res/drawable-ldpi/oc_workaround_icon.png differ
diff --git a/oc_jb_workaround/res/drawable-mdpi/oc_icon.png b/oc_jb_workaround/res/drawable-mdpi/oc_icon.png
new file mode 100644 (file)
index 0000000..6997c7e
Binary files /dev/null and b/oc_jb_workaround/res/drawable-mdpi/oc_icon.png differ
diff --git a/oc_jb_workaround/res/drawable-mdpi/oc_workaround_icon.png b/oc_jb_workaround/res/drawable-mdpi/oc_workaround_icon.png
new file mode 100644 (file)
index 0000000..78cd3ed
Binary files /dev/null and b/oc_jb_workaround/res/drawable-mdpi/oc_workaround_icon.png differ
diff --git a/oc_jb_workaround/res/drawable-xhdpi/oc_icon.png b/oc_jb_workaround/res/drawable-xhdpi/oc_icon.png
new file mode 100644 (file)
index 0000000..e388c7b
Binary files /dev/null and b/oc_jb_workaround/res/drawable-xhdpi/oc_icon.png differ
diff --git a/oc_jb_workaround/res/drawable-xhdpi/oc_workaround_icon.png b/oc_jb_workaround/res/drawable-xhdpi/oc_workaround_icon.png
new file mode 100644 (file)
index 0000000..d8a924c
Binary files /dev/null and b/oc_jb_workaround/res/drawable-xhdpi/oc_workaround_icon.png differ
diff --git a/oc_jb_workaround/res/values-v11/styles.xml b/oc_jb_workaround/res/values-v11/styles.xml
new file mode 100644 (file)
index 0000000..541752f
--- /dev/null
@@ -0,0 +1,11 @@
+<resources>
+
+    <!--
+        Base application theme for API 11+. This theme completely replaces
+        AppBaseTheme from res/values/styles.xml on API 11+ devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
+        <!-- API 11 theme customizations can go here. -->
+    </style>
+
+</resources>
\ No newline at end of file
diff --git a/oc_jb_workaround/res/values-v14/styles.xml b/oc_jb_workaround/res/values-v14/styles.xml
new file mode 100644 (file)
index 0000000..f20e015
--- /dev/null
@@ -0,0 +1,12 @@
+<resources>
+
+    <!--
+        Base application theme for API 14+. This theme completely replaces
+        AppBaseTheme from BOTH res/values/styles.xml and
+        res/values-v11/styles.xml on API 14+ devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+        <!-- API 14 theme customizations can go here. -->
+    </style>
+
+</resources>
\ No newline at end of file
diff --git a/oc_jb_workaround/res/values/strings.xml b/oc_jb_workaround/res/values/strings.xml
new file mode 100644 (file)
index 0000000..177c053
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <string name="app_name">ownCloud Jelly Bean Workaround for lost credentials</string>
+
+</resources>
\ No newline at end of file
diff --git a/oc_jb_workaround/res/values/styles.xml b/oc_jb_workaround/res/values/styles.xml
new file mode 100644 (file)
index 0000000..4a10ca4
--- /dev/null
@@ -0,0 +1,20 @@
+<resources>
+
+    <!--
+        Base application theme, dependent on API level. This theme is replaced
+        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Light">
+        <!--
+            Theme customizations available in newer API levels can go in
+            res/values-vXX/styles.xml, while customizations related to
+            backward-compatibility can go here.
+        -->
+    </style>
+
+    <!-- Application theme. -->
+    <style name="AppTheme" parent="AppBaseTheme">
+        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+    </style>
+
+</resources>
\ No newline at end of file
diff --git a/oc_jb_workaround/res/xml/authenticator.xml b/oc_jb_workaround/res/xml/authenticator.xml
new file mode 100644 (file)
index 0000000..a62aa21
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
+                       android:accountType="owncloud"
+                       android:icon="@drawable/oc_icon"
+                       android:label="@string/app_name"
+                       android:smallIcon="@drawable/oc_icon">  
+</account-authenticator>
\ No newline at end of file
diff --git a/oc_jb_workaround/src/com/owncloud/android/workaround/accounts/AccountAuthenticatorService.java b/oc_jb_workaround/src/com/owncloud/android/workaround/accounts/AccountAuthenticatorService.java
new file mode 100644 (file)
index 0000000..2d81f65
--- /dev/null
@@ -0,0 +1,103 @@
+/* ownCloud Jelly Bean Workaround for lost credentials
+ *
+ *   Copyright (C) 2013 ownCloud Inc.
+ */
+
+package com.owncloud.android.workaround.accounts;
+
+import android.accounts.AbstractAccountAuthenticator;
+import android.accounts.Account;
+import android.accounts.AccountAuthenticatorResponse;
+import android.accounts.AccountManager;
+import android.accounts.NetworkErrorException;
+import android.app.Service;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.IBinder;
+
+public class AccountAuthenticatorService extends Service {
+
+    private AccountAuthenticator mAuthenticator;
+    static final public String ACCOUNT_TYPE = "owncloud";
+
+    @Override
+    public void onCreate() {
+        super.onCreate();
+        mAuthenticator = new AccountAuthenticator(this);
+    }
+
+    @Override
+    public IBinder onBind(Intent intent) {
+        return mAuthenticator.getIBinder();
+    }
+    
+    
+    public static class AccountAuthenticator extends AbstractAccountAuthenticator {
+
+       public AccountAuthenticator(Context context) {
+            super(context);
+        }
+
+        @Override
+        public Bundle addAccount(AccountAuthenticatorResponse response,
+                String accountType, String authTokenType,
+                String[] requiredFeatures, Bundle options)
+                throws NetworkErrorException {
+            return getCommonResultBundle();
+        }
+
+        
+               @Override
+        public Bundle confirmCredentials(AccountAuthenticatorResponse response,
+                Account account, Bundle options) throws NetworkErrorException {
+            return getCommonResultBundle();
+        }
+
+        @Override
+        public Bundle editProperties(AccountAuthenticatorResponse response,
+                String accountType) {
+            return getCommonResultBundle();
+        }
+
+        @Override
+        public Bundle getAuthToken(AccountAuthenticatorResponse response,
+                Account account, String authTokenType, Bundle options)
+                throws NetworkErrorException {
+            return getCommonResultBundle();
+        }
+
+        @Override
+        public String getAuthTokenLabel(String authTokenType) {
+            return "";
+        }
+
+        @Override
+        public Bundle hasFeatures(AccountAuthenticatorResponse response,
+                Account account, String[] features) throws NetworkErrorException {
+            return getCommonResultBundle();
+        }
+
+        @Override
+        public Bundle updateCredentials(AccountAuthenticatorResponse response,
+                Account account, String authTokenType, Bundle options)
+                throws NetworkErrorException {
+            return getCommonResultBundle();
+        }
+
+        @Override
+        public Bundle getAccountRemovalAllowed(
+                AccountAuthenticatorResponse response, Account account)
+                throws NetworkErrorException {
+            return getCommonResultBundle();
+        }
+
+        private Bundle getCommonResultBundle() {
+               Bundle resultBundle = new Bundle();
+            resultBundle.putInt(AccountManager.KEY_ERROR_CODE, AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION);
+            resultBundle.putString(AccountManager.KEY_ERROR_MESSAGE, "This is just a workaround, not a real account authenticator");
+            return resultBundle;
+               }
+
+    }
+}
index d476196..716944a 100644 (file)
@@ -8,5 +8,5 @@
 # project structure.
 
 # Project target.
-target=android-14
+target=android-17
 android.library.reference.1=actionbarsherlock/library
diff --git a/res/layout/fragment_changelog.xml b/res/layout/fragment_changelog.xml
new file mode 100644 (file)
index 0000000..befaf08
--- /dev/null
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 
+  ownCloud Android client application
+
+  Copyright (C) 2013 ownCloud Inc
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/owncloud_white" 
+    android:id="@+id/explanation"
+    android:orientation="vertical">
+
+       <TextView
+               android:id="@+id/message"
+               android:layout_width="match_parent"
+               android:layout_height="0dp"
+               android:layout_weight="2"
+           android:padding="10dip"
+           android:scrollbarAlwaysDrawVerticalTrack="true"
+               android:text="@string/text_placeholder"
+               android:autoLink="all"
+               />
+    
+    <!-- LinearLayout
+        android:id="@+id/buttons"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center"
+        android:orientation="horizontal" >
+
+               <Button
+                   android:id="@+id/ok"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:layout_weight="1"
+                   android:text="@string/common_ok" />
+               
+        <Button
+            android:id="@+id/cancel"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="@string/common_cancel" />
+
+       </LinearLayout -->
+       
+</LinearLayout>
\ No newline at end of file
diff --git a/res/raw-de/changelog.html b/res/raw-de/changelog.html
new file mode 100644 (file)
index 0000000..836ad76
--- /dev/null
@@ -0,0 +1,13 @@
+<html>
+       <body>
+       <p>
+               Dieses Gerät läuft mit Android 4.1.x.
+       </p>
+       <p>
+               In dieser Version von Android existiert ein Bug, der nach jedem Neustart eine erneute Eingabe der ownCloud Login-Informationen nötig macht. Um das zu umgehen installieren Sie bitte diese kostenlose Hilfs-App: 
+       </p>
+       <p style="text-align:center">
+               <a href="http://play.google.com/store/apps/details?id=com.owncloud.android.workaround.accounts">ownCloud Jelly Bean Workaround</a> 
+       </p>
+       </body>
+</html>
diff --git a/res/raw-es/changelog.html b/res/raw-es/changelog.html
new file mode 100644 (file)
index 0000000..693224a
--- /dev/null
@@ -0,0 +1,13 @@
+<html>
+       <body>
+       <p>
+               Su dispositivo ejecuta Android 4.1.x. 
+       </p>
+       <p>
+               Para prevenir la pérdida de las credenciales de sus cuentas ownCloud en cada reinicio, por favor, instale esta app gratuita que evita el problema en Jelly Bean:        
+       </p>
+       <p style="text-align:center">
+               <a href="http://play.google.com/store/apps/details?id=com.owncloud.android.workaround.accounts">ownCloud Jelly Bean Workaround</a>
+       </p>
+       </body>
+</html>
diff --git a/res/raw/changelog.html b/res/raw/changelog.html
new file mode 100644 (file)
index 0000000..fccf0f7
--- /dev/null
@@ -0,0 +1,13 @@
+<html>
+       <body>
+       <p>
+               Your device runs Android 4.1.x. 
+       </p>
+       <p>
+               To prevent losing your ownCloud account credentials on every reboot, please, install this free helper app to work around the bug in Jelly Bean:
+       </p>
+       <p style="text-align:center">
+               <a href="http://play.google.com/store/apps/details?id=com.owncloud.android.workaround.accounts">ownCloud Jelly Bean Workaround</a> 
+       </p>
+       </body>
+</html>
index 0041d1b..8676e46 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <string name="app_name">ownCloud</string>
+    <string name="whats_new">What\'s new</string>
     <string name="main_password">Password:</string>
     <string name="main_login">Username:</string>
     <string name="main_button_login">Login</string>
index cfee79d..cfd9ae5 100644 (file)
@@ -35,6 +35,7 @@ import android.content.Intent;
 import android.content.IntentFilter;\r
 import android.content.ServiceConnection;\r
 import android.content.SharedPreferences;\r
+import android.content.SharedPreferences.Editor;\r
 import android.content.pm.PackageInfo;\r
 import android.content.pm.PackageManager.NameNotFoundException;\r
 import android.content.res.Resources.NotFoundException;\r
@@ -82,6 +83,7 @@ import com.owncloud.android.operations.RenameFileOperation;
 import com.owncloud.android.operations.SynchronizeFileOperation;\r
 import com.owncloud.android.operations.RemoteOperationResult.ResultCode;\r
 import com.owncloud.android.syncadapter.FileSyncService;\r
+import com.owncloud.android.ui.dialog.ChangelogDialog;\r
 import com.owncloud.android.ui.dialog.SslValidatorDialog;\r
 import com.owncloud.android.ui.dialog.SslValidatorDialog.OnSslValidatorListener;\r
 import com.owncloud.android.ui.fragment.FileDetailFragment;\r
@@ -124,6 +126,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
     private static final int DIALOG_CHOOSE_UPLOAD_SOURCE = 4;\r
     private static final int DIALOG_SSL_VALIDATOR = 5;\r
     private static final int DIALOG_CERT_NOT_SAVED = 6;\r
+    private static final String DIALOG_CHANGELOG_TAG = "DIALOG_CHANGELOG";\r
 \r
     \r
     private static final int ACTION_SELECT_CONTENT_FROM_APPS = 1;\r
@@ -206,11 +209,41 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
         actionBar.setListNavigationCallbacks(mDirectories, this);\r
         setSupportProgressBarIndeterminateVisibility(false);        // always AFTER setContentView(...) ; to workaround bug in its implementation\r
         \r
+        \r
+        // show changelog, if needed\r
+        showChangeLog();\r
+        \r
         Log.d(getClass().toString(), "onCreate() end");\r
     }\r
 \r
     \r
     /**\r
+     * Shows a dialog with the change log of the current version after each app update\r
+     * \r
+     *  TODO make it permanent; by now, only to advice the workaround app for 4.1.x\r
+     */\r
+    private void showChangeLog() {\r
+        if (android.os.Build.VERSION.SDK_INT == android.os.Build.VERSION_CODES.JELLY_BEAN) {\r
+            final String KEY_VERSION = "version";\r
+            SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());\r
+            int currentVersionNumber = 0;\r
+            int savedVersionNumber = sharedPref.getInt(KEY_VERSION, 0);\r
+            try {\r
+                PackageInfo pi          = getPackageManager().getPackageInfo(getPackageName(), 0);\r
+                currentVersionNumber    = pi.versionCode;\r
+            } catch (Exception e) {}\r
+     \r
+            if (currentVersionNumber > savedVersionNumber) {\r
+                ChangelogDialog.newInstance(true).show(getSupportFragmentManager(), DIALOG_CHANGELOG_TAG);\r
+                Editor editor   = sharedPref.edit();\r
+                editor.putInt(KEY_VERSION, currentVersionNumber);\r
+                editor.commit();\r
+            }\r
+        }\r
+    }\r
+    \r
+\r
+    /**\r
      * Launches the account creation activity. To use when no ownCloud account is available\r
      */\r
     private void createFirstAccount() {\r
diff --git a/src/com/owncloud/android/ui/dialog/ChangelogDialog.java b/src/com/owncloud/android/ui/dialog/ChangelogDialog.java
new file mode 100644 (file)
index 0000000..6330da7
--- /dev/null
@@ -0,0 +1,109 @@
+/* ownCloud Android client application
+ *   Copyright (C) 2013  ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package com.owncloud.android.ui.dialog;
+
+import java.io.InputStream;
+import java.util.Scanner;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.webkit.WebView;
+import android.widget.TextView;
+
+import com.actionbarsherlock.app.SherlockDialogFragment;
+import com.owncloud.android.R;
+
+/**
+ * Dialog to show the contents of res/raw/CHANGELOG.txt
+ */
+public class ChangelogDialog extends SherlockDialogFragment {
+
+    private static final String ARG_CANCELABLE = ChangelogDialog.class.getCanonicalName() + ".ARG_CANCELABLE";
+
+
+    /**
+     * Public factory method to get dialog instances.
+     * 
+     * @param cancelable    If 'true', the dialog can be cancelled by the user input (BACK button, touch outside...)
+     * @return              New dialog instance, ready to show.
+     */
+    public static ChangelogDialog newInstance(boolean cancelable) {
+        ChangelogDialog fragment = new ChangelogDialog();
+        Bundle args = new Bundle();
+        args.putBoolean(ARG_CANCELABLE, cancelable);
+        fragment.setArguments(args);
+        return fragment;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        /// load the custom view to insert in the dialog, between title and 
+        WebView webview = new WebView(getActivity());
+        webview.loadUrl("file:///android_res/raw/" + getResources().getResourceEntryName(R.raw.changelog) + ".html");
+        
+        /// build the dialog
+        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+        Dialog dialog = builder.setView(webview)
+                                .setIcon(R.drawable.icon)
+                                .setTitle(R.string.whats_new)
+                                .setPositiveButton(R.string.common_ok,
+                                        new DialogInterface.OnClickListener() {
+                                    @Override
+                                    public void onClick(DialogInterface dialog, int which) {
+                                        dialog.dismiss();
+                                    }
+                                }).create();
+        
+        dialog.setCancelable(getArguments().getBoolean(ARG_CANCELABLE));
+        return dialog;
+    } 
+    
+    /**
+     * {@inheritDoc}
+     *-/
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+        /// load the custom layout
+        View view = inflater.inflate(R.layout.fragment_changelog, container);
+        mEditText = (EditText) view.findViewById(R.id.txt_your_name);
+        getDialog().setTitle(R.string.whats_new);
+        
+        /// read full contents of the change log file (don't make it too big)
+        InputStream changeLogStream = getResources().openRawResource(R.raw.changelog);
+        Scanner scanner = new java.util.Scanner(changeLogStream).useDelimiter("\\A");
+        String text = scanner.hasNext() ? scanner.next() : "";
+        
+        /// make clickable the links in the change log file
+        SpannableString sText = new SpannableString(text);
+        Linkify.addLinks(sText, Linkify.ALL);
+
+        return view;
+    }
+    */
+}
+
+