mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-23 21:45:42 +03:00
Move theme utils reference to base class and use new status bar coloring in all relevant places
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
6075191bc5
commit
4d93a2099f
11 changed files with 32 additions and 66 deletions
|
@ -34,15 +34,20 @@ import com.nextcloud.talk.BuildConfig
|
|||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.databinding.ActivityFullScreenTextBinding
|
||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||
import com.nextcloud.talk.utils.DisplayUtils
|
||||
import com.nextcloud.talk.utils.Mimetype.TEXT_PREFIX_GENERIC
|
||||
import io.noties.markwon.Markwon
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication::class)
|
||||
class FullScreenTextViewerActivity : AppCompatActivity() {
|
||||
lateinit var binding: ActivityFullScreenTextBinding
|
||||
|
||||
@Inject
|
||||
lateinit var viewThemeUtils: ViewThemeUtils
|
||||
|
||||
private lateinit var path: String
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
|
@ -77,6 +82,7 @@ class FullScreenTextViewerActivity : AppCompatActivity() {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
|
||||
|
||||
binding = ActivityFullScreenTextBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
@ -98,12 +104,9 @@ class FullScreenTextViewerActivity : AppCompatActivity() {
|
|||
supportActionBar?.title = fileName
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
if (resources != null) {
|
||||
DisplayUtils.applyColorToStatusBar(
|
||||
this,
|
||||
ResourcesCompat.getColor(resources, R.color.appbar, null)
|
||||
)
|
||||
viewThemeUtils.themeStatusBar(this, binding.textviewToolbar)
|
||||
|
||||
if (resources != null) {
|
||||
DisplayUtils.applyColorToNavigationBar(
|
||||
this.window,
|
||||
ResourcesCompat.getColor(resources, R.color.bg_default, null)
|
||||
|
|
|
@ -155,7 +155,6 @@ import com.nextcloud.talk.ui.dialog.ShowReactionsDialog
|
|||
import com.nextcloud.talk.ui.recyclerview.MessageSwipeActions
|
||||
import com.nextcloud.talk.ui.recyclerview.MessageSwipeCallback
|
||||
import com.nextcloud.talk.ui.theme.ServerTheme
|
||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.AttendeePermissionsUtil
|
||||
import com.nextcloud.talk.utils.ConductorRemapping
|
||||
|
@ -237,9 +236,6 @@ class ChatController(args: Bundle) :
|
|||
@Inject
|
||||
lateinit var permissionUtil: PlatformPermissionUtil
|
||||
|
||||
@Inject
|
||||
lateinit var viewThemeUtils: ViewThemeUtils
|
||||
|
||||
@Inject
|
||||
lateinit var serverTheme: ServerTheme
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ import com.nextcloud.talk.models.json.converters.EnumActorTypeConverter
|
|||
import com.nextcloud.talk.models.json.participants.Participant
|
||||
import com.nextcloud.talk.ui.dialog.ContactsBottomDialog
|
||||
import com.nextcloud.talk.users.UserManager
|
||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.ConductorRemapping
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys
|
||||
|
@ -104,9 +103,6 @@ class ContactsController(args: Bundle) :
|
|||
@Inject
|
||||
lateinit var ncApi: NcApi
|
||||
|
||||
@Inject
|
||||
lateinit var viewThemeUtils: ViewThemeUtils
|
||||
|
||||
private var credentials: String? = null
|
||||
private var currentUser: User? = null
|
||||
private var contactsQueryDisposable: Disposable? = null
|
||||
|
|
|
@ -73,7 +73,6 @@ import com.nextcloud.talk.models.json.participants.Participant.ActorType.GROUPS
|
|||
import com.nextcloud.talk.models.json.participants.Participant.ActorType.USERS
|
||||
import com.nextcloud.talk.models.json.participants.ParticipantsOverall
|
||||
import com.nextcloud.talk.shareditems.activities.SharedItemsActivity
|
||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.DateConstants
|
||||
import com.nextcloud.talk.utils.DateUtils
|
||||
|
@ -113,9 +112,6 @@ class ConversationInfoController(args: Bundle) :
|
|||
@Inject
|
||||
lateinit var eventBus: EventBus
|
||||
|
||||
@Inject
|
||||
lateinit var viewThemeUtils: ViewThemeUtils
|
||||
|
||||
private val conversationToken: String?
|
||||
private val conversationUser: User?
|
||||
private val hasAvatarSpacing: Boolean
|
||||
|
|
|
@ -473,10 +473,7 @@ public class ConversationsListController extends BaseController implements Flexi
|
|||
activity.binding.toolbar.setVisibility(View.GONE);
|
||||
activity.binding.searchToolbar.setVisibility(View.VISIBLE);
|
||||
if (getResources() != null) {
|
||||
DisplayUtils.applyColorToStatusBar(
|
||||
activity,
|
||||
ResourcesCompat.getColor(getResources(), R.color.bg_default, null)
|
||||
);
|
||||
viewThemeUtils.resetStatusBar(activity, activity.binding.searchToolbar);
|
||||
}
|
||||
}
|
||||
SmoothScrollLinearLayoutManager layoutManager =
|
||||
|
|
|
@ -66,7 +66,6 @@ import com.nextcloud.talk.models.json.userprofile.UserProfileFieldsOverall
|
|||
import com.nextcloud.talk.models.json.userprofile.UserProfileOverall
|
||||
import com.nextcloud.talk.remotefilebrowser.activities.RemoteFileBrowserActivity
|
||||
import com.nextcloud.talk.ui.dialog.ScopeDialog
|
||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||
import com.nextcloud.talk.users.UserManager
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.DisplayUtils
|
||||
|
@ -108,9 +107,6 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
|
|||
@Inject
|
||||
lateinit var permissionUtil: PlatformPermissionUtil
|
||||
|
||||
@Inject
|
||||
lateinit var viewThemeUtils: ViewThemeUtils
|
||||
|
||||
private var currentUser: User? = null
|
||||
private var edit = false
|
||||
private var adapter: UserInfoAdapter? = null
|
||||
|
|
|
@ -78,7 +78,6 @@ import com.nextcloud.talk.jobs.ContactAddressBookWorker.Companion.deleteAll
|
|||
import com.nextcloud.talk.models.json.generic.GenericOverall
|
||||
import com.nextcloud.talk.models.json.userprofile.UserProfileOverall
|
||||
import com.nextcloud.talk.users.UserManager
|
||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.DisplayUtils
|
||||
import com.nextcloud.talk.utils.LoggingUtils.sendMailWithAttachment
|
||||
|
@ -119,9 +118,6 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
|||
@Inject
|
||||
lateinit var currentUserProvider: CurrentUserProviderNew
|
||||
|
||||
@Inject
|
||||
lateinit var viewThemeUtils: ViewThemeUtils
|
||||
|
||||
private var saveStateHandler: LovelySaveStateHandler? = null
|
||||
private var currentUser: User? = null
|
||||
private var credentials: String? = null
|
||||
|
|
|
@ -186,15 +186,9 @@ public abstract class BaseController extends ButterKnifeController {
|
|||
|
||||
if ((getResources() != null)) {
|
||||
if (showSearchBar) {
|
||||
DisplayUtils.applyColorToStatusBar(
|
||||
activity, ResourcesCompat.getColor(getResources(),
|
||||
R.color.bg_default, null)
|
||||
);
|
||||
viewThemeUtils.resetStatusBar(activity, activity.binding.searchToolbar);
|
||||
} else {
|
||||
DisplayUtils.applyColorToStatusBar(
|
||||
activity, ResourcesCompat.getColor(getResources(),
|
||||
R.color.appbar, null)
|
||||
);
|
||||
viewThemeUtils.themeStatusBar(activity, activity.binding.searchToolbar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ import com.nextcloud.talk.controllers.WebViewLoginController
|
|||
import com.nextcloud.talk.controllers.base.providers.ActionBarProvider
|
||||
import com.nextcloud.talk.controllers.util.ControllerViewBindingDelegate
|
||||
import com.nextcloud.talk.databinding.ActivityMainBinding
|
||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||
import com.nextcloud.talk.utils.DisplayUtils
|
||||
import com.nextcloud.talk.utils.preferences.AppPreferences
|
||||
import javax.inject.Inject
|
||||
|
@ -73,6 +74,9 @@ abstract class NewBaseController(@LayoutRes var layoutRes: Int, args: Bundle? =
|
|||
@Inject
|
||||
lateinit var context: Context
|
||||
|
||||
@Inject
|
||||
lateinit var viewThemeUtils: ViewThemeUtils
|
||||
|
||||
protected open val title: String?
|
||||
get() = null
|
||||
|
||||
|
@ -115,11 +119,19 @@ abstract class NewBaseController(@LayoutRes var layoutRes: Int, args: Bundle? =
|
|||
}
|
||||
|
||||
protected open fun onViewBound(view: View) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && appPreferences!!.isKeyboardIncognito) {
|
||||
disableKeyboardPersonalisedLearning(view as ViewGroup)
|
||||
if (activity != null && activity is MainActivity) {
|
||||
val activity = activity as MainActivity?
|
||||
disableKeyboardPersonalisedLearning(activity!!.binding.appBar)
|
||||
var activity: MainActivity? = null
|
||||
|
||||
if (getActivity() != null && getActivity() is MainActivity) {
|
||||
activity = getActivity() as MainActivity?
|
||||
viewThemeUtils.themeCardView(activity!!.binding.searchToolbar)
|
||||
viewThemeUtils.themeToolbar(activity.binding.toolbar)
|
||||
viewThemeUtils.themeSearchBarText(activity.binding.searchText)
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && appPreferences.isKeyboardIncognito) {
|
||||
disableKeyboardPersonalisedLearning((view as ViewGroup))
|
||||
if (activity != null) {
|
||||
disableKeyboardPersonalisedLearning(activity.binding.appBar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -192,19 +204,9 @@ abstract class NewBaseController(@LayoutRes var layoutRes: Int, args: Bundle? =
|
|||
private fun colorizeStatusBar(showSearchBar: Boolean, activity: Activity?, resources: Resources?) {
|
||||
if (activity != null && resources != null) {
|
||||
if (showSearchBar) {
|
||||
DisplayUtils.applyColorToStatusBar(
|
||||
activity,
|
||||
ResourcesCompat.getColor(
|
||||
resources, R.color.bg_default, null
|
||||
)
|
||||
)
|
||||
view?.let { viewThemeUtils.resetStatusBar(activity, it) }
|
||||
} else {
|
||||
DisplayUtils.applyColorToStatusBar(
|
||||
activity,
|
||||
ResourcesCompat.getColor(
|
||||
resources, R.color.appbar, null
|
||||
)
|
||||
)
|
||||
view?.let { viewThemeUtils.themeStatusBar(activity, it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ import com.nextcloud.talk.controllers.util.viewBinding
|
|||
import com.nextcloud.talk.databinding.ControllerEntryMenuBinding
|
||||
import com.nextcloud.talk.models.json.conversations.Conversation
|
||||
import com.nextcloud.talk.ui.theme.ServerTheme
|
||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||
import com.nextcloud.talk.users.UserManager
|
||||
import com.nextcloud.talk.utils.ShareUtils
|
||||
import com.nextcloud.talk.utils.UriUtils
|
||||
|
@ -74,9 +73,6 @@ class EntryMenuController(args: Bundle) :
|
|||
@Inject
|
||||
lateinit var userManager: UserManager
|
||||
|
||||
@Inject
|
||||
lateinit var viewThemeUtils: ViewThemeUtils
|
||||
|
||||
@Inject
|
||||
lateinit var serverTheme: ServerTheme
|
||||
|
||||
|
|
|
@ -73,14 +73,8 @@ class SharedItemsActivity : AppCompatActivity() {
|
|||
setSupportActionBar(binding.sharedItemsToolbar)
|
||||
setContentView(binding.root)
|
||||
|
||||
DisplayUtils.applyColorToStatusBar(
|
||||
this,
|
||||
ResourcesCompat.getColor(
|
||||
resources,
|
||||
R.color.appbar,
|
||||
null
|
||||
)
|
||||
)
|
||||
viewThemeUtils.themeStatusBar(this, binding.sharedItemsToolbar)
|
||||
|
||||
DisplayUtils.applyColorToNavigationBar(
|
||||
this.window,
|
||||
ResourcesCompat.getColor(resources, R.color.bg_default, null)
|
||||
|
|
Loading…
Reference in a new issue