diff --git a/chat/src/main/java/org/navgurukul/chat/core/di/ChatModules.kt b/chat/src/main/java/org/navgurukul/chat/core/di/ChatModules.kt index 29888c01e..1043a6739 100644 --- a/chat/src/main/java/org/navgurukul/chat/core/di/ChatModules.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/di/ChatModules.kt @@ -21,7 +21,7 @@ import org.navgurukul.chat.core.error.ChatErrorFormatter import org.navgurukul.chat.core.pushers.PushersManager import org.navgurukul.chat.core.repo.* import org.navgurukul.chat.core.resources.* -import org.merakilearn.core.utils.DimensionConverter +import org.navgurukul.chat.core.utils.DimensionConverter import org.navgurukul.chat.features.crypto.KeyRequestHandler import org.navgurukul.chat.features.grouplist.SelectedGroupDataSource import org.navgurukul.chat.features.home.AvatarRenderer diff --git a/chat/src/main/java/org/navgurukul/chat/core/extensions/TextView.kt b/chat/src/main/java/org/navgurukul/chat/core/extensions/TextView.kt index 16fc6884a..4817f9ac8 100644 --- a/chat/src/main/java/org/navgurukul/chat/core/extensions/TextView.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/extensions/TextView.kt @@ -10,7 +10,7 @@ import androidx.annotation.StringRes import androidx.core.view.isVisible import com.google.android.material.snackbar.Snackbar import org.navgurukul.chat.R -import org.merakilearn.core.utils.copyToClipboard +import org.navgurukul.chat.core.utils.copyToClipboard import org.navgurukul.commonui.themes.ThemeUtils /** diff --git a/chat/src/main/java/org/navgurukul/chat/core/intent/MerakiMimeType.kt b/chat/src/main/java/org/navgurukul/chat/core/intent/MerakiMimeType.kt index 7e4b68c55..e3e83e20a 100644 --- a/chat/src/main/java/org/navgurukul/chat/core/intent/MerakiMimeType.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/intent/MerakiMimeType.kt @@ -3,7 +3,7 @@ package org.navgurukul.chat.core.intent import android.content.Context import android.net.Uri import android.webkit.MimeTypeMap -import org.merakilearn.core.utils.getFileExtension +import org.navgurukul.chat.core.utils.getFileExtension import timber.log.Timber /** diff --git a/chat/src/main/java/org/navgurukul/chat/core/repo/ActiveSessionDataSource.kt b/chat/src/main/java/org/navgurukul/chat/core/repo/ActiveSessionDataSource.kt index 5b9ba680a..cdbcb817e 100644 --- a/chat/src/main/java/org/navgurukul/chat/core/repo/ActiveSessionDataSource.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/repo/ActiveSessionDataSource.kt @@ -2,6 +2,6 @@ package org.navgurukul.chat.core.repo import arrow.core.Option import org.matrix.android.sdk.api.session.Session -import org.merakilearn.core.utils.BehaviorDataSource +import org.navgurukul.chat.core.utils.BehaviorDataSource class ActiveSessionDataSource : BehaviorDataSource>() diff --git a/chat/src/main/java/org/navgurukul/chat/core/repo/AuthenticationRepository.kt b/chat/src/main/java/org/navgurukul/chat/core/repo/AuthenticationRepository.kt index b2903ad40..6e69b6dae 100644 --- a/chat/src/main/java/org/navgurukul/chat/core/repo/AuthenticationRepository.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/repo/AuthenticationRepository.kt @@ -13,7 +13,7 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.navgurukul.chat.R import org.navgurukul.chat.core.extensions.configureAndStart -import org.merakilearn.core.utils.deleteAllFiles +import org.navgurukul.chat.core.utils.deleteAllFiles import org.navgurukul.chat.features.settings.ChatPreferences import org.navgurukul.commonui.resources.StringProvider import kotlin.coroutines.resume diff --git a/core/src/main/java/org/merakilearn/core/utils/DataSource.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/DataSource.kt similarity index 100% rename from core/src/main/java/org/merakilearn/core/utils/DataSource.kt rename to chat/src/main/java/org/navgurukul/chat/core/utils/DataSource.kt diff --git a/core/src/main/java/org/merakilearn/core/utils/DebouncedClickListener.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/DebouncedClickListener.kt similarity index 94% rename from core/src/main/java/org/merakilearn/core/utils/DebouncedClickListener.kt rename to chat/src/main/java/org/navgurukul/chat/core/utils/DebouncedClickListener.kt index dd67d5f63..e015f2a94 100644 --- a/core/src/main/java/org/merakilearn/core/utils/DebouncedClickListener.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/utils/DebouncedClickListener.kt @@ -1,4 +1,4 @@ -package org.merakilearn.core.utils +package org.navgurukul.chat.core.utils import android.view.View import java.util.* diff --git a/core/src/main/java/org/merakilearn/core/utils/Debouncer.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/Debouncer.kt similarity index 96% rename from core/src/main/java/org/merakilearn/core/utils/Debouncer.kt rename to chat/src/main/java/org/navgurukul/chat/core/utils/Debouncer.kt index 8b8b91d18..aa05c9111 100644 --- a/core/src/main/java/org/merakilearn/core/utils/Debouncer.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/utils/Debouncer.kt @@ -1,4 +1,4 @@ -package org.merakilearn.core.utils +package org.navgurukul.chat.core.utils import android.os.Handler diff --git a/core/src/main/java/org/merakilearn/core/utils/DefaultSubscriber.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/DefaultSubscriber.kt similarity index 96% rename from core/src/main/java/org/merakilearn/core/utils/DefaultSubscriber.kt rename to chat/src/main/java/org/navgurukul/chat/core/utils/DefaultSubscriber.kt index a43ac9d4e..4a37eb3e8 100644 --- a/core/src/main/java/org/merakilearn/core/utils/DefaultSubscriber.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/utils/DefaultSubscriber.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.merakilearn.core.utils +package org.navgurukul.chat.core.utils import io.reactivex.Completable import io.reactivex.Single diff --git a/core/src/main/java/org/merakilearn/core/utils/DimensionConverter.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/DimensionConverter.kt similarity index 94% rename from core/src/main/java/org/merakilearn/core/utils/DimensionConverter.kt rename to chat/src/main/java/org/navgurukul/chat/core/utils/DimensionConverter.kt index b5fa94edf..c61593068 100644 --- a/core/src/main/java/org/merakilearn/core/utils/DimensionConverter.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/utils/DimensionConverter.kt @@ -1,4 +1,4 @@ -package org.merakilearn.core.utils +package org.navgurukul.chat.core.utils import android.content.res.Resources import android.util.TypedValue diff --git a/core/src/main/java/org/merakilearn/core/utils/Emoji.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/Emoji.kt similarity index 99% rename from core/src/main/java/org/merakilearn/core/utils/Emoji.kt rename to chat/src/main/java/org/navgurukul/chat/core/utils/Emoji.kt index 8c201e4ef..8b67c3d37 100644 --- a/core/src/main/java/org/merakilearn/core/utils/Emoji.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/utils/Emoji.kt @@ -1,4 +1,4 @@ -package org.merakilearn.core.utils +package org.navgurukul.chat.core.utils import java.util.regex.Pattern diff --git a/core/src/main/java/org/merakilearn/core/utils/EvenBetterLinkMovementMethod.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/EvenBetterLinkMovementMethod.kt similarity index 97% rename from core/src/main/java/org/merakilearn/core/utils/EvenBetterLinkMovementMethod.kt rename to chat/src/main/java/org/navgurukul/chat/core/utils/EvenBetterLinkMovementMethod.kt index aed2f1942..abd09fbfb 100644 --- a/core/src/main/java/org/merakilearn/core/utils/EvenBetterLinkMovementMethod.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/utils/EvenBetterLinkMovementMethod.kt @@ -1,4 +1,4 @@ -package org.merakilearn.core.utils +package org.navgurukul.chat.core.utils import android.text.Spanned import android.text.style.ClickableSpan diff --git a/core/src/main/java/org/merakilearn/core/utils/ExternalApplicationsUtil.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/ExternalApplicationsUtil.kt similarity index 98% rename from core/src/main/java/org/merakilearn/core/utils/ExternalApplicationsUtil.kt rename to chat/src/main/java/org/navgurukul/chat/core/utils/ExternalApplicationsUtil.kt index 7d87e3518..4d7ed48b1 100644 --- a/core/src/main/java/org/merakilearn/core/utils/ExternalApplicationsUtil.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/utils/ExternalApplicationsUtil.kt @@ -1,4 +1,4 @@ -package org.merakilearn.core.utils +package org.navgurukul.chat.core.utils import android.content.ActivityNotFoundException import android.content.Context diff --git a/core/src/main/java/org/merakilearn/core/utils/FileUtils.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/FileUtils.kt similarity index 98% rename from core/src/main/java/org/merakilearn/core/utils/FileUtils.kt rename to chat/src/main/java/org/navgurukul/chat/core/utils/FileUtils.kt index 0ad00a03f..d2b3b5282 100644 --- a/core/src/main/java/org/merakilearn/core/utils/FileUtils.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/utils/FileUtils.kt @@ -1,4 +1,4 @@ -package org.merakilearn.core.utils +package org.navgurukul.chat.core.utils import timber.log.Timber import java.io.File diff --git a/core/src/main/java/org/merakilearn/core/utils/Handler.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/Handler.kt similarity index 95% rename from core/src/main/java/org/merakilearn/core/utils/Handler.kt rename to chat/src/main/java/org/navgurukul/chat/core/utils/Handler.kt index 9967fbcb9..d857bf7c1 100644 --- a/core/src/main/java/org/merakilearn/core/utils/Handler.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/utils/Handler.kt @@ -16,7 +16,7 @@ */ -package org.merakilearn.core.utils +package org.navgurukul.chat.core.utils import android.os.Handler import android.os.HandlerThread diff --git a/chat/src/main/java/org/navgurukul/chat/core/utils/SystemUtils.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/SystemUtils.kt new file mode 100644 index 000000000..3ebef6f96 --- /dev/null +++ b/chat/src/main/java/org/navgurukul/chat/core/utils/SystemUtils.kt @@ -0,0 +1,164 @@ +package org.navgurukul.chat.core.utils + +import android.annotation.TargetApi +import android.app.Activity +import android.content.ActivityNotFoundException +import android.content.ClipData +import android.content.ClipboardManager +import android.content.Context +import android.content.Intent +import android.net.Uri +import android.os.Build +import android.os.PowerManager +import android.provider.Settings +import android.widget.Toast +import androidx.annotation.StringRes +import androidx.appcompat.app.AppCompatActivity +import androidx.fragment.app.Fragment +import org.navgurukul.chat.R +import org.navgurukul.chat.features.notifications.NotificationUtils + +/** + * Tells if the application ignores battery optimizations. + * + * Ignoring them allows the app to run in background to make background sync with the homeserver. + * This user option appears on Android M but Android O enforces its usage and kills apps not + * authorised by the user to run in background. + * + * @param context the context + * @return true if battery optimisations are ignored + */ +fun isIgnoringBatteryOptimizations(context: Context): Boolean { + // no issue before Android M, battery optimisations did not exist + return Build.VERSION.SDK_INT < Build.VERSION_CODES.M + || (context.getSystemService(Context.POWER_SERVICE) as PowerManager?)?.isIgnoringBatteryOptimizations(context.packageName) == true +} + +fun isAirplaneModeOn(context: Context): Boolean { + return Settings.Global.getInt(context.contentResolver, Settings.Global.AIRPLANE_MODE_ON, 0) != 0 +} + +/** + * display the system dialog for granting this permission. If previously granted, the + * system will not show it (so you should call this method). + * + * Note: If the user finally does not grant the permission, PushManager.isBackgroundSyncAllowed() + * will return false and the notification privacy will fallback to "LOW_DETAIL". + */ +@TargetApi(Build.VERSION_CODES.M) +fun requestDisablingBatteryOptimization(activity: Activity, fragment: Fragment?, requestCode: Int) { + val intent = Intent() + intent.action = Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS + intent.data = Uri.parse("package:" + activity.packageName) + if (fragment != null) { + fragment.startActivityForResult(intent, requestCode) + } else { + activity.startActivityForResult(intent, requestCode) + } +} + +// ============================================================================================================== +// Clipboard helper +// ============================================================================================================== + +/** + * Copy a text to the clipboard, and display a Toast when done + * + * @param context the context + * @param text the text to copy + */ +fun copyToClipboard(context: Context, text: CharSequence, showToast: Boolean = true, @StringRes toastMessage: Int = R.string.copied_to_clipboard) { + val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager + clipboard.setPrimaryClip(ClipData.newPlainText("", text)) + if (showToast) { + context.toast(toastMessage) + } +} + +/** + * Shows notification settings for the current app. + * In android O will directly opens the notification settings, in lower version it will show the App settings + */ +fun startNotificationSettingsIntent(activity: AppCompatActivity, requestCode: Int) { + val intent = Intent() + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS + intent.putExtra(Settings.EXTRA_APP_PACKAGE, activity.packageName) + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS + intent.putExtra("app_package", activity.packageName) + intent.putExtra("app_uid", activity.applicationInfo?.uid) + } else { + intent.action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS + intent.addCategory(Intent.CATEGORY_DEFAULT) + val uri = Uri.fromParts("package", activity.packageName, null) + intent.data = uri + } + activity.startActivityForResult(intent, requestCode) +} + +/** + * Shows notification system settings for the given channel id. + */ +@TargetApi(Build.VERSION_CODES.O) +fun startNotificationChannelSettingsIntent(fragment: Fragment, channelID: String) { + if (!NotificationUtils.supportNotificationChannels()) return + val intent = Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS).apply { + putExtra(Settings.EXTRA_APP_PACKAGE, fragment.context?.packageName) + putExtra(Settings.EXTRA_CHANNEL_ID, channelID) + } + fragment.startActivity(intent) +} + +fun startAddGoogleAccountIntent(context: AppCompatActivity, requestCode: Int) { + try { + val intent = Intent(Settings.ACTION_ADD_ACCOUNT) + intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, arrayOf("com.google")) + context.startActivityForResult(intent, requestCode) + } catch (activityNotFoundException: ActivityNotFoundException) { + context.toast(R.string.error_no_external_application_found) + } +} + +fun startSharePlainTextIntent(fragment: Fragment, chooserTitle: String?, text: String, subject: String? = null, requestCode: Int? = null) { + val share = Intent(Intent.ACTION_SEND) + share.type = "text/plain" + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + share.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT) + } else { + share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK) + } + // Add data to the intent, the receiving app will decide what to do with it. + share.putExtra(Intent.EXTRA_SUBJECT, subject) + share.putExtra(Intent.EXTRA_TEXT, text) + try { + if (requestCode != null) { + fragment.startActivityForResult(Intent.createChooser(share, chooserTitle), requestCode) + } else { + fragment.startActivity(Intent.createChooser(share, chooserTitle)) + } + } catch (activityNotFoundException: ActivityNotFoundException) { + fragment.activity?.toast(R.string.error_no_external_application_found) + } +} + +fun startImportTextFromFileIntent(fragment: Fragment, requestCode: Int) { + val intent = Intent(Intent.ACTION_GET_CONTENT).apply { + type = "text/plain" + } + if (intent.resolveActivity(fragment.requireActivity().packageManager) != null) { + fragment.startActivityForResult(intent, requestCode) + } else { + fragment.activity?.toast(R.string.error_no_external_application_found) + } +} + +// Not in KTX anymore +fun Context.toast(resId: Int) { + Toast.makeText(this, resId, Toast.LENGTH_SHORT).show() +} + +// Not in KTX anymore +fun Context.toast(message: String) { + Toast.makeText(this, message, Toast.LENGTH_SHORT).show() +} diff --git a/core/src/main/java/org/merakilearn/core/utils/TextUtils.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/TextUtils.kt similarity index 98% rename from core/src/main/java/org/merakilearn/core/utils/TextUtils.kt rename to chat/src/main/java/org/navgurukul/chat/core/utils/TextUtils.kt index 168172981..457814796 100644 --- a/core/src/main/java/org/merakilearn/core/utils/TextUtils.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/utils/TextUtils.kt @@ -1,4 +1,4 @@ -package org.merakilearn.core.utils +package org.navgurukul.chat.core.utils import android.content.Context import android.os.Build diff --git a/core/src/main/java/org/merakilearn/core/utils/UrlUtils.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/UrlUtils.kt similarity index 94% rename from core/src/main/java/org/merakilearn/core/utils/UrlUtils.kt rename to chat/src/main/java/org/navgurukul/chat/core/utils/UrlUtils.kt index 69e492499..b9abe135b 100644 --- a/core/src/main/java/org/merakilearn/core/utils/UrlUtils.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/utils/UrlUtils.kt @@ -1,4 +1,4 @@ -package org.merakilearn.core.utils +package org.navgurukul.chat.core.utils import java.net.URL diff --git a/core/src/main/java/org/merakilearn/core/utils/UserColor.kt b/chat/src/main/java/org/navgurukul/chat/core/utils/UserColor.kt similarity index 97% rename from core/src/main/java/org/merakilearn/core/utils/UserColor.kt rename to chat/src/main/java/org/navgurukul/chat/core/utils/UserColor.kt index e48d7e0de..57739aa53 100644 --- a/core/src/main/java/org/merakilearn/core/utils/UserColor.kt +++ b/chat/src/main/java/org/navgurukul/chat/core/utils/UserColor.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.merakilearn.core.utils +package org.navgurukul.chat.core.utils import androidx.annotation.ColorRes import org.navgurukul.chat.R diff --git a/chat/src/main/java/org/navgurukul/chat/features/grouplist/SelectedGroupDataSource.kt b/chat/src/main/java/org/navgurukul/chat/features/grouplist/SelectedGroupDataSource.kt index 1d8c92fb3..78c915db6 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/grouplist/SelectedGroupDataSource.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/grouplist/SelectedGroupDataSource.kt @@ -2,6 +2,6 @@ package org.navgurukul.chat.features.grouplist import arrow.core.Option import org.matrix.android.sdk.api.session.group.model.GroupSummary -import org.merakilearn.core.utils.BehaviorDataSource +import org.navgurukul.chat.core.utils.BehaviorDataSource class SelectedGroupDataSource : BehaviorDataSource>(Option.empty()) diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/AvatarRenderer.kt b/chat/src/main/java/org/navgurukul/chat/features/home/AvatarRenderer.kt index c09a2b359..df71f643d 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/AvatarRenderer.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/AvatarRenderer.kt @@ -18,8 +18,8 @@ import org.navgurukul.chat.core.glide.GlideApp import org.navgurukul.chat.core.glide.GlideRequest import org.navgurukul.chat.core.glide.GlideRequests import org.navgurukul.chat.core.repo.ActiveSessionHolder -import org.merakilearn.core.utils.getColorFromRoomId -import org.merakilearn.core.utils.getColorFromUserId +import org.navgurukul.chat.core.utils.getColorFromRoomId +import org.navgurukul.chat.core.utils.getColorFromUserId /** * This helper centralise ways to retrieve avatar into ImageView or even generic Target diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/HomeRoomListDataSource.kt b/chat/src/main/java/org/navgurukul/chat/features/home/HomeRoomListDataSource.kt index 230f35982..9b57024a4 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/HomeRoomListDataSource.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/HomeRoomListDataSource.kt @@ -1,6 +1,6 @@ package org.navgurukul.chat.features.home import org.matrix.android.sdk.api.session.room.model.RoomSummary -import org.merakilearn.core.utils.BehaviorDataSource +import org.navgurukul.chat.core.utils.BehaviorDataSource class HomeRoomListDataSource : BehaviorDataSource>() diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/JumpToBottomViewVisibilityManager.kt b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/JumpToBottomViewVisibilityManager.kt index b8d09923d..e4cf8f77e 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/JumpToBottomViewVisibilityManager.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/JumpToBottomViewVisibilityManager.kt @@ -3,7 +3,7 @@ package org.navgurukul.chat.features.home.room.detail import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.google.android.material.floatingactionbutton.FloatingActionButton -import org.merakilearn.core.utils.Debouncer +import org.navgurukul.chat.core.utils.Debouncer /** * Show or hide the jumpToBottomView, depending on the scrolling and if the timeline is displaying the more recent event diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/RoomDetailFragment.kt b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/RoomDetailFragment.kt index 3bcb345c9..fa1ee7eb7 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/RoomDetailFragment.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/RoomDetailFragment.kt @@ -57,8 +57,8 @@ import org.navgurukul.chat.core.dialogs.withColoredButton import org.navgurukul.chat.core.extensions.* import org.navgurukul.chat.core.glide.GlideApp import org.navgurukul.chat.core.repo.ActiveSessionHolder -import org.merakilearn.core.utils.* -import org.merakilearn.core.utils.createUIHandler +import org.navgurukul.chat.core.utils.* +import org.navgurukul.chat.core.utils.createUIHandler import org.navgurukul.chat.core.views.NotificationAreaView import org.navgurukul.chat.features.home.AvatarRenderer import org.navgurukul.chat.features.home.room.detail.composer.TextComposerView diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/RoomDetailFragmentViewModel.kt b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/RoomDetailFragmentViewModel.kt index ebea03d98..437b09224 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/RoomDetailFragmentViewModel.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/RoomDetailFragmentViewModel.kt @@ -36,8 +36,8 @@ import org.matrix.android.sdk.api.session.room.timeline.* import org.navgurukul.chat.R import org.navgurukul.chat.core.repo.ActiveSessionHolder import org.navgurukul.chat.core.resources.UserPreferencesProvider -import org.merakilearn.core.utils.isValidUrl -import org.merakilearn.core.utils.subscribeLogError +import org.navgurukul.chat.core.utils.isValidUrl +import org.navgurukul.chat.core.utils.subscribeLogError import org.navgurukul.chat.features.command.CommandParser import org.navgurukul.chat.features.command.ParsedCommand import org.navgurukul.chat.features.home.room.TypingHelper diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/MessageColorProvider.kt b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/MessageColorProvider.kt index 2aa83dca6..beebadbb1 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/MessageColorProvider.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/MessageColorProvider.kt @@ -4,7 +4,7 @@ import androidx.annotation.ColorInt import org.matrix.android.sdk.api.session.room.send.SendState import org.navgurukul.chat.R import org.navgurukul.chat.core.resources.ColorProvider -import org.merakilearn.core.utils.getColorFromUserId +import org.navgurukul.chat.core.utils.getColorFromUserId class MessageColorProvider( private val colorProvider: ColorProvider diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/action/MessageActionsBottomSheet.kt b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/action/MessageActionsBottomSheet.kt index 5e8530590..abdd59a2e 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/action/MessageActionsBottomSheet.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/action/MessageActionsBottomSheet.kt @@ -22,7 +22,7 @@ import org.navgurukul.chat.core.extensions.KEY_ARG import org.navgurukul.chat.core.extensions.args import org.navgurukul.chat.core.extensions.cleanup import org.navgurukul.chat.core.extensions.configureWith -import org.merakilearn.core.utils.DimensionConverter +import org.navgurukul.chat.core.utils.DimensionConverter import org.navgurukul.chat.features.home.room.detail.timeline.item.MessageInformationData @Parcelize diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/factory/MessageItemFactory.kt index 45df4c06b..2198a7c83 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/factory/MessageItemFactory.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/factory/MessageItemFactory.kt @@ -20,10 +20,10 @@ import org.navgurukul.chat.R import org.navgurukul.chat.core.epoxy.MerakiEpoxyModel import org.navgurukul.chat.core.repo.ActiveSessionHolder import org.navgurukul.chat.core.resources.ColorProvider -import org.merakilearn.core.utils.DebouncedClickListener -import org.merakilearn.core.utils.DimensionConverter -import org.merakilearn.core.utils.containsOnlyEmojis -import org.merakilearn.core.utils.isLocalFile +import org.navgurukul.chat.core.utils.DebouncedClickListener +import org.navgurukul.chat.core.utils.DimensionConverter +import org.navgurukul.chat.core.utils.containsOnlyEmojis +import org.navgurukul.chat.core.utils.isLocalFile import org.navgurukul.chat.features.home.room.detail.timeline.TimelineEventController import org.navgurukul.chat.features.home.room.detail.timeline.helper.* import org.navgurukul.chat.features.home.room.detail.timeline.item.* diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/helper/AvatarSizeProvider.kt b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/helper/AvatarSizeProvider.kt index 2dbff7f63..c34202011 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/helper/AvatarSizeProvider.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/helper/AvatarSizeProvider.kt @@ -1,6 +1,6 @@ package org.navgurukul.chat.features.home.room.detail.timeline.helper -import org.merakilearn.core.utils.DimensionConverter +import org.navgurukul.chat.core.utils.DimensionConverter class AvatarSizeProvider(private val dimensionConverter: DimensionConverter) { diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/helper/ContentUploadStateTrackerBinder.kt b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/helper/ContentUploadStateTrackerBinder.kt index 0f1c81e35..9aa71211a 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/helper/ContentUploadStateTrackerBinder.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/helper/ContentUploadStateTrackerBinder.kt @@ -9,7 +9,7 @@ import org.matrix.android.sdk.api.session.content.ContentUploadStateTracker import org.matrix.android.sdk.api.session.room.send.SendState import org.navgurukul.chat.R import org.navgurukul.chat.core.repo.ActiveSessionHolder -import org.merakilearn.core.utils.TextUtils.formatFileSize +import org.navgurukul.chat.core.utils.TextUtils.formatFileSize import org.navgurukul.chat.features.home.room.detail.timeline.MessageColorProvider import org.navgurukul.commonui.error.ErrorFormatter diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt index 2f2c0aa22..265a23ea3 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt @@ -2,7 +2,7 @@ package org.navgurukul.chat.features.home.room.detail.timeline.helper import android.view.View import org.navgurukul.chat.EmojiCompatFontProvider -import org.merakilearn.core.utils.DebouncedClickListener +import org.navgurukul.chat.core.utils.DebouncedClickListener import org.navgurukul.chat.features.home.AvatarRenderer import org.navgurukul.chat.features.home.room.detail.timeline.MessageColorProvider import org.navgurukul.chat.features.home.room.detail.timeline.TimelineEventController diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/item/AbsMessageItem.kt b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/item/AbsMessageItem.kt index bc6747a88..2265dcc62 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/item/AbsMessageItem.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/item/AbsMessageItem.kt @@ -8,7 +8,7 @@ import android.widget.TextView import androidx.annotation.IdRes import com.airbnb.epoxy.EpoxyAttribute import org.navgurukul.chat.R -import org.merakilearn.core.utils.DebouncedClickListener +import org.navgurukul.chat.core.utils.DebouncedClickListener import org.navgurukul.chat.features.home.AvatarRenderer import org.navgurukul.chat.features.home.room.detail.timeline.MessageColorProvider import org.navgurukul.chat.features.home.room.detail.timeline.TimelineEventController diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/item/BaseEventItem.kt b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/item/BaseEventItem.kt index 7de12bf00..27e6d6eae 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/item/BaseEventItem.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/item/BaseEventItem.kt @@ -7,7 +7,7 @@ import androidx.annotation.IdRes import com.airbnb.epoxy.EpoxyAttribute import org.navgurukul.chat.core.epoxy.MerakiEpoxyHolder import org.navgurukul.chat.core.epoxy.MerakiEpoxyModel -import org.merakilearn.core.utils.DimensionConverter +import org.navgurukul.chat.core.utils.DimensionConverter /** * Children must override getViewType() diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/tools/EventRenderingTools.kt b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/tools/EventRenderingTools.kt index 4c449e93a..8d524e56a 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/tools/EventRenderingTools.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/room/detail/timeline/tools/EventRenderingTools.kt @@ -12,8 +12,8 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.navgurukul.chat.core.linkify.SaralLinkify -import org.merakilearn.core.utils.EvenBetterLinkMovementMethod -import org.merakilearn.core.utils.isValidUrl +import org.navgurukul.chat.core.utils.EvenBetterLinkMovementMethod +import org.navgurukul.chat.core.utils.isValidUrl import org.navgurukul.chat.features.home.room.detail.timeline.TimelineEventController import org.navgurukul.chat.features.html.PillImageSpan diff --git a/chat/src/main/java/org/navgurukul/chat/features/home/room/list/RoomSummaryItemFactory.kt b/chat/src/main/java/org/navgurukul/chat/features/home/room/list/RoomSummaryItemFactory.kt index 54a8d4c61..5eea23f78 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/home/room/list/RoomSummaryItemFactory.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/home/room/list/RoomSummaryItemFactory.kt @@ -22,7 +22,7 @@ import org.matrix.android.sdk.api.util.toMatrixItem import org.navgurukul.chat.core.date.SaralDateFormatter import org.navgurukul.chat.core.extensions.localDateTime import org.navgurukul.chat.core.resources.DateProvider -import org.merakilearn.core.utils.DebouncedClickListener +import org.navgurukul.chat.core.utils.DebouncedClickListener import org.navgurukul.chat.features.home.AvatarRenderer import org.navgurukul.chat.features.home.room.TypingHelper import org.navgurukul.chat.features.home.room.format.DisplayableEventFormatter diff --git a/chat/src/main/java/org/navgurukul/chat/features/media/ImageContentRenderer.kt b/chat/src/main/java/org/navgurukul/chat/features/media/ImageContentRenderer.kt index edf50a134..3b751a0b8 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/media/ImageContentRenderer.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/media/ImageContentRenderer.kt @@ -18,8 +18,8 @@ import org.navgurukul.chat.R import org.navgurukul.chat.core.glide.GlideApp import org.navgurukul.chat.core.glide.GlideRequest import org.navgurukul.chat.core.repo.ActiveSessionHolder -import org.merakilearn.core.utils.DimensionConverter -import org.merakilearn.core.utils.isLocalFile +import org.navgurukul.chat.core.utils.DimensionConverter +import org.navgurukul.chat.core.utils.isLocalFile import kotlin.math.min diff --git a/chat/src/main/java/org/navgurukul/chat/features/media/MerakiAttachmentViewerActivity.kt b/chat/src/main/java/org/navgurukul/chat/features/media/MerakiAttachmentViewerActivity.kt index e0cf6e275..a01ad641a 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/media/MerakiAttachmentViewerActivity.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/media/MerakiAttachmentViewerActivity.kt @@ -19,7 +19,7 @@ import org.koin.android.ext.android.inject import org.navgurukul.chat.R import org.navgurukul.chat.core.intent.getMimeTypeFromUri import org.navgurukul.chat.core.repo.ActiveSessionHolder -import org.merakilearn.core.utils.shareMedia +import org.navgurukul.chat.core.utils.shareMedia import org.navgurukul.chat.features.attachmentviewer.AttachmentCommands import org.navgurukul.chat.features.attachmentviewer.AttachmentViewerActivity import timber.log.Timber diff --git a/chat/src/main/java/org/navgurukul/chat/features/notifications/NotificationUtils.kt b/chat/src/main/java/org/navgurukul/chat/features/notifications/NotificationUtils.kt index 2e1efd152..713a28067 100755 --- a/chat/src/main/java/org/navgurukul/chat/features/notifications/NotificationUtils.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/notifications/NotificationUtils.kt @@ -18,7 +18,7 @@ import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import org.merakilearn.core.navigator.MerakiNavigator import org.navgurukul.chat.R -import org.merakilearn.core.utils.startNotificationChannelSettingsIntent +import org.navgurukul.chat.core.utils.startNotificationChannelSettingsIntent import org.navgurukul.chat.features.settings.ChatPreferences import org.navgurukul.commonui.resources.StringProvider import timber.log.Timber diff --git a/chat/src/main/java/org/navgurukul/chat/features/reactions/widget/ReactionButton.kt b/chat/src/main/java/org/navgurukul/chat/features/reactions/widget/ReactionButton.kt index 37c3a21a4..ba0129f28 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/reactions/widget/ReactionButton.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/reactions/widget/ReactionButton.kt @@ -23,7 +23,7 @@ import androidx.core.content.withStyledAttributes import org.koin.java.KoinJavaComponent.inject import org.navgurukul.chat.EmojiCompatWrapper import org.navgurukul.chat.R -import org.merakilearn.core.utils.TextUtils +import org.navgurukul.chat.core.utils.TextUtils /** * An animated reaction button. diff --git a/chat/src/main/java/org/navgurukul/chat/features/sync/SyncStateView.kt b/chat/src/main/java/org/navgurukul/chat/features/sync/SyncStateView.kt index 4bcde028c..cef96e494 100644 --- a/chat/src/main/java/org/navgurukul/chat/features/sync/SyncStateView.kt +++ b/chat/src/main/java/org/navgurukul/chat/features/sync/SyncStateView.kt @@ -8,7 +8,7 @@ import androidx.core.view.isVisible import org.matrix.android.sdk.api.session.sync.SyncState import kotlinx.android.synthetic.main.view_sync_state.view.* import org.navgurukul.chat.R -import org.merakilearn.core.utils.isAirplaneModeOn +import org.navgurukul.chat.core.utils.isAirplaneModeOn class SyncStateView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : FrameLayout(context, attrs, defStyle) { diff --git a/core/src/main/java/org/merakilearn/core/utils/SystemUtils.kt b/core/src/main/java/org/merakilearn/core/utils/SystemUtils.kt index 312d5e18a..71c27414c 100644 --- a/core/src/main/java/org/merakilearn/core/utils/SystemUtils.kt +++ b/core/src/main/java/org/merakilearn/core/utils/SystemUtils.kt @@ -1,4 +1,4 @@ -package org.merakilearn.core.utils +package org.navgurukul.chat.core.utils import android.annotation.TargetApi import android.app.Activity @@ -15,8 +15,7 @@ import android.widget.Toast import androidx.annotation.StringRes import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment -import org.navgurukul.chat.R -import org.navgurukul.chat.features.notifications.NotificationUtils +import org.merakilearn.core.R /** * Tells if the application ignores battery optimizations. @@ -97,18 +96,6 @@ fun startNotificationSettingsIntent(activity: AppCompatActivity, requestCode: In activity.startActivityForResult(intent, requestCode) } -/** - * Shows notification system settings for the given channel id. - */ -@TargetApi(Build.VERSION_CODES.O) -fun startNotificationChannelSettingsIntent(fragment: Fragment, channelID: String) { - if (!NotificationUtils.supportNotificationChannels()) return - val intent = Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS).apply { - putExtra(Settings.EXTRA_APP_PACKAGE, fragment.context?.packageName) - putExtra(Settings.EXTRA_CHANNEL_ID, channelID) - } - fragment.startActivity(intent) -} fun startAddGoogleAccountIntent(context: AppCompatActivity, requestCode: Int) { try { diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml new file mode 100644 index 000000000..c5145bdf1 --- /dev/null +++ b/core/src/main/res/values/strings.xml @@ -0,0 +1,6 @@ + + + Copied to clipboard + Sorry, no external application has been found to complete this action. + Initial Sync… + \ No newline at end of file diff --git a/playground/src/main/java/org/navgurukul/playground/ui/PythonPlaygroundActivity.kt b/playground/src/main/java/org/navgurukul/playground/ui/PythonPlaygroundActivity.kt index 4697338b4..1876399b8 100644 --- a/playground/src/main/java/org/navgurukul/playground/ui/PythonPlaygroundActivity.kt +++ b/playground/src/main/java/org/navgurukul/playground/ui/PythonPlaygroundActivity.kt @@ -1,7 +1,5 @@ package org.navgurukul.playground.ui -import android.content.ClipData -import android.content.ClipboardManager import android.content.Context import android.content.Intent import android.graphics.Typeface @@ -9,7 +7,6 @@ import android.os.Bundle import android.text.* import android.text.style.CharacterStyle import android.text.style.StyleSpan -import android.util.Log import android.view.* import android.view.inputmethod.EditorInfo import android.view.inputmethod.InputMethodManager @@ -23,16 +20,11 @@ import com.chaquo.python.Python import com.chaquo.python.android.AndroidPlatform import com.google.android.material.bottomsheet.BottomSheetBehavior import kotlinx.android.synthetic.main.bottom_sheet_output.* -import org.koin.android.ext.android.inject import org.koin.androidx.viewmodel.ext.android.viewModel -import org.merakilearn.core.navigator.ChatModuleNavigator -import org.merakilearn.core.navigator.MerakiNavigator -import org.merakilearn.core.utils.copyToClipboard +import org.navgurukul.chat.core.utils.copyToClipboard import org.navgurukul.playground.R import org.navgurukul.playground.custom.addTextAtCursorPosition import java.io.File -import java.util.regex.Matcher -import java.util.regex.Pattern class PythonPlaygroundActivity : AppCompatActivity() {