Search in sources :

Example 16 with View

use of android.view.View in project Launcher3 by chislon.

the class PagedView method focusableViewAvailable.

/**
     * If one of our descendant views decides that it could be focused now, only
     * pass that along if it's on the current page.
     *
     * This happens when live folders requery, and if they're off page, they
     * end up calling requestFocus, which pulls it on page.
     */
@Override
public void focusableViewAvailable(View focused) {
    View current = getPageAt(mCurrentPage);
    View v = focused;
    while (true) {
        if (v == current) {
            super.focusableViewAvailable(focused);
            return;
        }
        if (v == this) {
            return;
        }
        ViewParent parent = v.getParent();
        if (parent instanceof View) {
            v = (View) v.getParent();
        } else {
            return;
        }
    }
}
Also used : ViewParent(android.view.ViewParent) View(android.view.View)

Example 17 with View

use of android.view.View in project Launcher3 by chislon.

the class PagedView method requestDisallowInterceptTouchEvent.

/**
     * {@inheritDoc}
     */
@Override
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
    if (disallowIntercept) {
        // We need to make sure to cancel our long press if
        // a scrollable widget takes over touch events
        final View currentPage = getPageAt(mCurrentPage);
        currentPage.cancelLongPress();
    }
    super.requestDisallowInterceptTouchEvent(disallowIntercept);
}
Also used : View(android.view.View)

Example 18 with View

use of android.view.View in project Launcher3 by chislon.

the class PagedView method getLayoutTransitionOffsetForPage.

// While layout transitions are occurring, a child's position may stray from its baseline
// position. This method returns the magnitude of this stray at any given time.
public int getLayoutTransitionOffsetForPage(int index) {
    if (mPageScrolls == null || index >= mPageScrolls.length || index < 0) {
        return 0;
    } else {
        View child = getChildAt(index);
        int scrollOffset = (getViewportWidth() - child.getMeasuredWidth()) / 2;
        int baselineX = mPageScrolls[index] + scrollOffset + getViewportOffsetX();
        return (int) (child.getX() - baselineX);
    }
}
Also used : View(android.view.View)

Example 19 with View

use of android.view.View in project Launcher3 by chislon.

the class PagedViewCellLayout method onTouchEvent.

@Override
public boolean onTouchEvent(MotionEvent event) {
    boolean result = super.onTouchEvent(event);
    int count = getPageChildCount();
    if (count > 0) {
        // We only intercept the touch if we are tapping in empty space after the final row
        View child = getChildOnPageAt(count - 1);
        int bottom = child.getBottom();
        int numRows = (int) Math.ceil((float) getPageChildCount() / getCellCountX());
        if (numRows < getCellCountY()) {
            // Add a little bit of buffer if there is room for another row
            bottom += mCellHeight / 2;
        }
        result = result || (event.getY() < bottom);
    }
    return result;
}
Also used : View(android.view.View)

Example 20 with View

use of android.view.View in project Launcher3 by chislon.

the class Workspace method reinflateWidgetsIfNecessary.

protected void reinflateWidgetsIfNecessary() {
    final int clCount = getChildCount();
    for (int i = 0; i < clCount; i++) {
        CellLayout cl = (CellLayout) getChildAt(i);
        ShortcutAndWidgetContainer swc = cl.getShortcutsAndWidgets();
        final int itemCount = swc.getChildCount();
        for (int j = 0; j < itemCount; j++) {
            View v = swc.getChildAt(j);
            if (v.getTag() instanceof LauncherAppWidgetInfo) {
                LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) v.getTag();
                LauncherAppWidgetHostView lahv = (LauncherAppWidgetHostView) info.hostView;
                if (lahv != null && lahv.orientationChangedSincedInflation()) {
                    mLauncher.removeAppWidget(info);
                    // Remove the current widget which is inflated with the wrong orientation
                    cl.removeView(lahv);
                    mLauncher.bindAppWidget(info);
                }
            }
        }
    }
}
Also used : View(android.view.View) TextView(android.widget.TextView) AppWidgetHostView(android.appwidget.AppWidgetHostView) Point(android.graphics.Point)

Aggregations

View (android.view.View)17009 TextView (android.widget.TextView)5834 ImageView (android.widget.ImageView)3323 ListView (android.widget.ListView)2098 RecyclerView (android.support.v7.widget.RecyclerView)1838 AdapterView (android.widget.AdapterView)1715 ViewGroup (android.view.ViewGroup)1568 Intent (android.content.Intent)1026 Paint (android.graphics.Paint)951 Button (android.widget.Button)876 OnClickListener (android.view.View.OnClickListener)808 AbsListView (android.widget.AbsListView)795 LayoutInflater (android.view.LayoutInflater)771 LinearLayout (android.widget.LinearLayout)656 ArrayList (java.util.ArrayList)638 RemoteView (android.widget.RemoteViews.RemoteView)600 ScrollView (android.widget.ScrollView)566 Rect (android.graphics.Rect)534 SuppressLint (android.annotation.SuppressLint)433 Context (android.content.Context)405