Commit 73fac106 authored by Tommy Martino's avatar Tommy Martino Committed by Commit Bot

[AF Android] Draw divider on legacy Android

The JellyBean implementation of the dropdown class doesn't show a
divider between the ListView and the footer. This CL corrects that issue
by wrapping the footer view in a simple new layout containing a divider,
on Jellybean only.

Bug: 900781
Change-Id: I37ed28c705dcfc4c0caa3aa9bde4dc122f29e9ca
Reviewed-on: https://chromium-review.googlesource.com/c/1311938Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Tommy Martino <tmartino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604594}
parent c1d9f291
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!-- TODO(crbug.com/896339): This is only used by the deprecated implementation
of DropdownPopupWindow. This layout should be removed when that class is
removed. -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/dropdown_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="fill_horizontal"
android:orientation="vertical" >
<View style="@style/HorizontalDivider"
android:layout_height="@dimen/divider_height"
android:layout_width="match_parent" />
<FrameLayout
android:id="@+id/dropdown_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
......@@ -6,12 +6,14 @@ package org.chromium.ui;
import android.content.Context;
import android.graphics.Rect;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.View.OnLayoutChangeListener;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListPopupWindow;
......@@ -32,6 +34,7 @@ import java.lang.reflect.Method;
class DropdownPopupWindowJellyBean implements DropdownPopupWindowInterface {
private static final String TAG = "AutofillPopup";
private final View mAnchorView;
private final Context mContext;
private boolean mRtl;
private int mInitialSelection = -1;
private OnLayoutChangeListener mLayoutChangeListener;
......@@ -53,6 +56,8 @@ class DropdownPopupWindowJellyBean implements DropdownPopupWindowInterface {
mAnchorView.setId(R.id.dropdown_popup_window);
mAnchorView.setTag(this);
mContext = context;
mLayoutChangeListener = new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
......@@ -196,13 +201,18 @@ class DropdownPopupWindowJellyBean implements DropdownPopupWindowInterface {
@Override
public void setFooterView(View footerView) {
mFooterView = footerView;
mListPopupWindow.setPromptPosition(ListPopupWindow.POSITION_PROMPT_BELOW);
if (footerView != null) {
footerView.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
mFooterView = LayoutInflater.from(mContext).inflate(
R.layout.dropdown_footer_wrapper_jellybean, null);
FrameLayout container = (FrameLayout) mFooterView.findViewById(R.id.dropdown_footer);
container.addView(footerView);
} else {
mFooterView = null;
}
mListPopupWindow.setPromptPosition(ListPopupWindow.POSITION_PROMPT_BELOW);
mListPopupWindow.setPromptView(footerView);
mListPopupWindow.setPromptView(mFooterView);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment