mirror of
https://github.com/vanitasvitae/Spherical
synced 2025-12-10 22:31:11 +01:00
Make system bars completely transparent
This commit is contained in:
parent
a497955836
commit
09241253c8
3 changed files with 42 additions and 28 deletions
|
|
@ -3,6 +3,7 @@ package de.trac.spherical;
|
|||
import android.content.Intent;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.AppBarLayout;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
|
|
@ -15,7 +16,10 @@ import android.view.MenuInflater;
|
|||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
|
|
@ -38,7 +42,6 @@ public class MainActivity extends AppCompatActivity {
|
|||
private Renderer renderer;
|
||||
private FloatingActionButton fab;
|
||||
private Toolbar toolbar;
|
||||
private AppBarLayout appBarLayout;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
|
@ -49,10 +52,9 @@ public class MainActivity extends AppCompatActivity {
|
|||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
appBarLayout = (AppBarLayout) findViewById(R.id.lay_toolbar);
|
||||
AppBarLayout.LayoutParams lp = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
|
||||
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) toolbar.getLayoutParams();
|
||||
lp.topMargin += getStatusBarHeight();
|
||||
appBarLayout.bringToFront();
|
||||
toolbar.bringToFront();
|
||||
fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
@ -62,6 +64,11 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
Window w = getWindow();
|
||||
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
}
|
||||
|
||||
// Initialize renderer and setup surface view.
|
||||
LinearLayout container = (LinearLayout) findViewById(R.id.container);
|
||||
surfaceView = new SphereSurfaceView(this);
|
||||
|
|
@ -102,10 +109,10 @@ public class MainActivity extends AppCompatActivity {
|
|||
private void displayUI(boolean display) {
|
||||
if (display) {
|
||||
fab.show();
|
||||
appBarLayout.setExpanded(true, true);
|
||||
toolbar.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
fab.setVisibility(View.INVISIBLE);
|
||||
appBarLayout.setExpanded(false, true);
|
||||
toolbar.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -223,6 +230,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
*/
|
||||
private void displayFlatImage(InputStream inputStream) {
|
||||
Log.d(TAG, "Display Flat Image!");
|
||||
displayPhotoSphere(inputStream, new PhotoSphereMetadata());
|
||||
}
|
||||
|
||||
public int getStatusBarHeight() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue