mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-24 22:15:41 +03:00
hide logos for conversation list and lockscreen if app is not nextcloud
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
ff52e8ebb4
commit
6f90623cab
4 changed files with 37 additions and 2 deletions
|
@ -101,6 +101,7 @@ import com.nextcloud.talk.ui.dialog.ConversationsListBottomDialog
|
|||
import com.nextcloud.talk.ui.dialog.FilterConversationFragment
|
||||
import com.nextcloud.talk.users.UserManager
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.BrandingUtils
|
||||
import com.nextcloud.talk.utils.CapabilitiesUtil.hasSpreedFeatureCapability
|
||||
import com.nextcloud.talk.utils.CapabilitiesUtil.isServerEOL
|
||||
import com.nextcloud.talk.utils.CapabilitiesUtil.isUnifiedSearchAvailable
|
||||
|
@ -959,6 +960,8 @@ class ConversationsListActivity :
|
|||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun prepareViews() {
|
||||
hideLogoForBrandedClients()
|
||||
|
||||
layoutManager = SmoothScrollLinearLayoutManager(this)
|
||||
binding.recyclerView.layoutManager = layoutManager
|
||||
binding.recyclerView.setHasFixedSize(true)
|
||||
|
@ -1019,6 +1022,12 @@ class ConversationsListActivity :
|
|||
binding?.newMentionPopupBubble?.let { viewThemeUtils.material.colorMaterialButtonPrimaryFilled(it) }
|
||||
}
|
||||
|
||||
private fun hideLogoForBrandedClients() {
|
||||
if (!BrandingUtils.isOriginalNextcloudClient(applicationContext)) {
|
||||
binding.emptyListIcon.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||
private fun checkToShowUnreadBubble() {
|
||||
|
|
|
@ -36,6 +36,7 @@ import com.nextcloud.talk.application.NextcloudTalkApplication
|
|||
import com.nextcloud.talk.arbitrarystorage.ArbitraryStorageManager
|
||||
import com.nextcloud.talk.databinding.ActivityDiagnoseBinding
|
||||
import com.nextcloud.talk.users.UserManager
|
||||
import com.nextcloud.talk.utils.BrandingUtils
|
||||
import com.nextcloud.talk.utils.ClosedInterfaceImpl
|
||||
import com.nextcloud.talk.utils.DisplayUtils
|
||||
import com.nextcloud.talk.utils.NotificationUtils
|
||||
|
@ -115,8 +116,7 @@ class DiagnoseActivity : BaseActivity() {
|
|||
|
||||
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
||||
super.onPrepareOptionsMenu(menu)
|
||||
menu.findItem(R.id.create_issue).isVisible =
|
||||
applicationContext.packageName.equals(ORIGINAL_NEXTCLOUD_TALK_APPLICATION_ID)
|
||||
menu.findItem(R.id.create_issue).isVisible = BrandingUtils.isOriginalNextcloudClient(applicationContext)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.app.KeyguardManager
|
|||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.activity.result.ActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
@ -21,6 +22,7 @@ import autodagger.AutoInjector
|
|||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.databinding.ActivityLockedBinding
|
||||
import com.nextcloud.talk.utils.BrandingUtils
|
||||
import com.nextcloud.talk.utils.SecurityUtils
|
||||
import com.nextcloud.talk.utils.preferences.AppPreferences
|
||||
import java.util.concurrent.Executor
|
||||
|
@ -55,6 +57,7 @@ class LockedActivity : AppCompatActivity() {
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
hideLogoForBrandedClients()
|
||||
|
||||
binding.unlockContainer.setOnClickListener {
|
||||
checkIfWeAreSecure()
|
||||
|
@ -62,6 +65,12 @@ class LockedActivity : AppCompatActivity() {
|
|||
checkIfWeAreSecure()
|
||||
}
|
||||
|
||||
private fun hideLogoForBrandedClients() {
|
||||
if (!BrandingUtils.isOriginalNextcloudClient(applicationContext)) {
|
||||
binding.appLogo.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkIfWeAreSecure() {
|
||||
val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager?
|
||||
if (keyguardManager?.isKeyguardSecure == true && appPreferences.isScreenLocked) {
|
||||
|
|
17
app/src/main/java/com/nextcloud/talk/utils/BrandingUtils.kt
Normal file
17
app/src/main/java/com/nextcloud/talk/utils/BrandingUtils.kt
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Nextcloud Talk - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2024 Marcel Hibbe <dev@mhibbe.de>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
package com.nextcloud.talk.utils
|
||||
|
||||
import android.content.Context
|
||||
|
||||
object BrandingUtils {
|
||||
private const val ORIGINAL_NEXTCLOUD_TALK_APPLICATION_ID = "com.nextcloud.talk2"
|
||||
|
||||
fun isOriginalNextcloudClient(context: Context): Boolean {
|
||||
return context.packageName.equals(ORIGINAL_NEXTCLOUD_TALK_APPLICATION_ID)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue