Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;

import org.androidsoft.coloring.util.ScreenUtils;
import org.androidsoft.utils.ui.NoTitleActivity;

public abstract class AbstractColoringActivity extends NoTitleActivity
Expand All @@ -37,6 +39,7 @@ public abstract class AbstractColoringActivity extends NoTitleActivity
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
ScreenUtils.setFullscreen(this);

WindowManager w = getWindowManager();
Display d = w.getDefaultDisplay();
Expand All @@ -45,6 +48,14 @@ public void onCreate(Bundle savedInstanceState)

}

@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
ScreenUtils.setFullscreen(this);
}
}

public static int getDisplayWitdh()
{
return _displayWidth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.os.Bundle;
import android.view.View;
import org.androidsoft.coloring.R;
import org.androidsoft.coloring.util.ScreenUtils;
import org.androidsoft.utils.credits.CreditsParams;
import org.androidsoft.utils.credits.CreditsView;
import org.androidsoft.utils.ui.BasicActivity;
Expand All @@ -33,12 +34,22 @@ public class CreditsActivity extends BasicActivity
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
ScreenUtils.setFullscreen(this);

View view = new CreditsView(this, getCreditsParams());
setContentView(view);

}

@Override
public void onWindowFocusChanged(boolean hasFocus)
{
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
ScreenUtils.setFullscreen(this);
}
}

/**
* {@inheritDoc }
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import android.widget.GridView;
import android.widget.ImageView;
import org.androidsoft.coloring.R;
import org.androidsoft.coloring.util.ScreenUtils;
import org.androidsoft.utils.ui.NoTitleActivity;

public class StartNewActivity extends NoTitleActivity implements View.OnClickListener
Expand All @@ -46,7 +47,7 @@ public static int randomOutlineId()
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

ScreenUtils.setFullscreen(this);
// Apparently this cannot be set from the style.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
Expand All @@ -57,6 +58,15 @@ public void onCreate(Bundle savedInstanceState)
gridview.setAdapter(new ImageAdapter(this));
}

@Override
public void onWindowFocusChanged(boolean hasFocus)
{
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
ScreenUtils.setFullscreen(this);
}
}

public void onClick(View view)
{
setResult(view.getId());
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/org/androidsoft/coloring/util/ScreenUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.androidsoft.coloring.util;

import android.app.Activity;
import android.view.View;

// Based on http://stackoverflow.com/questions/22265945/full-screen-action-bar-immersive#22560946
public class ScreenUtils {
static public void setFullscreen(Activity act) {
if (android.os.Build.VERSION.SDK_INT >= 19) {
act.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
}