-<?xml version="1.0" encoding="utf-8"?><!--
+<?xml version="1.0" encoding="utf-8"?>
+<!--
ownCloud Android client application
Copyright (C) 2012 Bartek Przybylski
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- -->
-<manifest package="com.owncloud.android"
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.owncloud.android"
android:versionCode="10800000"
- android:versionName="1.8.0" xmlns:android="http://schemas.android.com/apk/res/android">
+ android:versionName="1.8.0" >
+
+ <uses-sdk
+ android:minSdkVersion="14"
+ android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
- <uses-permission android:name="android.permission.WAKE_LOCK"/>
-
- <uses-sdk
- android:minSdkVersion="14"
- android:targetSdkVersion="22" />
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
+ <android:uses-permission android:name="android.permission.READ_PHONE_STATE" />
+ <android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".MainApp"
android:icon="@drawable/icon"
android:label="@string/app_name"
- android:theme="@style/Theme.ownCloud">
+ android:theme="@style/Theme.ownCloud" >
<activity
android:name=".ui.activity.FileDisplayActivity"
- android:label="@string/app_name">
+ android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
+
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- <activity android:name=".ui.activity.UploadFilesActivity"></activity>
- <activity android:name=".ui.activity.Uploader">
+ <activity android:name=".ui.activity.UploadFilesActivity" />
+ <activity android:name=".ui.activity.Uploader" >
<intent-filter>
- <action android:name="android.intent.action.SEND"></action>
+ <action android:name="android.intent.action.SEND" />
- <category android:name="android.intent.category.DEFAULT"></category>
+ <category android:name="android.intent.category.DEFAULT" />
- <data android:mimeType="*/*"></data>
+ <data android:mimeType="*/*" />
</intent-filter>
<intent-filter>
- <action android:name="android.intent.action.SEND_MULTIPLE"></action>
+ <action android:name="android.intent.action.SEND_MULTIPLE" />
- <category android:name="android.intent.category.DEFAULT"></category>
-
- <data android:mimeType="*/*"></data>
+ <category android:name="android.intent.category.DEFAULT" />
+ <data android:mimeType="*/*" />
</intent-filter>
</activity>
<activity
android:name=".ui.activity.Preferences"
android:theme="@style/Theme.ownCloud" >
</activity>
- <activity
+ <activity
android:name=".ui.preview.PreviewImageActivity"
- android:theme="@style/Theme.ownCloud.Overlay"
- />
-
- <activity
+ android:theme="@style/Theme.ownCloud.Overlay" />
+ <activity
android:name=".ui.preview.PreviewVideoActivity"
android:label="@string/app_name"
- android:theme="@style/Theme.ownCloud.Fullscreen"></activity>
+ android:theme="@style/Theme.ownCloud.Fullscreen" />
<service
android:name=".authentication.AccountAuthenticatorService"
- android:exported="true">
- <intent-filter android:priority="100">
+ android:exported="true" >
+ <intent-filter android:priority="100" >
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
</service>
<service
android:name=".syncadapter.FileSyncService"
- android:exported="true">
+ android:exported="true" >
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
android:enabled="true"
android:exported="false"
android:label="@string/sync_string_files"
- android:syncable="true"></provider>
+ android:syncable="true" />
<activity
android:name=".authentication.AuthenticatorActivity"
android:exported="true"
- android:theme="@style/Theme.ownCloud.noActionBar"
- android:launchMode="singleTask">
+ android:launchMode="singleTask"
+ android:theme="@style/Theme.ownCloud.noActionBar" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
<intent-filter>
<action android:name="com.owncloud.android.workaround.accounts.CREATE" />
+
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service android:name=".media.MediaService" />
<activity android:name=".ui.activity.PassCodeActivity" />
- <activity android:name=".ui.activity.ConflictsResolveActivity"/>
- <activity android:name=".ui.activity.GenericExplanationActivity"/>
- <activity android:name=".ui.activity.ErrorsWhileCopyingHandlerActivity"/>
-
- <activity android:name=".ui.activity.LogHistoryActivity"/>
-
- <receiver android:name=".files.InstantUploadBroadcastReceiver">
+ <activity android:name=".ui.activity.ConflictsResolveActivity" />
+ <activity android:name=".ui.activity.GenericExplanationActivity" />
+ <activity android:name=".ui.activity.ErrorsWhileCopyingHandlerActivity" />
+ <activity android:name=".ui.activity.LogHistoryActivity" />
+
+ <receiver android:name=".files.InstantUploadBroadcastReceiver" >
<intent-filter>
+
<!-- unofficially supported by many Android phones but not by HTC devices: -->
<action android:name="com.android.camera.NEW_PICTURE" />
<!-- officially supported since Android 4.0 (SDK 14, works even for HTC devices): -->
<action android:name="android.hardware.action.NEW_PICTURE" />
+
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.hardware.action.NEW_VIDEO" />
+
<data android:mimeType="video/*" />
</intent-filter>
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
- <receiver android:name=".files.BootupBroadcastReceiver">
+ <receiver android:name=".files.BootupBroadcastReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
- <service android:name=".services.observer.FileObserverService"/>
-
- <activity
- android:name=".ui.activity.CopyToClipboardActivity"
- android:label="@string/copy_link"
- android:icon="@drawable/copy_link"/>
- <activity
- android:name=".ui.activity.FolderPickerActivity"
- android:label="@string/app_name"/>
+ <service android:name=".services.observer.FileObserverService" />
<activity
- android:name=".ui.activity.UploadPathActivity"
- android:label="@string/app_name"/>
-
+ android:name=".ui.activity.CopyToClipboardActivity"
+ android:icon="@drawable/copy_link"
+ android:label="@string/copy_link" />
+ <activity
+ android:name=".ui.activity.FolderPickerActivity"
+ android:label="@string/app_name" />
+ <activity
+ android:name=".ui.activity.UploadPathActivity"
+ android:label="@string/app_name" />
+ <activity
+ android:name=".ui.activity.ShareActivity"
+ android:label="@string/share_dialog_title"
+ android:theme="@style/Theme.ownCloud.Dialog" >
+ </activity>
</application>
</manifest>
dependencies {
compile name: 'touch-image-view'
- compile 'com.android.support:support-v4:22.2.1'
compile project(':owncloud-android-library')
+ compile 'com.android.support:support-v4:22.2.1'
compile 'com.jakewharton:disklrucache:2.0.2'
compile 'com.android.support:appcompat-v7:22.2.1'
+ compile 'com.android.support:design:22.2.1'
}
android {
abortOnError false
}
}
-
+
productFlavors {
}
}
+
+
+
+
<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ownCloud Android client application
+ Copyright (C) 2015 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/>.
+-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ownCloud Android client application
+ Copyright (C) 2015 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/>.
+-->
+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:id="@+id/search_layout"
+ android:minWidth="200dp">
<SearchView
android:layout_width="match_parent"
android:hint="@string/share_search"/>
<ListView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:id="@+id/searchUsersListView" />
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/searchUsersListView"
+ android:scrollbars="vertical"/>
</LinearLayout>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ownCloud Android client application
+ Copyright (C) 2015 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/>.
+-->
+
+<android.support.design.widget.CoordinatorLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.owncloud.android.ui.activity.ShareActivity">
+
+ <android.support.design.widget.AppBarLayout
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent" android:theme="@style/Theme.ownCloud.AppBarOverlay">
+
+ <android.support.v7.widget.Toolbar android:id="@+id/toolbar"
+ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize"
+ android:background="?attr/colorPrimary"
+ app:popupTheme="@style/Theme.ownCloud.PopupOverlay" />
+
+ </android.support.design.widget.AppBarLayout>
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/share_fragment_container">
+ </FrameLayout>
+
+</android.support.design.widget.CoordinatorLayout>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ownCloud Android client application
- Copyright (C) 2015 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/>.
--->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context="com.owncloud.android.ui.dialog.ShareFileDialogFragment">
-
- <ScrollView
- android:id="@+id/shareScrollView"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fillViewport="true">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_marginBottom="8dp">
-
- <RelativeLayout
- android:id="@+id/shareHeaderContainer"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_margin="8dp">
-
- <ImageView
- android:id="@+id/shareFileIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/file"
- android:layout_margin="8dp"
- android:maxHeight="96dp"
- android:maxWidth="96dp"/>
-
- <TextView
- android:id="@+id/shareFileName"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/placeholder_filename"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:layout_marginTop="39dp"
- android:layout_alignParentTop="true"
- android:layout_toRightOf="@+id/shareFileIcon"
- android:layout_toEndOf="@+id/shareFileIcon" />
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:text="@string/placeholder_filesize"
- android:id="@+id/shareFileSize"
- android:layout_below="@+id/shareFileName"
- android:layout_toRightOf="@+id/shareFileIcon"
- android:layout_toEndOf="@+id/shareFileIcon"
- android:layout_marginTop="12dp" />
-
- </RelativeLayout>
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:text="@string/share_with_user_section_title"
- android:id="@+id/shareWithUsersSectionTitle"
- android:layout_gravity="left"
- android:padding="8dp"
- android:background="@color/actionbar_start_color"
- android:textColor="@color/white"/>
-
- <ListView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/shareUsersList"
- android:visibility="gone" />
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/shareNoUsers"
- android:text="@string/share_no_users"
- android:padding="12dp" />
-
- <android.support.v7.widget.AppCompatButton
- android:id="@+id/addUserButton"
- style="@style/ownCloud.Button"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:text="@string/share_add_user_or_group"
- android:contentDescription="shareAddUserButton"/>
- </LinearLayout>
- </ScrollView>
-</FrameLayout>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ownCloud Android client application
+ Copyright (C) 2015 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/>.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ tools:context="com.owncloud.android.ui.fragment.ShareFileFragment">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/background_material_light"
+ android:orientation="vertical">
+
+ <RelativeLayout
+ android:id="@+id/shareHeaderContainer"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:layout_marginBottom="8dp"
+ android:background="@color/background_color">
+
+ <ImageView
+ android:id="@+id/shareFileIcon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxWidth="96dp"
+ android:layout_margin="12dp"
+ android:src="@drawable/file" />
+
+ <TextView
+ android:id="@+id/shareFileName"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/placeholder_filename"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:layout_marginTop="39dp"
+ android:layout_alignParentTop="true"
+ android:layout_toRightOf="@+id/shareFileIcon"
+ android:layout_toEndOf="@+id/shareFileIcon" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@string/placeholder_filesize"
+ android:id="@+id/shareFileSize"
+ android:layout_below="@+id/shareFileName"
+ android:layout_toRightOf="@+id/shareFileIcon"
+ android:layout_toEndOf="@+id/shareFileIcon"
+ android:layout_marginTop="12dp" />
+
+ </RelativeLayout>
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@string/share_with_user_section_title"
+ android:id="@+id/shareWithUsersSectionTitle"
+ android:layout_gravity="left"
+ android:padding="8dp"
+ android:background="@color/actionbar_start_color"
+ android:textColor="@color/white"/>
+
+ <ListView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/shareUsersList"
+ android:visibility="gone"
+ android:scrollbars="vertical"/>
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/shareNoUsers"
+ android:text="@string/share_no_users"
+ android:padding="12dp" />
+
+ <android.support.design.widget.FloatingActionButton
+ android:id="@+id/addUserButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom|end"
+ android:layout_margin="@dimen/fab_margin"
+ android:src="@android:drawable/ic_input_add"
+ android:contentDescription="shareAddUserButton"
+ app:backgroundTint="@color/actionbar_start_color"
+ app:rippleColor="@color/background_color" />
+
+ </LinearLayout>
+</FrameLayout>
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="ProgressDialogTheme" parent="ownCloud.Dialog">
- </style>
+ </style>>
+ <style name="Theme.ownCloud.NoActionBar">
+ <item name="windowActionBar">false</item>
+ <item name="windowNoTitle">true</item>
+ <item name="android:windowDrawsSystemBarBackgrounds">true</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
+ </style>
</resources>
\ No newline at end of file
--- /dev/null
+<resources>
+ <!-- Example customization of dimensions originally defined in res/values/dimens.xml
+ (such as screen margins) for screens with more than 820dp of available width. This
+ would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
+ <dimen name="activity_horizontal_margin">64dp</dimen>
+</resources>
--- /dev/null
+<resources>
+ <dimen name="app_bar_height">180dp</dimen>
+ <dimen name="fab_margin">16dp</dimen>
+ <dimen name="text_margin">16dp</dimen>
+</resources>
<color name="setup_text_hint">#777777</color>
<color name="setup_text_typed">#000000</color>
+ <style name="Theme.ownCloud.NoActionBar">
+ <item name="windowActionBar">false</item>
+ <item name="windowNoTitle">true</item>
+ </style>
+ <style name="Theme.ownCloud.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
+ <style name="Theme.ownCloud.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
\ No newline at end of file
import com.owncloud.android.services.OperationsService;
import com.owncloud.android.services.observer.FileObserverService;
import com.owncloud.android.ui.activity.FileActivity;
-import com.owncloud.android.ui.dialog.ShareFileDialogFragment;
+import com.owncloud.android.ui.activity.ShareActivity;
import com.owncloud.android.ui.dialog.ShareLinkToDialog;
import org.apache.http.protocol.HTTP;
}
public void showShareFile(OCFile file){
- ShareFileDialogFragment dialog =
- ShareFileDialogFragment.newInstance(file, mFileActivity.getAccount());
- dialog.show(mFileActivity.getSupportFragmentManager(), mFileActivity.DIALOG_SHARE_FILE);
+ Intent intent = new Intent(mFileActivity, ShareActivity.class);
+ intent.putExtra(mFileActivity.EXTRA_FILE, file);
+ intent.putExtra(mFileActivity.EXTRA_ACCOUNT, mFileActivity.getAccount());
+ mFileActivity.startActivity(intent);
}
public static final String TAG = FileActivity.class.getSimpleName();
private static final String DIALOG_WAIT_TAG = "DIALOG_WAIT";
- public static final String DIALOG_SHARE_FILE = "DIALOG_SHARE_FILE";
private static final String KEY_WAITING_FOR_OP_ID = "WAITING_FOR_OP_ID";
private static final String DIALOG_SHARE_PASSWORD = "DIALOG_SHARE_PASSWORD";
import com.owncloud.android.syncadapter.FileSyncAdapter;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
-import com.owncloud.android.ui.dialog.ShareFileDialogFragment;
-import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;
import com.owncloud.android.ui.dialog.UploadSourceDialogFragment;
*/
@Override
public void showShareFile(OCFile file) {
- ShareFileDialogFragment dialog =
- ShareFileDialogFragment.newInstance(file, getAccount());
- dialog.show(getSupportFragmentManager(), DIALOG_SHARE_FILE);
+ Intent intent = new Intent(this, ShareActivity.class);
+ intent.putExtra(EXTRA_FILE, file);
+ intent.putExtra(EXTRA_ACCOUNT, getAccount());
+ startActivity(intent);
}
@Override
--- /dev/null
+/**
+ * ownCloud Android client application
+ *
+ * @author masensio
+ * Copyright (C) 2015 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;
+
+import android.accounts.Account;
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.v4.app.FragmentTransaction;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+
+import com.owncloud.android.R;
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.ui.fragment.SearchFragment;
+import com.owncloud.android.ui.fragment.ShareFileFragment;
+
+/**
+ * Activity for sharing files
+ */
+
+public class ShareActivity extends AppCompatActivity
+ implements ShareFileFragment.OnShareFragmentInteractionListener,
+ SearchFragment.OnSearchFragmentInteractionListener {
+
+ private static final String TAG_SHARE_FRAGMENT = "SHARE_FRAGMENT";
+ private static final String TAG_SEARCH_FRAGMENT = "SEARCH_USER_AND_GROUPS_FRAGMENT";
+
+ private Account mAccount;
+ private OCFile mFile;
+
+ private ShareFileFragment mShareFileFragment;
+ private SearchFragment mSearchFragment;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.share_activity);
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+
+ FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
+
+ if (savedInstanceState != null) {
+ mFile = savedInstanceState.getParcelable(FileActivity.EXTRA_FILE);
+ mAccount = savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT);
+
+ mShareFileFragment = (ShareFileFragment) getSupportFragmentManager().
+ getFragment(savedInstanceState, TAG_SHARE_FRAGMENT);
+ mSearchFragment = (SearchFragment) getSupportFragmentManager().
+ getFragment(savedInstanceState, TAG_SEARCH_FRAGMENT);
+
+ if (mShareFileFragment != null){
+ ft.replace(R.id.share_fragment_container, mShareFileFragment, TAG_SHARE_FRAGMENT);
+
+ if (mSearchFragment != null){
+ ft.hide(mShareFileFragment);
+ ft.add(R.id.share_fragment_container, mSearchFragment, TAG_SEARCH_FRAGMENT);
+ ft.addToBackStack(TAG_SEARCH_FRAGMENT);
+ }
+ ft.commit();
+ }
+
+ } else {
+ // Read Extras
+ mFile = getIntent().getParcelableExtra(FileActivity.EXTRA_FILE);
+ mAccount = getIntent().getParcelableExtra(FileActivity.EXTRA_ACCOUNT);
+
+ // Add Share fragment
+ mShareFileFragment = ShareFileFragment.newInstance(mFile, mAccount);
+ ft.replace(R.id.share_fragment_container, mShareFileFragment, TAG_SHARE_FRAGMENT);
+ ft.commit();
+
+ mSearchFragment = null;
+ }
+
+ }
+
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putParcelable(FileActivity.EXTRA_FILE, mFile);
+ outState.putParcelable(FileActivity.EXTRA_ACCOUNT, mAccount);
+
+ //Save the fragment's instance
+ getSupportFragmentManager().putFragment(outState, TAG_SHARE_FRAGMENT, mShareFileFragment);
+ if (mSearchFragment != null) {
+ getSupportFragmentManager().putFragment(outState, TAG_SEARCH_FRAGMENT, mSearchFragment);
+ }
+
+ }
+
+ @Override
+ public void showSearchUsersAndGroups() {
+ FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
+ mSearchFragment = SearchFragment.newInstance(mFile, mAccount);
+ ft.hide(mShareFileFragment);
+ ft.add(R.id.share_fragment_container, mSearchFragment, TAG_SEARCH_FRAGMENT);
+ ft.addToBackStack(TAG_SEARCH_FRAGMENT);
+ ft.commit();
+ }
+
+ @Override
+ public void onBackPressed() {
+ super.onBackPressed();
+ if (mSearchFragment != null){
+ getSupportFragmentManager().popBackStackImmediate();
+ mSearchFragment = null;
+ }
+ }
+
+ @Override
+ public void onShareFragmentInteraction(Uri uri) {
+
+ }
+
+ @Override
+ public void onSearchFragmentInteraction(Uri uri) {
+
+ }
+}
+++ /dev/null
-/**
- * ownCloud Android client application
- *
- * @author masensio
- * Copyright (C) 2015 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.dialog;
-
-import android.accounts.Account;
-import android.app.Dialog;
-import android.content.DialogInterface;
-import android.graphics.Bitmap;
-import android.net.Uri;
-import android.os.Bundle;
-import android.app.Fragment;
-import android.support.v4.app.DialogFragment;
-import android.support.v7.app.AlertDialog;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.owncloud.android.R;
-import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.datamodel.ThumbnailsCacheManager;
-import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.MimetypeIconUtil;
-
-/**
- * A simple {@link Fragment} subclass.
- * Activities that contain this fragment must implement the
- * {@link ShareFileDialogFragment.OnFragmentInteractionListener} interface
- * to handle interaction events.
- * Use the {@link ShareFileDialogFragment#newInstance} factory method to
- * create an instance of this fragment.
- *
- * Dialog Fragment to show the share options of a file/folder
- *
- * Search the users and share with them
- */
-public class ShareFileDialogFragment extends DialogFragment
- implements DialogInterface.OnClickListener{
- private static final String TAG = ShareFileDialogFragment.class.getSimpleName();
-
- // the fragment initialization parameters
- private static final String ARG_FILE = "FILE";
- private static final String ARG_ACCOUNT = "ACCOUNT";
-
- // Parameters
- private OCFile mFile;
- private Account mAccount;
-
- private OnFragmentInteractionListener mListener;
-
- /**
- * Public factory method to create new ShareFileDialogFragment instances.
- *
- * @param fileToShare An {@link OCFile} to show in the fragment
- * @param account An ownCloud account
- * @return A new instance of fragment ShareFragment.
- */
- public static ShareFileDialogFragment newInstance(OCFile fileToShare, Account account) {
- ShareFileDialogFragment fragment = new ShareFileDialogFragment();
- Bundle args = new Bundle();
- args.putParcelable(ARG_FILE, fileToShare);
- args.putParcelable(ARG_ACCOUNT, account);
- fragment.setArguments(args);
- return fragment;
- }
-
- public ShareFileDialogFragment() {
- // Required empty public constructor
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- if (getArguments() != null) {
- mFile = getArguments().getParcelable(ARG_FILE);
- mAccount = getArguments().getParcelable(ARG_ACCOUNT);
- }
- }
-
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
-
- // Inflate the layout for the dialog
- LayoutInflater inflater = getActivity().getLayoutInflater();
- View view = inflater.inflate(R.layout.share_file_dialog, null);
-
- // Setup layout
- // Image
- ImageView icon = (ImageView) view.findViewById(R.id.shareFileIcon);
- icon.setImageResource(MimetypeIconUtil.getFileTypeIconId(mFile.getMimetype(),
- mFile.getFileName()));
- if (mFile.isImage()) {
- String remoteId = String.valueOf(mFile.getRemoteId());
- Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(remoteId);
- if (thumbnail != null){
- icon.setImageBitmap(thumbnail);
- }
- }
- // Name
- TextView filename = (TextView) view.findViewById(R.id.shareFileName);
- filename.setText(mFile.getFileName());
- // Size
- TextView size = (TextView) view.findViewById(R.id.shareFileSize);
- if (mFile.isFolder()){
- size.setVisibility(View.GONE);
- } else {
- size.setText(DisplayUtils.bytesToHumanReadable(mFile.getFileLength()));
- }
-
- // Build the dialog
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- builder.setView(view)
- .setPositiveButton(R.string.common_ok, this)
- .setTitle(R.string.share_dialog_title);
-
- Dialog d = builder.create();
- return d;
- }
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
-
- }
-
- /**
- * This interface must be implemented by activities that contain this
- * fragment to allow an interaction in this fragment to be communicated
- * to the activity and potentially other fragments contained in that
- * activity.
- * <p/>
- * See the Android Training lesson <a href=
- * "http://developer.android.com/training/basics/fragments/communicating.html"
- * >Communicating with Other Fragments</a> for more information.
- */
- public interface OnFragmentInteractionListener {
- // TODO: Update argument type and name
- public void onFragmentInteraction(Uri uri);
- }
-
-}
--- /dev/null
+/**
+ * ownCloud Android client application
+ *
+ * @author masensio
+ * Copyright (C) 2015 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.fragment;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.owncloud.android.R;
+import com.owncloud.android.datamodel.OCFile;
+
+/**
+ * Fragment for Searching users and groups
+ *
+ * A simple {@link Fragment} subclass.
+ * Activities that contain this fragment must implement the
+ * {@link SearchFragment.OnSearchFragmentInteractionListener} interface
+ * to handle interaction events.
+ * Use the {@link SearchFragment#newInstance} factory method to
+ * create an instance of this fragment.
+ */
+public class SearchFragment extends Fragment {
+ private static final String TAG = ShareFileFragment.class.getSimpleName();
+
+ // the fragment initialization parameters
+ private static final String ARG_FILE = "FILE";
+ private static final String ARG_ACCOUNT = "ACCOUNT";
+
+ // Parameters
+ private OCFile mFile;
+ private Account mAccount;
+
+ private OnSearchFragmentInteractionListener mListener;
+
+ /**
+ * Public factory method to create new SearchFragment instances.
+ *
+ * @param fileToShare An {@link OCFile} to show in the fragment
+ * @param account An ownCloud account
+ * @return A new instance of fragment SearchFragment.
+ */
+ // TODO: Rename and change types and number of parameters
+ public static SearchFragment newInstance(OCFile fileToShare, Account account) {
+ SearchFragment fragment = new SearchFragment();
+ Bundle args = new Bundle();
+ args.putParcelable(ARG_FILE, fileToShare);
+ args.putParcelable(ARG_ACCOUNT, account);
+ fragment.setArguments(args);
+ return fragment;
+ }
+
+ public SearchFragment() {
+ // Required empty public constructor
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getArguments() != null) {
+ mFile = getArguments().getParcelable(ARG_FILE);
+ mAccount = getArguments().getParcelable(ARG_ACCOUNT);
+ }
+
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ View view = inflater.inflate(R.layout.search_users_groups_layout, container, false);
+
+ return view;
+ }
+
+ // TODO: Rename method, update argument and hook method into UI event
+ public void onButtonPressed(Uri uri) {
+ if (mListener != null) {
+ mListener.onSearchFragmentInteraction(uri);
+ }
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ try {
+ mListener = (OnSearchFragmentInteractionListener) activity;
+ } catch (ClassCastException e) {
+ throw new ClassCastException(activity.toString()
+ + " must implement OnFragmentInteractionListener");
+ }
+ }
+
+ @Override
+ public void onDetach() {
+ super.onDetach();
+ mListener = null;
+ }
+
+ // TODO: review if it is necessary
+ /**
+ * This interface must be implemented by activities that contain this
+ * fragment to allow an interaction in this fragment to be communicated
+ * to the activity and potentially other fragments contained in that
+ * activity.
+ * <p/>
+ * See the Android Training lesson <a href=
+ * "http://developer.android.com/training/basics/fragments/communicating.html"
+ * >Communicating with Other Fragments</a> for more information.
+ */
+ public interface OnSearchFragmentInteractionListener {
+ // TODO: Update argument type and name
+ public void onSearchFragmentInteraction(Uri uri);
+ }
+
+}
--- /dev/null
+/**
+ * ownCloud Android client application
+ *
+ * @author masensio
+ * Copyright (C) 2015 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.fragment;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.design.widget.FloatingActionButton;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.owncloud.android.R;
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.datamodel.ThumbnailsCacheManager;
+import com.owncloud.android.utils.DisplayUtils;
+import com.owncloud.android.utils.MimetypeIconUtil;
+
+/**
+ * Fragment for Sharing a file with users
+ *
+ * A simple {@link Fragment} subclass.
+ * Activities that contain this fragment must implement the
+ * {@link ShareFileFragment.OnShareFragmentInteractionListener} interface
+ * to handle interaction events.
+ * Use the {@link ShareFileFragment#newInstance} factory method to
+ * create an instance of this fragment.
+ */
+public class ShareFileFragment extends Fragment {
+ private static final String TAG = ShareFileFragment.class.getSimpleName();
+
+ // the fragment initialization parameters
+ private static final String ARG_FILE = "FILE";
+ private static final String ARG_ACCOUNT = "ACCOUNT";
+
+ // Parameters
+ private OCFile mFile;
+ private Account mAccount;
+
+ private OnShareFragmentInteractionListener mListener;
+
+ /**
+ * Public factory method to create new ShareFileFragment instances.
+ *
+ * @param fileToShare An {@link OCFile} to show in the fragment
+ * @param account An ownCloud account
+ * @return A new instance of fragment ShareFileFragment.
+ */
+ public static ShareFileFragment newInstance(OCFile fileToShare, Account account) {
+ ShareFileFragment fragment = new ShareFileFragment();
+ Bundle args = new Bundle();
+ args.putParcelable(ARG_FILE, fileToShare);
+ args.putParcelable(ARG_ACCOUNT, account);
+ fragment.setArguments(args);
+ return fragment;
+ }
+
+ public ShareFileFragment() {
+ // Required empty public constructor
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getArguments() != null) {
+ mFile = getArguments().getParcelable(ARG_FILE);
+ mAccount = getArguments().getParcelable(ARG_ACCOUNT);
+ }
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ View view = inflater.inflate(R.layout.share_file_layout, container, false);
+
+ // Setup layout
+ // Image
+ ImageView icon = (ImageView) view.findViewById(R.id.shareFileIcon);
+ icon.setImageResource(MimetypeIconUtil.getFileTypeIconId(mFile.getMimetype(),
+ mFile.getFileName()));
+ if (mFile.isImage()) {
+ String remoteId = String.valueOf(mFile.getRemoteId());
+ Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(remoteId);
+ if (thumbnail != null){
+ icon.setImageBitmap(thumbnail);
+ }
+ }
+ // Name
+ TextView filename = (TextView) view.findViewById(R.id.shareFileName);
+ filename.setText(mFile.getFileName());
+ // Size
+ TextView size = (TextView) view.findViewById(R.id.shareFileSize);
+ if (mFile.isFolder()){
+ size.setVisibility(View.GONE);
+ } else {
+ size.setText(DisplayUtils.bytesToHumanReadable(mFile.getFileLength()));
+ }
+
+ // Add User Button
+ FloatingActionButton addUserGroupButton = (FloatingActionButton)
+ view.findViewById(R.id.addUserButton);
+ addUserGroupButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ // Show Search Fragment
+ mListener.showSearchUsersAndGroups();
+ }
+ });
+
+ return view;
+ }
+
+ // TODO: Rename method, update argument and hook method into UI event
+ public void onButtonPressed(Uri uri) {
+ if (mListener != null) {
+ mListener.onShareFragmentInteraction(uri);
+ }
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ try {
+ mListener = (OnShareFragmentInteractionListener) activity;
+ } catch (ClassCastException e) {
+ throw new ClassCastException(activity.toString()
+ + " must implement OnShareFragmentInteractionListener");
+ }
+ }
+
+ @Override
+ public void onDetach() {
+ super.onDetach();
+ mListener = null;
+ }
+
+ // TODO: review if it is necessary
+ /**
+ * This interface must be implemented by activities that contain this
+ * fragment to allow an interaction in this fragment to be communicated
+ * to the activity and potentially other fragments contained in that
+ * activity.
+ * <p/>
+ * See the Android Training lesson <a href=
+ * "http://developer.android.com/training/basics/fragments/communicating.html"
+ * >Communicating with Other Fragments</a> for more information.
+ */
+ public interface OnShareFragmentInteractionListener {
+ public void showSearchUsersAndGroups();
+
+ public void onShareFragmentInteraction(Uri uri);
+ }
+
+}
import com.owncloud.android.operations.UnshareLinkOperation;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.activity.FileDisplayActivity;
-import com.owncloud.android.ui.dialog.ShareFileDialogFragment;
+import com.owncloud.android.ui.activity.ShareActivity;
import com.owncloud.android.ui.fragment.FileFragment;
*/
@Override
public void showShareFile(OCFile file) {
- ShareFileDialogFragment dialog =
- ShareFileDialogFragment.newInstance(file, getAccount());
- dialog.show(getSupportFragmentManager(), DIALOG_SHARE_FILE);
+ Intent intent = new Intent(this, ShareActivity.class);
+ intent.putExtra(EXTRA_FILE, file);
+ intent.putExtra(EXTRA_ACCOUNT, getAccount());
+ startActivity(intent);
}
private void requestForDownload(OCFile file) {
if (mDownloaderBinder == null) {