| OLD | NEW |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
| 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | 4 |
| 5 package org.mozilla.gecko.menu; | 5 package org.mozilla.gecko.menu; |
| 6 | 6 |
| 7 import org.mozilla.gecko.AppConstants; | 7 import org.mozilla.gecko.AppConstants; |
| 8 import org.mozilla.gecko.GeckoAppShell; | 8 import org.mozilla.gecko.GeckoAppShell; |
| 9 import org.mozilla.gecko.R; | 9 import org.mozilla.gecko.R; |
| 10 import org.mozilla.gecko.util.ThreadUtils; | 10 import org.mozilla.gecko.util.ThreadUtils; |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 public void onClick(View v) { | 833 public void onClick(View v) { |
| 834 GeckoMenu listView = GeckoMenu.this; | 834 GeckoMenu listView = GeckoMenu.this; |
| 835 listView.performItemClick(actionView, pos + listView.get
HeaderViewsCount(), id); | 835 listView.performItemClick(actionView, pos + listView.get
HeaderViewsCount(), id); |
| 836 } | 836 } |
| 837 }); | 837 }); |
| 838 } | 838 } |
| 839 | 839 |
| 840 // Initialize the view. | 840 // Initialize the view. |
| 841 view.setShowIcon(mShowIcons); | 841 view.setShowIcon(mShowIcons); |
| 842 view.initialize(item); | 842 view.initialize(item); |
| 843 return (View) view; | 843 |
| 844 // Dropdown menu items can be up to 2 lines long |
| 845 // See https://issues.adblockplus.org/ticket/5470 |
| 846 if (view instanceof android.widget.TextView) |
| 847 { |
| 848 final android.widget.TextView textView = (android.widget.TextVie
w) view; |
| 849 textView.setSingleLine(false); |
| 850 textView.setMaxLines(2); |
| 851 textView.setEllipsize(android.text.TextUtils.TruncateAt.END); |
| 852 } |
| 853 |
| 854 return (View) view; |
| 844 } | 855 } |
| 845 | 856 |
| 846 @Override | 857 @Override |
| 847 public int getItemViewType(int position) { | 858 public int getItemViewType(int position) { |
| 848 return getItem(position).getGeckoActionProvider() == null ? VIEW_TYP
E_DEFAULT : VIEW_TYPE_ACTION_MODE; | 859 return getItem(position).getGeckoActionProvider() == null ? VIEW_TYP
E_DEFAULT : VIEW_TYPE_ACTION_MODE; |
| 849 } | 860 } |
| 850 | 861 |
| 851 @Override | 862 @Override |
| 852 public int getViewTypeCount() { | 863 public int getViewTypeCount() { |
| 853 return 2; | 864 return 2; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 public GeckoMenuItem getMenuItem(int id) { | 919 public GeckoMenuItem getMenuItem(int id) { |
| 909 for (GeckoMenuItem item : mItems) { | 920 for (GeckoMenuItem item : mItems) { |
| 910 if (item.getItemId() == id) | 921 if (item.getItemId() == id) |
| 911 return item; | 922 return item; |
| 912 } | 923 } |
| 913 | 924 |
| 914 return null; | 925 return null; |
| 915 } | 926 } |
| 916 } | 927 } |
| 917 } | 928 } |
| OLD | NEW |