Java Code Examples for android.view.View.getRootView()

The following are Jave code examples for showing how to use getRootView() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: AndroidTvDemo   File: BorderEffect.java   View Source Code Vote up 7 votes
@Override
public void onLayout(View target, View attachView)
{
    try
    {
        ViewGroup viewGroup = (ViewGroup)attachView.getRootView();
        if (target.getParent() != null && target.getParent() != viewGroup)
        {
            target.setVisibility(View.GONE);
            if (mFirstFocus)
                viewGroup.requestFocus();
        }
    }
    catch (Exception ex)
    {
        ex.printStackTrace();
    }
}
 
Example 2
Project: ZoomPreviewPicture   File: ViewServer.java   View Source Code Vote up 7 votes
/**
 * Invoke this method to unregister a view hierarchy.
 * 
 * @param view A view that belongs to the view hierarchy/window to unregister
 * 
 * @see #addWindow(View, String)
 */
public void removeWindow(View view) {
    View rootView;
    mWindowsLock.writeLock().lock();
    try {
        rootView = view.getRootView();
        mWindows.remove(rootView);
    } finally {
        mWindowsLock.writeLock().unlock();
    }
    mFocusLock.writeLock().lock();
    try {
        if (mFocusedWindow == rootView) {
            mFocusedWindow = null;
        }
    } finally {
        mFocusLock.writeLock().unlock();
    }
    fireWindowsChangedEvent();
}
 
Example 3
Project: wirtualnaApteczka   File: RegisterNewUserOnClickListener.java   View Source Code Vote up 6 votes
@Override
public void onClick(View v) {
    View registrationLayoutView = v.getRootView();

    initializeViewComponents(registrationLayoutView);
    UserRegistrationTO userRegistrationTO = prepareUserRegistrationTO();

    boolean isValidUserRegistrationData = validateUserRegistrationData(v.getContext(), userRegistrationTO);

    if (isValidUserRegistrationData) {
        FirebaseAuth firebaseAuth = SessionManager.getFirebaseAuth();
        firebaseAuth.createUserWithEmailAndPassword(userRegistrationTO.getEmail(), userRegistrationTO.getPassword())
                .addOnCompleteListener(new RegistrationOnCompleteListener(v.getContext(), userRegistrationTO));
    }
}
 
Example 4
Project: mapbox-navigation-android   File: ViewUtils.java   View Source Code Vote up 6 votes
public static Bitmap captureView(View view) {
  View rootView = view.getRootView();
  rootView.setDrawingCacheEnabled(true);
  Bitmap bitmap = Bitmap.createBitmap(rootView.getDrawingCache());
  rootView.setDrawingCacheEnabled(false);
  return bitmap;
}
 
Example 5
Project: News24x7-news-from-every-part-of-the-world   File: DetailsFragment.java   View Source Code Vote up 6 votes
public static Bitmap getScreenShot(View view) {
    View screenView = view.getRootView();
    screenView.setDrawingCacheEnabled(true);
    Bitmap bitmap = Bitmap.createBitmap(screenView.getDrawingCache());
    screenView.setDrawingCacheEnabled(false);
    return bitmap;
}
 
Example 6
Project: open-rmbt   File: ViewServer.java   View Source Code Vote up 6 votes
/**
 * Invoke this method to change the currently focused window.
 * 
 * @param view A view that belongs to the view hierarchy/window that has focus,
 *             or null to remove focus
 */
public void setFocusedWindow(View view) {
    mFocusLock.writeLock().lock();
    try {
        mFocusedWindow = view == null ? null : view.getRootView();
    } finally {
        mFocusLock.writeLock().unlock();
    }
    fireFocusChangedEvent();
}
 
Example 7
Project: phonk   File: AndroidUtils.java   View Source Code Vote up 6 votes
public static void takeScreenshot(View v) {
    // create bitmap screen capture
    Bitmap bitmap;
    View v1 = v.getRootView();
    v1.setDrawingCacheEnabled(true);
    bitmap = Bitmap.createBitmap(v1.getDrawingCache());
    v1.setDrawingCacheEnabled(false);
}
 
Example 8
Project: JewelryUI   File: ViewUtil.java   View Source Code Vote up 6 votes
public static int getRelativeTop(View view) {
    if (view.getParent() == view.getRootView())
        return view.getTop();
    else
        return view.getTop() + getRelativeTop((View) view.getParent());
}
 
Example 9
Project: StickyScrollView   File: StickyScrollView.java   View Source Code Vote up 6 votes
private int getRelativeTop(View myView) {
    if (myView.getParent() == myView.getRootView()) {
        return myView.getTop();
    } else {
        return myView.getTop() + getRelativeTop((View) myView.getParent());
    }
}
 
Example 10
Project: wallpaperboard   File: AboutAdapter.java   View Source Code Vote up 6 votes
ShadowViewHolder(View itemView) {
    super(itemView);
    if (!Preferences.get(mContext).isShadowEnabled()) {
        View shadow = itemView.findViewById(R.id.shadow);
        shadow.setVisibility(View.GONE);

        View root = shadow.getRootView();
        root.setPadding(0, 0, 0, 0);
    }
}
 
Example 11
Project: ZoomPreviewPicture   File: ViewServer.java   View Source Code Vote up 6 votes
/**
 * Invoke this method to change the currently focused window.
 * 
 * @param view A view that belongs to the view hierarchy/window that has focus,
 *             or null to remove focus
 */
public void setFocusedWindow(View view) {
    mFocusLock.writeLock().lock();
    try {
        mFocusedWindow = view == null ? null : view.getRootView();
    } finally {
        mFocusLock.writeLock().unlock();
    }
    fireFocusChangedEvent();
}
 
Example 12
Project: Expert-Android-Programming   File: ViewUtils.java   View Source Code Vote up 6 votes
public static int getRelativeTop(View myView) {
    if (myView.getParent() == myView.getRootView()) {
        return myView.getTop();
    } else {
        return myView.getTop() + getRelativeTop((View) myView.getParent());
    }
}
 
Example 13
Project: wallpaperboard   File: SettingsAdapter.java   View Source Code Vote up 6 votes
FooterViewHolder(View itemView) {
    super(itemView);
    if (!Preferences.get(mContext).isShadowEnabled()) {
        View shadow = itemView.findViewById(R.id.shadow);
        shadow.setVisibility(View.GONE);

        View root = shadow.getRootView();
        root.setPadding(0, 0, 0, 0);
    }
}
 
Example 14
Project: JewelryUI   File: ViewUtil.java   View Source Code Vote up 5 votes
public static int getRelativeLeft(View view) {
    if (view.getParent() == view.getRootView())
        return view.getLeft();
    else
        return view.getLeft() + getRelativeLeft((View) view.getParent());
}
 
Example 15
Project: Swift-Braille-Soft-keyboard   File: Common.java   View Source Code Vote up 5 votes
public static int getRelativeLeft(View myView) {
    if (myView.getParent() == myView.getRootView())
        return myView.getLeft();
    else
        return myView.getLeft() + getRelativeLeft((View) myView.getParent());
}
 
Example 16
Project: Swift-Braille-Soft-keyboard   File: Common.java   View Source Code Vote up 5 votes
public static int getRelativeTop(View myView) {
    if (myView.getParent() == myView.getRootView())
        return myView.getTop();
    else
        return myView.getTop() + getRelativeTop((View) myView.getParent());
}
 
Example 17
Project: boohee_v5.6   File: ResolutionUtils.java   View Source Code Vote up 5 votes
public static Bitmap getViewBitmap(View v) {
    View view = v.getRootView();
    view.setDrawingCacheEnabled(true);
    view.buildDrawingCache();
    return view.getDrawingCache();
}
 
Example 18
Project: Expert-Android-Programming   File: HomeActivity.java   View Source Code Vote up 5 votes
private int getRelativeTop(View myView) {
    if (myView.getParent() == myView.getRootView())
        return myView.getTop();
    else
        return myView.getTop() + getRelativeTop((View) myView.getParent());
}
 
Example 19
Project: Expert-Android-Programming   File: BrowseNearbyActivity.java   View Source Code Vote up 5 votes
private int getRelativeLeft(View myView) {
    if (myView.getParent() == myView.getRootView())
        return myView.getLeft();
    else
        return myView.getLeft() + getRelativeLeft((View) myView.getParent());
}
 
Example 20
Project: Expert-Android-Programming   File: BrowseNearbyActivity.java   View Source Code Vote up 5 votes
private int getRelativeTop(View myView) {
    if (myView.getParent() == myView.getRootView())
        return myView.getTop();
    else
        return myView.getTop() + getRelativeTop((View) myView.getParent());
}