78a2d7fc65ce0eafL31">31
|
public class CopyOfREditText extends EditText {
|
|
32
|
|
|
|
33
|
|
// Ĭ��,�����ı�������ɫ
|
|
34
|
|
private static final int FOREGROUND_COLOR = Color.parseColor("#FF8C00");
|
|
35
|
|
// Ĭ��,���ⱳ��������ɫ
|
|
36
|
|
private static final int BACKGROUND_COLOR = Color.parseColor("#FFDEAD");
|
|
37
|
|
|
|
38
|
|
/**
|
|
39
|
|
* �����߿���������
|
|
40
|
|
*/
|
|
41
|
|
private int mForegroundColor = FOREGROUND_COLOR;// �����ı�������ɫ
|
|
42
|
|
private int mBackgroundColor = BACKGROUND_COLOR;// ���ⱳ��������ɫ
|
|
43
|
|
private List<RObject> mRObjectsList = new ArrayList<RObject>();// object����
|
|
44
|
|
|
|
45
|
|
public CopyOfREditText(Context context) {
|
|
46
|
|
this(context, null);
|
|
47
|
|
}
|
|
48
|
|
|
|
49
|
|
public CopyOfREditText(Context context, AttributeSet attrs) {
|
|
50
|
|
super(context, attrs);
|
|
51
|
|
|
|
52
|
|
TypedArray a = context.obtainStyledAttributes(attrs,
|
|
53
|
|
R.styleable.REditText);
|
|
54
|
|
mBackgroundColor = a
|
|
55
|
|
.getColor(R.styleable.REditText_object_background_color,
|
|
56
|
|
BACKGROUND_COLOR);
|
|
57
|
|
mForegroundColor = a
|
|
58
|
|
.getColor(R.styleable.REditText_object_foreground_color,
|
|
59
|
|
getResources().getColor(R.color.blue));
|
|
60
|
|
a.recycle();
|
|
61
|
|
|
|
62
|
|
// ��ʼ������
|
|
63
|
|
initView();
|
|
64
|
|
}
|
|
65
|
|
|
|
66
|
|
/**
|
|
67
|
|
* ��������λ��,����괦�ڻ��������м����ƶ���굽�������λ��
|
|
68
|
|
*/
|
|
69
|
|
@Override
|
|
70
|
|
protected void onSelectionChanged(int selStart, int selEnd) {
|
|
71
|
|
super.onSelectionChanged(selStart, selEnd);
|
|
72
|
|
if (mRObjectsList == null || mRObjectsList.size() == 0) {
|
|
73
|
|
return;
|
|
74
|
|
}
|
|
75
|
|
|
|
76
|
|
int startPosition = 0;
|
|
77
|
|
int endPosition = 0;
|
|
78
|
|
String objectText = "";
|
|
79
|
|
for (int i = 0; i < mRObjectsList.size(); i++) {
|
|
80
|
|
objectText = mRObjectsList.get(i).getObjectText();// �ı�
|
|
81
|
|
startPosition = getText().toString().indexOf(objectText);// ��ȡ�ı���ʼ�±�
|
|
82
|
|
endPosition = startPosition + objectText.length();
|
|
83
|
|
if (startPosition != -1 && selStart > startPosition
|
|
84
|
|
&& selStart <= endPosition) {// ����괦�ڻ��������м����ƶ���굽�������λ��
|
|
85
|
|
setSelection(endPosition);
|
|
86
|
|
}
|
|
87
|
|
}
|
|
88
|
|
|
|
89
|
|
}
|
|
90
|
|
|
|
91
|
|
/**
|
|
92
|
|
* ��ʼ���ؼ�,һЩ����
|
|
93
|
|
*/
|
|
94
|
|
private void initView() {
|
|
95
|
|
|
|
96
|
|
/**
|
|
97
|
|
* ��������ݱ仯����<br/>
|
|
98
|
|
* 1.���������ݲ����仯��ʱ��ʵʱ����UI
|
|
99
|
|
*/
|
|
100
|
|
this.addTextChangedListener(new TextWatcher() {
|
|
101
|
|
@Override
|
|
102
|
|
public void beforeTextChanged(CharSequence s, int start, int count,
|
|
103
|
|
int after) {
|
|
104
|
|
}
|
|
105
|
|
|
|
106
|
|
@Override
|
|
107
|
|
public void onTextChanged(CharSequence s, int start, int before,
|
|
108
|
|
int count) {
|
|
109
|
|
}
|
|
110
|
|
|
|
111
|
|
@Override
|
|
112
|
|
public void afterTextChanged(Editable s) {
|
|
113
|
|
// ���ָı�ˢ��UI
|
|
114
|
|
refreshEditTextUI(s.toString());
|
|
115
|
|
}
|
|
116
|
|
});
|
|
117
|
|
|
|
118
|
|
/**
|
|
119
|
|
* ����ɾ���� <br/>
|
|
120
|
|
* 1.����ڻ������,��������������ɾ�� <br/>
|
|
121
|
|
* 2.�������ͨ���ֺ���,ɾ��һ���ַ�
|
|
122
|
|
*/
|
|
123
|
|
this.setOnKeyListener(new OnKeyListener() {
|
|
124
|
|
@Override
|
|
125
|
|
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
|
126
|
|
|
|
127
|
|
if (keyCode == KeyEvent.KEYCODE_DEL
|
|
128
|
|
&& event.getAction() == KeyEvent.ACTION_DOWN) {
|
|
129
|
|
|
|
130
|
|
int selectionStart = getSelectionStart();
|
|
131
|
|
int selectionEnd = getSelectionEnd();
|
|
132
|
|
|
|
133
|
|
/**
|
|
134
|
|
* ��������ʼ�ͽ�������ͬһλ��,ɾ���ı�
|
|
135
|
|
*/
|
|
136
|
|
if (selectionStart != selectionEnd) {
|
|
137
|
|
// ��ѯ�ı��Ƿ�����Ŀ�����,�����Ƴ��б�����
|
|
138
|
|
String tagetText = getText().toString().substring(
|
|
139
|
|
selectionStart, selectionEnd);
|
|
140
|
|
for (int i = 0; i < mRObjectsList.size(); i++) {
|
|
141
|
|
RObject object = mRObjectsList.get(i);
|
|
142
|
|
if (tagetText.equals(object.getObjectText())) {
|
|
143
|
|
mRObjectsList.remove(object);
|
|
144
|
|
}
|
|
145
|
|
}
|
|
146
|
|
return false;
|
|
147
|
|
}
|
|
148
|
|
|
|
149
|
|
int lastPos = 0;
|
|
150
|
|
Editable editable = getText();
|
|
151
|
|
// �����жϹ���λ��
|
|
152
|
|
for (int i = 0; i < mRObjectsList.size(); i++) {
|
|
153
|
|
|
|
154
|
|
String objectText = mRObjectsList.get(i)
|
|
155
|
|
.getObjectText();
|
|
156
|
|
|
|
157
|
|
lastPos = getText().toString().indexOf(objectText,
|
|
158
|
|
lastPos);
|
|
159
|
|
if (lastPos != -1) {
|
|
160
|
|
if (selectionStart != 0
|
|
161
|
|
&& selectionStart >= lastPos
|
|
162
|
|
&& selectionStart <= (lastPos + objectText
|
|
163
|
|
.length())) {
|
|
164
|
|
// ѡ�л���
|
|
165
|
|
setSelection(lastPos,
|
|
166
|
|
lastPos + objectText.length());
|
|
167
|
|
// ���ñ���ɫ
|
|
168
|
|
editable.setSpan(new BackgroundColorSpan(
|
|
169
|
|
mBackgroundColor), lastPos, lastPos
|
|
170
|
|
+ objectText.length(),
|
|
171
|
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
172
|
|
return true;
|
|
173
|
|
}
|
|
174
|
|
}
|
|
175
|
|
lastPos += objectText.length();
|
|
176
|
|
}
|
|
177
|
|
}
|
|
178
|
|
|
|
179
|
|
// if (keyCode == KeyEvent.KEYCODE_DEL
|
|
180
|
|
// && event.getAction() == KeyEvent.ACTION_DOWN) { //
|
|
181
|
|
// ��Ϊɾ���������ǰ��¶���ʱִ��
|
|
182
|
|
//
|
|
183
|
|
// int selectionStart = getSelectionStart();// ��ǰ���λ��
|
|
184
|
|
// int selectionEnd = getSelectionEnd();// �������
|
|
185
|
|
//
|
|
186
|
|
// Log.w("tag", "--selectionStart:" + selectionStart
|
|
187
|
|
// + "---selectionEnd:" + selectionEnd);
|
|
188
|
|
//
|
|
189
|
|
// /**
|
|
190
|
|
// * ��������ʼ�ͽ�������ͬһλ��,ɾ���ı�
|
|
191
|
|
// */
|
|
192
|
|
// if (selectionStart != selectionEnd) {
|
|
193
|
|
// // ��ѯ�ı��Ƿ�����Ŀ�����,�����Ƴ��б�����
|
|
194
|
|
// String tagetText = getText().toString().substring(
|
|
195
|
|
// selectionStart, selectionEnd);
|
|
196
|
|
// for (int i = 0; i < mRObjectsList.size(); i++) {
|
|
197
|
|
// RObject object = mRObjectsList.get(i);
|
|
198
|
|
// if (tagetText.equals(object.getObjectText())) {
|
|
199
|
|
// mRObjectsList.remove(object);
|
|
200
|
|
// }
|
|
201
|
|
// }
|
|
202
|
|
// return false;
|
|
203
|
|
// }
|
|
204
|
|
//
|
|
205
|
|
// int startPosition = 0;
|
|
206
|
|
// int endPosition = 0;
|
|
207
|
|
// for (int i = 0; i < mRObjectsList.size(); i++) {
|
|
208
|
|
//
|
|
209
|
|
// String objectText = mRObjectsList.get(i)
|
|
210
|
|
// .getObjectText();
|
|
211
|
|
// startPosition = getText().toString()
|
|
212
|
|
// .indexOf(objectText);
|
|
213
|
|
// endPosition = startPosition + objectText.length();
|
|
214
|
|
//
|
|
215
|
|
// if (startPosition != -1
|
|
216
|
|
// && selectionStart == endPosition) {
|
|
217
|
|
//
|
|
218
|
|
// Log.w("tag", "--����--" + startPosition + "---"
|
|
219
|
|
// + endPosition);
|
|
220
|
|
// // ѡ�л���
|
|
221
|
|
// setSelection(startPosition, endPosition);
|
|
222
|
|
// // ���ñ���ɫ
|
|
223
|
|
// Editable editable = getText();
|
|
224
|
|
// editable.setSpan(new BackgroundColorSpan(
|
|
225
|
|
// mBackgroundColor), startPosition,
|
|
226
|
|
// endPosition,
|
|
227
|
|
// Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
228
|
|
// return true;
|
|
229
|
|
//
|
|
230
|
|
// }
|
|
231
|
|
// }
|
|
232
|
|
//
|
|
233
|
|
// }
|
|
234
|
|
|
|
235
|
|
return false;
|
|
236
|
|
}
|
|
237
|
|
});
|
|
238
|
|
|
|
239
|
|
}
|
|
240
|
|
|
|
241
|
|
/**
|
|
242
|
|
* EditText������֮��ˢ��UI
|
|
243
|
|
*
|
|
244
|
|
* @param content���������
|
|
245
|
|
*/
|
|
246
|
|
private void refreshEditTextUI(String content) {
|
|
247
|
|
|
|
248
|
|
/**
|
|
249
|
|
* ���ݱ仯ʱ����<br/>
|
|
250
|
|
* 1.����ƥ�����л������� <br/>
|
|
251
|
|
* 2.���û�������������ɫ
|
|
252
|
|
*/
|
|
253
|
|
|
|
254
|
|
if (mRObjectsList.size() == 0)
|
|
255
|
|
return;
|
|
256
|
|
|
|
257
|
|
if (TextUtils.isEmpty(content)) {
|
|
258
|
|
mRObjectsList.clear();
|
|
259
|
|
return;
|
|
260
|
|
}
|
|
261
|
|
|
|
262
|
|
/**
|
|
263
|
|
* ��������span
|
|
264
|
|
*/
|
|
265
|
|
Editable editable = getText();
|
|
266
|
|
int findPosition = 0;
|
|
267
|
|
for (int i = 0; i < mRObjectsList.size(); i++) {
|
|
268
|
|
final RObject object = mRObjectsList.get(i);
|
|
269
|
|
String objectText = object.getObjectText();// �ı�
|
|
270
|
|
findPosition = content.indexOf(objectText);// ��ȡ�ı���ʼ�±�
|
|
271
|
|
|
|
272
|
|
if (findPosition != -1) {// ���û�������ǰ��ɫ����
|
|
273
|
|
|
|
274
|
|
ForegroundColorSpan colorSpan = new ForegroundColorSpan(
|
|
275
|
|
getResources().getColor(R.color.blue));
|
|
276
|
|
editable.setSpan(colorSpan, findPosition, findPosition
|
|
277
|
|
+ objectText.length(),
|
|
278
|
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
279
|
|
|
|
280
|
|
}
|
|
281
|
|
}
|
|
282
|
|
|
|
283
|
|
}
|
|
284
|
|
|
|
285
|
|
/**
|
|
286
|
|
* ����/���û���
|
|
287
|
|
*
|
|
288
|
|
* @param object�������
|
|
289
|
|
*/
|
|
290
|
|
public void setObject(RObject object) {
|
|
291
|
|
|
|
292
|
|
if (object == null)
|
|
293
|
|
return;
|
|
294
|
|
|
|
295
|
|
String objectRule = object.getObjectRule();
|
|
296
|
|
String objectText = object.getObjectText();
|
|
297
|
|
if (TextUtils.isEmpty(objectText) || TextUtils.isEmpty(objectRule))
|
|
298
|
|
return;
|
|
299
|
|
|
|
300
|
|
// ƴ���ַ�# %s #,������
|
|
301
|
|
objectText = objectRule + objectText + objectRule;
|
|
302
|
|
object.setObjectText(objectText);
|
|
303
|
|
|
|
304
|
|
/**
|
|
305
|
|
* ��ӻ���<br/>
|
|
306
|
|
* 1.������������ӵ����ݼ�����<br/>
|
|
307
|
|
* 2.������������ӵ�EditText��չʾ
|
|
308
|
|
*/
|
|
309
|
|
|
|
310
|
|
/**
|
|
311
|
|
* 1.��ӻ������ݵ����ݼ���
|
|
312
|
|
*/
|
|
313
|
|
mRObjectsList.add(object);
|
|
314
|
|
|
|
315
|
|
/**
|
|
316
|
|
* 2.������������ӵ�EditText��չʾ
|
|
317
|
|
*/
|
|
318
|
|
int selectionStart = getSelectionStart();// ����
|
|
319
|
|
Editable editable = getText();// ԭ������
|
|
320
|
|
|
|
321
|
|
if (selectionStart >= 0) {
|
|
322
|
|
editable.insert(selectionStart, objectText);// �ڹ��λ�ò�������
|
|
323
|
|
editable.insert(getSelectionStart(), " ");// ����������ո�,������Ҫ
|
|
324
|
|
setSelection(getSelectionStart());// �ƶ���굽��ӵ����ݺ���
|
|
325
|
|
}
|
|
326
|
|
|
|
327
|
|
}
|
|
328
|
|
|
|
329
|
|
/**
|
|
330
|
|
* ��ȡobject�б�����
|
|
331
|
|
*/
|
|
332
|
|
public List<RObject> getObjects() {
|
|
333
|
|
List<RObject> objectsList = new ArrayList<RObject>();
|
|
334
|
|
// ���ڱ���ʱ���ı����������ƥ���ַ�#,�˴�ȥ��,��ԭ����
|
|
335
|
|
if (mRObjectsList != null && mRObjectsList.size() > 0) {
|
|
336
|
|
for (int i = 0; i < mRObjectsList.size(); i++) {
|
|
337
|
|
RObject object = mRObjectsList.get(i);
|
|
338
|
|
String objectText = object.getObjectText();
|
|
339
|
|
String objectRule = object.getObjectRule();
|
|
340
|
|
object.setObjectText(objectText.replace(objectRule, ""));// ��ƥ������ַ��滻
|
|
341
|
|
objectsList.add(object);
|
|
342
|
|
}
|
|
343
|
|
}
|
|
344
|
|
return objectsList;
|
|
345
|
|
}
|
|
346
|
|
|
|
347
|
|
}
|
|
|
@ -1,231 +0,0 @@
|
|
1
|
|
package com.electric.chargingpile.view;
|
|
2
|
|
|
|
3
|
|
/**
|
|
4
|
|
* Created by Demon on 15/8/11.
|
|
5
|
|
*/
|
|
6
|
|
|
|
7
|
|
import com.electric.chargingpile.R;
|
|
8
|
|
|
|
9
|
|
import android.content.Context;
|
|
10
|
|
import android.content.res.TypedArray;
|
|
11
|
|
import android.graphics.Bitmap;
|
|
12
|
|
import android.graphics.BitmapFactory;
|
|
13
|
|
import android.graphics.Canvas;
|
|
14
|
|
import android.graphics.Paint;
|
|
15
|
|
import android.graphics.PorterDuff;
|
|
16
|
|
import android.graphics.PorterDuffXfermode;
|
|
17
|
|
import android.graphics.RectF;
|
|
18
|
|
import android.graphics.Bitmap.Config;
|
|
19
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
20
|
|
import android.graphics.drawable.Drawable;
|
|
21
|
|
import android.util.AttributeSet;
|
|
22
|
|
import android.util.Log;
|
|
23
|
|
import android.util.TypedValue;
|
|
24
|
|
import android.view.View;
|
|
25
|
|
import android.view.View.MeasureSpec;
|
|
26
|
|
|
|
27
|
|
/**
|
|
28
|
|
* 自定义View,实现圆角,圆形等效果
|
|
29
|
|
*
|
|
30
|
|
* @author zhy
|
|
31
|
|
*
|
|
32
|
|
*/
|
|
33
|
|
public class CustomImageView extends View
|
|
34
|
|
{
|
|
35
|
|
|
|
36
|
|
/**
|
|
37
|
|
* TYPE_CIRCLE / TYPE_ROUND
|
|
38
|
|
*/
|
|
39
|
|
private int type;
|
|
40
|
|
private static final int TYPE_CIRCLE = 0;
|
|
41
|
|
private static final int TYPE_ROUND = 1;
|
|
42
|
|
|
|
43
|
|
/**
|
|
44
|
|
* 图片
|
|
45
|
|
*/
|
|
46
|
|
private Bitmap mSrc;
|
|
47
|
|
|
|
48
|
|
/**
|
|
49
|
|
* 圆角的大小
|
|
50
|
|
*/
|
|
51
|
|
private int mRadius;
|
|
52
|
|
|
|
53
|
|
/**
|
|
54
|
|
* 控件的宽度
|
|
55
|
|
*/
|
|
56
|
|
private int mWidth;
|
|
57
|
|
/**
|
|
58
|
|
* 控件的高度
|
|
59
|
|
*/
|
|
60
|
|
private int mHeight;
|
|
61
|
|
|
|
62
|
|
public CustomImageView(Context context, AttributeSet attrs)
|
|
63
|
|
{
|
|
64
|
|
this(context, attrs, 0);
|
|
65
|
|
}
|
|
66
|
|
|
|
67
|
|
public CustomImageView(Context context)
|
|
68
|
|
{
|
|
69
|
|
this(context, null);
|
|
70
|
|
}
|
|
71
|
|
|
|
72
|
|
/**
|
|
73
|
|
* 初始化一些自定义的参数
|
|
74
|
|
*
|
|
75
|
|
* @param context
|
|
76
|
|
* @param attrs
|
|
77
|
|
* @param defStyle
|
|
78
|
|
*/
|
|
79
|
|
public CustomImageView(Context context, AttributeSet attrs, int defStyle)
|
|
80
|
|
{
|
|
81
|
|
super(context, attrs, defStyle);
|
|
82
|
|
|
|
83
|
|
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.CustomImageView, defStyle, 0);
|
|
84
|
|
|
|
85
|
|
int n = a.getIndexCount();
|
|
86
|
|
for (int i = 0; i < n; i++)
|
|
87
|
|
{
|
|
88
|
|
int attr = a.getIndex(i);
|
|
89
|
|
switch (attr)
|
|
90
|
|
{
|
|
91
|
|
case R.styleable.CustomImageView_src:
|
|
92
|
|
mSrc = BitmapFactory.decodeResource(getResources(), a.getResourceId(attr, 0));
|
|
93
|
|
break;
|
|
94
|
|
case R.styleable.CustomImageView_type:
|
|
95
|
|
type = a.getInt(attr, 0);// 默认为Circle
|
|
96
|
|
break;
|
|
97
|
|
case R.styleable.CustomImageView_borderRadius:
|
|
98
|
|
type = a.getDimensionPixelSize(attr, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10f,
|
|
99
|
|
getResources().getDisplayMetrics()));// 默认为10DP
|
|
100
|
|
break;
|
|
101
|
|
}
|
|
102
|
|
}
|
|
103
|
|
a.recycle();
|
|
104
|
|
}
|
|
105
|
|
|
|
106
|
|
/**
|
|
107
|
|
* 计算控件的高度和宽度
|
|
108
|
|
*/
|
|
109
|
|
@Override
|
|
110
|
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
|
111
|
|
{
|
|
112
|
|
// super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
|
113
|
|
|
|
114
|
|
/**
|
|
115
|
|
* 设置宽度
|
|
116
|
|
*/
|
|
117
|
|
int specMode = MeasureSpec.getMode(widthMeasureSpec);
|
|
118
|
|
int specSize = MeasureSpec.getSize(widthMeasureSpec);
|
|
119
|
|
|
|
120
|
|
if (specMode == MeasureSpec.EXACTLY)// match_parent , accurate
|
|
121
|
|
{
|
|
122
|
|
mWidth = specSize;
|
|
123
|
|
} else
|
|
124
|
|
{
|
|
125
|
|
// 由图片决定的宽
|
|
126
|
|
int desireByImg = getPaddingLeft() + getPaddingRight() + mSrc.getWidth();
|
|
127
|
|
if (specMode == MeasureSpec.AT_MOST)// wrap_content
|
|
128
|
|
{
|
|
129
|
|
mWidth = Math.min(desireByImg, specSize);
|
|
130
|
|
}
|
|
131
|
|
}
|
|
132
|
|
|
|
133
|
|
/***
|
|
134
|
|
* 设置高度
|
|
135
|
|
*/
|
|
136
|
|
|
|
137
|
|
specMode = MeasureSpec.getMode(heightMeasureSpec);
|
|
138
|
|
specSize = MeasureSpec.getSize(heightMeasureSpec);
|
|
139
|
|
if (specMode == MeasureSpec.EXACTLY)// match_parent , accurate
|
|
140
|
|
{
|
|
141
|
|
mHeight = specSize;
|
|
142
|
|
} else
|
|
143
|
|
{
|
|
144
|
|
int desire = getPaddingTop() + getPaddingBottom() + mSrc.getHeight();
|
|
145
|
|
if (specMode == MeasureSpec.AT_MOST)// wrap_content
|
|
146
|
|
{
|
|
147
|
|
mHeight = Math.min(desire, specSize);
|
|
148
|
|
}
|
|
149
|
|
}
|
|
150
|
|
setMeasuredDimension(mWidth, mHeight);
|
|
151
|
|
|
|
152
|
|
}
|
|
153
|
|
|
|
154
|
|
/**
|
|
155
|
|
* 绘制
|
|
156
|
|
*/
|
|
157
|
|
@Override
|
|
158
|
|
protected void onDraw(Canvas canvas)
|
|
159
|
|
{
|
|
160
|
|
|
|
161
|
|
switch (type)
|
|
162
|
|
{
|
|
163
|
|
// 如果是TYPE_CIRCLE绘制圆形
|
|
164
|
|
case TYPE_CIRCLE:
|
|
165
|
|
|
|
166
|
|
int min = Math.min(mWidth, mHeight);
|
|
167
|
|
/**
|
|
168
|
|
* 长度如果不一致,按小的值进行压缩
|
|
169
|
|
*/
|
|
170
|
|
mSrc = Bitmap.createScaledBitmap(mSrc, min, min, false);
|
|
171
|
|
|
|
172
|
|
canvas.drawBitmap(createCircleImage(mSrc, min), 0, 0, null);
|
|
173
|
|
break;
|
|
174
|
|
case TYPE_ROUND:
|
|
175
|
|
canvas.drawBitmap(createRoundConerImage(mSrc), 0, 0, null);
|
|
176
|
|
break;
|
|
177
|
|
|
|
178
|
|
}
|
|
179
|
|
|
|
180
|
|
}
|
|
181
|
|
|
|
182
|
|
/**
|
|
183
|
|
* 根据原图和变长绘制圆形图片
|
|
184
|
|
*
|
|
185
|
|
* @param source
|
|
186
|
|
* @param min
|
|
187
|
|
* @return
|
|
188
|
|
*/
|
|
189
|
|
private Bitmap createCircleImage(Bitmap source, int min)
|
|
190
|
|
{
|
|
191
|
|
final Paint paint = new Paint();
|
|
192
|
|
paint.setAntiAlias(true);
|
|
193
|
|
Bitmap target = Bitmap.createBitmap(min, min, Config.ARGB_8888);
|
|
194
|
|
/**
|
|
195
|
|
* 产生一个同样大小的画布
|
|
196
|
|
*/
|
|
197
|
|
Canvas canvas = new Canvas(target);
|
|
198
|
|
/**
|
|
199
|
|
* 首先绘制圆形
|
|
200
|
|
*/
|
|
201
|
|
canvas.drawCircle(min / 2, min / 2, min / 2, paint);
|
|
202
|
|
/**
|
|
203
|
|
* 使用SRC_IN,参考上面的说明
|
|
204
|
|
*/
|
|
205
|
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
|
206
|
|
/**
|
|
207
|
|
* 绘制图片
|
|
208
|
|
*/
|
|
209
|
|
canvas.drawBitmap(source, 0, 0, paint);
|
|
210
|
|
return target;
|
|
211
|
|
}
|
|
212
|
|
|
|
213
|
|
/**
|
|
214
|
|
* 根据原图添加圆角
|
|
215
|
|
*
|
|
216
|
|
* @param source
|
|
217
|
|
* @return
|
|
218
|
|
*/
|
|
219
|
|
private Bitmap createRoundConerImage(Bitmap source)
|
|
220
|
|
{
|
|
221
|
|
final Paint paint = new Paint();
|
|
222
|
|
paint.setAntiAlias(true);
|
|
223
|
|
Bitmap target = Bitmap.createBitmap(mWidth, mHeight, Config.ARGB_8888);
|
|
224
|
|
Canvas canvas = new Canvas(target);
|
|
225
|
|
RectF rect = new RectF(0, 0, source.getWidth(), source.getHeight());
|
|
226
|
|
canvas.drawRoundRect(rect, 50f, 50f, paint);
|
|
227
|
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
|
228
|
|
canvas.drawBitmap(source, 0, 0, paint);
|
|
229
|
|
return target;
|
|
230
|
|
}
|
|
231
|
|
}
|
|
|
@ -1,97 +0,0 @@
|
|
1
|
|
package com.electric.chargingpile.view;
|
|
2
|
|
|
|
3
|
|
import android.app.Activity;
|
|
4
|
|
import android.content.Context;
|
|
5
|
|
import android.view.Display;
|
|
6
|
|
import android.view.LayoutInflater;
|
|
7
|
|
import android.view.View;
|
|
8
|
|
import android.view.WindowManager;
|
|
9
|
|
import android.view.inputmethod.InputMethodManager;
|
|
10
|
|
import android.widget.EditText;
|
|
11
|
|
import android.widget.FrameLayout;
|
|
12
|
|
import android.widget.LinearLayout;
|
|
13
|
|
import android.widget.TextView;
|
|
14
|
|
|
|
15
|
|
import com.electric.chargingpile.R;
|
|
16
|
|
|
|
17
|
|
/**
|
|
18
|
|
* Created by demon on 2018/3/14.
|
|
19
|
|
*/
|
|
20
|
|
|
|
21
|
|
public class RefundDialog {
|
|
22
|
|
private Context context;
|
|
23
|
|
private Activity activity;
|
|
24
|
|
private android.app.Dialog dialog;
|
|
25
|
|
private Display display;
|
|
26
|
|
private TextView dialog_cancel,dialog_sure;
|
|
27
|
|
private FrameLayout dialog_bg;
|
|
28
|
|
private EditText dialog_et;
|
|
29
|
|
|
|
30
|
|
|
|
31
|
|
public RefundDialog(Context context,Activity activity) {
|
|
32
|
|
this.context = context;
|
|
33
|
|
this.activity = activity;
|
|
34
|
|
WindowManager windowManager = (WindowManager) context
|
|
35
|
|
.getSystemService(Context.WINDOW_SERVICE);
|
|
36
|
|
display = windowManager.getDefaultDisplay();
|
|
37
|
|
}
|
|
38
|
|
|
|
39
|
|
public RefundDialog builder() {
|
|
40
|
|
// 获取Dialog布局
|
|
41
|
|
View view = LayoutInflater.from(context).inflate(
|
|
42
|
|
R.layout.layout_refund_dialog, null);
|
|
43
|
|
|
|
44
|
|
// 获取自定义Dialog布局中的控件
|
|
45
|
|
dialog_bg = (FrameLayout) view.findViewById(R.id.dialog_bg);
|
|
46
|
|
dialog_cancel = (TextView) view.findViewById(R.id.dialog_tv_cancel);
|
|
47
|
|
dialog_sure = (TextView) view.findViewById(R.id.dialog_tv_sure);
|
|
48
|
|
dialog_et = (EditText) view.findViewById(R.id.dialog_et_account);
|
|
49
|
|
|
|
50
|
|
// 定义Dialog布局和参数
|
|
51
|
|
dialog = new android.app.Dialog(context, R.style.AlertDialogStyle);
|
|
52
|
|
dialog.setContentView(view);
|
|
53
|
|
|
|
54
|
|
// 调整dialog背景大小
|
|
55
|
|
dialog_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (display
|
|
56
|
|
.getWidth() * 0.85), LinearLayout.LayoutParams.WRAP_CONTENT));
|
|
57
|
|
|
|
58
|
|
return this;
|
|
59
|
|
}
|
|
60
|
|
|
|
61
|
|
public RefundDialog setCancelable(boolean cancel) {
|
|
62
|
|
dialog.setCancelable(cancel);
|
|
63
|
|
dialog.setCanceledOnTouchOutside(cancel);
|
|
64
|
|
return this;
|
|
65
|
|
}
|
|
66
|
|
|
|
67
|
|
public void show() {
|
|
68
|
|
dialog_cancel.setOnClickListener(new View.OnClickListener() {
|
|
69
|
|
@Override
|
|
70
|
|
public void onClick(View v) {
|
|
71
|
|
try {
|
|
72
|
|
hideInput();
|
|
73
|
|
dialog.dismiss();
|
|
74
|
|
} catch (Exception e) {
|
|
75
|
|
e.printStackTrace();
|
|
76
|
|
}
|
|
77
|
|
}
|
|
78
|
|
});
|
|
79
|
|
|
|
80
|
|
dialog.show();
|
|
81
|
|
// showInput(dialog_et);
|
|
82
|
|
|
|
83
|
|
}
|
|
84
|
|
|
|
85
|
|
public void hideInput() {
|
|
86
|
|
View view = activity.getWindow().peekDecorView();
|
|
87
|
|
if (view != null) {
|
|
88
|
|
InputMethodManager inputmanger = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
89
|
|
inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
|
90
|
|
}
|
|
91
|
|
}
|
|
92
|
|
|
|
93
|
|
public void showInput(View view){
|
|
94
|
|
InputMethodManager inputmanger = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
95
|
|
inputmanger.showSoftInput(view, 0);
|
|
96
|
|
}
|
|
97
|
|
}
|
|
|
@ -1,25 +0,0 @@
|
|
1
|
|
package com.electric.chargingpile.view;
|
|
2
|
|
|
|
3
|
|
/**
|
|
4
|
|
* Created by demon on 2017/5/18.
|
|
5
|
|
*/
|
|
6
|
|
|
|
7
|
|
import android.content.Context;
|
|
8
|
|
import android.util.AttributeSet;
|
|
9
|
|
import android.widget.TextView;
|
|
10
|
|
|
|
11
|
|
public class SaundProgressIndicator extends TextView {
|
|
12
|
|
|
|
13
|
|
public SaundProgressIndicator(Context context) {
|
|
14
|
|
this(context, null);
|
|
15
|
|
}
|
|
16
|
|
|
|
17
|
|
public SaundProgressIndicator(Context context, AttributeSet attrs) {
|
|
18
|
|
this(context, attrs, 0);
|
|
19
|
|
}
|
|
20
|
|
|
|
21
|
|
public SaundProgressIndicator(Context context, AttributeSet attrs,
|
|
22
|
|
int defStyle) {
|
|
23
|
|
super(context, attrs, defStyle);
|
|
24
|
|
}
|
|
25
|
|
}
|
|
|
@ -1,36 +0,0 @@
|
|
1
|
|
package com.electric.chargingpile.view;
|
|
2
|
|
|
|
3
|
|
import com.electric.chargingpile.R;
|
|
4
|
|
|
|
5
|
|
import android.app.Dialog;
|
|
6
|
|
import android.content.Context;
|
|
7
|
|
import android.os.Bundle;
|
|
8
|
|
import android.widget.TextView;
|
|
9
|
|
|
|
10
|
|
public class SearchDialog extends Dialog {
|
|
11
|
|
private TextView zhan, search;
|
|
12
|
|
Context context;
|
|
13
|
|
|
|
14
|
|
public SearchDialog(Context context) {
|
|
15
|
|
super(context);
|
|
16
|
|
this.context = context;
|
|
17
|
|
}
|
|
18
|
|
|
|
19
|
|
@Override
|
|
20
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
21
|
|
super.onCreate(savedInstanceState);
|
|
22
|
|
this.setContentView(R.layout.dialog_search);
|
|
23
|
|
|
|
24
|
|
zhan = (TextView) findViewById(R.id.dialog_search_zhan);
|
|
25
|
|
search = (TextView) findViewById(R.id.dialog_search_address);
|
|
26
|
|
}
|
|
27
|
|
|
|
28
|
|
public TextView getZhan() {
|
|
29
|
|
return zhan;
|
|
30
|
|
}
|
|
31
|
|
|
|
32
|
|
public TextView getSearch() {
|
|
33
|
|
return search;
|
|
34
|
|
}
|
|
35
|
|
|
|
36
|
|
}
|
|
|
@ -1,268 +0,0 @@
|
|
1
|
|
package com.electric.chargingpile.view;
|
|
2
|
|
|
|
3
|
|
import android.content.Context;
|
|
4
|
|
import android.graphics.Canvas;
|
|
5
|
|
import android.graphics.Color;
|
|
6
|
|
import android.graphics.Paint;
|
|
7
|
|
import android.graphics.Path;
|
|
8
|
|
import android.graphics.Rect;
|
|
9
|
|
import android.graphics.RectF;
|
|
10
|
|
import android.os.SystemClock;
|
|
11
|
|
import android.util.AttributeSet;
|
|
12
|
|
import android.view.View;
|
|
13
|
|
|
|
14
|
|
/**
|
|
15
|
|
* Created by demon on 2017/6/2.
|
|
16
|
|
*/
|
|
17
|
|
|
|
18
|
|
public class WaterWaveView extends View {
|
|
19
|
|
//边框宽度
|
|
20
|
|
private int STROKE_WIDTH;
|
|
21
|
|
//组件的宽,高
|
|
22
|
|
private int width, height;
|
|
23
|
|
/**
|
|
24
|
|
* 进度条最大值和当前进度值
|
|
25
|
|
*/
|
|
26
|
|
private float max, progress;
|
|
27
|
|
|
|
28
|
|
/**
|
|
29
|
|
* 绘制波浪的画笔
|
|
30
|
|
*/
|
|
31
|
|
private Paint progressPaint;
|
|
32
|
|
|
|
33
|
|
//波纹振幅与半径之比。(建议设置:<0.1)
|
|
34
|
|
private static final float A = 0.05f;
|
|
35
|
|
//绘制文字的画笔
|
|
36
|
|
private Paint textPaint;
|
|
37
|
|
//绘制边框的画笔
|
|
38
|
|
private Paint circlePaint;
|
|
39
|
|
|
|
40
|
|
/**
|
|
41
|
|
* 圆弧圆心位置
|
|
42
|
|
*/
|
|
43
|
|
private int centerX, centerY;
|
|
44
|
|
|
|
45
|
|
//内圆所在的矩形
|
|
46
|
|
private RectF circleRectF;
|
|
47
|
|
|
|
48
|
|
public WaterWaveView(Context context) {
|
|
49
|
|
super(context);
|
|
50
|
|
init();
|
|
51
|
|
}
|
|
52
|
|
|
|
53
|
|
public WaterWaveView(Context context, AttributeSet attrs) {
|
|
54
|
|
super(context, attrs);
|
|
55
|
|
init();
|
|
56
|
|
}
|
|
57
|
|
|
|
58
|
|
public WaterWaveView(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
59
|
|
super(context, attrs, defStyleAttr);
|
|
60
|
|
init();
|
|
61
|
|
}
|
|
62
|
|
|
|
63
|
|
//初始化
|
|
64
|
|
private void init() {
|
|
65
|
|
progressPaint = new Paint();
|
|
66
|
|
progressPaint.setColor(Color.parseColor("#77cccc88"));
|
|
67
|
|
progressPaint.setAntiAlias(true);
|
|
68
|
|
|
|
69
|
|
textPaint = new Paint();
|
|
70
|
|
textPaint.setColor(Color.WHITE);
|
|
71
|
|
textPaint.setAntiAlias(true);
|
|
72
|
|
|
|
73
|
|
circlePaint = new Paint();
|
|
74
|
|
circlePaint.setStyle(Paint.Style.STROKE);
|
|
75
|
|
circlePaint.setAntiAlias(true);
|
|
76
|
|
circlePaint.setColor(Color.parseColor("#33333333"));
|
|
77
|
|
|
|
78
|
|
autoRefresh();
|
|
79
|
|
}
|
|
80
|
|
|
|
81
|
|
@Override
|
|
82
|
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
83
|
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
|
84
|
|
|
|
85
|
|
if (width == 0 || height == 0) {
|
|
86
|
|
width = getWidth();
|
|
87
|
|
height = getHeight();
|
|
88
|
|
|
|
89
|
|
//计算圆弧半径和圆心点
|
|
90
|
|
int circleRadius = Math.min(width, height) >> 1;
|
|
91
|
|
STROKE_WIDTH = circleRadius / 10;
|
|
92
|
|
circlePaint.setStrokeWidth(STROKE_WIDTH);
|
|
93
|
|
|
|
94
|
|
centerX = width / 2;
|
|
95
|
|
centerY = height / 2;
|
|
96
|
|
|
|
97
|
|
VALID_RADIUS = circleRadius - STROKE_WIDTH;
|
|
98
|
|
RADIANS_PER_X = (float) (Math.PI / VALID_RADIUS);
|
|
99
|
|
circleRectF = new RectF(centerX - VALID_RADIUS, centerY - VALID_RADIUS,
|
|
100
|
|
centerX + VALID_RADIUS, centerY + VALID_RADIUS);
|
|
101
|
|
}
|
|
102
|
|
}
|
|
103
|
|
|
|
104
|
|
private Rect textBounds = new Rect();
|
|
105
|
|
|
|
106
|
|
//x方向偏移量
|
|
107
|
|
private int xOffset;
|
|
108
|
|
|
|
109
|
|
@Override
|
|
110
|
|
protected void onDraw(Canvas canvas) {
|
|
111
|
|
super.onDraw(canvas);
|
|
112
|
|
|
|
113
|
|
//绘制圆形边框
|
|
114
|
|
canvas.drawCircle(centerX, centerY, VALID_RADIUS + (STROKE_WIDTH >> 1), circlePaint);
|
|
115
|
|
//绘制水波曲线
|
|
116
|
|
canvas.drawPath(getWavePath(xOffset), progressPaint);
|
|
117
|
|
|
|
118
|
|
//绘制文字
|
|
119
|
|
textPaint.setTextSize(VALID_RADIUS >> 1);
|
|
120
|
|
String text1 = String.valueOf(progress);
|
|
121
|
|
//测量文字长度
|
|
122
|
|
float w1 = textPaint.measureText(text1);
|
|
123
|
|
//测量文字高度
|
|
124
|
|
textPaint.getTextBounds("8", 0, 1, textBounds);
|
|
125
|
|
float h1 = textBounds.height();
|
|
126
|
|
float extraW = textPaint.measureText("8") / 3;
|
|
127
|
|
canvas.drawText(text1, centerX - w1 / 2 - extraW, centerY + h1 / 2, textPaint);
|
|
128
|
|
|
|
129
|
|
textPaint.setTextSize(VALID_RADIUS / 6);
|
|
130
|
|
textPaint.getTextBounds("M", 0, 1, textBounds);
|
|
131
|
|
float h2 = textBounds.height();
|
|
132
|
|
canvas.drawText("M", centerX + w1 / 2 - extraW + 5, centerY - (h1 / 2 - h2), textPaint);
|
|
133
|
|
|
|
134
|
|
String text3 = "共" + String.valueOf(max) + "M";
|
|
135
|
|
float w3 = textPaint.measureText(text3, 0, text3.length());
|
|
136
|
|
textPaint.getTextBounds("M", 0, 1, textBounds);
|
|
137
|
|
float h3 = textBounds.height();
|
|
138
|
|
canvas.drawText(text3, centerX - w3 / 2, centerY + (VALID_RADIUS >> 1) + h3 / 2, textPaint);
|
|
139
|
|
|
|
140
|
|
String text4 = "流量剩余";
|
|
141
|
|
float w4 = textPaint.measureText(text4, 0, text4.length());
|
|
142
|
|
textPaint.getTextBounds(text4, 0, text4.length(), textBounds);
|
|
143
|
|
float h4 = textBounds.height();
|
|
144
|
|
canvas.drawText(text4, centerX - w4 / 2, centerY - (VALID_RADIUS >> 1) + h4 / 2, textPaint);
|
|
145
|
|
|
|
146
|
|
}
|
|
147
|
|
|
|
148
|
|
//绘制水波的路径
|
|
149
|
|
private Path wavePath;
|
|
150
|
|
//每一个像素对应的弧度数
|
|
151
|
|
private float RADIANS_PER_X;
|
|
152
|
|
//去除边框后的半径(即内圆半径)
|
|
153
|
|
private int VALID_RADIUS;
|
|
154
|
|
|
|
155
|
|
/**
|
|
156
|
|
* 获取水波曲线(包含圆弧部分)的Path.
|
|
157
|
|
*
|
|
158
|
|
* @param xOffset x方向像素偏移量.
|
|
159
|
|
*/
|
|
160
|
|
private Path getWavePath(int xOffset) {
|
|
161
|
|
if (wavePath == null) {
|
|
162
|
|
wavePath = new Path();
|
|
163
|
|
} else {
|
|
164
|
|
wavePath.reset();
|
|
165
|
|
}
|
|
166
|
|
|
|
167
|
|
float[] startPoint = new float[2]; //波浪线起点
|
|
168
|
|
float[] endPoint = new float[2]; //波浪线终点
|
|
169
|
|
|
|
170
|
|
for (int i = 0; i <= VALID_RADIUS * 2; i += 2) {
|
|
171
|
|
float x = centerX - VALID_RADIUS + i;
|
|
172
|
|
float y = (float) (centerY + VALID_RADIUS * (1.0f + A) * 2 * (0.5f - progress / max)
|
|
173
|
|
+ VALID_RADIUS * A * Math.sin((xOffset + i) * RADIANS_PER_X));
|
|
174
|
|
|
|
175
|
|
//只计算内圆内部的点,边框上的忽略
|
|
176
|
|
if (calDistance(x, y, centerX, centerY) > VALID_RADIUS) {
|
|
177
|
|
if (x < centerX) {
|
|
178
|
|
continue; //左边框,继续循环
|
|
179
|
|
} else {
|
|
180
|
|
break; //右边框,结束循环
|
|
181
|
|
}
|
|
182
|
|
}
|
|
183
|
|
|
|
184
|
|
//第1个点
|
|
185
|
|
if (wavePath.isEmpty()) {
|
|
186
|
|
startPoint[0] = x;
|
|
187
|
|
startPoint[1] = y;
|
|
188
|
|
wavePath.moveTo(x, y);
|
|
189
|
|
} else {
|
|
190
|
|
wavePath.lineTo(x, y);
|
|
191
|
|
}
|
|
192
|
|
|
|
193
|
|
endPoint[0] = x;
|
|
194
|
|
endPoint[1] = y;
|
|
195
|
|
}
|
|
196
|
|
|
|
197
|
|
if (wavePath.isEmpty()) {
|
|
198
|
|
if (progress / max >= 0.5f) {
|
|
199
|
|
//满格
|
|
200
|
|
wavePath.moveTo(centerX, centerY - VALID_RADIUS);
|
|
201
|
|
wavePath.addCircle(centerX, centerY, VALID_RADIUS, Path.Direction.CW);
|
|
202
|
|
} else {
|
|
203
|
|
//空格
|
|
204
|
|
return wavePath;
|
|
205
|
|
}
|
|
206
|
|
} else {
|
|
207
|
|
//添加圆弧部分
|
|
208
|
|
float startDegree = calDegreeByPosition(startPoint[0], startPoint[1]); //0~180
|
|
209
|
|
float endDegree = calDegreeByPosition(endPoint[0], endPoint[1]); //180~360
|
|
210
|
|
wavePath.arcTo(circleRectF, endDegree - 360, startDegree - (endDegree - 360));
|
|
211
|
|
}
|
|
212
|
|
|
|
213
|
|
return wavePath;
|
|
214
|
|
}
|
|
215
|
|
|
|
216
|
|
private float calDistance(float x1, float y1, float x2, float y2) {
|
|
217
|
|
return (float) Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
|
|
218
|
|
}
|
|
219
|
|
|
|
220
|
|
//根据当前位置,计算出进度条已经转过的角度。
|
|
221
|
|
private float calDegreeByPosition(float currentX, float currentY) {
|
|
222
|
|
float a1 = (float) (Math.atan(1.0f * (centerX - currentX) / (currentY - centerY)) / Math.PI * 180);
|
|
223
|
|
if (currentY < centerY) {
|
|
224
|
|
a1 += 180;
|
|
225
|
|
} else if (currentY > centerY && currentX > centerX) {
|
|
226
|
|
a1 += 360;
|
|
227
|
|
}
|
|
228
|
|
|
|
229
|
|
return a1 + 90;
|
|
230
|
|
}
|
|
231
|
|
|
|
232
|
|
public void setMax(int max) {
|
|
233
|
|
this.max = max;
|
|
234
|
|
invalidate();
|
|
235
|
|
}
|
|
236
|
|
|
|
237
|
|
//直接设置进度值(同步)
|
|
238
|
|
public void setProgressSync(float progress) {
|
|
239
|
|
this.progress = progress;
|
|
240
|
|
invalidate();
|
|
241
|
|
}
|
|
242
|
|
|
|
243
|
|
/**
|
|
244
|
|
* 自动刷新页面,创造水波效果。组件销毁后该线城将自动停止。
|
|
245
|
|
*/
|
|
246
|
|
private void autoRefresh() {
|
|
247
|
|
new Thread(new Runnable() {
|
|
248
|
|
@Override
|
|
249
|
|
public void run() {
|
|
250
|
|
while (!detached) {
|
|
251
|
|
xOffset += (VALID_RADIUS >> 4);
|
|
252
|
|
SystemClock.sleep(100);
|
|
253
|
|
postInvalidate();
|
|
254
|
|
}
|
|
255
|
|
}
|
|
256
|
|
}).start();
|
|
257
|
|
}
|
|
258
|
|
|
|
259
|
|
//标记View是否已经销毁
|
|
260
|
|
private boolean detached = false;
|
|
261
|
|
|
|
262
|
|
@Override
|
|
263
|
|
protected void onDetachedFromWindow() {
|
|
264
|
|
super.onDetachedFromWindow();
|
|
265
|
|
|
|
266
|
|
detached = true;
|
|
267
|
|
}
|
|
268
|
|
}
|
|
|
@ -1,37 +0,0 @@
|
|
1
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
|
android:layout_width="wrap_content"
|
|
4
|
|
android:layout_height="wrap_content"
|
|
5
|
|
android:padding="10dp" >
|
|
6
|
|
|
|
7
|
|
<TextView
|
|
8
|
|
android:id="@+id/zhuang_name"
|
|
9
|
|
android:layout_width="wrap_content"
|
|
10
|
|
android:layout_height="wrap_content"
|
|
11
|
|
android:layout_alignParentBottom="true"
|
|
12
|
|
android:layout_centerHorizontal="true"
|
|
13
|
|
android:text="1号"
|
|
14
|
|
android:textColor="@color/white"
|
|
15
|
|
android:textSize="12sp" />
|
|
16
|
|
|
|
17
|
|
<TextView
|
|
18
|
|
android:id="@+id/zhuang_content"
|
|
19
|
|
android:layout_width="20dp"
|
|
20
|
|
android:layout_height="wrap_content"
|
|
21
|
|
android:layout_above="@id/zhuang_name"
|
|
22
|
|
android:layout_centerHorizontal="true"
|
|
23
|
|
android:layout_marginBottom="10dp"
|
|
24
|
|
android:background="@drawable/radius_bkg_one" />
|
|
25
|
|
|
|
26
|
|
<TextView
|
|
27
|
|
android:id="@+id/zhuang_baifen"
|
|
28
|
|
android:layout_width="wrap_content"
|
|
29
|
|
android:layout_height="wrap_content"
|
|
30
|
|
android:layout_above="@id/zhuang_content"
|
|
31
|
|
android:layout_centerHorizontal="true"
|
|
32
|
|
android:layout_marginBottom="10dp"
|
|
33
|
|
android:text="100%"
|
|
34
|
|
android:textColor="@color/white"
|
|
35
|
|
android:textSize="12sp" />
|
|
36
|
|
|
|
37
|
|
</RelativeLayout>
|
|
|
@ -1,108 +0,0 @@
|
|
1
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
|
android:layout_width="wrap_content"
|
|
4
|
|
android:layout_height="wrap_content"
|
|
5
|
|
android:background="@drawable/login_edit_normal" >
|
|
6
|
|
|
|
7
|
|
<TextView
|
|
8
|
|
android:id="@+id/detail_name"
|
|
9
|
|
android:layout_width="wrap_content"
|
|
10
|
|
android:layout_height="wrap_content"
|
|
11
|
|
android:layout_marginLeft="10dp"
|
|
12
|
|
android:layout_marginTop="5dp"
|
|
13
|
|
android:ellipsize="end"
|
|
14
|
|
android:maxLines="2"
|
|
15
|
|
android:text="国贸充电站"
|
|
16
|
|
android:textSize="15sp" />
|
|
17
|
|
|
|
18
|
|
<LinearLayout
|
|
19
|
|
android:id="@+id/linear"
|
|
20
|
|
android:layout_width="wrap_content"
|
|
21
|
|
android:layout_height="wrap_content"
|
|
22
|
|
android:layout_below="@id/detail_name"
|
|
23
|
|
android:layout_marginTop="3dp"
|
|
24
|
|
android:orientation="horizontal" >
|
|
25
|
|
|
|
26
|
|
<TextView
|
|
27
|
|
android:id="@+id/detail_address"
|
|
28
|
|
android:layout_width="0dp"
|
|
29
|
|
android:layout_weight="1"
|
|
30
|
|
android:layout_height="wrap_content"
|
|
31
|
|
android:layout_gravity="center_vertical"
|
|
32
|
|
android:layout_marginLeft="10dp"
|
|
33
|
|
android:drawableLeft="@drawable/icon_address"
|
|
34
|
|
android:drawablePadding="2dp"
|
|
35
|
|
android:ellipsize="end"
|
|
36
|
|
android:maxLines="2"
|
|
37
|
|
android:text="大望路20号万达广场"
|
|
38
|
|
android:textColor="#dbdbdb"
|
|
39
|
|
android:textSize="12sp" />
|
|
40
|
|
|
|
41
|
|
<View
|
|
42
|
|
android:layout_width="1dp"
|
|
43
|
|
android:layout_height="14dp"
|
|
44
|
|
android:layout_gravity="center_vertical"
|
|
45
|
|
android:layout_marginLeft="5dp"
|
|
46
|
|
android:layout_marginRight="5dp"
|
|
47
|
|
android:background="#dbdbdb" />
|
|
48
|
|
|
|
49
|
|
<TextView
|
|
50
|
|
android:id="@+id/detail_distance"
|
|
51
|
|
android:layout_width="wrap_content"
|
|
52
|
|
android:layout_height="wrap_content"
|
|
53
|
|
android:layout_gravity="center_vertical"
|
|
54
|
|
|
|
55
|
|
android:drawablePadding="2dp"
|
|
56
|
|
android:text="3.5km"
|
|
57
|
|
android:textColor="#dbdbdb"
|
|
58
|
|
android:textSize="12sp" />
|
|
59
|
|
</LinearLayout>
|
|
60
|
|
|
|
61
|
|
<View
|
|
62
|
|
android:id="@+id/view_line"
|
|
63
|
|
android:layout_width="fill_parent"
|
|
64
|
|
android:layout_height="1dp"
|
|
65
|
|
android:layout_below="@id/linear"
|
|
66
|
|
android:layout_marginTop="2dp"
|
|
67
|
|
android:background="#dbdbdb" />
|
|
68
|
|
|
|
69
|
|
<LinearLayout
|
|
70
|
|
android:layout_width="fill_parent"
|
|
71
|
|
android:layout_height="wrap_content"
|
|
72
|
|
android:layout_below="@id/view_line"
|
|
73
|
|
android:gravity="center_vertical"
|
|
74
|
|
android:orientation="horizontal" >
|
|
75
|
|
|
|
76
|
|
<TextView
|
|
77
|
|
android:id="@+id/detail_daohang"
|
|
78
|
|
android:layout_width="fill_parent"
|
|
79
|
|
android:layout_height="wrap_content"
|
|
80
|
|
android:layout_weight="1"
|
|
81
|
|
android:gravity="center"
|
|
82
|
|
android:paddingBottom="5dp"
|
|
83
|
|
android:paddingLeft="30dp"
|
|
84
|
|
android:paddingRight="30dp"
|
|
85
|
|
android:paddingTop="5dp"
|
|
86
|
|
android:text="导航"
|
|
87
|
|
android:textColor="@color/bkg_button_green" />
|
|
88
|
|
|
|
89
|
|
<View
|
|
90
|
|
android:layout_width="1dp"
|
|
91
|
|
android:layout_height="15dp"
|
|
92
|
|
android:background="#dbdbdb" />
|
|
93
|
|
|
|
94
|
|
<TextView
|
|
95
|
|
android:id="@+id/detail_yue"
|
|
96
|
|
android:layout_width="fill_parent"
|
|
97
|
|
android:layout_height="wrap_content"
|
|
98
|
|
android:layout_weight="1"
|
|
99
|
|
android:gravity="center"
|
|
100
|
|
android:paddingBottom="5dp"
|
|
101
|
|
android:paddingLeft="30dp"
|
|
102
|
|
android:paddingRight="30dp"
|
|
103
|
|
android:paddingTop="5dp"
|
|
104
|
|
android:text="详情"
|
|
105
|
|
android:textColor="@color/bkg_button_green" />
|
|
106
|
|
</LinearLayout>
|
|
107
|
|
|
|
108
|
|
</RelativeLayout>
|
|
|
@ -1,64 +0,0 @@
|
|
1
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
|
android:layout_width="730px"
|
|
4
|
|
android:layout_height="300px"
|
|
5
|
|
android:layout_gravity="center"
|
|
6
|
|
android:background="@drawable/login_edit_normal"
|
|
7
|
|
android:orientation="vertical" >
|
|
8
|
|
|
|
9
|
|
|
|
10
|
|
<TextView
|
|
11
|
|
android:layout_width="wrap_content"
|
|
12
|
|
android:layout_height="0dp"
|
|
13
|
|
android:layout_weight="1"
|
|
14
|
|
android:background="@color/white"
|
|
15
|
|
android:padding="10dp"
|
|
16
|
|
android:layout_gravity="center"
|
|
17
|
|
android:text="请选择您要搜索的类型"
|
|
18
|
|
android:textSize="20sp" />
|
|
19
|
|
|
|
20
|
|
<View
|
|
21
|
|
android:layout_width="wrap_content"
|
|
22
|
|
android:layout_height="1dp"
|
|
23
|
|
android:background="@color/bkg_line"/>
|
|
24
|
|
|
|
25
|
|
|
|
26
|
|
<LinearLayout
|
|
27
|
|
android:layout_width="fill_parent"
|
|
28
|
|
android:layout_height="0dp"
|
|
29
|
|
android:layout_weight="0.9"
|
|
30
|
|
android:layout_marginTop="1dp"
|
|
31
|
|
android:orientation="horizontal" >
|
|
32
|
|
|
|
33
|
|
<Button
|
|
34
|
|
android:id="@+id/dialog_search_zhan"
|
|
35
|
|
android:layout_width="wrap_content"
|
|
36
|
|
android:layout_height="wrap_content"
|
|
37
|
|
android:layout_weight="1"
|
|
38
|
|
android:background="@drawable/bkg_press_white_grey"
|
|
39
|
|
android:textColor="@color/bkg_button_green"
|
|
40
|
|
android:text="搜站名"
|
|
41
|
|
android:gravity="center"
|
|
42
|
|
android:textSize="15sp"
|
|
43
|
|
/>
|
|
44
|
|
|
|
45
|
|
<!-- 搜地址按钮 -->
|
|
46
|
|
<View
|
|
47
|
|
android:layout_width="1dp"
|
|
48
|
|
android:layout_height="wrap_content"
|
|
49
|
|
android:background="@color/bkg_line"/>
|
|
50
|
|
|
|
51
|
|
<Button
|
|
52
|
|
android:id="@+id/dialog_search_address"
|
|
53
|
|
android:layout_width="wrap_content"
|
|
54
|
|
android:layout_height="wrap_content"
|
|
55
|
|
android:layout_weight="1"
|
|
56
|
|
android:gravity="center"
|
|
57
|
|
android:background="@drawable/bkg_press_white_grey"
|
|
58
|
|
android:textColor="@color/bkg_button_green"
|
|
59
|
|
android:text="搜地址"
|
|
60
|
|
android:textSize="15sp" />
|
|
61
|
|
|
|
62
|
|
</LinearLayout>
|
|
63
|
|
|
|
64
|
|
</LinearLayout>
|
|
|
@ -1,50 +0,0 @@
|
|
1
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
|
android:layout_width="match_parent"
|
|
4
|
|
android:layout_height="wrap_content"
|
|
5
|
|
android:orientation="vertical"
|
|
6
|
|
android:padding="8dp" >
|
|
7
|
|
|
|
8
|
|
<TextView
|
|
9
|
|
android:id="@+id/txt_title"
|
|
10
|
|
android:layout_width="match_parent"
|
|
11
|
|
android:layout_height="wrap_content"
|
|
12
|
|
android:background="@drawable/actionsheet_top_normal"
|
|
13
|
|
android:gravity="center"
|
|
14
|
|
android:minHeight="45dp"
|
|
15
|
|
android:paddingTop="10dp"
|
|
16
|
|
android:paddingBottom="10dp"
|
|
17
|
|
android:paddingLeft="15dp"
|
|
18
|
|
android:paddingRight="15dp"
|
|
19
|
|
android:textColor="@color/actionsheet_gray"
|
|
20
|
|
android:textSize="13sp"
|
|
21
|
|
android:visibility="gone" />
|
|
22
|
|
|
|
23
|
|
<ScrollView
|
|
24
|
|
android:id="@+id/sLayout_content"
|
|
25
|
|
android:layout_width="match_parent"
|
|
26
|
|
android:layout_height="wrap_content"
|
|
27
|
|
android:fadingEdge="none"
|
|
28
|
|
>
|
|
29
|
|
|
|
30
|
|
<LinearLayout
|
|
31
|
|
android:id="@+id/lLayout_content"
|
|
32
|
|
android:layout_width="match_parent"
|
|
33
|
|
android:layout_height="wrap_content"
|
|
34
|
|
android:orientation="vertical" >
|
|
35
|
|
</LinearLayout>
|
|
36
|
|
</ScrollView>
|
|
37
|
|
|
|
38
|
|
<TextView
|
|
39
|
|
android:id="@+id/txt_cancel"
|
|
40
|
|
android:layout_width="match_parent"
|
|
41
|
|
android:layout_height="45dp"
|
|
42
|
|
android:layout_marginTop="8dp"
|
|
43
|
|
android:background="@drawable/actionsheet_single_selector"
|
|
44
|
|
android:gravity="center"
|
|
45
|
|
android:text="取消"
|
|
46
|
|
android:textColor="@color/actionsheet_green"
|
|
47
|
|
android:textSize="18sp"
|
|
48
|
|
android:textStyle="bold" />
|
|
49
|
|
|
|
50
|
|
</LinearLayout>
|
|
|
@ -1,40 +0,0 @@
|
|
1
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
|
android:layout_width="match_parent"
|
|
4
|
|
android:layout_height="match_parent"
|
|
5
|
|
android:orientation="vertical" >
|
|
6
|
|
|
|
7
|
|
<RadioGroup
|
|
8
|
|
android:id="@+id/rg_time"
|
|
9
|
|
android:layout_width="fill_parent"
|
|
10
|
|
android:layout_height="wrap_content"
|
|
11
|
|
android:orientation="horizontal" >
|
|
12
|
|
|
|
13
|
|
<RadioButton
|
|
14
|
|
android:id="@+id/rb_time_one"
|
|
15
|
|
style="@style/appointent_time_item_style"
|
|
16
|
|
android:layout_weight="1.0"
|
|
17
|
|
android:checked="true"
|
|
18
|
|
android:text="09:00-15:00" />
|
|
19
|
|
|
|
20
|
|
<RadioButton
|
|
21
|
|
android:id="@+id/rb_time_two"
|
|
22
|
|
style="@style/appointent_time_item_style"
|
|
23
|
|
android:layout_weight="1.0"
|
|
24
|
|
android:text="15:30-23:00" />
|
|
25
|
|
</RadioGroup>
|
|
26
|
|
|
|
27
|
|
<GridView
|
|
28
|
|
android:id="@+id/gv_time"
|
|
29
|
|
android:layout_width="fill_parent"
|
|
30
|
|
android:layout_height="wrap_content"
|
|
31
|
|
android:layout_below="@id/rg_time"
|
|
32
|
|
android:background="@color/transparent"
|
|
33
|
|
android:gravity="center"
|
|
34
|
|
android:horizontalSpacing="5dp"
|
|
35
|
|
android:numColumns="4"
|
|
36
|
|
android:padding="10dp"
|
|
37
|
|
android:stretchMode="columnWidth"
|
|
38
|
|
android:verticalSpacing="5dp" />
|
|
39
|
|
|
|
40
|
|
</RelativeLayout>
|
|
|
@ -1,6 +0,0 @@
|
|
1
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
|
android:orientation="vertical" android:layout_width="match_parent"
|
|
4
|
|
android:layout_height="match_parent">
|
|
5
|
|
|
|
6
|
|
</LinearLayout>
|
|
|
@ -1,19 +0,0 @@
|
|
1
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
|
android:layout_alignWithParentIfMissing="true"
|
|
4
|
|
android:layout_width="wrap_content"
|
|
5
|
|
android:layout_height="wrap_content" >
|
|
6
|
|
|
|
7
|
|
<Button
|
|
8
|
|
android:id="@+id/zoomin"
|
|
9
|
|
android:layout_width="wrap_content"
|
|
10
|
|
android:layout_height="wrap_content"
|
|
11
|
|
android:background="@drawable/zoomin_seletor" />
|
|
12
|
|
|
|
13
|
|
<Button
|
|
14
|
|
android:id="@+id/zoomout"
|
|
15
|
|
android:layout_width="wrap_content"
|
|
16
|
|
android:layout_height="wrap_content"
|
|
17
|
|
android:layout_below="@+id/zoomin"
|
|
18
|
|
android:background="@drawable/zoomout_seletor" />
|
|
19
|
|
</RelativeLayout>
|
|
|
@ -62,12 +62,6 @@
|
|
62
|
62
|
<attr name="border_color" format="color" />
|
|
63
|
63
|
</declare-styleable>
|
|
64
|
64
|
|
|
65
|
|
|
|
66
|
|
<declare-styleable name="CustomImageView">
|
|
67
|
|
<attr name="borderRadius" />
|
|
68
|
|
<attr name="type" />
|
|
69
|
|
<attr name="src" />
|
|
70
|
|
</declare-styleable>
|
|
71
|
65
|
<declare-styleable name="RoundAngleImageView">
|
|
72
|
66
|
<attr name="roundWidth" format="dimension" />
|
|
73
|
67
|
<attr name="roundHeight" format="dimension" />
|
|
|
@ -1,3 +1,2 @@
|
|
1
|
|
include ':app', ':autolayout', ':xrichtextt', ':zxing', ':XRefreshView'
|
|
2
|
|
include ':library'
|
|
|
1
|
include ':app', ':autolayout', ':xrichtextt', ':zxing', ':XRefreshView',':ijkplayer-java',':library'
|
|
3
|
2
|
project(':xrichtextt').projectDir = new File('xrichtext')
|