Merge branch 'share_link__new_share' into share_link__refresh_shares_folder_per_folder

This commit is contained in:
David A. Velasco 2014-02-06 20:16:14 +01:00
commit 0fde0084e2
4 changed files with 57 additions and 15 deletions

View file

@ -8,6 +8,7 @@
<string name ="db_name">ownCloud</string> <string name ="db_name">ownCloud</string>
<string name ="data_folder">owncloud</string> <string name ="data_folder">owncloud</string>
<string name ="log_name">Owncloud_</string> <string name ="log_name">Owncloud_</string>
<string name ="default_display_name_for_root_folder">/</string>
<!-- URLs and flags related --> <!-- URLs and flags related -->
<string name="server_url"></string> <string name="server_url"></string>

View file

@ -98,7 +98,7 @@ import com.owncloud.android.utils.Log_OC;
* @author David A. Velasco * @author David A. Velasco
*/ */
public class FileDisplayActivity extends FileActivity implements public class FileDisplayActivity extends HookActivity implements
OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNavigationListener, OnSslValidatorListener, EditNameDialogListener { OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNavigationListener, OnSslValidatorListener, EditNameDialogListener {
private ArrayAdapter<String> mDirectories; private ArrayAdapter<String> mDirectories;
@ -531,7 +531,8 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa
// the next operation triggers a new call to this method, but it's necessary to // 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 // ensure that the name exposed in the action bar is the current directory when the
// user selected it in the navigation list // user selected it in the navigation list
getSupportActionBar().setSelectedNavigationItem(0); if (getSupportActionBar().getNavigationMode() == ActionBar.NAVIGATION_MODE_LIST && itemPosition != 0)
getSupportActionBar().setSelectedNavigationItem(0);
} }
return true; return true;
} }
@ -873,6 +874,8 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa
((TextView) v).setTextColor(getResources().getColorStateList( ((TextView) v).setTextColor(getResources().getColorStateList(
android.R.color.white)); android.R.color.white));
fixRoot((TextView) v );
return v; return v;
} }
@ -883,9 +886,16 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa
((TextView) v).setTextColor(getResources().getColorStateList( ((TextView) v).setTextColor(getResources().getColorStateList(
android.R.color.white)); android.R.color.white));
fixRoot((TextView) v );
return 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 { private class SyncBroadcastReceiver extends BroadcastReceiver {
@ -1172,9 +1182,13 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa
if (chosenFile == null || mDualPane) { if (chosenFile == null || mDualPane) {
// only list of files - set for browsing through folders // only list of files - set for browsing through folders
OCFile currentDir = getCurrentDir(); OCFile currentDir = getCurrentDir();
actionBar.setDisplayHomeAsUpEnabled(currentDir != null && currentDir.getParentId() != 0); boolean noRoot = (currentDir != null && currentDir.getParentId() != 0);
actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayHomeAsUpEnabled(noRoot);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); 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 actionBar.setListNavigationCallbacks(mDirectories, this); // assuming mDirectories is updated
} else { } else {

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.ui.activity;
public abstract class HookActivity extends FileActivity {
private static final String TAG = HookActivity.class.getName();
}

View file

@ -17,6 +17,7 @@
*/ */
package com.owncloud.android.ui.activity; package com.owncloud.android.ui.activity;
import android.accounts.Account;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
@ -35,6 +36,7 @@ import com.actionbarsherlock.app.SherlockPreferenceActivity;
import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
import com.owncloud.android.R; import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.db.DbHandler; import com.owncloud.android.db.DbHandler;
import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.Log_OC; import com.owncloud.android.utils.Log_OC;
@ -131,18 +133,19 @@ public class Preferences extends SherlockPreferenceActivity {
Intent intent = new Intent(Intent.ACTION_SENDTO); Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setType("text/plain"); intent.setType("text/plain");
//Account currentAccount = AccountUtils.getCurrentOwnCloudAccount(Preferences.this);
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 recommendSubject = String.format(getString(R.string.recommend_subject), appName);
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.setData(Uri.parse(getString(R.string.mail_recommend)));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
String appName = getString(R.string.app_name);
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);
intent.putExtra(Intent.EXTRA_TEXT, recommendText);
startActivity(intent); startActivity(intent);