mirror of
https://github.com/nextcloud/android.git
synced 2024-12-20 16:02:01 +03:00
Some progress on fixing bugs
This commit is contained in:
parent
e92eaf5694
commit
206f3f06f3
6 changed files with 49 additions and 87 deletions
|
@ -99,7 +99,7 @@
|
|||
</activity>
|
||||
<activity
|
||||
android:name=".ui.preview.PreviewImageActivity"
|
||||
android:theme="@style/Theme.ownCloud" />
|
||||
android:theme="@style/Theme.ownCloud.Overlay" />
|
||||
<activity
|
||||
android:name=".ui.preview.PreviewVideoActivity"
|
||||
android:label="@string/app_name"
|
||||
|
|
|
@ -47,7 +47,9 @@
|
|||
<RelativeLayout
|
||||
android:id="@+id/multi_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_margin="@dimen/zero">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -120,7 +120,6 @@
|
|||
<!-- separat translucent action bar style -->
|
||||
<style name="Theme.ownCloud.Overlay" parent="style/Theme.ownCloud">
|
||||
<item name="android:actionBarStyle">@style/Theme.ownCloud.Overlay.ActionBar</item>
|
||||
<item name="windowActionBarOverlay">true</item>
|
||||
<!-- Support library compatibility -->
|
||||
<item name="actionBarStyle">@style/Theme.ownCloud.Overlay.ActionBar</item>
|
||||
</style>
|
||||
|
@ -128,7 +127,6 @@
|
|||
<!-- ACTION BAR STYLES -->
|
||||
<style name="Theme.ownCloud.Overlay.ActionBar" parent="@style/Widget.AppCompat.ActionBar">
|
||||
<item name="android:background">@color/owncloud_blue_transparent</item>
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
|
||||
<!-- Support library compatibility -->
|
||||
<item name="background">@color/owncloud_blue_transparent</item>
|
||||
|
|
|
@ -21,15 +21,12 @@
|
|||
|
||||
package com.owncloud.android.operations;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import android.accounts.Account;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
|
||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
|
||||
import com.owncloud.android.lib.common.operations.OperationCancelledException;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperation;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
|
@ -37,8 +34,11 @@ import com.owncloud.android.lib.common.utils.Log_OC;
|
|||
import com.owncloud.android.lib.resources.files.DownloadRemoteFileOperation;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* Remote mDownloadOperation performing the download of a file to an ownCloud server
|
||||
|
|
|
@ -26,14 +26,14 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.ortiz.touch.ExtendedViewPager;
|
||||
import com.owncloud.android.MainApp;
|
||||
|
@ -66,8 +66,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|||
public class PreviewImageActivity extends FileActivity implements
|
||||
FileFragment.ContainerActivity,
|
||||
ViewPager.OnPageChangeListener, OnRemoteOperationListener {
|
||||
|
||||
public static final int DIALOG_SHORT_WAIT = 0;
|
||||
|
||||
public static final String TAG = PreviewImageActivity.class.getSimpleName();
|
||||
|
||||
|
@ -75,8 +73,6 @@ public class PreviewImageActivity extends FileActivity implements
|
|||
private static final String KEY_WAITING_FOR_BINDER = "WAITING_FOR_BINDER";
|
||||
private static final String KEY_SYSTEM_VISIBLE = "TRUE";
|
||||
|
||||
private static final int INITIAL_HIDE_DELAY = 0; // immediate hide
|
||||
|
||||
private ExtendedViewPager mViewPager;
|
||||
private PreviewImagePagerAdapter mPreviewImagePagerAdapter;
|
||||
private int mSavedPosition = 0;
|
||||
|
@ -85,54 +81,38 @@ public class PreviewImageActivity extends FileActivity implements
|
|||
private boolean mRequestWaitingForBinder;
|
||||
|
||||
private DownloadFinishReceiver mDownloadFinishReceiver;
|
||||
|
||||
private View mFullScreenAnchorView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (Build.VERSION.SDK_INT < 16) {
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
} else {
|
||||
View decorView = getWindow().getDecorView();
|
||||
// Hide the status bar.
|
||||
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
|
||||
|
||||
decorView.setSystemUiVisibility(uiOptions);
|
||||
}
|
||||
|
||||
if (savedInstanceState != null && !savedInstanceState.getBoolean(KEY_SYSTEM_VISIBLE, true)) {
|
||||
toggleFullScreen();
|
||||
}
|
||||
|
||||
setContentView(R.layout.preview_image_activity);
|
||||
|
||||
// Navigation Drawer
|
||||
setupDrawer();
|
||||
|
||||
// ActionBar
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
updateActionBarTitleAndHomeButton(null);
|
||||
|
||||
mFullScreenAnchorView = getWindow().getDecorView();
|
||||
// to keep our UI controls visibility in line with system bars visibility
|
||||
mFullScreenAnchorView.setOnSystemUiVisibilityChangeListener
|
||||
(new View.OnSystemUiVisibilityChangeListener() {
|
||||
@SuppressLint("InlinedApi")
|
||||
@Override
|
||||
public void onSystemUiVisibilityChange(int flags) {
|
||||
boolean visible = (flags & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (visible) {
|
||||
actionBar.show();
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
||||
} else {
|
||||
actionBar.hide();
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
mRequestWaitingForBinder = savedInstanceState.getBoolean(KEY_WAITING_FOR_BINDER);
|
||||
if (!savedInstanceState.getBoolean(KEY_SYSTEM_VISIBLE, true)) {
|
||||
hideSystemUI(mFullScreenAnchorView);
|
||||
}
|
||||
} else {
|
||||
mRequestWaitingForBinder = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void initViewPager() {
|
||||
// get parent from path
|
||||
String parentPath = getFile().getRemotePath().substring(0,
|
||||
|
@ -424,23 +404,22 @@ public class PreviewImageActivity extends FileActivity implements
|
|||
}
|
||||
|
||||
public boolean getSystemUIVisible() {
|
||||
return (mFullScreenAnchorView.getSystemUiVisibility() & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
|
||||
if (getSupportActionBar() != null && getSupportActionBar().isShowing()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
public void toggleFullScreen() {
|
||||
|
||||
boolean visible = (mFullScreenAnchorView.getSystemUiVisibility()
|
||||
& View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
|
||||
|
||||
if (visible) {
|
||||
hideSystemUI(mFullScreenAnchorView);
|
||||
// actionBar.hide(); // propagated through
|
||||
// OnSystemUiVisibilityChangeListener()
|
||||
if (getSupportActionBar() != null && getSupportActionBar().isShowing()) {
|
||||
getSupportActionBar().hide();
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
||||
} else {
|
||||
showSystemUI(mFullScreenAnchorView);
|
||||
// actionBar.show(); // propagated through
|
||||
// OnSystemUiVisibilityChangeListener()
|
||||
getSupportActionBar().show();
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -489,25 +468,4 @@ public class PreviewImageActivity extends FileActivity implements
|
|||
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
private void hideSystemUI(View anchorView) {
|
||||
anchorView.setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hides NAVIGATION BAR; Android >= 4.0
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN // hides STATUS BAR; Android >= 4.1
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE // stays interactive; Android >= 4.4
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE // draw full window; Android >= 4.1
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN // draw full window; Android >= 4.1
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION // draw full window; Android >= 4.1
|
||||
);
|
||||
}
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
private void showSystemUI(View anchorView) {
|
||||
anchorView.setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE // draw full window; Android >= 4.1
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN // draw full window; Android >= 4.1
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION // draw full window; Android >= 4.1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,6 +98,8 @@ public class PreviewImageFragment extends FileFragment {
|
|||
|
||||
private LoadBitmapTask mLoadBitmapTask = null;
|
||||
|
||||
private View primaryView;
|
||||
|
||||
/**
|
||||
* Public factory method to create a new fragment that previews an image.
|
||||
*
|
||||
|
@ -159,11 +161,11 @@ public class PreviewImageFragment extends FileFragment {
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
View view = inflater.inflate(R.layout.preview_image_fragment, container, false);
|
||||
mImageView = (TouchImageViewCustom) view.findViewById(R.id.image);
|
||||
primaryView = inflater.inflate(R.layout.preview_image_fragment, container, false);
|
||||
mImageView = (TouchImageViewCustom) primaryView.findViewById(R.id.image);
|
||||
mImageView.setVisibility(View.GONE);
|
||||
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
primaryView.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((PreviewImageActivity) getActivity()).toggleFullScreen();
|
||||
|
@ -179,12 +181,12 @@ public class PreviewImageFragment extends FileFragment {
|
|||
}
|
||||
});
|
||||
|
||||
mMultiView = (RelativeLayout) view.findViewById(R.id.multi_view);
|
||||
mMultiView = (RelativeLayout) primaryView.findViewById(R.id.multi_view);
|
||||
|
||||
setupMultiView(view);
|
||||
setupMultiView(primaryView);
|
||||
setMultiListLoadingMessage();
|
||||
|
||||
return view;
|
||||
return primaryView;
|
||||
}
|
||||
|
||||
protected void setupMultiView(View view) {
|
||||
|
@ -558,6 +560,8 @@ public class PreviewImageFragment extends FileFragment {
|
|||
private void showErrorMessage() {
|
||||
mImageView.setBackgroundColor(Color.TRANSPARENT);
|
||||
setMessageForMultiList(mErrorMessageId, R.string.preview_sorry, R.drawable.file_image);
|
||||
primaryView.setOnClickListener(null);
|
||||
mImageView.setOnClickListener(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue