Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Displaced circle and round rect when activity in full screen. #12

Open
alexandrucaraus opened this issue Dec 22, 2016 · 0 comments
Open

Comments

@alexandrucaraus
Copy link

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;
    }`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant