--- /dev/null
+<?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>
--- /dev/null
+# 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
--- /dev/null
+<?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>
--- /dev/null
+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
--- /dev/null
+<?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
--- /dev/null
+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
--- /dev/null
+# 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 *;
+#}
--- /dev/null
+# 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
--- /dev/null
+<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
--- /dev/null
+<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
--- /dev/null
+<?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
--- /dev/null
+<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
--- /dev/null
+<?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
--- /dev/null
+/* 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;
+ }
+
+ }
+}
# project structure.
# Project target.
-target=android-14
+target=android-17
android.library.reference.1=actionbarsherlock/library
--- /dev/null
+<?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
--- /dev/null
+<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>
--- /dev/null
+<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>
--- /dev/null
+<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>
<?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>
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
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
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
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
--- /dev/null
+/* 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;
+ }
+ */
+}
+
+