Revision c651024f
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/dialogs/RubikDialogUpdates.java | ||
---|---|---|
51 | 51 |
private TextView mText; |
52 | 52 |
private ScrollView mScroll; |
53 | 53 |
private LinearLayout mLayout; |
54 |
private int mMargin, mSize, mFontSize; |
|
54 | 55 |
|
55 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
56 | 57 |
|
... | ... | |
79 | 80 |
|
80 | 81 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
81 | 82 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
82 |
final float titleSize= displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE; |
|
83 |
final float okSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE; |
|
83 |
int w= displaymetrics.widthPixels; |
|
84 |
int h= displaymetrics.heightPixels; |
|
85 |
final float titleSize= w*RubikActivity.MENU_BIG_TEXT_SIZE; |
|
86 |
final float okSize = w*RubikActivity.DIALOG_BUTTON_SIZE; |
|
87 |
mMargin = (int)(w*RubikActivity.MEDIUM_MARGIN); |
|
88 |
mSize = (int)(h*0.19f); |
|
89 |
mFontSize = (int)(h*0.02f); |
|
84 | 90 |
|
85 | 91 |
TextView title = (TextView) inflater.inflate(R.layout.dialog_title, null); |
86 | 92 |
title.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); |
... | ... | |
119 | 125 |
} |
120 | 126 |
}); |
121 | 127 |
|
128 |
RubikNetwork network = RubikNetwork.getInstance(); |
|
129 |
network.signUpForUpdates(this); |
|
130 |
|
|
122 | 131 |
return dialog; |
123 | 132 |
} |
124 | 133 |
|
... | ... | |
129 | 138 |
{ |
130 | 139 |
super.onResume(); |
131 | 140 |
|
132 |
RubikNetwork network = RubikNetwork.getInstance(); |
|
133 |
network.signUpForUpdates(this); |
|
134 |
|
|
135 | 141 |
Window window = getDialog().getWindow(); |
136 | 142 |
Context context = getContext(); |
137 | 143 |
|
... | ... | |
145 | 151 |
params.height = (int)(0.75f*height); |
146 | 152 |
window.setAttributes(params); |
147 | 153 |
|
148 |
int textHeight = (int)(0.8f*params.height);
|
|
154 |
int textHeight = (int)(0.75f*params.height);
|
|
149 | 155 |
mText.setHeight(textHeight); |
156 |
mLayout.setMinimumHeight(textHeight); |
|
150 | 157 |
} |
151 | 158 |
} |
152 | 159 |
|
... | ... | |
166 | 173 |
} |
167 | 174 |
else |
168 | 175 |
{ |
176 |
//mScroll.setVerticalScrollBarEnabled(false); |
|
177 |
//mText.setText(act.getString(R.string.no_updates)); |
|
178 |
|
|
179 |
int imagH = (int)(mSize*0.52f); |
|
180 |
int textH = (int)(mSize*0.20f); |
|
181 |
int buttH = (int)(mSize*0.35f); |
|
182 |
|
|
183 |
LinearLayout.LayoutParams pI = new LinearLayout.LayoutParams( imagH,imagH ); |
|
184 |
pI.setMargins(mMargin/2, mMargin/2, mMargin/2, mMargin/2 ); |
|
185 |
LinearLayout.LayoutParams pV = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, mSize ); |
|
186 |
pV.setMargins(mMargin, mMargin, mMargin, 0); |
|
187 |
LinearLayout.LayoutParams pT = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, textH ); |
|
188 |
LinearLayout.LayoutParams pB = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, buttH ); |
|
189 |
|
|
169 | 190 |
mText.setVisibility(View.GONE); |
170 | 191 |
|
171 | 192 |
if( mLayout!=null ) |
... | ... | |
174 | 195 |
{ |
175 | 196 |
RubikUpdates.UpdateInfo info = updates.getNewUpdate(i); |
176 | 197 |
RubikDialogUpdateView rubikView = new RubikDialogUpdateView(); |
177 |
View pane = rubikView.createView(act,info,true);
|
|
198 |
View pane = rubikView.createView(act,info,mFontSize,true,pI,pV,pT,pB);
|
|
178 | 199 |
mLayout.addView(pane); |
179 | 200 |
} |
180 | 201 |
for(int i=0; i<numU; i++) |
181 | 202 |
{ |
182 | 203 |
RubikUpdates.UpdateInfo info = updates.getUpdUpdate(i); |
183 | 204 |
RubikDialogUpdateView rubikView = new RubikDialogUpdateView(); |
184 |
View pane = rubikView.createView(act,info,false);
|
|
205 |
View pane = rubikView.createView(act,info,mFontSize,false,pI,pV,pT,pB);
|
|
185 | 206 |
mLayout.addView(pane); |
186 | 207 |
} |
187 | 208 |
} |
Also available in: Unified diff
Downloading updates: dialog progress.