/
TimePopWindow.java
47 lines (41 loc) · 1.56 KB
/
TimePopWindow.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.single.multiselect;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.PopupWindow;
import com.library.multiselct.MultiSelectView;
/**
* Created by xiangcheng on 17/10/31.
*/
public class TimePopWindow extends PopupWindow {
private View conentView;
private Context context;
public TimePopWindow(final Activity context) {
this.context = context;
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
conentView = inflater.inflate(R.layout.layout_pop, null);
int w = context.getWindowManager().getDefaultDisplay().getWidth();
this.setContentView(conentView);
this.setWidth(w);
this.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
this.setFocusable(true);
this.setOutsideTouchable(true);
this.update();
this.setAnimationStyle(R.style.mypopwindow_anim_style);
final MultiSelectView multiSelectView = (MultiSelectView) conentView.findViewById(R.id.select_view);
multiSelectView.setOnAllSelect(new MultiSelectView.OnAllSelect() {
@Override
public void select(String text) {
((MainActivity) context).setAddress(text);
}
});
multiSelectView.validateList(Constant.initData());
}
// @Override
// public void select(String text) {
// ((MainActivity) context).setAddress(text);
// }
}