From: David A. Velasco Date: Fri, 7 Feb 2014 08:23:40 +0000 (+0100) Subject: Merge branch 'share_link__new_share' into release-1.5.4 X-Git-Tag: oc-android-1.5.5~35^2~16 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/cba8baa98d3b2a15ca8f7fce8302bd64e83c6976?hp=fdedbaa18f0a228fcb2b4fab781e3096979c7e60 Merge branch 'share_link__new_share' into release-1.5.4 --- diff --git a/res/values/setup.xml b/res/values/setup.xml index a40d5c21..2e07ae4b 100644 --- a/res/values/setup.xml +++ b/res/values/setup.xml @@ -8,6 +8,7 @@ ownCloud owncloud Owncloud_ + / diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 5d2f777d..6f33dc7a 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -100,7 +100,7 @@ import com.owncloud.android.utils.Log_OC; * @author David A. Velasco */ -public class FileDisplayActivity extends FileActivity implements +public class FileDisplayActivity extends HookActivity implements OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNavigationListener, OnSslValidatorListener, EditNameDialogListener { private ArrayAdapter mDirectories; @@ -533,7 +533,8 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa // the next operation triggers a new call to this method, but it's necessary to // ensure that the name exposed in the action bar is the current directory when the // user selected it in the navigation list - getSupportActionBar().setSelectedNavigationItem(0); + if (getSupportActionBar().getNavigationMode() == ActionBar.NAVIGATION_MODE_LIST && itemPosition != 0) + getSupportActionBar().setSelectedNavigationItem(0); } return true; } @@ -870,6 +871,8 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa ((TextView) v).setTextColor(getResources().getColorStateList( android.R.color.white)); + + fixRoot((TextView) v ); return v; } @@ -880,9 +883,16 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa ((TextView) v).setTextColor(getResources().getColorStateList( android.R.color.white)); + fixRoot((TextView) v ); return v; } + private void fixRoot(TextView v) { + if (v.getText().equals(OCFile.PATH_SEPARATOR)) { + v.setText(R.string.default_display_name_for_root_folder); + } + } + } private class SyncBroadcastReceiver extends BroadcastReceiver { @@ -1169,9 +1179,13 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa if (chosenFile == null || mDualPane) { // only list of files - set for browsing through folders OCFile currentDir = getCurrentDir(); - actionBar.setDisplayHomeAsUpEnabled(currentDir != null && currentDir.getParentId() != 0); - actionBar.setDisplayShowTitleEnabled(false); - actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); + boolean noRoot = (currentDir != null && currentDir.getParentId() != 0); + actionBar.setDisplayHomeAsUpEnabled(noRoot); + actionBar.setDisplayShowTitleEnabled(!noRoot); + if (!noRoot) { + actionBar.setTitle(getString(R.string.default_display_name_for_root_folder)); + } + actionBar.setNavigationMode(!noRoot ? ActionBar.NAVIGATION_MODE_STANDARD : ActionBar.NAVIGATION_MODE_LIST); actionBar.setListNavigationCallbacks(mDirectories, this); // assuming mDirectories is updated } else { diff --git a/src/com/owncloud/android/ui/activity/HookActivity.java b/src/com/owncloud/android/ui/activity/HookActivity.java new file mode 100644 index 00000000..54d65b1b --- /dev/null +++ b/src/com/owncloud/android/ui/activity/HookActivity.java @@ -0,0 +1,24 @@ +/* ownCloud Android client application + * Copyright (C) 2012-2014 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 . + * + */ + +package com.owncloud.android.ui.activity; + +public abstract class HookActivity extends FileActivity { + + private static final String TAG = HookActivity.class.getName(); + +} diff --git a/src/com/owncloud/android/ui/activity/Preferences.java b/src/com/owncloud/android/ui/activity/Preferences.java index 05a631d0..3ebb432c 100644 --- a/src/com/owncloud/android/ui/activity/Preferences.java +++ b/src/com/owncloud/android/ui/activity/Preferences.java @@ -17,6 +17,7 @@ */ package com.owncloud.android.ui.activity; +import android.accounts.Account; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageInfo; @@ -35,6 +36,7 @@ import com.actionbarsherlock.app.SherlockPreferenceActivity; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuItem; import com.owncloud.android.R; +import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.db.DbHandler; import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.Log_OC; @@ -131,18 +133,19 @@ public class Preferences extends SherlockPreferenceActivity { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setType("text/plain"); - //Account currentAccount = AccountUtils.getCurrentOwnCloudAccount(Preferences.this); + intent.setData(Uri.parse(getString(R.string.mail_recommend))); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + String appName = getString(R.string.app_name); - //String username = currentAccount.name.substring(0, currentAccount.name.lastIndexOf('@')); - //String recommendSubject = String.format(getString(R.string.recommend_subject), username, appName); + String downloadUrl = getString(R.string.url_app_download); + Account currentAccount = AccountUtils.getCurrentOwnCloudAccount(Preferences.this); + String username = currentAccount.name.substring(0, currentAccount.name.lastIndexOf('@')); + String recommendSubject = String.format(getString(R.string.recommend_subject), appName); + String recommendText = String.format(getString(R.string.recommend_text), appName, downloadUrl, username); + intent.putExtra(Intent.EXTRA_SUBJECT, recommendSubject); - //String recommendText = String.format(getString(R.string.recommend_text), getString(R.string.app_name), username); - String recommendText = String.format(getString(R.string.recommend_text), getString(R.string.app_name), getString(R.string.url_app_download)); intent.putExtra(Intent.EXTRA_TEXT, recommendText); - - intent.setData(Uri.parse(getString(R.string.mail_recommend))); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);