@qusaieilouti99/call-manager 0.1.72 → 0.1.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/margelo/nitro/qusaieilouti99/callmanager/CallActivity.kt +34 -3
- package/android/src/main/java/com/margelo/nitro/qusaieilouti99/callmanager/CallEngine.kt +1 -3
- package/android/src/main/res/drawable/action_button_secondary.xml +12 -0
- package/android/src/main/res/drawable/answer_button.xml +15 -0
- package/android/src/main/res/drawable/answer_button_shadow.xml +10 -0
- package/android/src/main/res/drawable/avatar_bg.xml +8 -0
- package/android/src/main/res/drawable/avatar_glow.xml +10 -0
- package/android/src/main/res/drawable/call_background.xml +24 -0
- package/android/src/main/res/drawable/decline_button.xml +15 -0
- package/android/src/main/res/drawable/decline_button_shadow.xml +10 -0
- package/android/src/main/res/drawable/overlay_gradient.xml +8 -0
- package/android/src/main/res/layout/activity_call.xml +159 -48
- package/package.json +1 -1
- package/android/src/main/res/drawable/circle_bg.xml +0 -4
- package/android/src/main/res/drawable/circle_green.xml +0 -4
- package/android/src/main/res/drawable/circle_red.xml +0 -4
|
@@ -10,10 +10,16 @@ import android.util.Log
|
|
|
10
10
|
import android.view.WindowManager
|
|
11
11
|
import android.widget.Button
|
|
12
12
|
import android.widget.TextView
|
|
13
|
+
import android.content.BroadcastReceiver
|
|
14
|
+
import android.content.Context
|
|
15
|
+
import android.content.IntentFilter
|
|
13
16
|
|
|
14
17
|
class CallActivity : Activity() {
|
|
15
18
|
|
|
16
|
-
private enum class FinishReason {
|
|
19
|
+
private enum class FinishReason {
|
|
20
|
+
ANSWER, DECLINE, TIMEOUT, MANUAL_DISMISS, EXTERNAL_END
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
private var finishReason: FinishReason? = null
|
|
18
24
|
private var callId: String = ""
|
|
19
25
|
private var callType: String = "Audio"
|
|
@@ -26,6 +32,18 @@ class CallActivity : Activity() {
|
|
|
26
32
|
finishCallActivity()
|
|
27
33
|
}
|
|
28
34
|
|
|
35
|
+
// NEW: Broadcast receiver to listen for close events
|
|
36
|
+
private val closeReceiver = object : BroadcastReceiver() {
|
|
37
|
+
override fun onReceive(context: Context?, intent: Intent?) {
|
|
38
|
+
val receivedCallId = intent?.getStringExtra("callId")
|
|
39
|
+
if (receivedCallId == callId) {
|
|
40
|
+
Log.d(TAG, "Received close broadcast for $callId")
|
|
41
|
+
finishReason = FinishReason.EXTERNAL_END
|
|
42
|
+
finishCallActivity()
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
29
47
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
30
48
|
super.onCreate(savedInstanceState)
|
|
31
49
|
Log.d(TAG, "CallActivity onCreate")
|
|
@@ -62,8 +80,6 @@ class CallActivity : Activity() {
|
|
|
62
80
|
answerBtn.setOnClickListener {
|
|
63
81
|
Log.d(TAG, "CallActivity: Answer button clicked for callId: $callId")
|
|
64
82
|
finishReason = FinishReason.ANSWER
|
|
65
|
-
|
|
66
|
-
// FIXED: Use single source of truth - this will handle all cleanup
|
|
67
83
|
CallEngine.answerCall(callId)
|
|
68
84
|
finishCallActivity()
|
|
69
85
|
}
|
|
@@ -75,6 +91,14 @@ class CallActivity : Activity() {
|
|
|
75
91
|
finishCallActivity()
|
|
76
92
|
}
|
|
77
93
|
|
|
94
|
+
// NEW: Register broadcast receiver
|
|
95
|
+
val filter = IntentFilter("com.qusaieilouti99.callmanager.CLOSE_CALL_ACTIVITY")
|
|
96
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
97
|
+
registerReceiver(closeReceiver, filter, Context.RECEIVER_NOT_EXPORTED)
|
|
98
|
+
} else {
|
|
99
|
+
registerReceiver(closeReceiver, filter)
|
|
100
|
+
}
|
|
101
|
+
|
|
78
102
|
timeoutHandler.postDelayed(timeoutRunnable, 60_000)
|
|
79
103
|
}
|
|
80
104
|
|
|
@@ -83,6 +107,13 @@ class CallActivity : Activity() {
|
|
|
83
107
|
Log.d(TAG, "CallActivity onDestroy for callId: $callId. Reason: $finishReason")
|
|
84
108
|
timeoutHandler.removeCallbacks(timeoutRunnable)
|
|
85
109
|
|
|
110
|
+
// NEW: Unregister broadcast receiver
|
|
111
|
+
try {
|
|
112
|
+
unregisterReceiver(closeReceiver)
|
|
113
|
+
} catch (e: Exception) {
|
|
114
|
+
Log.w(TAG, "Receiver already unregistered: ${e.message}")
|
|
115
|
+
}
|
|
116
|
+
|
|
86
117
|
// FIXED: Ensure cleanup happens regardless of how activity ends
|
|
87
118
|
CallEngine.stopRingtone()
|
|
88
119
|
CallEngine.cancelIncomingCallUI()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
android:color="#30FFFFFF">
|
|
4
|
+
<item>
|
|
5
|
+
<shape android:shape="oval">
|
|
6
|
+
<solid android:color="#40FFFFFF" />
|
|
7
|
+
<stroke
|
|
8
|
+
android:width="2dp"
|
|
9
|
+
android:color="#60FFFFFF" />
|
|
10
|
+
</shape>
|
|
11
|
+
</item>
|
|
12
|
+
</ripple>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
android:color="#40FFFFFF">
|
|
4
|
+
<item>
|
|
5
|
+
<shape android:shape="oval">
|
|
6
|
+
<gradient
|
|
7
|
+
android:startColor="#4CAF50"
|
|
8
|
+
android:endColor="#388E3C"
|
|
9
|
+
android:angle="135" />
|
|
10
|
+
<stroke
|
|
11
|
+
android:width="3dp"
|
|
12
|
+
android:color="#66BB6A" />
|
|
13
|
+
</shape>
|
|
14
|
+
</item>
|
|
15
|
+
</ripple>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
android:shape="oval">
|
|
4
|
+
<gradient
|
|
5
|
+
android:startColor="#40000000"
|
|
6
|
+
android:centerColor="#20000000"
|
|
7
|
+
android:endColor="#00000000"
|
|
8
|
+
android:type="radial"
|
|
9
|
+
android:gradientRadius="40dp" />
|
|
10
|
+
</shape>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
android:shape="oval">
|
|
4
|
+
<gradient
|
|
5
|
+
android:startColor="#40FFFFFF"
|
|
6
|
+
android:centerColor="#20FFFFFF"
|
|
7
|
+
android:endColor="#00FFFFFF"
|
|
8
|
+
android:type="radial"
|
|
9
|
+
android:gradientRadius="70dp" />
|
|
10
|
+
</shape>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
|
+
<!-- Base gradient -->
|
|
4
|
+
<item>
|
|
5
|
+
<shape>
|
|
6
|
+
<gradient
|
|
7
|
+
android:startColor="#1a237e"
|
|
8
|
+
android:centerColor="#283593"
|
|
9
|
+
android:endColor="#3949ab"
|
|
10
|
+
android:angle="135" />
|
|
11
|
+
</shape>
|
|
12
|
+
</item>
|
|
13
|
+
|
|
14
|
+
<!-- Abstract pattern overlay -->
|
|
15
|
+
<item>
|
|
16
|
+
<shape>
|
|
17
|
+
<gradient
|
|
18
|
+
android:startColor="#20FFFFFF"
|
|
19
|
+
android:centerColor="#10FFFFFF"
|
|
20
|
+
android:endColor="#05FFFFFF"
|
|
21
|
+
android:angle="45" />
|
|
22
|
+
</shape>
|
|
23
|
+
</item>
|
|
24
|
+
</layer-list>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
android:color="#40FFFFFF">
|
|
4
|
+
<item>
|
|
5
|
+
<shape android:shape="oval">
|
|
6
|
+
<gradient
|
|
7
|
+
android:startColor="#F44336"
|
|
8
|
+
android:endColor="#D32F2F"
|
|
9
|
+
android:angle="135" />
|
|
10
|
+
<stroke
|
|
11
|
+
android:width="3dp"
|
|
12
|
+
android:color="#EF5350" />
|
|
13
|
+
</shape>
|
|
14
|
+
</item>
|
|
15
|
+
</ripple>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
android:shape="oval">
|
|
4
|
+
<gradient
|
|
5
|
+
android:startColor="#40000000"
|
|
6
|
+
android:centerColor="#20000000"
|
|
7
|
+
android:endColor="#00000000"
|
|
8
|
+
android:type="radial"
|
|
9
|
+
android:gradientRadius="40dp" />
|
|
10
|
+
</shape>
|
|
@@ -1,55 +1,166 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
android:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
android:
|
|
17
|
-
android:
|
|
18
|
-
android:scaleType="centerCrop" />
|
|
19
|
-
|
|
20
|
-
<TextView
|
|
21
|
-
android:id="@+id/caller_name"
|
|
22
|
-
android:layout_width="wrap_content"
|
|
2
|
+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
android:id="@+id/call_root"
|
|
4
|
+
android:layout_width="match_parent"
|
|
5
|
+
android:layout_height="match_parent"
|
|
6
|
+
android:background="@drawable/call_background">
|
|
7
|
+
|
|
8
|
+
<!-- Overlay for better text readability -->
|
|
9
|
+
<View
|
|
10
|
+
android:layout_width="match_parent"
|
|
11
|
+
android:layout_height="match_parent"
|
|
12
|
+
android:background="@drawable/overlay_gradient" />
|
|
13
|
+
|
|
14
|
+
<!-- Top section with incoming call info -->
|
|
15
|
+
<LinearLayout
|
|
16
|
+
android:id="@+id/top_section"
|
|
17
|
+
android:layout_width="match_parent"
|
|
23
18
|
android:layout_height="wrap_content"
|
|
24
|
-
android:
|
|
25
|
-
android:
|
|
26
|
-
android:
|
|
27
|
-
android:
|
|
28
|
-
android:
|
|
19
|
+
android:layout_centerInParent="true"
|
|
20
|
+
android:layout_marginTop="80dp"
|
|
21
|
+
android:gravity="center"
|
|
22
|
+
android:orientation="vertical"
|
|
23
|
+
android:padding="32dp">
|
|
24
|
+
|
|
25
|
+
<TextView
|
|
26
|
+
android:layout_width="wrap_content"
|
|
27
|
+
android:layout_height="wrap_content"
|
|
28
|
+
android:text="Incoming call"
|
|
29
|
+
android:textColor="#B3FFFFFF"
|
|
30
|
+
android:textSize="16sp"
|
|
31
|
+
android:layout_marginBottom="24dp"
|
|
32
|
+
android:letterSpacing="0.1" />
|
|
33
|
+
|
|
34
|
+
<!-- Avatar with glow effect -->
|
|
35
|
+
<FrameLayout
|
|
36
|
+
android:layout_width="140dp"
|
|
37
|
+
android:layout_height="140dp"
|
|
38
|
+
android:layout_marginBottom="24dp">
|
|
39
|
+
|
|
40
|
+
<View
|
|
41
|
+
android:layout_width="140dp"
|
|
42
|
+
android:layout_height="140dp"
|
|
43
|
+
android:background="@drawable/avatar_glow" />
|
|
29
44
|
|
|
45
|
+
<ImageView
|
|
46
|
+
android:id="@+id/avatar"
|
|
47
|
+
android:layout_width="120dp"
|
|
48
|
+
android:layout_height="120dp"
|
|
49
|
+
android:layout_gravity="center"
|
|
50
|
+
android:background="@drawable/avatar_bg"
|
|
51
|
+
android:scaleType="centerCrop"
|
|
52
|
+
android:src="@android:drawable/sym_def_app_icon" />
|
|
53
|
+
</FrameLayout>
|
|
54
|
+
|
|
55
|
+
<TextView
|
|
56
|
+
android:id="@+id/caller_name"
|
|
57
|
+
android:layout_width="wrap_content"
|
|
58
|
+
android:layout_height="wrap_content"
|
|
59
|
+
android:text="Caller Name"
|
|
60
|
+
android:textColor="#FFFFFF"
|
|
61
|
+
android:textSize="28sp"
|
|
62
|
+
android:textStyle="bold"
|
|
63
|
+
android:layout_marginBottom="8dp"
|
|
64
|
+
android:shadowColor="#33000000"
|
|
65
|
+
android:shadowDx="0"
|
|
66
|
+
android:shadowDy="2"
|
|
67
|
+
android:shadowRadius="4" />
|
|
68
|
+
|
|
69
|
+
<TextView
|
|
70
|
+
android:layout_width="wrap_content"
|
|
71
|
+
android:layout_height="wrap_content"
|
|
72
|
+
android:text="Mobile"
|
|
73
|
+
android:textColor="#B3FFFFFF"
|
|
74
|
+
android:textSize="16sp"
|
|
75
|
+
android:layout_marginBottom="48dp" />
|
|
76
|
+
|
|
77
|
+
</LinearLayout>
|
|
78
|
+
|
|
79
|
+
<!-- Bottom section with action buttons -->
|
|
30
80
|
<LinearLayout
|
|
31
|
-
android:layout_width="
|
|
81
|
+
android:layout_width="match_parent"
|
|
32
82
|
android:layout_height="wrap_content"
|
|
83
|
+
android:layout_alignParentBottom="true"
|
|
84
|
+
android:layout_marginBottom="80dp"
|
|
85
|
+
android:gravity="center"
|
|
33
86
|
android:orientation="horizontal"
|
|
34
|
-
android:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
android:layout_width="
|
|
39
|
-
android:layout_height="
|
|
40
|
-
android:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
android:
|
|
87
|
+
android:padding="32dp">
|
|
88
|
+
|
|
89
|
+
<!-- Additional quick actions -->
|
|
90
|
+
<FrameLayout
|
|
91
|
+
android:layout_width="56dp"
|
|
92
|
+
android:layout_height="56dp"
|
|
93
|
+
android:layout_marginEnd="32dp">
|
|
94
|
+
|
|
95
|
+
<ImageView
|
|
96
|
+
android:layout_width="56dp"
|
|
97
|
+
android:layout_height="56dp"
|
|
98
|
+
android:background="@drawable/action_button_secondary"
|
|
99
|
+
android:src="@android:drawable/ic_menu_call"
|
|
100
|
+
android:padding="16dp"
|
|
101
|
+
android:tint="#FFFFFF" />
|
|
102
|
+
</FrameLayout>
|
|
103
|
+
|
|
104
|
+
<!-- Decline Button -->
|
|
105
|
+
<FrameLayout
|
|
106
|
+
android:layout_width="80dp"
|
|
107
|
+
android:layout_height="80dp"
|
|
108
|
+
android:layout_marginEnd="48dp">
|
|
109
|
+
|
|
110
|
+
<View
|
|
111
|
+
android:layout_width="80dp"
|
|
112
|
+
android:layout_height="80dp"
|
|
113
|
+
android:background="@drawable/decline_button_shadow" />
|
|
114
|
+
|
|
115
|
+
<Button
|
|
116
|
+
android:id="@+id/decline_btn"
|
|
117
|
+
android:layout_width="72dp"
|
|
118
|
+
android:layout_height="72dp"
|
|
119
|
+
android:layout_gravity="center"
|
|
120
|
+
android:background="@drawable/decline_button"
|
|
121
|
+
android:text="✕"
|
|
122
|
+
android:textColor="#FFFFFF"
|
|
123
|
+
android:textSize="24sp"
|
|
124
|
+
android:textStyle="bold" />
|
|
125
|
+
</FrameLayout>
|
|
126
|
+
|
|
127
|
+
<!-- Answer Button -->
|
|
128
|
+
<FrameLayout
|
|
129
|
+
android:layout_width="80dp"
|
|
130
|
+
android:layout_height="80dp">
|
|
131
|
+
|
|
132
|
+
<View
|
|
133
|
+
android:layout_width="80dp"
|
|
134
|
+
android:layout_height="80dp"
|
|
135
|
+
android:background="@drawable/answer_button_shadow" />
|
|
136
|
+
|
|
137
|
+
<Button
|
|
138
|
+
android:id="@+id/answer_btn"
|
|
139
|
+
android:layout_width="72dp"
|
|
140
|
+
android:layout_height="72dp"
|
|
141
|
+
android:layout_gravity="center"
|
|
142
|
+
android:background="@drawable/answer_button"
|
|
143
|
+
android:text="✓"
|
|
144
|
+
android:textColor="#FFFFFF"
|
|
145
|
+
android:textSize="24sp"
|
|
146
|
+
android:textStyle="bold" />
|
|
147
|
+
</FrameLayout>
|
|
148
|
+
|
|
149
|
+
<!-- Message quick action -->
|
|
150
|
+
<FrameLayout
|
|
151
|
+
android:layout_width="56dp"
|
|
152
|
+
android:layout_height="56dp"
|
|
153
|
+
android:layout_marginStart="32dp">
|
|
154
|
+
|
|
155
|
+
<ImageView
|
|
156
|
+
android:layout_width="56dp"
|
|
157
|
+
android:layout_height="56dp"
|
|
158
|
+
android:background="@drawable/action_button_secondary"
|
|
159
|
+
android:src="@android:drawable/ic_menu_send"
|
|
160
|
+
android:padding="16dp"
|
|
161
|
+
android:tint="#FFFFFF" />
|
|
162
|
+
</FrameLayout>
|
|
163
|
+
|
|
54
164
|
</LinearLayout>
|
|
55
|
-
|
|
165
|
+
|
|
166
|
+
</RelativeLayout>
|
package/package.json
CHANGED