OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.app.Dialog; | 8 import android.app.Dialog; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.DialogInterface; | 10 import android.content.DialogInterface; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PA
RENT, | 538 new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PA
RENT, |
539 LinearLayout.LayoutParams.MATCH_PA
RENT)); | 539 LinearLayout.LayoutParams.MATCH_PA
RENT)); |
540 mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { | 540 mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { |
541 @Override | 541 @Override |
542 public void onDismiss(DialogInterface dialog) { | 542 public void onDismiss(DialogInterface dialog) { |
543 mItemSelectedCallback.onItemSelected(""); | 543 mItemSelectedCallback.onItemSelected(""); |
544 } | 544 } |
545 }); | 545 }); |
546 | 546 |
547 Window window = mDialog.getWindow(); | 547 Window window = mDialog.getWindow(); |
548 if (!DeviceFormFactor.isTablet(mActivity)) { | 548 if (!DeviceFormFactor.isTablet()) { |
549 // On smaller screens, make the dialog fill the width of the screen, | 549 // On smaller screens, make the dialog fill the width of the screen, |
550 // and appear at the top. | 550 // and appear at the top. |
551 window.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); | 551 window.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); |
552 window.setGravity(Gravity.TOP); | 552 window.setGravity(Gravity.TOP); |
553 window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, | 553 window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, |
554 ViewGroup.LayoutParams.WRAP_CONTENT); | 554 ViewGroup.LayoutParams.WRAP_CONTENT); |
555 } | 555 } |
556 | 556 |
557 mDialog.show(); | 557 mDialog.show(); |
558 } | 558 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 } | 681 } |
682 | 682 |
683 /** | 683 /** |
684 * Returns the ItemAdapter associated with this class. For use with tests on
ly. | 684 * Returns the ItemAdapter associated with this class. For use with tests on
ly. |
685 */ | 685 */ |
686 @VisibleForTesting | 686 @VisibleForTesting |
687 public ItemAdapter getItemAdapterForTesting() { | 687 public ItemAdapter getItemAdapterForTesting() { |
688 return mItemAdapter; | 688 return mItemAdapter; |
689 } | 689 } |
690 } | 690 } |
OLD | NEW |