ThemeModule: convert to Kotlin and fix copyright

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey Vilas 2022-04-25 12:12:14 +02:00 committed by Álvaro Brey (Rebase PR Action)
parent e2c3091fc0
commit 42c28dce70
2 changed files with 131 additions and 132 deletions

View file

@ -1,132 +0,0 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.di;
import android.content.Context;
import com.owncloud.android.utils.theme.ThemeAvatarUtils;
import com.owncloud.android.utils.theme.ThemeBarUtils;
import com.owncloud.android.utils.theme.ThemeButtonUtils;
import com.owncloud.android.utils.theme.ThemeCheckableUtils;
import com.owncloud.android.utils.theme.ThemeColorUtils;
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
import com.owncloud.android.utils.theme.ThemeFabUtils;
import com.owncloud.android.utils.theme.ThemeLayoutUtils;
import com.owncloud.android.utils.theme.ThemeMenuUtils;
import com.owncloud.android.utils.theme.ThemeSnackbarUtils;
import com.owncloud.android.utils.theme.ThemeTextInputUtils;
import com.owncloud.android.utils.theme.ThemeTextUtils;
import com.owncloud.android.utils.theme.ThemeToolbarUtils;
import com.owncloud.android.utils.theme.ThemeUtils;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
@Module
class ThemeModule {
@Provides
@Singleton
ThemeColorUtils themeColorUtils() {
return new ThemeColorUtils();
}
@Provides
@Singleton
ThemeFabUtils themeFabUtils(ThemeColorUtils themeColorUtils, ThemeDrawableUtils themeDrawableUtils) {
return new ThemeFabUtils(themeColorUtils, themeDrawableUtils);
}
@Provides
@Singleton
ThemeLayoutUtils themeLayoutUtils(ThemeColorUtils themeColorUtils) {
return new ThemeLayoutUtils(themeColorUtils);
}
@Provides
@Singleton
ThemeToolbarUtils themeToolbarUtils(ThemeColorUtils themeColorUtils,
ThemeDrawableUtils themeDrawableUtils,
ThemeTextInputUtils themeTextInputUtils) {
return new ThemeToolbarUtils(themeColorUtils, themeDrawableUtils, themeTextInputUtils);
}
@Provides
@Singleton
ThemeDrawableUtils themeDrawableUtils(Context context) {
return new ThemeDrawableUtils(context);
}
@Provides
@Singleton
ThemeUtils themeUtils() {
return new ThemeUtils();
}
@Provides
@Singleton
ThemeMenuUtils themeMenuUtils() {
return new ThemeMenuUtils();
}
@Provides
@Singleton
ThemeSnackbarUtils themeSnackbarUtils() {
return new ThemeSnackbarUtils();
}
@Provides
@Singleton
ThemeTextUtils themeTextUtils() {
return new ThemeTextUtils();
}
@Provides
@Singleton
ThemeButtonUtils themeButtonUtils() {
return new ThemeButtonUtils();
}
@Provides
@Singleton
ThemeBarUtils themeBarUtils() {
return new ThemeBarUtils();
}
@Provides
@Singleton
ThemeTextInputUtils themeTextInputUtils() {
return new ThemeTextInputUtils();
}
@Provides
@Singleton
ThemeCheckableUtils themeCheckableUtils() {
return new ThemeCheckableUtils();
}
@Provides
@Singleton
ThemeAvatarUtils themeAvatarUtils() {
return new ThemeAvatarUtils();
}
}

View file

@ -0,0 +1,131 @@
/*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2022 Tobias Kaminsky
* Copyright (C) 2022 Nextcloud GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.di
import android.content.Context
import javax.inject.Singleton
import com.owncloud.android.utils.theme.ThemeColorUtils
import com.owncloud.android.utils.theme.ThemeDrawableUtils
import com.owncloud.android.utils.theme.ThemeFabUtils
import com.owncloud.android.utils.theme.ThemeLayoutUtils
import com.owncloud.android.utils.theme.ThemeTextInputUtils
import com.owncloud.android.utils.theme.ThemeToolbarUtils
import com.owncloud.android.utils.theme.ThemeMenuUtils
import com.owncloud.android.utils.theme.ThemeSnackbarUtils
import com.owncloud.android.utils.theme.ThemeTextUtils
import com.owncloud.android.utils.theme.ThemeButtonUtils
import com.owncloud.android.utils.theme.ThemeBarUtils
import com.owncloud.android.utils.theme.ThemeCheckableUtils
import com.owncloud.android.utils.theme.ThemeAvatarUtils
import com.owncloud.android.utils.theme.ThemeUtils
import dagger.Module
import dagger.Provides
@Module
internal class ThemeModule {
@Provides
@Singleton
fun themeColorUtils(): ThemeColorUtils {
return ThemeColorUtils()
}
@Provides
@Singleton
fun themeFabUtils(themeColorUtils: ThemeColorUtils?, themeDrawableUtils: ThemeDrawableUtils?): ThemeFabUtils {
return ThemeFabUtils(themeColorUtils, themeDrawableUtils)
}
@Provides
@Singleton
fun themeLayoutUtils(themeColorUtils: ThemeColorUtils?): ThemeLayoutUtils {
return ThemeLayoutUtils(themeColorUtils)
}
@Provides
@Singleton
fun themeToolbarUtils(
themeColorUtils: ThemeColorUtils?,
themeDrawableUtils: ThemeDrawableUtils?,
themeTextInputUtils: ThemeTextInputUtils?
): ThemeToolbarUtils {
return ThemeToolbarUtils(themeColorUtils, themeDrawableUtils, themeTextInputUtils)
}
@Provides
@Singleton
fun themeDrawableUtils(context: Context?): ThemeDrawableUtils {
return ThemeDrawableUtils(context)
}
@Provides
@Singleton
fun themeUtils(): ThemeUtils {
return ThemeUtils()
}
@Provides
@Singleton
fun themeMenuUtils(): ThemeMenuUtils {
return ThemeMenuUtils()
}
@Provides
@Singleton
fun themeSnackbarUtils(): ThemeSnackbarUtils {
return ThemeSnackbarUtils()
}
@Provides
@Singleton
fun themeTextUtils(): ThemeTextUtils {
return ThemeTextUtils()
}
@Provides
@Singleton
fun themeButtonUtils(): ThemeButtonUtils {
return ThemeButtonUtils()
}
@Provides
@Singleton
fun themeBarUtils(): ThemeBarUtils {
return ThemeBarUtils()
}
@Provides
@Singleton
fun themeTextInputUtils(): ThemeTextInputUtils {
return ThemeTextInputUtils()
}
@Provides
@Singleton
fun themeCheckableUtils(): ThemeCheckableUtils {
return ThemeCheckableUtils()
}
@Provides
@Singleton
fun themeAvatarUtils(): ThemeAvatarUtils {
return ThemeAvatarUtils()
}
}