diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml deleted file mode 100644 index 53449dae..00000000 --- a/.idea/libraries/Flutter_Plugins.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b580bcb0..e1697b04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,14 @@ +## 1.0.2+2 + +* Fix notification Android 12 +* Fix sound notification +* Support `backgroundUrl` using path assets +* Fixed some bugs. + ## 1.0.2+1 -* Issue no audio when Accpet(iOS) -* Duplicate sound notificaiton(Android) +* Issue no audio when Accept(iOS) +* Duplicate sound notification(Android) * Support Flutter 3 * Fixed some bugs. diff --git a/README.md b/README.md index e02a5594..9a9e75f3 100644 --- a/README.md +++ b/README.md @@ -315,7 +315,7 @@ A Flutter plugin to show incoming call in your Flutter app(Custom for Android/Ca | **`isShowCallback`** | Show callback action from miss call notification. | `true` | | **`ringtonePath`** | File name ringtone. put file into `/android/app/src/main/res/raw/ringtone_default.pm3` |`system_ringtone_default`
using ringtone default of the phone| | **`backgroundColor`** | Incoming call screen background color. | `#0955fa` | - | **`backgroundUrl`** | Using image background for Incoming call screen. | _None_ | + | **`backgroundUrl`** | Using image background for Incoming call screen. example: http://... https://... or "assets/abc.png" | _None_ | | **`actionColor`** | Color used in button/text on notification. | `#4CAF50` |
diff --git a/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/CallkitIncomingActivity.kt b/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/CallkitIncomingActivity.kt index f24437b5..ad42aeaa 100644 --- a/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/CallkitIncomingActivity.kt +++ b/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/CallkitIncomingActivity.kt @@ -52,17 +52,17 @@ class CallkitIncomingActivity : Activity() { companion object { const val ACTION_ENDED_CALL_INCOMING = - "com.hiennv.flutter_callkit_incoming.ACTION_ENDED_CALL_INCOMING" + "com.hiennv.flutter_callkit_incoming.ACTION_ENDED_CALL_INCOMING" fun getIntent(data: Bundle) = Intent(ACTION_CALL_INCOMING).apply { action = ACTION_CALL_INCOMING putExtra(EXTRA_CALLKIT_INCOMING_DATA, data) flags = - Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT + Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT } fun getIntentEnded() = - Intent(ACTION_ENDED_CALL_INCOMING) + Intent(ACTION_ENDED_CALL_INCOMING) } @@ -112,8 +112,8 @@ class CallkitIncomingActivity : Activity() { initView() incomingData(intent) registerReceiver( - endedCallkitIncomingBroadcastReceiver, - IntentFilter(ACTION_ENDED_CALL_INCOMING) + endedCallkitIncomingBroadcastReceiver, + IntentFilter(ACTION_ENDED_CALL_INCOMING) ) } @@ -121,8 +121,8 @@ class CallkitIncomingActivity : Activity() { val pm = applicationContext.getSystemService(POWER_SERVICE) as PowerManager val wakeLock = pm.newWakeLock( - PowerManager.SCREEN_BRIGHT_WAKE_LOCK or PowerManager.FULL_WAKE_LOCK or PowerManager.ACQUIRE_CAUSES_WAKEUP, - "Callkit:PowerManager" + PowerManager.SCREEN_BRIGHT_WAKE_LOCK or PowerManager.FULL_WAKE_LOCK or PowerManager.ACQUIRE_CAUSES_WAKEUP, + "Callkit:PowerManager" ) wakeLock.acquire(duration) } @@ -130,8 +130,8 @@ class CallkitIncomingActivity : Activity() { private fun transparentStatusAndNavigation() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { setWindowFlag( - WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS - or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, true + WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS + or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, true ) } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { @@ -141,8 +141,8 @@ class CallkitIncomingActivity : Activity() { } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setWindowFlag( - (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS - or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION), false + (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS + or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION), false ) window.statusBarColor = Color.TRANSPARENT window.navigationBarColor = Color.TRANSPARENT @@ -176,10 +176,10 @@ class CallkitIncomingActivity : Activity() { ivAvatar.visibility = View.VISIBLE val headers = data.getSerializable(EXTRA_CALLKIT_HEADERS) as HashMap getPicassoInstance(this@CallkitIncomingActivity, headers) - .load(avatarUrl) - .placeholder(R.drawable.ic_default_avatar) - .error(R.drawable.ic_default_avatar) - .into(ivAvatar) + .load(avatarUrl) + .placeholder(R.drawable.ic_default_avatar) + .error(R.drawable.ic_default_avatar) + .into(ivAvatar) } val callType = data?.getInt(EXTRA_CALLKIT_TYPE, 0) ?: 0 @@ -192,31 +192,34 @@ class CallkitIncomingActivity : Activity() { finishTimeout(data, duration) val textAccept = data?.getString(EXTRA_CALLKIT_TEXT_ACCEPT, "") - tvAccept.text = if(TextUtils.isEmpty(textAccept)) getString(R.string.text_accept) else textAccept + tvAccept.text = if (TextUtils.isEmpty(textAccept)) getString(R.string.text_accept) else textAccept val textDecline = data?.getString(EXTRA_CALLKIT_TEXT_DECLINE, "") - tvDecline.text = if(TextUtils.isEmpty(textDecline)) getString(R.string.text_decline) else textDecline + tvDecline.text = if (TextUtils.isEmpty(textDecline)) getString(R.string.text_decline) else textDecline val backgroundColor = data?.getString(EXTRA_CALLKIT_BACKGROUND_COLOR, "#0955fa") try { ivBackground.setBackgroundColor(Color.parseColor(backgroundColor)) } catch (error: Exception) { } - val backgroundUrl = data?.getString(EXTRA_CALLKIT_BACKGROUND_URL, "") + var backgroundUrl = data?.getString(EXTRA_CALLKIT_BACKGROUND_URL, "") if (backgroundUrl != null && backgroundUrl.isNotEmpty()) { - val headers = data.getSerializable(EXTRA_CALLKIT_HEADERS) as HashMap + if (!backgroundUrl.startsWith("http://", true) && !backgroundUrl.startsWith("https://", true)){ + backgroundUrl = String.format("file:///android_asset/flutter_assets/%s", backgroundUrl) + } + val headers = data?.getSerializable(EXTRA_CALLKIT_HEADERS) as HashMap getPicassoInstance(this@CallkitIncomingActivity, headers) - .load(backgroundUrl) - .placeholder(R.drawable.transparent) - .error(R.drawable.transparent) - .into(ivBackground) + .load(backgroundUrl) + .placeholder(R.drawable.transparent) + .error(R.drawable.transparent) + .into(ivBackground) } } private fun finishTimeout(data: Bundle?, duration: Long) { val currentSystemTime = System.currentTimeMillis() val timeStartCall = - data?.getLong(CallkitNotificationManager.EXTRA_TIME_START_CALL, currentSystemTime) - ?: currentSystemTime + data?.getLong(CallkitNotificationManager.EXTRA_TIME_START_CALL, currentSystemTime) + ?: currentSystemTime val timeOut = duration - abs(currentSystemTime - timeStartCall) Handler(Looper.getMainLooper()).postDelayed({ @@ -234,7 +237,7 @@ class CallkitIncomingActivity : Activity() { ivBackground = findViewById(R.id.ivBackground) llBackgroundAnimation = findViewById(R.id.llBackgroundAnimation) llBackgroundAnimation.layoutParams.height = - Utils.getScreenWidth() + Utils.getStatusBarHeight(this@CallkitIncomingActivity) + Utils.getScreenWidth() + Utils.getStatusBarHeight(this@CallkitIncomingActivity) llBackgroundAnimation.startRippleAnimation() tvNameCaller = findViewById(R.id.tvNameCaller) @@ -245,7 +248,7 @@ class CallkitIncomingActivity : Activity() { llAction = findViewById(R.id.llAction) val params = llAction.layoutParams as MarginLayoutParams - params.setMargins(0,0,0,Utils.getNavigationBarHeight(this@CallkitIncomingActivity)) + params.setMargins(0, 0, 0, Utils.getNavigationBarHeight(this@CallkitIncomingActivity)) llAction.layoutParams = params ivAcceptCall = findViewById(R.id.ivAcceptCall) @@ -264,7 +267,7 @@ class CallkitIncomingActivity : Activity() { private fun animateAcceptCall() { val shakeAnimation = - AnimationUtils.loadAnimation(this@CallkitIncomingActivity, R.anim.shake_anim) + AnimationUtils.loadAnimation(this@CallkitIncomingActivity, R.anim.shake_anim) ivAcceptCall.animation = shakeAnimation } @@ -298,23 +301,23 @@ class CallkitIncomingActivity : Activity() { private fun onDeclineClick() { val data = intent.extras?.getBundle(EXTRA_CALLKIT_INCOMING_DATA) val intent = - CallkitIncomingBroadcastReceiver.getIntentDecline(this@CallkitIncomingActivity, data) + CallkitIncomingBroadcastReceiver.getIntentDecline(this@CallkitIncomingActivity, data) sendBroadcast(intent) } private fun getPicassoInstance(context: Context, headers: HashMap): Picasso { val client = OkHttpClient.Builder() - .addNetworkInterceptor { chain -> - val newRequestBuilder: okhttp3.Request.Builder = chain.request().newBuilder() - for ((key, value) in headers) { - newRequestBuilder.addHeader(key, value.toString()) + .addNetworkInterceptor { chain -> + val newRequestBuilder: okhttp3.Request.Builder = chain.request().newBuilder() + for ((key, value) in headers) { + newRequestBuilder.addHeader(key, value.toString()) + } + chain.proceed(newRequestBuilder.build()) } - chain.proceed(newRequestBuilder.build()) - } - .build() + .build() return Picasso.Builder(context) - .downloader(OkHttp3Downloader(client)) - .build() + .downloader(OkHttp3Downloader(client)) + .build() } override fun onDestroy() { diff --git a/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/CallkitNotificationManager.kt b/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/CallkitNotificationManager.kt index fb9dfcac..bf251bf6 100644 --- a/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/CallkitNotificationManager.kt +++ b/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/CallkitNotificationManager.kt @@ -7,6 +7,7 @@ import android.app.PendingIntent import android.content.Context import android.content.Intent import android.graphics.Bitmap +import android.graphics.BitmapFactory import android.graphics.Color import android.graphics.drawable.Drawable import android.media.RingtoneManager @@ -16,7 +17,6 @@ import android.os.Bundle import android.os.Handler import android.os.Looper import android.text.TextUtils -import android.util.TypedValue import android.view.View import android.widget.RemoteViews import androidx.core.app.NotificationCompat @@ -49,6 +49,7 @@ class CallkitNotificationManager(private val context: Context) { private lateinit var notificationBuilder: NotificationCompat.Builder private var notificationViews: RemoteViews? = null + private var notificationSmallViews: RemoteViews? = null private var notificationId: Int = 9696 private var targetLoadAvatarDefault = object : Target { @@ -57,19 +58,24 @@ class CallkitNotificationManager(private val context: Context) { getNotificationManager().notify(notificationId, notificationBuilder.build()) } - override fun onBitmapFailed(e: Exception?, errorDrawable: Drawable?) {} + override fun onBitmapFailed(e: Exception?, errorDrawable: Drawable?) { + } - override fun onPrepareLoad(placeHolderDrawable: Drawable?) {} + override fun onPrepareLoad(placeHolderDrawable: Drawable?) { + } } private var targetLoadAvatarCustomize = object : Target { override fun onBitmapLoaded(bitmap: Bitmap?, from: Picasso.LoadedFrom?) { notificationViews?.setImageViewBitmap(R.id.ivAvatar, bitmap) notificationViews?.setViewVisibility(R.id.ivAvatar, View.VISIBLE) + notificationSmallViews?.setImageViewBitmap(R.id.ivAvatar, bitmap) + notificationSmallViews?.setViewVisibility(R.id.ivAvatar, View.VISIBLE) getNotificationManager().notify(notificationId, notificationBuilder.build()) } - override fun onBitmapFailed(e: Exception?, errorDrawable: Drawable?) {} + override fun onBitmapFailed(e: Exception?, errorDrawable: Drawable?) { + } override fun onPrepareLoad(placeHolderDrawable: Drawable?) { } @@ -122,45 +128,23 @@ class CallkitNotificationManager(private val context: Context) { if (isCustomNotification) { notificationViews = RemoteViews(context.packageName, R.layout.layout_custom_notification) - notificationViews?.setTextViewText( - R.id.tvNameCaller, - data.getString(EXTRA_CALLKIT_NAME_CALLER, "") - ) - notificationViews?.setTextViewText( - R.id.tvNumber, - data.getString(EXTRA_CALLKIT_HANDLE, "") - ) - notificationViews?.setOnClickPendingIntent( - R.id.llDecline, - getDeclinePendingIntent(notificationId, data) - ) - val textDecline = data.getString(EXTRA_CALLKIT_TEXT_DECLINE, "") - notificationViews?.setTextViewText( - R.id.tvDecline, - if (TextUtils.isEmpty(textDecline)) context.getString(R.string.text_decline) else textDecline - ) - notificationViews?.setOnClickPendingIntent( - R.id.llAccept, - getAcceptPendingIntent(notificationId, data) - ) - val textAccept = data.getString(EXTRA_CALLKIT_TEXT_ACCEPT, "") - notificationViews?.setTextViewText( - R.id.tvAccept, - if (TextUtils.isEmpty(textAccept)) context.getString(R.string.text_accept) else textAccept - ) - val avatarUrl = data.getString(EXTRA_CALLKIT_AVATAR, "") - if (avatarUrl != null && avatarUrl.isNotEmpty()) { - val headers = - data.getSerializable(CallkitIncomingBroadcastReceiver.EXTRA_CALLKIT_HEADERS) as HashMap - getPicassoInstance(context, headers).load(avatarUrl) - .transform(CircleTransform()) - .into(targetLoadAvatarCustomize) + initNotificationViews(notificationViews!!, data) + + + if (Build.MANUFACTURER.equals("Samsung", ignoreCase = true) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + notificationSmallViews = + RemoteViews(context.packageName, R.layout.layout_custom_small_ex_notification) + initNotificationViews(notificationSmallViews!!, data) + } else { + notificationSmallViews = + RemoteViews(context.packageName, R.layout.layout_custom_small_notification) + initNotificationViews(notificationSmallViews!!, data) } notificationBuilder.setStyle(NotificationCompat.DecoratedCustomViewStyle()) - notificationBuilder.setCustomContentView(notificationViews) + notificationBuilder.setCustomContentView(notificationSmallViews) notificationBuilder.setCustomBigContentView(notificationViews) - notificationBuilder.setCustomHeadsUpContentView(notificationViews) + notificationBuilder.setCustomHeadsUpContentView(notificationSmallViews) } else { val avatarUrl = data.getString(EXTRA_CALLKIT_AVATAR, "") if (avatarUrl != null && avatarUrl.isNotEmpty()) { @@ -191,6 +175,43 @@ class CallkitNotificationManager(private val context: Context) { getNotificationManager().notify(notificationId, notification) } + private fun initNotificationViews(remoteViews: RemoteViews, data: Bundle) { + remoteViews.setTextViewText( + R.id.tvNameCaller, + data.getString(EXTRA_CALLKIT_NAME_CALLER, "") + ) + remoteViews.setTextViewText( + R.id.tvNumber, + data.getString(EXTRA_CALLKIT_HANDLE, "") + ) + remoteViews.setOnClickPendingIntent( + R.id.llDecline, + getDeclinePendingIntent(notificationId, data) + ) + val textDecline = data.getString(EXTRA_CALLKIT_TEXT_DECLINE, "") + remoteViews.setTextViewText( + R.id.tvDecline, + if (TextUtils.isEmpty(textDecline)) context.getString(R.string.text_decline) else textDecline + ) + remoteViews.setOnClickPendingIntent( + R.id.llAccept, + getAcceptPendingIntent(notificationId, data) + ) + val textAccept = data.getString(EXTRA_CALLKIT_TEXT_ACCEPT, "") + remoteViews.setTextViewText( + R.id.tvAccept, + if (TextUtils.isEmpty(textAccept)) context.getString(R.string.text_accept) else textAccept + ) + val avatarUrl = data.getString(EXTRA_CALLKIT_AVATAR, "") + if (avatarUrl != null && avatarUrl.isNotEmpty()) { + val headers = + data.getSerializable(CallkitIncomingBroadcastReceiver.EXTRA_CALLKIT_HEADERS) as HashMap + getPicassoInstance(context, headers).load(avatarUrl) + .transform(CircleTransform()) + .into(targetLoadAvatarCustomize) + } + } + fun showMissCallNotification(data: Bundle) { notificationId = data.getString(EXTRA_CALLKIT_ID, "callkit_incoming").hashCode() + 1 createNotificationChanel() @@ -312,9 +333,9 @@ class CallkitNotificationManager(private val context: Context) { private fun createNotificationChanel() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { var channelCall = getNotificationManager().getNotificationChannel("callkit_incoming_channel_id") - if (channelCall != null){ + if (channelCall != null) { channelCall.setSound(null, null) - }else { + } else { channelCall = NotificationChannel( "callkit_incoming_channel_id", "Incoming Call", diff --git a/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/CallkitSoundPlayerService.kt b/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/CallkitSoundPlayerService.kt index 2eae15c8..8c9a33a3 100644 --- a/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/CallkitSoundPlayerService.kt +++ b/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/CallkitSoundPlayerService.kt @@ -77,6 +77,19 @@ class CallkitSoundPlayerService : Service() { RingtoneManager.TYPE_RINGTONE ) } + try { + mediaPlayer(uri!!) + } catch (e: Exception) { + try { + uri = getRingtoneUri("ringtone_default") + mediaPlayer(uri!!) + } catch (e2: Exception) { + e2.printStackTrace() + } + } + } + + private fun mediaPlayer(uri: Uri) { mediaPlayer = MediaPlayer() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { val attribution = AudioAttributes.Builder() @@ -88,17 +101,12 @@ class CallkitSoundPlayerService : Service() { } else { mediaPlayer?.setAudioStreamType(AudioManager.STREAM_RING) } - try { - mediaPlayer?.setDataSource(applicationContext, uri!!) - mediaPlayer?.prepare() - mediaPlayer?.isLooping = true - mediaPlayer?.start() - } catch (e: Exception) { - e.printStackTrace() - } + mediaPlayer?.setDataSource(applicationContext, uri) + mediaPlayer?.prepare() + mediaPlayer?.isLooping = true + mediaPlayer?.start() } - private fun getRingtoneUri(fileName: String) = try { if (TextUtils.isEmpty(fileName)) { RingtoneManager.getActualDefaultRingtoneUri( diff --git a/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/TransparentActivity.kt b/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/TransparentActivity.kt index cc5471eb..bab6b421 100644 --- a/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/TransparentActivity.kt +++ b/android/src/main/kotlin/com/hiennv/flutter_callkit_incoming/TransparentActivity.kt @@ -3,8 +3,10 @@ package com.hiennv.flutter_callkit_incoming import android.app.Activity import android.content.Context import android.content.Intent +import android.net.Uri import android.os.Bundle import android.util.Log +import java.util.* class TransparentActivity : Activity() { @@ -16,6 +18,7 @@ class TransparentActivity : Activity() { intent.putExtra("type", "ACCEPT") intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION) intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY) + intent.data = Uri.parse(UUID.randomUUID().toString()) return intent } @@ -25,6 +28,7 @@ class TransparentActivity : Activity() { intent.putExtra("type", "CALLBACK") intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION) intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY) + intent.data = Uri.parse(UUID.randomUUID().toString()) return intent } @@ -43,6 +47,11 @@ class TransparentActivity : Activity() { val data = intent.getBundleExtra("data") val acceptIntent = CallkitIncomingBroadcastReceiver.getIntentAccept(this@TransparentActivity, data) sendBroadcast(acceptIntent) + if(isTaskRoot) { + val intent = packageManager.getLaunchIntentForPackage(packageName)?.cloneFilter() + intent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK) + startActivity(intent) + } } "CALLBACK" -> { val data = intent.getBundleExtra("data") diff --git a/android/src/main/res/drawable-xxxhdpi/ic_default_avatar.png b/android/src/main/res/drawable-xxxhdpi/ic_default_avatar.png index e7596cc4..e69f2271 100644 Binary files a/android/src/main/res/drawable-xxxhdpi/ic_default_avatar.png and b/android/src/main/res/drawable-xxxhdpi/ic_default_avatar.png differ diff --git a/android/src/main/res/layout/layout_custom_miss_notification.xml b/android/src/main/res/layout/layout_custom_miss_notification.xml index 8864abae..9f472823 100644 --- a/android/src/main/res/layout/layout_custom_miss_notification.xml +++ b/android/src/main/res/layout/layout_custom_miss_notification.xml @@ -4,20 +4,19 @@ android:layout_height="wrap_content" android:orientation="vertical"> - @@ -25,7 +24,7 @@ @@ -37,10 +36,10 @@ android:id="@+id/ivAvatar" android:layout_width="@dimen/base_margin_x4" android:layout_height="@dimen/base_margin_x4" - android:layout_alignParentRight="true" android:scaleType="centerCrop" - android:visibility="invisible" /> - + android:visibility="visible" + android:src="@drawable/ic_default_avatar"/> + - @@ -27,7 +26,7 @@ @@ -37,13 +36,12 @@ - + android:src="@drawable/ic_default_avatar" + android:visibility="visible" /> + + android:layout_marginRight="@dimen/base_margin_half" + android:layout_marginLeft="@dimen/base_margin_half" + android:textColor="@color/action_text" /> + + + android:layout_marginRight="@dimen/base_margin_half" + android:layout_marginLeft="@dimen/base_margin_half" + android:textColor="@color/action_text" /> @@ -123,5 +129,3 @@ - - \ No newline at end of file diff --git a/android/src/main/res/layout/layout_custom_small_ex_notification.xml b/android/src/main/res/layout/layout_custom_small_ex_notification.xml new file mode 100644 index 00000000..ce1d458e --- /dev/null +++ b/android/src/main/res/layout/layout_custom_small_ex_notification.xml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/src/main/res/layout/layout_custom_small_notification.xml b/android/src/main/res/layout/layout_custom_small_notification.xml new file mode 100644 index 00000000..6e104770 --- /dev/null +++ b/android/src/main/res/layout/layout_custom_small_notification.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/src/main/res/values/dimens.xml b/android/src/main/res/values/dimens.xml index c901e6a8..c02fd5c7 100644 --- a/android/src/main/res/values/dimens.xml +++ b/android/src/main/res/values/dimens.xml @@ -8,6 +8,7 @@ 30dp 35dp 40dp + 48dp 50dp 60dp diff --git a/example/assets/test.png b/example/assets/test.png new file mode 100644 index 00000000..f20f3373 Binary files /dev/null and b/example/assets/test.png differ diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 6cb0fa8e..f3b9703c 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,5 +1,4 @@ PODS: - - CryptoSwift (1.5.1) - Firebase/CoreOnly (8.15.0): - FirebaseCore (= 8.15.0) - Firebase/Messaging (8.15.0): @@ -36,9 +35,6 @@ PODS: - GoogleUtilities/UserDefaults (~> 7.7) - nanopb (~> 2.30908.0) - Flutter (1.0.0) - - flutter_callkit_incoming (0.0.1): - - CryptoSwift - - Flutter - GoogleDataTransport (9.1.4): - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30910.0, >= 2.30908.0) @@ -71,11 +67,9 @@ DEPENDENCIES: - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - Flutter (from `Flutter`) - - flutter_callkit_incoming (from `.symlinks/plugins/flutter_callkit_incoming/ios`) SPEC REPOS: trunk: - - CryptoSwift - Firebase - FirebaseCore - FirebaseCoreDiagnostics @@ -93,11 +87,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/firebase_messaging/ios" Flutter: :path: Flutter - flutter_callkit_incoming: - :path: ".symlinks/plugins/flutter_callkit_incoming/ios" SPEC CHECKSUMS: - CryptoSwift: c4f2debceb38bf44c80659afe009f71e23e4a082 Firebase: 5f8193dff4b5b7c5d5ef72ae54bb76c08e2b841d firebase_core: aa1b92020533f5c23955e388c347c58fd64f8627 firebase_messaging: b33237c4497357a8cac939cbfedb0c415fbddcc2 @@ -106,7 +97,6 @@ SPEC CHECKSUMS: FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd FirebaseMessaging: 5e5118a2383b3531e730d974680954c679ca0a13 Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a - flutter_callkit_incoming: 417dd1b46541cdd5d855ad795ccbe97d1c18155e GoogleDataTransport: 5fffe35792f8b96ec8d6775f5eccd83c998d5a3b GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1 nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 diff --git a/example/lib/home_page.dart b/example/lib/home_page.dart index f7a49902..e32acec4 100644 --- a/example/lib/home_page.dart +++ b/example/lib/home_page.dart @@ -128,7 +128,7 @@ class HomePageState extends State { 'avatar': 'https://i.pravatar.cc/100', 'handle': '0123456789', 'type': 0, - 'duration': 10000, + 'duration': 30000, 'textAccept': 'Accept', 'textDecline': 'Decline', 'textMissedCall': 'Missed call', @@ -145,7 +145,7 @@ class HomePageState extends State { 'isShowMissedCallNotification': true, 'ringtonePath': 'system_ringtone_default', 'backgroundColor': '#0955fa', - 'background': 'https://i.pravatar.cc/500', + 'backgroundUrl': 'assets/test.png', 'actionColor': '#4CAF50' }, 'ios': { diff --git a/example/lib/main.dart b/example/lib/main.dart index d30b1478..87743170 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -34,7 +34,7 @@ Future showCallkitIncoming(String uuid) async { 'isShowCallback': false, 'ringtonePath': 'system_ringtone_default', 'backgroundColor': '#0955fa', - 'background': 'https://i.pravatar.cc/500', + 'backgroundUrl': 'https://i.pravatar.cc/500', 'actionColor': '#4CAF50' }, 'ios': { diff --git a/example/pubspec.lock b/example/pubspec.lock index bd939b3f..29f374c3 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -117,7 +117,7 @@ packages: path: ".." relative: true source: path - version: "1.0.2" + version: "1.0.2+1" flutter_test: dependency: "direct dev" description: flutter diff --git a/example/pubspec.yaml b/example/pubspec.yaml index b6d878a8..abeffb02 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -45,8 +45,8 @@ flutter: uses-material-design: true # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg + assets: + - assets/test.png # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see diff --git a/pubspec.yaml b/pubspec.yaml index 8c38f9b7..da05de40 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_callkit_incoming description: Flutter Callkit Incoming to show callkit screen in your Flutter app. -version: 1.0.2+1 +version: 1.0.2+2 homepage: https://github.com/hiennguyen92/flutter_callkit_incoming repository: https://github.com/hiennguyen92/flutter_callkit_incoming issue_tracker: https://github.com/hiennguyen92/flutter_callkit_incoming/issues