florent37 / florent37/TutoShowcase

Displaced circle and round rect when activity in full screen.

Open
#12 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
499
Forks
85
PR merge metrics
No merged PRs in 30d

Description

The circle or rect is displaced when the activity is in full screen.
I copied the project over and fixed it in the following way.

`public final class TutoShowcase {

public static final float DEFAULT_ADDITIONAL_RADIUS_RATIO = 1.5f;
private static final String SHARED_TUTO = "SHARED_TUTO";
private FrameLayout container;
private TutoView tutoView;
private SharedPreferences sharedPreferences;
private boolean isFullScreen = false;

private TutoShowcase(@NonNull Activity activity) {
this.sharedPreferences = activity.getSharedPreferences(SHARED_TUTO, Context.MODE_PRIVATE);
this.container = new FrameLayout(activity);
this.tutoView = new TutoView(activity);
Window window = activity.getWindow();
if (window != null) {
ViewGroup decorView = (ViewGroup) window.getDecorView();
if (decorView != null) {
ViewGroup content = (ViewGroup) decorView.findViewById(android.R.id.content);
if (content != null) {
content.addView(container, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
this.container.addView(tutoView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
}
}
}

int flg = activity.getWindow().getAttributes().flags;
if ((flg & WindowManager.LayoutParams.FLAG_FULLSCREEN) == WindowManager.LayoutParams.FLAG_FULLSCREEN) {
isFullScreen = true;
}

this.container.setVisibility(View.GONE);
ViewCompat.setAlpha(container, 0f);
}`

`public static class ViewActions {
private final TutoShowcase tutoShowcase;
private final View view;
private final ViewActionsSettings settings;
private final boolean isFullScreen;

public ViewActions(final TutoShowcase tutoShowcase, View view, boolean fullScreen) {
this.tutoShowcase = tutoShowcase;
this.view = view;
this.settings = new ViewActionsSettings();
this.isFullScreen = fullScreen;
}`

` private int getStatusBarHeight() {
int result = 0;
Context context = view.getContext();
Resources resources = context.getResources();
int resourceId = resources.getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = resources.getDimensionPixelSize(resourceId);
}
if( isFullScreen ) {
result = 0;
}

return result;
}`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.