fix testcase

This commit is contained in:
侯歌 2022-02-16 18:52:25 +08:00
parent 37158fdd8a
commit b42fa895ab
11 changed files with 79 additions and 121 deletions

View File

@ -82,6 +82,7 @@ class IDGenerater(object):
lastmodifytime=0
for top, dirs, nondirs in os.walk(scanPath):
dirs.sort()
nondirs.sort()
for item in nondirs:
fname=os.path.join(top, item)
if (not item.endswith('.xml')) or (self.dirHasId(fname)<0):

View File

@ -751,17 +751,17 @@ void AlertController::AlertParams::createListView(AlertController* dialog){
if (mOnClickListener) {
listView->setOnItemClickListener([&](AdapterView& parent, View& v, int position, long id) {
mOnClickListener(*dialog->mDialogInterface, position);
if (!mIsSingleChoice) {
dialog->mDialogInterface->dismiss();
}
mOnClickListener(*dialog->mDialogInterface, position);
if (!mIsSingleChoice) {
dialog->mDialogInterface->dismiss();
}
});
} else if (mOnCheckboxClickListener) {
listView->setOnItemClickListener([&](AdapterView& parent, View& v, int position, long id) {
if (mCheckedItems.size()) {
mCheckedItems[position] = listView->isItemChecked(position);
}
mOnCheckboxClickListener(*dialog->mDialogInterface, position, listView->isItemChecked(position));
if (mCheckedItems.size()) {
mCheckedItems[position] = listView->isItemChecked(position);
}
mOnCheckboxClickListener(*dialog->mDialogInterface, position, listView->isItemChecked(position));
});
}

View File

@ -74,7 +74,7 @@ AlertDialog::Builder::Builder(Context* context){
}
AlertDialog::Builder::~Builder(){
delete P;
//delete P;
}
Context* AlertDialog::Builder::getContext(){
@ -169,8 +169,8 @@ AlertDialog::Builder& AlertDialog::Builder::setAdapter(ListAdapter* adapter,Dial
return *this;
}
AlertDialog::Builder& AlertDialog::Builder::setMultiChoiceItems(const std::string&itemsId,const std::vector<bool>& checkedItems,
DialogInterface::OnMultiChoiceClickListener listener){
AlertDialog::Builder& AlertDialog::Builder::setMultiChoiceItems(const std::string&itemsId,
const std::vector<bool>& checkedItems,DialogInterface::OnMultiChoiceClickListener listener){
//P.mItems = P.mContext.getResources().getTextArray(itemsId);
P->mContext->getArray(itemsId,P->mItems);
P->mOnCheckboxClickListener = listener;
@ -179,8 +179,8 @@ AlertDialog::Builder& AlertDialog::Builder::setMultiChoiceItems(const std::strin
return *this;
}
AlertDialog::Builder& AlertDialog::Builder::setMultiChoiceItems(const std::vector<std::string>&items, const std::vector<bool>& checkedItems,
DialogInterface::OnMultiChoiceClickListener listener){
AlertDialog::Builder& AlertDialog::Builder::setMultiChoiceItems(const std::vector<std::string>&items,
const std::vector<bool>&checkedItems, DialogInterface::OnMultiChoiceClickListener listener){
P->mItems=items;
P->mOnCheckboxClickListener = listener;
P->mCheckedItems = checkedItems;
@ -188,7 +188,8 @@ AlertDialog::Builder& AlertDialog::Builder::setMultiChoiceItems(const std::vecto
return *this;
}
AlertDialog::Builder& AlertDialog::Builder::setSingleChoiceItems(const std::string&itemsId, int checkedItem, DialogInterface::OnClickListener listener){
AlertDialog::Builder& AlertDialog::Builder::setSingleChoiceItems(const std::string&itemsId,
int checkedItem, DialogInterface::OnClickListener listener){
//P.mItems = P.mContext.getResources().getTextArray(itemsId);
P->mContext->getArray(itemsId,P->mItems);
P->mOnClickListener = listener;

View File

@ -17,7 +17,7 @@ public:
const std::string getString(const std::string&resid)const;
public:
Builder(Context* context);
~Builder();
~Builder();
Context* getContext();
Builder& setTitle(const std::string& title);
Builder& setCustomTitle(View* customTitleView);

View File

@ -1,30 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
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.
-->
<CheckedTextView 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="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="?android:attr/textColorAlertDialogListItem"
android:gravity="center_vertical"
android:paddingStart="12dip"
android:paddingEnd="7dip"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:ellipsize="marquee"
<CheckedTextView xmlns:cdroid="http://schemas.android.com/apk/res/android"
cdroid:id="@cdroid:id/text1"
cdroid:layout_width="match_parent"
cdroid:layout_height="wrap_content"
cdroid:minHeight="?cdroid:attr/listPreferredItemHeight"
cdroid:textAppearance="?cdroid:attr/textAppearanceLarge"
cdroid:textColor="?cdroid:attr/textColorAlertDialogListItem"
cdroid:gravity="center_vertical"
cdroid:paddingStart="12dip"
cdroid:paddingEnd="7dip"
cdroid:checkMark="?cdroid:attr/listChoiceIndicatorMultiple"
cdroid:ellipsize="marquee"
/>

View File

@ -1,29 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
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.
-->
<CheckedTextView 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="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="?android:attr/textColorAlertDialogListItem"
android:gravity="center_vertical"
android:paddingStart="12dip"
android:paddingEnd="7dip"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:ellipsize="marquee"
<CheckedTextView xmlns:cdroid="http://schemas.android.com/apk/res/android"
cdroid:id="@cdroid:id/text1"
cdroid:layout_width="match_parent"
cdroid:layout_height="wrap_content"
cdroid:minHeight="?cdroid:attr/listPreferredItemHeight"
cdroid:textAppearance="?cdroid:attr/textAppearanceLarge"
cdroid:textColor="?cdroid:attr/textColorAlertDialogListItem"
cdroid:gravity="center_vertical"
cdroid:paddingStart="12dip"
cdroid:paddingEnd="7dip"
cdroid:checkMark="?cdroid:attr/listChoiceIndicatorSingle"
cdroid:ellipsize="marquee"
/>

View File

@ -1,29 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
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.
-->
<CheckedTextView 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="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorAlertDialogListItem"
android:gravity="center_vertical"
android:paddingStart="16dip"
android:paddingEnd="16dip"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:ellipsize="marquee"
<CheckedTextView xmlns:cdroid="http://schemas.android.com/apk/res/android"
cdroid:id="@cdroid:id/text1"
cdroid:layout_width="match_parent"
cdroid:layout_height="wrap_content"
cdroid:minHeight="?cdroid:attr/listPreferredItemHeightSmall"
cdroid:textAppearance="?cdroid:attr/textAppearanceMedium"
cdroid:textColor="?cdroid:attr/textColorAlertDialogListItem"
cdroid:gravity="center_vertical"
cdroid:paddingStart="16dip"
cdroid:paddingEnd="16dip"
cdroid:checkMark="?cdroid:attr/listChoiceIndicatorSingle"
cdroid:ellipsize="marquee"
/>

View File

@ -20,17 +20,17 @@
<id name="button3">0x000003f9</id>
<id name="button2">0x000003fa</id>
<id name="rightSpacer">0x000003fb</id>
<id name="titleDividerNoCustom">0x000003fc</id>
<id name="text1">0x000003fd</id>
<id name="select_dialog_listview">0x000003fe</id>
<id name="increment">0x000003ff</id>
<id name="numberpicker_input">0x00000400</id>
<id name="decrement">0x00000401</id>
<id name="textSpacerNoTitle">0x00000402</id>
<id name="textSpacerNoButtons">0x00000403</id>
<id name="titleDividerTop">0x00000404</id>
<id name="progress_percent">0x00000405</id>
<id name="progress_number">0x00000406</id>
<id name="body">0x00000407</id>
<id name="titleDividerTop">0x000003fc</id>
<id name="textSpacerNoTitle">0x000003fd</id>
<id name="textSpacerNoButtons">0x000003fe</id>
<id name="progress_percent">0x000003ff</id>
<id name="progress_number">0x00000400</id>
<id name="titleDividerNoCustom">0x00000401</id>
<id name="increment">0x00000402</id>
<id name="numberpicker_input">0x00000403</id>
<id name="decrement">0x00000404</id>
<id name="body">0x00000405</id>
<id name="select_dialog_listview">0x00000406</id>
<id name="text1">0x00000407</id>
</resources>

View File

@ -28,18 +28,18 @@ public:
button3 = 0x000003F9 /* 1017*/,
button2 = 0x000003FA /* 1018*/,
rightSpacer = 0x000003FB /* 1019*/,
titleDividerNoCustom = 0x000003FC /* 1020*/,
text1 = 0x000003FD /* 1021*/,
select_dialog_listview = 0x000003FE /* 1022*/,
increment = 0x000003FF /* 1023*/,
numberpicker_input = 0x00000400 /* 1024*/,
decrement = 0x00000401 /* 1025*/,
textSpacerNoTitle = 0x00000402 /* 1026*/,
textSpacerNoButtons = 0x00000403 /* 1027*/,
titleDividerTop = 0x00000404 /* 1028*/,
progress_percent = 0x00000405 /* 1029*/,
progress_number = 0x00000406 /* 1030*/,
body = 0x00000407 /* 1031*/
titleDividerTop = 0x000003FC /* 1020*/,
textSpacerNoTitle = 0x000003FD /* 1021*/,
textSpacerNoButtons = 0x000003FE /* 1022*/,
progress_percent = 0x000003FF /* 1023*/,
progress_number = 0x00000400 /* 1024*/,
titleDividerNoCustom = 0x00000401 /* 1025*/,
increment = 0x00000402 /* 1026*/,
numberpicker_input = 0x00000403 /* 1027*/,
decrement = 0x00000404 /* 1028*/,
body = 0x00000405 /* 1029*/,
select_dialog_listview = 0x00000406 /* 1030*/,
text1 = 0x00000407 /* 1031*/
};/*enum*/};/*class*/
};//endof class R

View File

@ -60,7 +60,7 @@ void CheckedTextView::setCheckMarkDrawable(const std::string&resId) {
}
void CheckedTextView::setCheckMarkDrawable(Drawable* d) {
setCheckMarkDrawableInternal(d, 0);
setCheckMarkDrawableInternal(d, "");
}
void CheckedTextView::setCheckMarkDrawableInternal(Drawable* d,const std::string&resId){

View File

@ -272,7 +272,7 @@ TextView::TextView(Context*ctx,const AttributeSet& attrs)
setMinWidth(attrs.getDimensionPixelSize("minWidth", INT_MIN));
setMaxWidth(attrs.getDimensionPixelSize("maxWidth", INT_MAX));
mSingleLine=attrs.getBoolean("singleLine",mSingleLine);
setSingleLine(attrs.getBoolean("singleLine",mSingleLine));
TextAppearanceAttributes attributes;
const std::string appearance=attrs.getString("textAppearance");