import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.operations.CreateShareOperation;
import com.owncloud.android.operations.RemoveFileOperation;
import com.owncloud.android.operations.UnshareLinkOperation;
import com.owncloud.android.ui.activity.PinCodeActivity;
import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.Log_OC;
/**
private boolean mRequestWaitingForBinder;
private DownloadFinishReceiver mDownloadFinishReceiver;
-
- //private boolean mFullScreen;
private View mFullScreenAnchorView;
// PIN CODE request
if (getIntent().getExtras() != null && savedInstanceState == null && fromNotification()) {
requestPinCode();
- }
+ }
+
+ // Make sure we're running on Honeycomb or higher to use FullScreen and
+ // Immersive Mode
+ if (isHoneycombOrHigher()) {
- //mFullScreen = true;
- mFullScreenAnchorView = getWindow().getDecorView();
- // to keep our UI controls visibility in line with system bars visibility
- mFullScreenAnchorView.setOnSystemUiVisibilityChangeListener(
- new View.OnSystemUiVisibilityChangeListener() {
+ 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;
+ @Override
+ public void onSystemUiVisibilityChange(int flags) {
+ boolean visible = (flags & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
ActionBar actionBar = getSupportActionBar();
if (visible) {
actionBar.show();
actionBar.hide();
}
}
- }
- );
+ });
+
+ }
if (savedInstanceState != null) {
mRequestWaitingForBinder = savedInstanceState.getBoolean(KEY_WAITING_FOR_BINDER);
Handler mHideSystemUiHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
- hideSystemUI(mFullScreenAnchorView);
+ if (isHoneycombOrHigher()) {
+ hideSystemUI(mFullScreenAnchorView);
+ }
getSupportActionBar().hide();
}
};
super.onWindowFocusChanged(hasFocus);
// When the window loses focus (e.g. the action overflow is shown),
- // cancel any pending hide action. When the window gains focus,
- // hide the system UI.
- if (hasFocus) {
- delayedHide(INITIAL_HIDE_DELAY);
- } else {
+ // cancel any pending hide action.
+ if (!hasFocus) {
mHideSystemUiHandler.removeMessages(0);
}
}
@Override
protected void onResume() {
super.onResume();
- //Log.e(TAG, "ACTIVITY, ONRESUME");
+ //Log_OC.e(TAG, "ACTIVITY, ONRESUME");
mDownloadFinishReceiver = new DownloadFinishReceiver();
IntentFilter filter = new IntentFilter(FileDownloader.getDownloadFinishMessage());
@Override
protected void onPostResume() {
- //Log.e(TAG, "ACTIVITY, ONPOSTRESUME");
+ //Log_OC.e(TAG, "ACTIVITY, ONPOSTRESUME");
super.onPostResume();
}
@SuppressLint("InlinedApi")
public void toggleFullScreen() {
- //ActionBar actionBar = getSupportActionBar();
-
- boolean visible = (
- mFullScreenAnchorView.getSystemUiVisibility()
- & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- ) == 0;
+
+ if (isHoneycombOrHigher()) {
- if (visible) {
- hideSystemUI(mFullScreenAnchorView);
- //actionBar.hide(); // propagated through OnSystemUiVisibilityChangeListener()
- } else {
- showSystemUI(mFullScreenAnchorView);
- //actionBar.show(); // propagated through OnSystemUiVisibilityChangeListener()
- }
- /*
- if (mFullScreen) {
- actionBar.show();
-
+ boolean visible = (mFullScreenAnchorView.getSystemUiVisibility()
+ & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
+
+ if (visible) {
+ hideSystemUI(mFullScreenAnchorView);
+ // actionBar.hide(); // propagated through
+ // OnSystemUiVisibilityChangeListener()
+ } else {
+ showSystemUI(mFullScreenAnchorView);
+ // actionBar.show(); // propagated through
+ // OnSystemUiVisibilityChangeListener()
+ }
+
} else {
- actionBar.hide();
-
+
+ ActionBar actionBar = getSupportActionBar();
+ if (!actionBar.isShowing()) {
+ actionBar.show();
+
+ } else {
+ actionBar.hide();
+
+ }
+
}
- mFullScreen = !mFullScreen;
- */
}
@Override
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION // draw full window; Android >= 4.1
);
}
-
-
+
+ /**
+ * Checks if OS version is Honeycomb one or higher
+ *
+ * @return boolean
+ */
+ private boolean isHoneycombOrHigher() {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ return true;
+ }
+ return false;
+ }
}