Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
baoyongzhang committed Jun 6, 2014
1 parent 8457c98 commit b84b80c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 27 deletions.
1 change: 0 additions & 1 deletion code/gen/com/baoyz/actionsheet/R.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ public static final class style {
*/
public static final int AppBaseTheme=0x7f040002;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f040003;
}
Expand Down
41 changes: 20 additions & 21 deletions code/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<resources>

<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="actionSheetStyle">@style/ActionSheetStyleIOS6</item>
<item name="actionSheetStyle">@style/ActionSheetStyleIOS7</item>
</style>

</resources>
<resources>

<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- <item name="actionSheetStyle">@style/ActionSheetStyleIOS6</item> -->
</style>

</resources>
Expand Down
5 changes: 0 additions & 5 deletions code/src/com/baoyz/actionsheet/ActionSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
mView = createView();
mGroup = (ViewGroup) getActivity().getWindow().getDecorView();

// create view items
createItems();

mGroup.addView(mView);
Expand Down Expand Up @@ -219,7 +218,6 @@ public void run() {

private Attributes readAttribute() {
Attributes attrs = new Attributes(getActivity());
// read style
TypedArray a = getActivity().getTheme().obtainStyledAttributes(null,
R.styleable.ActionSheet, R.attr.actionSheetStyle, 0);
Drawable background = a
Expand Down Expand Up @@ -289,7 +287,6 @@ public void setActionSheetListener(ActionSheetListener listener) {
@Override
public void onClick(View v) {
if (v.getId() == BG_VIEW_ID) {
// click background
return;
}
dismiss();
Expand All @@ -308,7 +305,6 @@ private static class Attributes {

public Attributes(Context context) {
mContext = context;
// default value
this.background = new ColorDrawable(Color.TRANSPARENT);
this.cancelButtonBackground = new ColorDrawable(Color.BLACK);
ColorDrawable gray = new ColorDrawable(Color.GRAY);
Expand All @@ -325,7 +321,6 @@ public Attributes(Context context) {
}

public Drawable getOtherButtonMiddleBackground() {
// if is a selector, need create a new drawable object
if (otherButtonMiddleBackground instanceof StateListDrawable) {
TypedArray a = mContext.getTheme().obtainStyledAttributes(null,
R.styleable.ActionSheet, R.attr.actionSheetStyle, 0);
Expand Down
2 changes: 2 additions & 0 deletions code/src/com/baoyz/actionsheet/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ protected void onCreate(Bundle savedInstanceState) {
public void onClick(View v) {
switch (v.getId()) {
case R.id.ios6:
// 请在styles.xml中配置
setTheme(R.style.ActionSheetStyleIOS6);
break;
case R.id.ios7:
// 请在styles.xml中配置
setTheme(R.style.ActionSheetStyleIOS7);
break;
}
Expand Down
Binary file modified screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b84b80c

Please sign in to comment.