Revision 054fbee1
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/dialogs/RubikDialogPatternView.java | ||
---|---|---|
68 | 68 |
|
69 | 69 |
mTab = position; |
70 | 70 |
mDialog = dialog; |
71 |
mExpandedGroup = -1; |
|
71 |
|
|
72 |
RubikPattern pattern = RubikPattern.getInstance(); |
|
73 |
mExpandedGroup = pattern.recallExpanded(position); |
|
72 | 74 |
|
73 | 75 |
View tab = inflate( act, R.layout.dialog_pattern_tab, null); |
74 | 76 |
|
75 | 77 |
mListView = tab.findViewById(R.id.patternListView); |
76 |
mListAdapter = new RubikDialogPatternListAdapter(act,mTab); |
|
78 |
mListAdapter = new RubikDialogPatternListAdapter(act,mTab, ract.getScreenHeightInPixels());
|
|
77 | 79 |
mListView.setAdapter(mListAdapter); |
78 | 80 |
|
81 |
if( mExpandedGroup>=0 ) |
|
82 |
{ |
|
83 |
mListView.expandGroup(mExpandedGroup); |
|
84 |
} |
|
85 |
|
|
86 |
int visible = pattern.recallVisiblePos(mTab); |
|
87 |
mListView.setSelectionFromTop(visible,0); |
|
88 |
|
|
79 | 89 |
mListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() |
80 | 90 |
{ |
81 | 91 |
@Override |
... | ... | |
126 | 136 |
|
127 | 137 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
128 | 138 |
|
129 |
int getCurrentScrollPos()
|
|
139 |
int getCurrentVisiblePos()
|
|
130 | 140 |
{ |
131 |
return 0;//mScroll.getScrollY();
|
|
141 |
return mListView.getFirstVisiblePosition();
|
|
132 | 142 |
} |
133 | 143 |
|
134 | 144 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
135 | 145 |
|
136 |
@Override |
|
137 |
protected void onLayout(boolean changed, int left, int top, int right, int bottom) |
|
146 |
int getExpanded() |
|
138 | 147 |
{ |
139 |
super.onLayout(changed,left,top,right,bottom); |
|
140 |
/* |
|
141 |
if( !changed ) |
|
142 |
{ |
|
143 |
final RubikPattern pattern = RubikPattern.getInstance(); |
|
144 |
mScroll.setScrollY( pattern.recallScrollPos(mTab) ); |
|
145 |
} |
|
146 |
*/ |
|
148 |
return mExpandedGroup; |
|
147 | 149 |
} |
148 | 150 |
} |
Also available in: Unified diff
Reinvent the Pattern Dialog (Part 2)