mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
Non-previewable file is opened after successful donwload
This commit is contained in:
parent
99d5800234
commit
f767bf3f01
5 changed files with 18 additions and 14 deletions
|
@ -19,7 +19,7 @@
|
|||
-->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:id="@+id/action_open_file_with" android:title="@string/filedetails_open" android:icon="@android:drawable/ic_menu_edit" android:orderInCategory="1" />
|
||||
<item android:id="@+id/action_open_file_with" android:title="@string/actionbar_open_with" android:icon="@android:drawable/ic_menu_edit" android:orderInCategory="1" />
|
||||
<item android:id="@+id/action_download_file" android:title="@string/filedetails_download" android:icon="@drawable/ic_action_download" android:orderInCategory="1" />
|
||||
<item android:id="@+id/action_sync_file" android:title="@string/filedetails_sync_file" android:icon="@drawable/ic_action_refresh" android:orderInCategory="1" />
|
||||
<item android:id="@+id/action_cancel_download" android:title="@string/common_cancel_download" android:icon="@android:drawable/ic_menu_close_clear_cancel" android:orderInCategory="1" />
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<string name="actionbar_upload">Upload</string>
|
||||
<string name="actionbar_upload_from_apps">Content from other apps</string>
|
||||
<string name="actionbar_upload_files">Files</string>
|
||||
<string name="actionbar_open_with">Open with</string>
|
||||
<string name="actionbar_mkdir">Create directory</string>
|
||||
<string name="actionbar_search">Search</string>
|
||||
<string name="actionbar_settings">Settings</string>
|
||||
|
@ -81,7 +82,6 @@
|
|||
<string name="filedetails_download">Download</string>
|
||||
<string name="filedetails_sync_file">Refresh</string>
|
||||
<string name="filedetails_redownload">Redownload</string>
|
||||
<string name="filedetails_open">Open</string>
|
||||
<string name="filedetails_renamed_in_upload_msg">File was renamed to %1$s during upload</string>
|
||||
<string name="common_yes">Yes</string>
|
||||
<string name="common_no">No</string>
|
||||
|
|
|
@ -31,6 +31,7 @@ import android.webkit.MimeTypeMap;
|
|||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.owncloud.android.AccountUtils;
|
||||
import com.owncloud.android.Log_OC;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.authentication.AccountAuthenticator;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.files.FileHandler;
|
||||
|
@ -46,6 +47,7 @@ public abstract class FileActivity extends SherlockFragmentActivity implements F
|
|||
|
||||
public static final String EXTRA_FILE = "com.owncloud.android.ui.activity.FILE";
|
||||
public static final String EXTRA_ACCOUNT = "com.owncloud.android.ui.activity.ACCOUNT";
|
||||
public static final String EXTRA_WAITING_TO_PREVIEW = "com.owncloud.android.ui.activity.ACCOUNT";
|
||||
|
||||
public static final String TAG = FileActivity.class.getSimpleName();
|
||||
|
||||
|
@ -249,9 +251,9 @@ public abstract class FileActivity extends SherlockFragmentActivity implements F
|
|||
|
||||
Intent chooserIntent = null;
|
||||
if (intentForGuessedMimeType != null) {
|
||||
chooserIntent = Intent.createChooser(intentForGuessedMimeType, null);
|
||||
chooserIntent = Intent.createChooser(intentForGuessedMimeType, getString(R.string.actionbar_open_with));
|
||||
} else {
|
||||
chooserIntent = Intent.createChooser(intentForSavedMimeType, null);
|
||||
chooserIntent = Intent.createChooser(intentForSavedMimeType, getString(R.string.actionbar_open_with));
|
||||
}
|
||||
|
||||
startActivity(chooserIntent);
|
||||
|
|
|
@ -204,6 +204,9 @@ public class FileDetailActivity extends FileActivity implements FileFragment.Con
|
|||
intent.putExtra(PreviewVideoActivity.EXTRA_START_POSITION, videoFragment.getPosition());
|
||||
intent.putExtra(PreviewVideoActivity.EXTRA_AUTOPLAY, videoFragment.isPlaying());
|
||||
}
|
||||
if (mWaitingToPreview) {
|
||||
intent.putExtra(FileDisplayActivity.EXTRA_WAITING_TO_PREVIEW, mWaitingToPreview);
|
||||
}
|
||||
|
||||
} else {
|
||||
intent = new Intent(this, FileDetailActivity.class);
|
||||
|
@ -460,6 +463,7 @@ public class FileDetailActivity extends FileActivity implements FileFragment.Con
|
|||
transaction.commit();
|
||||
} else {
|
||||
detailsFragment.updateFileDetails(false, (success));
|
||||
openFile(getFile());
|
||||
}
|
||||
mWaitingToPreview = false;
|
||||
|
||||
|
|
|
@ -213,17 +213,15 @@ public class FileDisplayActivity extends FileActivity implements
|
|||
if (mDualPane && getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG) == null) {
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
if (mChosenFile != null) {
|
||||
if (PreviewMediaFragment.canBePreviewed(mChosenFile)) {
|
||||
if (mChosenFile.isDown()) {
|
||||
int startPlaybackPosition = getIntent().getIntExtra(PreviewVideoActivity.EXTRA_START_POSITION, 0);
|
||||
boolean autoplay = getIntent().getBooleanExtra(PreviewVideoActivity.EXTRA_AUTOPLAY, true);
|
||||
transaction.replace(R.id.file_details_container, new PreviewMediaFragment(mChosenFile, getAccount(), startPlaybackPosition, autoplay), FileDetailFragment.FTAG);
|
||||
} else {
|
||||
transaction.replace(R.id.file_details_container, new FileDetailFragment(mChosenFile, getAccount()), FileDetailFragment.FTAG);
|
||||
if (!mChosenFile.isDown()) {
|
||||
transaction.replace(R.id.file_details_container, new FileDetailFragment(mChosenFile, getAccount()), FileDetailFragment.FTAG);
|
||||
if (getIntent().getBooleanExtra(EXTRA_WAITING_TO_PREVIEW, false)) {
|
||||
mWaitingToPreview = mChosenFile;
|
||||
}
|
||||
} else {
|
||||
transaction.replace(R.id.file_details_container, new FileDetailFragment(mChosenFile, getAccount()), FileDetailFragment.FTAG);
|
||||
} else if (PreviewMediaFragment.canBePreviewed(mChosenFile)) {
|
||||
int startPlaybackPosition = getIntent().getIntExtra(PreviewVideoActivity.EXTRA_START_POSITION, 0);
|
||||
boolean autoplay = getIntent().getBooleanExtra(PreviewVideoActivity.EXTRA_AUTOPLAY, true);
|
||||
transaction.replace(R.id.file_details_container, new PreviewMediaFragment(mChosenFile, getAccount(), startPlaybackPosition, autoplay), FileDetailFragment.FTAG);
|
||||
}
|
||||
mChosenFile = null;
|
||||
|
||||
|
@ -833,8 +831,8 @@ public class FileDisplayActivity extends FileActivity implements
|
|||
transaction.replace(R.id.file_details_container, new PreviewMediaFragment(mWaitingToPreview, getAccount(), 0, true), FileDetailFragment.FTAG);
|
||||
transaction.commit();
|
||||
} else {
|
||||
// file cannot be previewed
|
||||
detailsFragment.updateFileDetails(false, (success));
|
||||
openFile(mWaitingToPreview);
|
||||
|
||||
}
|
||||
mWaitingToPreview = null;
|
||||
|
|
Loading…
Reference in a new issue