<string name ="db_name">ownCloud</string>
<string name ="data_folder">owncloud</string>
<string name ="log_name">Owncloud_</string>
+ <string name ="default_display_name_for_root_folder">/</string>
<!-- URLs and flags related -->
<string name="server_url"></string>
* @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<String> mDirectories;
// 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;
}
((TextView) v).setTextColor(getResources().getColorStateList(
android.R.color.white));
+
+ fixRoot((TextView) v );
return v;
}
((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 {
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 {
--- /dev/null
+/* 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();
+
+}
*/
package com.owncloud.android.ui.activity;
+import android.accounts.Account;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
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;
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);