nl-40 ol-40">
|
40
|
PhoneDialog phoneDialog = new PhoneDialog();
|
|
|
41
|
final Bundle args = new Bundle();
|
|
|
42
|
args.putString(PHONE_KEY, phone);
|
|
|
43
|
phoneDialog.setArguments(args);
|
|
|
44
|
return phoneDialog;
|
|
|
45
|
}
|
|
|
46
|
|
|
|
47
|
@Override
|
|
|
48
|
public void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
|
|
|
49
|
super.onCreate(savedInstanceState);
|
|
|
50
|
setStyle(DialogFragment.STYLE_NORMAL, R.style.TransparentVideoDialogFragmentTheme);
|
|
|
51
|
|
|
|
52
|
}
|
|
|
53
|
@Nullable
|
|
|
54
|
@org.jetbrains.annotations.Nullable
|
|
|
55
|
@Override
|
|
|
56
|
public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
|
|
|
57
|
return LayoutInflater.from(requireContext()).inflate(R.layout.dialog_phone, container, false);
|
|
|
58
|
}
|
|
|
59
|
|
|
|
60
|
|
|
|
61
|
@Override
|
|
|
62
|
public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
|
|
|
63
|
super.onViewCreated(view, savedInstanceState);
|
|
|
64
|
telNum = getArguments() == null ? "" : getArguments().getString(PHONE_KEY);
|
|
|
65
|
TextView tvPhone = view.findViewById(R.id.tvPhone);
|
|
|
66
|
tvPhone.setText(telNum);
|
|
|
67
|
view.findViewById(R.id.tvCancel).setOnClickListener(v->{
|
|
|
68
|
dismissAllowingStateLoss();
|
|
|
69
|
});
|
|
|
70
|
view.findViewById(R.id.tvCall).setOnClickListener(v->{
|
|
|
71
|
tellTask();
|
|
|
72
|
});
|
|
|
73
|
}
|
|
|
74
|
|
|
|
75
|
public void tellTask() {
|
|
|
76
|
boolean granted = XXPermissions.isGranted(requireContext(), Permission.CALL_PHONE);
|
|
|
77
|
if (granted) {
|
|
|
78
|
callPhone();
|
|
|
79
|
} else {
|
|
|
80
|
XXPermissions.with(this)
|
|
|
81
|
// 申请单个权限
|
|
|
82
|
.permission(Permission.CALL_PHONE)
|
|
|
83
|
.request(new OnPermissionCallback() {
|
|
|
84
|
@Override
|
|
|
85
|
public void onGranted(List<String> permissions, boolean all) {
|
|
|
86
|
callPhone();
|
|
|
87
|
}
|
|
|
88
|
@Override
|
|
|
89
|
public void onDenied(List<String> permissions, boolean never) {
|
|
|
90
|
if (never) {
|
|
|
91
|
ToastUtil.showToast(requireContext(),"被永久拒绝授权,请手动授予拨打电话权限", Toast.LENGTH_SHORT);
|
|
|
92
|
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
|
|
93
|
XXPermissions.startPermissionActivity(requireContext(), permissions);
|
|
|
94
|
} else {
|
|
|
95
|
ToastUtil.showToast(requireContext(),"获取拨打电话权限失败", Toast.LENGTH_SHORT);
|
|
|
96
|
}
|
|
|
97
|
dismissAllowingStateLoss();
|
|
|
98
|
}
|
|
|
99
|
});
|
|
|
100
|
}
|
|
|
101
|
}
|
|
|
102
|
|
|
|
103
|
private void callPhone() {
|
|
|
104
|
Intent intent = new Intent();
|
|
|
105
|
intent.setAction("android.intent.action.CALL");
|
|
|
106
|
intent.addCategory("android.intent.category.DEFAULT");
|
|
|
107
|
intent.setData(Uri.parse("tel:" + telNum));
|
|
|
108
|
startActivity(intent);
|
|
|
109
|
dismissAllowingStateLoss();
|
|
|
110
|
}
|
|
|
111
|
|
|
|
112
|
public void show(FragmentManager fragmentManager){
|
|
|
113
|
FragmentTransaction ft = fragmentManager.beginTransaction();
|
|
|
114
|
Fragment prev = fragmentManager.findFragmentByTag(PhoneDialog.class.getName());
|
|
|
115
|
if (prev != null) {
|
|
|
116
|
ft.remove(prev);
|
|
|
117
|
}
|
|
|
118
|
show(fragmentManager,PhoneDialog.class.getName());
|
|
|
119
|
fragmentManager.executePendingTransactions();
|
|
|
120
|
}
|
|
|
121
|
}
|
|
|
@ -0,0 +1,9 @@
|
|
|
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
2
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
|
3
|
<item >
|
|
|
4
|
<shape android:shape="rectangle">
|
|
|
5
|
<stroke android:width="1dp" android:color="#ff3ec34c" />
|
|
|
6
|
<corners android:radius="20dp" />
|
|
|
7
|
</shape>
|
|
|
8
|
</item>
|
|
|
9
|
</selector>
|
|
|
@ -936,7 +936,7 @@
|
|
936
|
936
|
android:layout_alignParentBottom="true"
|
|
937
|
937
|
android:background="@color/white"
|
|
938
|
938
|
android:visibility="gone"
|
|
939
|
|
tools:visibility="visible">
|
|
|
939
|
>
|
|
940
|
940
|
|
|
941
|
941
|
<LinearLayout
|
|
942
|
942
|
android:layout_width="match_parent"
|
|
|
@ -62,14 +62,27 @@
|
|
62
|
62
|
android:textColor="@color/color_3ec34c"
|
|
63
|
63
|
android:textSize="12sp"
|
|
64
|
64
|
/>
|
|
65
|
|
<androidx.recyclerview.widget.RecyclerView
|
|
|
65
|
|
|
|
66
|
<RelativeLayout
|
|
|
67
|
android:layout_marginBottom="13dp"
|
|
66
|
68
|
android:layout_marginTop="13dp"
|
|
67
|
|
android:layout_width="match_parent"
|
|
68
|
|
android:id="@+id/recyclerView"
|
|
|
69
|
android:layout_height="0dp"
|
|
69
|
70
|
android:layout_weight="1"
|
|
70
|
|
android:layout_marginBottom="13dp"
|
|
71
|
|
android:layout_height="0dp"/>
|
|
|
71
|
android:layout_width="match_parent"
|
|
|
72
|
>
|
|
|
73
|
<androidx.recyclerview.widget.RecyclerView
|
|
|
74
|
android:layout_width="match_parent"
|
|
|
75
|
android:id="@+id/recyclerView"
|
|
|
76
|
android:layout_height="match_parent"/>
|
|
72
|
77
|
|
|
|
78
|
<ProgressBar
|
|
|
79
|
android:id="@+id/progressBar"
|
|
|
80
|
tools:visibility="visible"
|
|
|
81
|
android:visibility="gone"
|
|
|
82
|
android:layout_centerInParent="true"
|
|
|
83
|
android:layout_width="wrap_content"
|
|
|
84
|
android:layout_height="wrap_content"/>
|
|
|
85
|
</RelativeLayout>
|
|
73
|
86
|
<LinearLayout
|
|
74
|
87
|
android:layout_width="match_parent"
|
|
75
|
88
|
android:layout_height="wrap_content">
|
|
|
@ -0,0 +1,61 @@
|
|
|
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
|
xmlns:tools="http://schemas.android.com/tools"
|
|
|
5
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
|
6
|
tools:background="#f1f1"
|
|
|
7
|
android:layout_height="match_parent">
|
|
|
8
|
<androidx.constraintlayout.widget.ConstraintLayout
|
|
|
9
|
android:layout_centerInParent="true"
|
|
|
10
|
android:background="@drawable/bg_white_radius6"
|
|
|
11
|
android:paddingBottom="20dp"
|
|
|
12
|
android:paddingEnd="10dp"
|
|
|
13
|
android:paddingStart="10dp"
|
|
|
14
|
android:paddingTop="30dp"
|
|
|
15
|
android:layout_width="256dp"
|
|
|
16
|
android:layout_height="wrap_content">
|
|
|
17
|
|
|
|
18
|
<TextView
|
|
|
19
|
android:id="@+id/tvPhone"
|
|
|
20
|
app:layout_constraintEnd_toEndOf="parent"
|
|
|
21
|
app:layout_constraintStart_toStartOf="parent"
|
|
|
22
|
app:layout_constraintTop_toTopOf="parent"
|
|
|
23
|
android:gravity="center"
|
|
|
24
|
android:layout_width="match_parent"
|
|
|
25
|
android:layout_height="wrap_content"
|
|
|
26
|
tools:text="400-061-0999"
|
|
|
27
|
android:textColor="@color/editcolor"
|
|
|
28
|
android:textSize="20sp"
|
|
|
29
|
/>
|
|
|
30
|
|
|
|
31
|
<TextView
|
|
|
32
|
android:background="@drawable/bg_3ec34c_hollow_radius20"
|
|
|
33
|
android:id="@+id/tvCancel"
|
|
|
34
|
android:gravity="center"
|
|
|
35
|
android:layout_marginTop="20dp"
|
|
|
36
|
app:layout_constraintTop_toBottomOf="@+id/tvPhone"
|
|
|
37
|
app:layout_constraintStart_toStartOf="parent"
|
|
|
38
|
android:layout_width="0dp"
|
|
|
39
|
android:layout_height="30dp"
|
|
|
40
|
android:text="取消"
|
|
|
41
|
android:textColor="@color/color_3ec34c"
|
|
|
42
|
android:textSize="14sp"
|
|
|
43
|
app:layout_constraintEnd_toStartOf="@+id/tvCall"
|
|
|
44
|
/>
|
|
|
45
|
|
|
|
46
|
<TextView
|
|
|
47
|
android:background="@drawable/bg_3ec34c_radius20"
|
|
|
48
|
android:layout_marginStart="8dp"
|
|
|
49
|
android:id="@+id/tvCall"
|
|
|
50
|
android:layout_width="0dp"
|
|
|
51
|
android:layout_height="30dp"
|
|
|
52
|
android:layout_marginTop="20dp"
|
|
|
53
|
android:gravity="center"
|
|
|
54
|
android:text="呼叫"
|
|
|
55
|
android:textColor="@color/white"
|
|
|
56
|
android:textSize="14sp"
|
|
|
57
|
app:layout_constraintEnd_toEndOf="parent"
|
|
|
58
|
app:layout_constraintStart_toEndOf="@+id/tvCancel"
|
|
|
59
|
app:layout_constraintTop_toBottomOf="@+id/tvPhone" />
|
|
|
60
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
|
61
|
</RelativeLayout>
|
|
|
@ -41,11 +41,29 @@
|
|
41
|
41
|
</LinearLayout>
|
|
42
|
42
|
|
|
43
|
43
|
<ListView
|
|
|
44
|
android:layout_above="@+id/tvLock"
|
|
44
|
45
|
android:id="@+id/lv_status"
|
|
45
|
46
|
android:layout_width="match_parent"
|
|
46
|
|
android:layout_height="match_parent"
|
|
|
47
|
android:layout_height="wrap_content"
|
|
47
|
48
|
android:divider="@color/ui_6d"
|
|
48
|
49
|
android:dividerHeight="0.5dp"
|
|
49
|
50
|
android:background="@color/white"/>
|
|
50
|
51
|
|
|
|
52
|
<TextView
|
|
|
53
|
tools:visibility="visible"
|
|
|
54
|
android:visibility="gone"
|
|
|
55
|
android:gravity="center"
|
|
|
56
|
android:background="@drawable/bg_lock_contact"
|
|
|
57
|
android:layout_marginTop="12dp"
|
|
|
58
|
android:layout_marginEnd="12dp"
|
|
|
59
|
android:layout_marginStart="12dp"
|
|
|
60
|
android:layout_marginBottom="30dp"
|
|
|
61
|
android:layout_alignParentBottom="true"
|
|
|
62
|
android:id="@+id/tvLock"
|
|
|
63
|
android:layout_width="match_parent"
|
|
|
64
|
android:layout_height="42dp"
|
|
|
65
|
android:text="降地锁"
|
|
|
66
|
android:textColor="@color/white"
|
|
|
67
|
android:textSize="16sp"
|
|
|
68
|
/>
|
|
51
|
69
|
</RelativeLayout>
|
|
|
@ -25,8 +25,8 @@
|
|
25
|
25
|
app:layout_constraintStart_toStartOf="parent"
|
|
26
|
26
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
27
|
27
|
app:layout_constraintTop_toTopOf="parent"
|
|
28
|
|
android:layout_width="8dp"
|
|
29
|
|
android:layout_height="22dp"
|
|
|
28
|
android:layout_width="wrap_content"
|
|
|
29
|
android:layout_height="wrap_content"
|
|
30
|
30
|
android:text="1"
|
|
31
|
31
|
android:textColor="@color/editcolor"
|
|
32
|
32
|
android:textSize="16sp"
|
|
|
@ -235,7 +235,7 @@
|
|
235
|
235
|
|
|
236
|
236
|
<TextView
|
|
237
|
237
|
tools:visibility="visible"
|
|
238
|
|
android:visibility="visible"
|
|
|
238
|
android:visibility="gone"
|
|
239
|
239
|
android:id="@+id/tvLock"
|
|
240
|
240
|
android:layout_gravity="end|bottom"
|
|
241
|
241
|
android:gravity="center"
|
|
|
@ -1,8 +1,8 @@
|
|
1
|
1
|
package com.google.zxing.client.android.constant;
|
|
2
|
2
|
|
|
3
|
3
|
public interface UrlConstants {
|
|
4
|
|
String HOST_URL = "http://cdz.evcharge.cc/zhannew/basic/web/index.php/";
|
|
5
|
|
// String HOST_URL = "http://59.110.68.162/zhannew/basic/web/index.php/"; //测试链接
|
|
|
4
|
// String HOST_URL = "http://cdz.evcharge.cc/zhannew/basic/web/index.php/";
|
|
|
5
|
String HOST_URL = "http://59.110.68.162/zhannew/basic/web/index.php/"; //测试链接
|
|
6
|
6
|
|
|
7
|
7
|
String USER_CHARGING_CHECK_URL = HOST_URL + "api/charge/check-user";
|
|
8
|
8
|
// String START_CHARGING_URL = HOST_URL + "api/charge/start";
|