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

A Repaint issue? #62

Closed
naddaf opened this issue Sep 2, 2012 · 31 comments
Closed

A Repaint issue? #62

naddaf opened this issue Sep 2, 2012 · 31 comments

Comments

@naddaf
Copy link

naddaf commented Sep 2, 2012

Hi.
I am using your wonderful library along with the Sherlock library. I am running into an issue on an android 2.3 version on an HTC 4G phone. My front fragment (shown in front) has a view that shows a live camera view (it has a view that is an extension of SurfaceView) and my sliding "behind" menu is a simple list fragment.

In my JellyBean (Galaxy Nexus) device, all works fine; I can slide the front view and see the behind menu but on my HTC phone, when I do that, the real estate that was covered by the camera surface is now black on the behind menu; it seems to be a repaint issue (I guess?) since if I press on the black area, the menu item that is supposed to be there actually reacts and does its job.

I don't know how I can attach screenshots to make this visually more clear. Any help or suggestion to fix the issue is greatly appreciated.

Thanks again for the great library.

Ali.

@naddaf
Copy link
Author

naddaf commented Sep 3, 2012

Just to add a bit more info, the same happens if on the front view I add a, say, VideoView; the exact location of that view will be black when the sliding menu is opened.

@jfeinstein10
Copy link
Owner

I'm still a little bit confused. Is the View removed ? Or does its surface just go black?

@naddaf
Copy link
Author

naddaf commented Sep 3, 2012

Only the surface that the VideoView was covering (when the sliding menu was closed) goes black. If there is a way I can send you images, I would be glad to provide some screenshots.

@jfeinstein10
Copy link
Owner

You can put them up on imgur (or any other image sharing site) and send the link

@jfeinstein10
Copy link
Owner

Does it remain black when the SlidingMenu is opened again?

@naddaf
Copy link
Author

naddaf commented Sep 3, 2012

Yes, it remains black if I just close and open the sliding menu on that same page. The behind view in my case is a list of menu items so if I click on the black area, it actually does invoke the list click and I update the list (in the behind view) and then I can see the real content.

@jfeinstein10
Copy link
Owner

Okay I have an idea of what this might be. Have you checked out the latest changes?

@naddaf
Copy link
Author

naddaf commented Sep 3, 2012

Here is a screenshot when the menu is closed and I see the camera view:
http://i.imgur.com/nuOfZ.png

Here is when I open the menu:
http://i.imgur.com/g7JAr.png

@naddaf
Copy link
Author

naddaf commented Sep 3, 2012

My existing code is from 7/29, so it is not the latest. If you think there is anything related to this issue, I will checkout the latest; in fact, I still check out the latest anyway to make sure I am getting the best code.

Thanks
Ali

@jfeinstein10
Copy link
Owner

Hmmm okay let me know if that works. Yes, there were a lot of improvements and features introduced since then. I would suggest looking at the example app for some cool things.

@iPaulPro
Copy link
Contributor

iPaulPro commented Sep 3, 2012

@naddaf Dude, it's not proper, or fair, to report issues when your code is a full month and dozens of commits behind. Just saying...

@naddaf
Copy link
Author

naddaf commented Sep 3, 2012

Jeremy,
I just updated to the latest code and I am still seeing the same issue.

Thanks,
Ali.

@jfeinstein10
Copy link
Owner

What happens when you invalidate the SlidingMenu?

@naddaf
Copy link
Author

naddaf commented Sep 3, 2012

where would be the right place to do that?

@jfeinstein10
Copy link
Owner

Try it in an OnOpenedListener

@naddaf
Copy link
Author

naddaf commented Sep 3, 2012

Unfortunately didn't help; I did that in the toggle() so prior to showBehind(), I invalidated the mSlidingMenu.

@naddaf
Copy link
Author

naddaf commented Sep 3, 2012

I also tried that in OnOpenedListener and didn't help.

@naddaf
Copy link
Author

naddaf commented Sep 4, 2012

I am not sure what you mean by manually altering its bounds. Could you please explain?
Thanks
Ali.

@jfeinstein10
Copy link
Owner

I don't have much experience with SurfaceViews so I would rather offer no advice and say play around than offer bad advice :\

@naddaf
Copy link
Author

naddaf commented Sep 4, 2012

Jeremy,
I have recreated the issue using the sample code that comes along with your library in a very simple way on ICS version, I am hoping that helps you see the issue and hopefully come up with a new suggestion.

layout resource (video.xml):

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:orientation="vertical">

    <VideoView android:id="@+id/videoView1" android:layout_width="match_parent"
        android:layout_height="wrap_content" android:layout_marginTop="100dp" />

</LinearLayout>

VideoFragment.java:

package com.slidingmenu.example;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class VideoFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.video, container, false);
        return view;
    }

}

Updated SlidingTitleBar.java:

package com.slidingmenu.example;

import android.os.Bundle;


public class SlidingTitleBar extends BaseActivity {

    public SlidingTitleBar() {
        super(R.string.title_bar_slide);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // set the Above View
        setContentView(R.layout.content_frame);
        getSupportFragmentManager()
        .beginTransaction()
//      .replace(R.id.content_frame, new SampleListFragment())
        .replace(R.id.content_frame, new VideoFragment())
        .commit();

        setSlidingActionBarEnabled(true);
    }

}

The VideoFragment has a simple VideoView in it and I have added 100dp margin on top to make the effect visible. If you run the sample and select Sliding Title Bar, you will see a black screen which is the video screen (since it is not playing anything, it is black) and if you slide the menu open, you will see only the top 100dp of the list, the rest is black (100dp is visible since the VideoView is placed with 100dp top margin).

Note: this code works on Jelly Beans but exhibits the issue on ICS

Many thanks
Ali

@naddaf naddaf closed this as completed Sep 4, 2012
@naddaf naddaf reopened this Sep 4, 2012
@naddaf
Copy link
Author

naddaf commented Sep 4, 2012

I don't know how I managed to close the issues, so I reopened it, sorry.

@jfeinstein10
Copy link
Owner

Try pulling the changes from this morning and running it again

@dermatthias
Copy link

Just wanted to let you know that I had a similiar issue and the changes fixed the problem. Thanks!

I am having single FrameLayout in the aboveView, which get filled with a fragment (.replace() with FragmentManager and FragmentTransaction) when you choose a menu item from the slidung menu (it's a ListView in my case). The new active fragment wasn't drawing it's UI, I just got a blank screen, but the underlying code (calls to an API etc.) worked.

@jfeinstein10
Copy link
Owner

So it all works for you now?

@dermatthias
Copy link

Oh sorry, yes it works now.
But I am not sure about the original creator of this issue.

@naddaf
Copy link
Author

naddaf commented Sep 6, 2012

Hi Jeremy.
Sorry for my delay, was busy with a new release at work. I just tested my sample and it worked fine, thanks. I now need to go back and fix my main project since after upgrading to the recent version of your library (my old one was about a month old), a lot of things are broken so need to see what is happening.

Thanks again,
Ali.

@jfeinstein10
Copy link
Owner

Set the background of your VideoView to transparent

@carlonzo
Copy link

carlonzo commented Apr 1, 2013

Hi!

I had the same problem with the camera surface on the main activity.
I solved the problem putting a transparent view above the surfaceview.

something like this:

 <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

 <SurfaceView
            android:id="@+id/camera_preview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

 <View
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/transparent" />
</FrameLayout>

this solved for me the problem!!!!!!
I'm sorry for my english and thanks again Jeremy for your wonderful library!!!

@MichalZajac
Copy link

Thank you CARLONZO - the solution works for me too.

@carlonzo
Copy link

carlonzo commented May 3, 2013

:) you are welcome. the solution of Jeremy (put a transparent background) did not work for me..

@brockhaus
Copy link

This seems to be a more general problem.
I have a fragment showing a map and a sliding menu. This is working on 90% of the tested devices, but on (at least) 2 devices I had exactly the same problem, as described here. But with a MapView instead of this Camera thing.

The fix is the same. I changed the LinearLayout holding my MapView to FrameLayout and added the transparant view on top. Now it is working on these two devices.
Is there some chance to have the SlidingMenu working w/o this workaround? Or is there nothing we can do?

Btw: Thanks a lot for this great lib. I love it!

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

7 participants