Improve dialog layout
This commit is contained in:
1 parent
55e7ef7c73
commit
722a51d243
5 files changed
+34
-5
No files matched your search
@@ -33,7 +33,7 @@ public class CheckBoxDialogBuilder extends AlertDialog.Builder {
|
||||
@SuppressLint("InflateParams")
|
||||
public CheckBoxDialogBuilder(Context context, String message, String checkText, boolean checked) {
|
||||
super(context);
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.dialog_checkbox_builder, null);
|
||||
View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_checkbox_builder, null);
|
||||
setView(view);
|
||||
TextView messageView = (TextView) view.findViewById(R.id.message);
|
||||
mCheckBox = (CheckBox) view.findViewById(R.id.checkbox);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class EditTextDialogBuilder extends AlertDialog.Builder implements EditTe
|
||||
@SuppressLint("InflateParams")
|
||||
public EditTextDialogBuilder(Context context, String text, String hint) {
|
||||
super(context);
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.dialog_edittext_builder, null);
|
||||
View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_edittext_builder, null);
|
||||
setView(view);
|
||||
mTextInputLayout = (TextInputLayout) view;
|
||||
mEditText = (EditText) view.findViewById(R.id.edit_text);
|
||||
|
||||
@@ -39,11 +39,11 @@ public class ListCheckBoxDialogBuilder extends AlertDialog.Builder {
|
||||
public ListCheckBoxDialogBuilder(Context context, CharSequence[] items,
|
||||
final OnItemClickListener listener, String checkText, boolean checked) {
|
||||
super(context);
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.dialog_list_checkbox_builder, null);
|
||||
View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_list_checkbox_builder, null);
|
||||
setView(view);
|
||||
ListView listView = (ListView) ViewUtils.$$(view, R.id.list_view);
|
||||
mCheckBox = (CheckBox) ViewUtils.$$(view, R.id.checkbox);
|
||||
listView.setAdapter(new ArrayAdapter<>(context, R.layout.item_simple_list, items));
|
||||
listView.setAdapter(new ArrayAdapter<>(getContext(), R.layout.item_select_dialog, items));
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
@@ -1413,7 +1413,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
mProgressView.setVisibility(View.GONE);
|
||||
mErrorText.setVisibility(View.GONE);
|
||||
mListView.setVisibility(View.VISIBLE);
|
||||
mListView.setAdapter(new ArrayAdapter<>(getContext(), R.layout.item_simple_list, nameArray));
|
||||
mListView.setAdapter(new ArrayAdapter<>(mDialog.getContext(), R.layout.item_select_dialog, nameArray));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2016 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/listPreferredItemHeightSmall"
|
||||
android:textAppearance="?attr/textAppearanceListItemSmall"
|
||||
android:textColor="?attr/textColorAlertDialogListItem"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="?attr/listPreferredItemPaddingLeft"
|
||||
android:paddingRight="?attr/listPreferredItemPaddingRight"
|
||||
android:ellipsize="marquee"/>
|
||||
Reference in new issue
Block a user