org.chromium.chrome.browser.widget.FadingShadow Java Examples

The following examples show how to use org.chromium.chrome.browser.widget.FadingShadow. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BookmarkContentView.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mItemsContainer = (BookmarkRecyclerView) findViewById(R.id.bookmark_items_container);
    TextView emptyView = (TextView) findViewById(R.id.bookmark_empty_view);
    emptyView.setText(R.string.bookmarks_folder_empty);
    mItemsContainer.setEmptyView(emptyView);
    mActionBar = (BookmarkActionBar) findViewById(R.id.bookmark_action_bar);
    mLoadingView = (LoadingView) findViewById(R.id.bookmark_initial_loading_view);
    FadingShadowView shadow = (FadingShadowView) findViewById(R.id.shadow);
    if (DeviceFormFactor.isLargeTablet(getContext())) {
        shadow.setVisibility(View.GONE);
    } else {
        shadow.init(ApiCompatibilityUtils.getColor(getResources(),
                R.color.toolbar_shadow_color), FadingShadow.POSITION_TOP);
    }
}
 
Example #2
Source File: SelectableListLayout.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes the SelectionToolbar.
 *
 * @param toolbarLayoutId The resource id of the toolbar layout. This will be inflated into
 *                        a ViewStub.
 * @param delegate The SelectionDelegate that will inform the toolbar of selection changes.
 * @param titleResId The resource id of the title string. May be 0 if this class shouldn't set
 *                   set a title when the selection is cleared.
 * @param drawerLayout The DrawerLayout whose navigation icon is displayed in this toolbar.
 * @param normalGroupResId The resource id of the menu group to show when a selection isn't
 *                         established.
 * @param selectedGroupResId The resource id of the menu item to show when a selection is
 *                           established.
 * @param normalBackgroundColorResId The resource id of the color to use as the background color
 *                                   when selection is not enabled. If null the default appbar
 *                                   background color will be used.
 * @param listener The OnMenuItemClickListener to set on the toolbar.
 * @return The initialized SelectionToolbar.
 */
public SelectableListToolbar<E> initializeToolbar(int toolbarLayoutId,
        SelectionDelegate<E> delegate, int titleResId, @Nullable DrawerLayout drawerLayout,
        int normalGroupResId, int selectedGroupResId,
        @Nullable Integer normalBackgroundColorResId,
        @Nullable OnMenuItemClickListener listener) {
    mToolbarStub.setLayoutResource(toolbarLayoutId);
    @SuppressWarnings("unchecked")
    SelectableListToolbar<E> toolbar = (SelectableListToolbar<E>) mToolbarStub.inflate();
    mToolbar = toolbar;
    mToolbar.initialize(delegate, titleResId, drawerLayout, normalGroupResId,
            selectedGroupResId, normalBackgroundColorResId);

    if (listener != null) {
        mToolbar.setOnMenuItemClickListener(listener);
    }

    mToolbarShadow = (FadingShadowView) findViewById(R.id.shadow);
    mToolbarShadow.init(
            ApiCompatibilityUtils.getColor(getResources(), R.color.toolbar_shadow_color),
            FadingShadow.POSITION_TOP);
    delegate.addObserver(this);
    setToolbarShadowVisibility();

    return mToolbar;
}
 
Example #3
Source File: SelectableListLayout.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    LayoutInflater.from(getContext()).inflate(R.layout.selectable_list_layout, this);

    mEmptyView = (TextView) findViewById(R.id.empty_view);
    mLoadingView = (LoadingView) findViewById(R.id.loading_view);
    mLoadingView.showLoadingUI();

    mToolbarStub = (ViewStub) findViewById(R.id.action_bar_stub);

    FadingShadowView shadow = (FadingShadowView) findViewById(R.id.shadow);
    if (DeviceFormFactor.isLargeTablet(getContext())) {
        shadow.setVisibility(View.GONE);
    } else {
        shadow.init(ApiCompatibilityUtils.getColor(getResources(),
                R.color.toolbar_shadow_color), FadingShadow.POSITION_TOP);
    }
}
 
Example #4
Source File: FadingEdgeScrollView.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
protected void dispatchDraw(Canvas canvas) {
    super.dispatchDraw(canvas);
    setVerticalFadingEdgeEnabled(true);
    float topShadowStrength = getTopFadingEdgeStrength();
    float bottomShadowStrength = getBottomFadingEdgeStrength();
    float shadowHeight = getVerticalFadingEdgeLength();
    setVerticalFadingEdgeEnabled(false);

    if (mDrawTopShadow) {
        mFadingShadow.drawShadow(this, canvas, FadingShadow.POSITION_TOP,
                shadowHeight, topShadowStrength);
    }

    if (mDrawBottomShadow) {
        mFadingShadow.drawShadow(this, canvas, FadingShadow.POSITION_BOTTOM,
                shadowHeight, bottomShadowStrength);
    }
}
 
Example #5
Source File: DownloadManagerUi.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes the UI for the given Activity.
 *
 * @param activity Activity that is showing the UI.
 */
public void initialize(DownloadManagerUiDelegate delegate, Activity activity) {
    mDelegate = delegate;

    mActionBarDrawerToggle = new ActionBarDrawerToggle(activity,
            this, (Toolbar) findViewById(R.id.action_bar),
            R.string.accessibility_bookmark_drawer_toggle_btn_open,
            R.string.accessibility_bookmark_drawer_toggle_btn_close);
    addDrawerListener(mActionBarDrawerToggle);
    mActionBarDrawerToggle.syncState();

    FadingShadowView shadow = (FadingShadowView) findViewById(R.id.shadow);
    if (DeviceFormFactor.isLargeTablet(getContext())) {
        shadow.setVisibility(View.GONE);
    } else {
        shadow.init(ApiCompatibilityUtils.getColor(getResources(),
                R.color.toolbar_shadow_color), FadingShadow.POSITION_TOP);
    }

    mSpaceDisplay.update(0);

    ((Toolbar) findViewById(R.id.action_bar)).setTitle(R.string.menu_downloads);
}
 
Example #6
Source File: BookmarkContentView.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    mItemsContainer = (BookmarkRecyclerView) findViewById(R.id.bookmark_items_container);
    TextView emptyView = (TextView) findViewById(R.id.bookmark_empty_view);
    emptyView.setText(R.string.bookmarks_folder_empty);
    mItemsContainer.setEmptyView(emptyView);
    mActionBar = (BookmarkActionBar) findViewById(R.id.bookmark_action_bar);
    mLoadingView = (LoadingView) findViewById(R.id.bookmark_initial_loading_view);
    FadingShadowView shadow = (FadingShadowView) findViewById(R.id.shadow);
    if (DeviceFormFactor.isLargeTablet(getContext())) {
        shadow.setVisibility(View.GONE);
    } else {
        shadow.init(ApiCompatibilityUtils.getColor(getResources(),
                R.color.toolbar_shadow_color), FadingShadow.POSITION_TOP);
    }
}
 
Example #7
Source File: FadingEdgeScrollView.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
protected void dispatchDraw(Canvas canvas) {
    super.dispatchDraw(canvas);
    setVerticalFadingEdgeEnabled(true);
    float topShadowStrength = getTopFadingEdgeStrength();
    float bottomShadowStrength = getBottomFadingEdgeStrength();
    float shadowHeight = getVerticalFadingEdgeLength();
    setVerticalFadingEdgeEnabled(false);

    if (mDrawTopShadow) {
        mFadingShadow.drawShadow(this, canvas, FadingShadow.POSITION_TOP,
                shadowHeight, topShadowStrength);
    }

    if (mDrawBottomShadow) {
        mFadingShadow.drawShadow(this, canvas, FadingShadow.POSITION_BOTTOM,
                shadowHeight, bottomShadowStrength);
    }
}
 
Example #8
Source File: NewTabPageScrollView.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
protected void dispatchDraw(Canvas canvas) {
    super.dispatchDraw(canvas);
    if (mFadingShadow != null) {
        setVerticalFadingEdgeEnabled(true);
        float shadowStrength = getBottomFadingEdgeStrength();
        float shadowHeight = getVerticalFadingEdgeLength();
        setVerticalFadingEdgeEnabled(false);
        mFadingShadow.drawShadow(this, canvas, FadingShadow.POSITION_BOTTOM,
                shadowHeight, shadowStrength);
    }
}
 
Example #9
Source File: EditorView.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Prepares the toolbar for use.
 *
 * Many of the things that would ideally be set as attributes don't work and need to be set
 * programmatically.  This is likely due to how we compile the support libraries.
 */
private void prepareToolbar() {
    EditorDialogToolbar toolbar = (EditorDialogToolbar) mLayout.findViewById(R.id.action_bar);
    toolbar.setTitle(mEditorModel.getTitle());
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.setShowDeleteMenuItem(false);

    // Show the help article when the user asks.
    toolbar.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            launchAutofillHelpPage(mContext);
            return true;
        }
    });

    // Cancel editing when the user hits the back arrow.
    toolbar.setNavigationContentDescription(R.string.cancel);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            cancelEdit();
        }
    });

    // Make it appear that the toolbar is floating by adding a shadow.
    FadingShadowView shadow = (FadingShadowView) mLayout.findViewById(R.id.shadow);
    shadow.init(ApiCompatibilityUtils.getColor(mContext.getResources(),
            R.color.toolbar_shadow_color), FadingShadow.POSITION_TOP);

    // The top shadow is handled by the toolbar, so hide the one used in the field editor.
    FadingEdgeScrollView scrollView =
            (FadingEdgeScrollView) mLayout.findViewById(R.id.scroll_view);
    scrollView.setShadowVisibility(false, true);
}
 
Example #10
Source File: EditorView.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Prepares the toolbar for use.
 *
 * Many of the things that would ideally be set as attributes don't work and need to be set
 * programmatically.  This is likely due to how we compile the support libraries.
 */
private void prepareToolbar() {
    EditorDialogToolbar toolbar = (EditorDialogToolbar) mLayout.findViewById(R.id.action_bar);
    toolbar.setTitle(mEditorModel.getTitle());
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.setShowDeleteMenuItem(false);

    // Show the help article when the user asks.
    toolbar.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            launchAutofillHelpPage(mContext);
            return true;
        }
    });

    // Cancel editing when the user hits the back arrow.
    toolbar.setNavigationContentDescription(R.string.cancel);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            cancelEdit();
        }
    });

    // Make it appear that the toolbar is floating by adding a shadow.
    FadingShadowView shadow = (FadingShadowView) mLayout.findViewById(R.id.shadow);
    shadow.init(ApiCompatibilityUtils.getColor(mContext.getResources(),
            R.color.toolbar_shadow_color), FadingShadow.POSITION_TOP);

    // The top shadow is handled by the toolbar, so hide the one used in the field editor.
    // TODO(dfalcantara): Make the toolbar's shadow cover the field editor instead of pushing
    //                    it down.  Maybe use a RelativeLayout with overlapping views?
    FadingEdgeScrollView scrollView =
            (FadingEdgeScrollView) mLayout.findViewById(R.id.scroll_view);
    scrollView.setShadowVisibility(false, true);
}
 
Example #11
Source File: IncognitoBottomSheetContent.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a new IncognitoBottomSheetContent.
 * @param activity The {@link Activity} displaying this bottom sheet content.
 */
public IncognitoBottomSheetContent(final Activity activity) {
    LayoutInflater inflater = LayoutInflater.from(activity);
    mView = inflater.inflate(R.layout.incognito_bottom_sheet_content, null);

    View learnMore = mView.findViewById(R.id.learn_more);
    learnMore.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            HelpAndFeedback.getInstance(activity).show(activity,
                    activity.getString(R.string.help_context_incognito_learn_more),
                    Profile.getLastUsedProfile(), null);
        }
    });

    final FadingShadowView shadow = (FadingShadowView) mView.findViewById(R.id.shadow);
    shadow.init(
            ApiCompatibilityUtils.getColor(mView.getResources(), R.color.toolbar_shadow_color),
            FadingShadow.POSITION_TOP);

    mScrollView = (ScrollView) mView.findViewById(R.id.scroll_view);
    mScrollView.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() {
        @Override
        public void onScrollChanged() {
            boolean shadowVisible = mScrollView.canScrollVertically(-1);
            shadow.setVisibility(shadowVisible ? View.VISIBLE : View.GONE);
        }
    });
}
 
Example #12
Source File: NewTabPageScrollView.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
protected void dispatchDraw(Canvas canvas) {
    super.dispatchDraw(canvas);
    if (mFadingShadow != null) {
        setVerticalFadingEdgeEnabled(true);
        float shadowStrength = getBottomFadingEdgeStrength();
        float shadowHeight = getVerticalFadingEdgeLength();
        setVerticalFadingEdgeEnabled(false);
        mFadingShadow.drawShadow(this, canvas, FadingShadow.POSITION_BOTTOM,
                shadowHeight, shadowStrength);
    }
}
 
Example #13
Source File: NewTabPageScrollView.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
protected void dispatchDraw(Canvas canvas) {
    super.dispatchDraw(canvas);
    if (mFadingShadow != null) {
        setVerticalFadingEdgeEnabled(true);
        float shadowStrength = getBottomFadingEdgeStrength();
        float shadowHeight = getVerticalFadingEdgeLength();
        setVerticalFadingEdgeEnabled(false);
        mFadingShadow.drawShadow(this, canvas, FadingShadow.POSITION_BOTTOM,
                shadowHeight, shadowStrength);
    }
}
 
Example #14
Source File: EditorDialog.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Prepares the toolbar for use.
 *
 * Many of the things that would ideally be set as attributes don't work and need to be set
 * programmatically.  This is likely due to how we compile the support libraries.
 */
private void prepareToolbar() {
    EditorDialogToolbar toolbar = (EditorDialogToolbar) mLayout.findViewById(R.id.action_bar);
    toolbar.setTitle(mEditorModel.getTitle());
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.setShowDeleteMenuItem(false);

    // Show the help article when the user asks.
    toolbar.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            launchAutofillHelpPage(mContext);
            return true;
        }
    });

    // Cancel editing when the user hits the back arrow.
    toolbar.setNavigationContentDescription(R.string.cancel);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dismissDialog();
        }
    });

    // Make it appear that the toolbar is floating by adding a shadow.
    FadingShadowView shadow = (FadingShadowView) mLayout.findViewById(R.id.shadow);
    shadow.init(ApiCompatibilityUtils.getColor(
                        mContext.getResources(), R.color.toolbar_shadow_color),
            FadingShadow.POSITION_TOP);

    // The top shadow is handled by the toolbar, so hide the one used in the field editor.
    FadingEdgeScrollView scrollView =
            (FadingEdgeScrollView) mLayout.findViewById(R.id.scroll_view);
    scrollView.setEdgeVisibility(
            FadingEdgeScrollView.DRAW_NO_EDGE, FadingEdgeScrollView.DRAW_FADING_EDGE);
}
 
Example #15
Source File: ListUrlsActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    setContentView(R.layout.physical_web_list_urls_activity);

    initSharedPreferences();

    mAdapter = new NearbyUrlsAdapter(this);

    View emptyView = findViewById(R.id.physical_web_empty);
    mListView = (ListView) findViewById(R.id.physical_web_urls_list);
    mListView.setEmptyView(emptyView);
    mListView.setAdapter(mAdapter);
    mListView.setOnItemClickListener(this);

    mEmptyListText = (TextView) findViewById(R.id.physical_web_empty_list_text);

    mScanningImageView = (ImageView) findViewById(R.id.physical_web_logo);

    mSwipeRefreshWidget =
            (SwipeRefreshWidget) findViewById(R.id.physical_web_swipe_refresh_widget);
    mSwipeRefreshWidget.setOnRefreshListener(this);

    mBottomBar = findViewById(R.id.physical_web_bottom_bar);

    int shadowColor = ApiCompatibilityUtils.getColor(getResources(),
            R.color.bottom_bar_shadow_color);
    FadingShadowView shadow =
            (FadingShadowView) findViewById(R.id.physical_web_bottom_bar_shadow);
    shadow.init(shadowColor, FadingShadow.POSITION_BOTTOM);

    View bottomBarClose = (View) findViewById(R.id.physical_web_bottom_bar_close);
    bottomBarClose.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            hideBottomBar();
        }
    });

    mPwsClient = new PwsClientImpl(this);
    int referer = getIntent().getIntExtra(REFERER_KEY, 0);
    if (savedInstanceState == null) {  // Ensure this is a newly-created activity.
        PhysicalWebUma.onActivityReferral(this, referer);
    }
    mIsInitialDisplayRecorded = false;
    mIsRefreshing = false;
    mIsRefreshUserInitiated = false;
    mPhysicalWebBleClient =
        PhysicalWebBleClient.getInstance((ChromeApplication) getApplicationContext());
}
 
Example #16
Source File: FadingEdgeScrollView.java    From delion with Apache License 2.0 4 votes vote down vote up
public FadingEdgeScrollView(Context context, AttributeSet attrs) {
    super(context, attrs);

    mFadingShadow = new FadingShadow(SHADOW_COLOR);
    setFadingEdgeLength(getResources().getDimensionPixelSize(R.dimen.ntp_shadow_height));
}
 
Example #17
Source File: SuggestionsBottomSheetContent.java    From 365browser with Apache License 2.0 4 votes vote down vote up
public SuggestionsBottomSheetContent(final ChromeActivity activity, final BottomSheet sheet,
        TabModelSelector tabModelSelector, SnackbarManager snackbarManager) {
    Profile profile = Profile.getLastUsedProfile();
    SuggestionsNavigationDelegate navigationDelegate =
            new SuggestionsNavigationDelegateImpl(activity, profile, sheet, tabModelSelector);
    mTileGroupDelegate = new TileGroupDelegateImpl(
            activity, profile, tabModelSelector, navigationDelegate, snackbarManager);
    mSuggestionsUiDelegate = createSuggestionsDelegate(
            profile, navigationDelegate, sheet, activity.getReferencePool());

    mView = LayoutInflater.from(activity).inflate(
            R.layout.suggestions_bottom_sheet_content, null);
    mRecyclerView = (SuggestionsRecyclerView) mView.findViewById(R.id.recycler_view);

    TouchEnabledDelegate touchEnabledDelegate = new TouchEnabledDelegate() {
        @Override
        public void setTouchEnabled(boolean enabled) {
            activity.getBottomSheet().setTouchEnabled(enabled);
        }
    };
    mContextMenuManager =
            new ContextMenuManager(activity, navigationDelegate, touchEnabledDelegate);
    activity.getWindowAndroid().addContextMenuCloseListener(mContextMenuManager);
    mSuggestionsUiDelegate.addDestructionObserver(new DestructionObserver() {
        @Override
        public void onDestroy() {
            activity.getWindowAndroid().removeContextMenuCloseListener(mContextMenuManager);
        }
    });

    UiConfig uiConfig = new UiConfig(mRecyclerView);

    final NewTabPageAdapter adapter = new NewTabPageAdapter(mSuggestionsUiDelegate,
            /* aboveTheFoldView = */ null, uiConfig, OfflinePageBridge.getForProfile(profile),
            mContextMenuManager, mTileGroupDelegate);
    mRecyclerView.init(uiConfig, mContextMenuManager, adapter);

    mBottomSheetObserver = new SuggestionsSheetVisibilityChangeObserver(this, activity) {
        @Override
        public void onSheetOpened() {
            mRecyclerView.scrollToPosition(0);
            adapter.refreshSuggestions();
            mSuggestionsUiDelegate.getEventReporter().onSurfaceOpened();
            mRecyclerView.getScrollEventReporter().reset();

            if (ChromeFeatureList.isEnabled(
                        ChromeFeatureList.CONTEXTUAL_SUGGESTIONS_CAROUSEL)
                    && sheet.getActiveTab() != null) {
                updateContextualSuggestions(sheet.getActiveTab().getUrl());
            }

            super.onSheetOpened();
        }

        @Override
        public void onContentShown() {
            SuggestionsMetrics.recordSurfaceVisible();
        }

        @Override
        public void onContentHidden() {
            SuggestionsMetrics.recordSurfaceHidden();
        }

        @Override
        public void onContentStateChanged(@BottomSheet.SheetState int contentState) {
            if (contentState == BottomSheet.SHEET_STATE_HALF) {
                SuggestionsMetrics.recordSurfaceHalfVisible();
            } else if (contentState == BottomSheet.SHEET_STATE_FULL) {
                SuggestionsMetrics.recordSurfaceFullyVisible();
            }
        }
    };

    mShadowView = (FadingShadowView) mView.findViewById(R.id.shadow);
    mShadowView.init(
            ApiCompatibilityUtils.getColor(mView.getResources(), R.color.toolbar_shadow_color),
            FadingShadow.POSITION_TOP);

    mRecyclerView.addOnScrollListener(new OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            boolean shadowVisible = mRecyclerView.canScrollVertically(-1);
            mShadowView.setVisibility(shadowVisible ? View.VISIBLE : View.GONE);
        }
    });

    final LocationBar locationBar = (LocationBar) sheet.findViewById(R.id.location_bar);
    mRecyclerView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        @SuppressLint("ClickableViewAccessibility")
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (locationBar != null && locationBar.isUrlBarFocused()) {
                locationBar.setUrlBarFocus(false);
            }

            // Never intercept the touch event.
            return false;
        }
    });
}
 
Example #18
Source File: ListUrlsActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    setContentView(R.layout.physical_web_list_urls_activity);

    initSharedPreferences();

    mAdapter = new NearbyUrlsAdapter(this);

    View emptyView = findViewById(R.id.physical_web_empty);
    mListView = (ListView) findViewById(R.id.physical_web_urls_list);
    mListView.setEmptyView(emptyView);
    mListView.setAdapter(mAdapter);
    mListView.setOnItemClickListener(this);

    mEmptyListText = (TextView) findViewById(R.id.physical_web_empty_list_text);

    mScanningImageView = (ImageView) findViewById(R.id.physical_web_logo);

    mSwipeRefreshWidget =
            (SwipeRefreshWidget) findViewById(R.id.physical_web_swipe_refresh_widget);
    mSwipeRefreshWidget.setOnRefreshListener(this);

    mBottomBar = findViewById(R.id.physical_web_bottom_bar);

    int shadowColor = ApiCompatibilityUtils.getColor(getResources(),
            R.color.bottom_bar_shadow_color);
    FadingShadowView shadow =
            (FadingShadowView) findViewById(R.id.physical_web_bottom_bar_shadow);
    shadow.init(shadowColor, FadingShadow.POSITION_BOTTOM);

    View bottomBarClose = (View) findViewById(R.id.physical_web_bottom_bar_close);
    bottomBarClose.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            hideBottomBar();
        }
    });

    mPwsClient = new PwsClientImpl(this);
    int referer = getIntent().getIntExtra(REFERER_KEY, 0);
    if (savedInstanceState == null) {  // Ensure this is a newly-created activity.
        PhysicalWebUma.onActivityReferral(this, referer);
    }
    mIsInitialDisplayRecorded = false;
    mIsRefreshing = false;
    mIsRefreshUserInitiated = false;
    mNearbyForegroundSubscription = new NearbyForegroundSubscription(this);
}
 
Example #19
Source File: FadingEdgeScrollView.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
public FadingEdgeScrollView(Context context, AttributeSet attrs) {
    super(context, attrs);

    mFadingShadow = new FadingShadow(SHADOW_COLOR);
    setFadingEdgeLength(getResources().getDimensionPixelSize(R.dimen.ntp_shadow_height));
}
 
Example #20
Source File: NewTabPageScrollView.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * Enables drawing a shadow at the bottom of the view when the view's content extends beyond
 * the bottom of the view. This is exactly the same as a fading edge, except that the shadow
 * color can have an alpha component, whereas a fading edge color must be opaque.
 *
 * @param shadowColor The color of the shadow, e.g. 0x11000000.
 */
public void enableBottomShadow(int shadowColor) {
    mFadingShadow = new FadingShadow(shadowColor);
    setFadingEdgeLength(getResources().getDimensionPixelSize(R.dimen.ntp_shadow_height));
}
 
Example #21
Source File: NewTabPageScrollView.java    From AndroidChromium with Apache License 2.0 2 votes vote down vote up
/**
 * Enables drawing a shadow at the bottom of the view when the view's content extends beyond
 * the bottom of the view. This is exactly the same as a fading edge, except that the shadow
 * color can have an alpha component, whereas a fading edge color must be opaque.
 *
 * @param shadowColor The color of the shadow, e.g. 0x11000000.
 */
public void enableBottomShadow(int shadowColor) {
    mFadingShadow = new FadingShadow(shadowColor);
    setFadingEdgeLength(getResources().getDimensionPixelSize(R.dimen.ntp_shadow_height));
}
 
Example #22
Source File: NewTabPageScrollView.java    From delion with Apache License 2.0 2 votes vote down vote up
/**
 * Enables drawing a shadow at the bottom of the view when the view's content extends beyond
 * the bottom of the view. This is exactly the same as a fading edge, except that the shadow
 * color can have an alpha component, whereas a fading edge color must be opaque.
 *
 * @param shadowColor The color of the shadow, e.g. 0x11000000.
 */
public void enableBottomShadow(int shadowColor) {
    mFadingShadow = new FadingShadow(shadowColor);
    setFadingEdgeLength(getResources().getDimensionPixelSize(R.dimen.ntp_shadow_height));
}