Skip to content
This repository has been archived by the owner on Jun 7, 2020. It is now read-only.

[NEW FEATURE] Theme Engine for Changing and Adding Custom Themes. #2450

Open
wants to merge 122 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
694e0bc
Update gradle version from 3.4.0 to 3.4.1
noor-binte-amir Jun 19, 2019
84c0f6d
Added thememanager package and themelibrary.
noor-binte-amir Jun 21, 2019
dfbbf29
Updated themelibrary and styles.
noor-binte-amir Jun 21, 2019
c4285fc
Updated ThemeManager and added BaseActivity.
noor-binte-amir Jun 21, 2019
58f6aa6
Updated layout and drawable colors.
noor-binte-amir Jun 22, 2019
57d6ef4
Update AndroidManifest.xml
noor-binte-amir Jun 22, 2019
569a517
Changed Colors
noor-binte-amir Jun 20, 2019
273a59d
Added string title_change_theme.
noor-binte-amir Jun 20, 2019
aa38c45
Updated UI
noor-binte-amir Jun 21, 2019
09cdad5
Replaced if structure with when
noor-binte-amir Jun 21, 2019
92b8a38
Using getThemeAttribute from BaseActivity in ViewHolder.
noor-binte-amir Jun 22, 2019
5aa6f60
Added ThemeUtil to get theme attributes across app.
noor-binte-amir Jun 22, 2019
00980b2
[FIX] Fixed Dependency Injection to work with BaseActivity.
noor-binte-amir Jun 23, 2019
e699437
Removed unused import in PasswordActivity.kt
noor-binte-amir Jun 23, 2019
865fe0d
Merge pull request #15 from NBAMIR/theme-3
noor-binte-amir Jun 23, 2019
030a829
Merge branch 'theme-2' into theme
noor-binte-amir Jun 23, 2019
c55efdb
[Improvement] Completed UI for ThemeFragment.kt
noor-binte-amir Jun 23, 2019
bb0ffae
Merge pull request #16 from NBAMIR/theme-4
noor-binte-amir Jun 23, 2019
c8d183e
[FIX] Fixed status and navigation bar theming issue.
noor-binte-amir Jun 23, 2019
910a2cb
Merge pull request #17 from NBAMIR/theme-5
noor-binte-amir Jun 23, 2019
9f9f121
[Improvement] Provided Smooth Theme Switching.
noor-binte-amir Jun 23, 2019
d05a921
Merge pull request #19 from NBAMIR/theme-6
noor-binte-amir Jun 23, 2019
5fc8e62
[FIX] Fixed issue with message responses.
noor-binte-amir Jun 24, 2019
c7cc33a
Merge pull request #20 from NBAMIR/theme-7
noor-binte-amir Jun 24, 2019
8948119
[FIX] Changing drawable colors using Theme Utility across app.
noor-binte-amir Jun 24, 2019
65b8c47
[FIX] Changed code for theme switching.
noor-binte-amir Jun 25, 2019
68527e2
Merge pull request #21 from NBAMIR/theme-8
noor-binte-amir Jun 25, 2019
fc306fd
[FIX] Allowed reverting to default theme and displayed date last chan…
noor-binte-amir Jun 25, 2019
f9d6d51
Merge pull request #22 from NBAMIR/theme-9
noor-binte-amir Jun 25, 2019
68c3599
[FIX] Fixed issue of missing avatar in chatroom.
noor-binte-amir Jun 25, 2019
c1149bf
Merge pull request #23 from NBAMIR/theme-10
noor-binte-amir Jun 25, 2019
319888f
[FIX] Fixed status bar color changes.
noor-binte-amir Jun 28, 2019
336e2d2
Merge pull request #24 from NBAMIR/theme-11
noor-binte-amir Jun 28, 2019
5b34568
[FIX] Changed spinner drop-down item style to support theme switching.
noor-binte-amir Jun 29, 2019
b37dd2d
[FIX] Tinted drawables for log in and sign up.
noor-binte-amir Jun 29, 2019
e73ee53
[Improvement] Set toolbar overflow icon color.
noor-binte-amir Jun 29, 2019
9a1274d
[Improvement] Updated theme colors
noor-binte-amir Jul 1, 2019
1df72a9
Merge pull request #25 from NBAMIR/theme-12
noor-binte-amir Jul 1, 2019
0e51212
[Improvement] Added strings in strings.xml
noor-binte-amir Jul 4, 2019
28e1c07
Added BaseActivity in AndroidManifest.xml
noor-binte-amir Jul 5, 2019
6545a07
[FIX] Tinted key drawable in AlertDialog.
noor-binte-amir Jul 5, 2019
72fb04d
Removed unnecessary theme attributes.
noor-binte-amir Jul 5, 2019
6c78326
[FIX] Fixed AlertDialog theming issue.
noor-binte-amir Jul 5, 2019
de349c6
[FIX] Fixed DialogAlert theming in SettingsFragment.kt
noor-binte-amir Jul 5, 2019
bf2d6cb
[FIX] Fixed homeAsUpIndicator.
noor-binte-amir Jul 5, 2019
d16da9d
[FIX] Tinted Drawables in ChatRoomsFragment.kt and DirectoryFragment.kt
noor-binte-amir Jul 5, 2019
d50b95c
[FIX] Tinted drawables in BottomSheetFragments.
noor-binte-amir Jul 5, 2019
cc45c5d
Merge pull request #26 from NBAMIR/theme-14
noor-binte-amir Jul 5, 2019
cfb1d93
[Improvement] Displayed Current Theme Programmatically.
noor-binte-amir Jul 6, 2019
352b66f
[Improvement] Changed string create_personal_theme to create_custom_t…
noor-binte-amir Jul 6, 2019
eba84d5
Merge pull request #27 from NBAMIR/theme-15
noor-binte-amir Jul 6, 2019
542418c
[FIX] Fixed theming issue with Language Alert Dialog.
noor-binte-amir Jul 7, 2019
c9028de
[NEW FEATURE] Added Custom Theme Engine.
noor-binte-amir Jul 20, 2019
9424d5c
[IMPROVEMENT] Added an option for returning to default theme accent o…
noor-binte-amir Jul 21, 2019
9383676
Updated Theme.kt to remove redundant if statement.
noor-binte-amir Jul 21, 2019
0afe1f6
[IMPROVEMENT] Added Default Background color option for Custom Themes.
noor-binte-amir Jul 21, 2019
5780ffc
[IMPROVEMENT] Updated unread chatroom timestamp to match customt them…
noor-binte-amir Jul 21, 2019
39798cb
[FIX] Modified EditText and Toolbar SearchView hint color to support …
noor-binte-amir Jul 21, 2019
652986e
[FIX] Fixed Chatroom Toolbar Theming issue.
noor-binte-amir Jul 22, 2019
d84a1d3
[FIX] Modified AlertDialogs to support custom themes.
noor-binte-amir Jul 22, 2019
6631b89
[FIX] Fixed Navigation Bar styling to work with custom themes.
noor-binte-amir Jul 23, 2019
c3c7dcd
[FIX] Removed bug on loading WebViewActivity.
noor-binte-amir Jul 28, 2019
d17f601
[IMPROVEMENT] Tinted Selection Drawables in Bottom Sheet Fragments.
noor-binte-amir Jul 28, 2019
2c98364
[IMPROVEMENT] Changed layout attributes to support theme switching.
noor-binte-amir Jul 28, 2019
ea4e001
[IMPROVEMENT] Removed unnecessary comments from code.
noor-binte-amir Jul 28, 2019
d1edad0
[IMPROVEMENT] Changed colors and styles to fix minor theming issues.
noor-binte-amir Jul 28, 2019
272e302
[FIX] Fixed MessageComposer Theming Issue in ChatRoomsFragment.
noor-binte-amir Jul 31, 2019
02c8f9f
Merge pull request #29 from NBAMIR/theme-18
noor-binte-amir Jul 31, 2019
6e77e0d
[Improvement] Updated Message Composer to use applied custom accent.
noor-binte-amir Aug 1, 2019
e58b98c
Merge pull request #30 from NBAMIR/theme-19
noor-binte-amir Aug 1, 2019
c42d78e
[FIX] Updated Chat Rooms Fragment to show custom accent for URLS and …
noor-binte-amir Aug 1, 2019
3bebb33
[FIX] Updated FloatingActionButton in ChatRoomsFragment to show custo…
noor-binte-amir Aug 1, 2019
47a9960
[FIX] Updated unread messages icon over FloatingActionButton to show …
noor-binte-amir Aug 1, 2019
374cc29
[FIX] Custom theme accent applied to view in ChatRoomsFragment.
noor-binte-amir Aug 2, 2019
af2e48b
[FIX] Modified colorControlText to work with all theme background col…
noor-binte-amir Aug 2, 2019
c0f2983
[IMPROVEMENT] Added transparency to timestamp text to make it work wi…
noor-binte-amir Aug 2, 2019
cf3ef10
[FIX] Tinted drawable in MessageActionsBottomSheet.kt and fragment_pi…
noor-binte-amir Aug 2, 2019
b0cffbe
[IMPROVEMENT] Minor styling changes.
noor-binte-amir Aug 2, 2019
799a567
Merge pull request #31 from NBAMIR/theme-20
noor-binte-amir Aug 2, 2019
1341da4
Merge pull request #28 from NBAMIR/theme-17
noor-binte-amir Aug 2, 2019
a1c4091
[IMPROVEMENT] Fixed styling to support custom themes.
noor-binte-amir Aug 4, 2019
ad33a9f
[IMRPOVEMENT] Merged ThemesActivity and CustomThemesActivity.
noor-binte-amir Aug 4, 2019
783efc9
Merge pull request #32 from NBAMIR/theme-21
noor-binte-amir Aug 6, 2019
f912ffe
Merge pull request #33 from NBAMIR/theme-17
noor-binte-amir Aug 6, 2019
60dd5d6
[FIX] Fixed setTheme screen rotation issue.
noor-binte-amir Aug 6, 2019
9411507
[FIX] Tinted drawables in message action item bottomsheet.
noor-binte-amir Aug 7, 2019
e844e18
[IMPROVEMENT] Removed unnecessary color custom attribute.
noor-binte-amir Aug 10, 2019
e1d431a
[FIX] Polished theme implementation of CreateChannelFragment.
noor-binte-amir Aug 10, 2019
390792d
[FIX] Fixed Toolbar Theming Issue in MessageInfoActivity.kt
noor-binte-amir Aug 10, 2019
1cce2b6
Merge branch 'develop_theme' into theme
noor-binte-amir Aug 11, 2019
092f395
Merge pull request #34 from NBAMIR/theme
noor-binte-amir Aug 11, 2019
8c4c102
[FIX] Fixed errors to compile project.
noor-binte-amir Aug 11, 2019
fe1a29c
Update DrawableHelper.kt
noor-binte-amir Aug 11, 2019
46662c2
Removed unnecessary comments from ProfileFragment.kt
noor-binte-amir Aug 11, 2019
2df0be7
[FIX] Fixed theming issues in UserDetailsFragment.kt
noor-binte-amir Aug 11, 2019
7182d58
Removed unnecessary comments and code.
noor-binte-amir Aug 11, 2019
2503a46
Merge branch 'develop_theme' into theme-22
noor-binte-amir Aug 11, 2019
4cf9bf1
Merge pull request #35 from NBAMIR/theme-22
noor-binte-amir Aug 11, 2019
91af453
[FIX] Fixed Issue with Base Themes.
noor-binte-amir Aug 16, 2019
5506e7b
Merge pull request #36 from NBAMIR/theme-23
noor-binte-amir Aug 16, 2019
6e971ce
[FIX] Fixed Scrolling Issue and Palette Visibility.
noor-binte-amir Aug 18, 2019
b78fc77
Merge pull request #37 from NBAMIR/theme-24
noor-binte-amir Aug 18, 2019
d83d47d
[IMPROVEMENT] Improved styles and colors.
noor-binte-amir Aug 18, 2019
574ee16
Merge pull request #38 from NBAMIR/theme-27
noor-binte-amir Aug 18, 2019
7a0495a
[FIX] Fixed issue with deleting themes.
noor-binte-amir Aug 18, 2019
4e280a6
[FIX] Fixed AlertDialog theming issues.
noor-binte-amir Aug 18, 2019
22d5e8c
[FIX] Fixed floating action button theming.
noor-binte-amir Aug 18, 2019
85dee33
Merge pull request #39 from NBAMIR/theme-28
noor-binte-amir Aug 18, 2019
35627ed
[FIX] Fixed theming for update_avatar_options.xml.
noor-binte-amir Aug 19, 2019
e559f7a
Merge pull request #40 from NBAMIR/theme-29
noor-binte-amir Aug 19, 2019
0b87cec
[FIX] Fixed theming issues in ChatRoomFragment.kt
noor-binte-amir Aug 19, 2019
0596724
Merge pull request #41 from NBAMIR/theme-30
noor-binte-amir Aug 19, 2019
1f9a02a
[FIX] Fixed theming issues with message attachments.
noor-binte-amir Aug 19, 2019
9337a28
Merge pull request #42 from NBAMIR/theme-31
noor-binte-amir Aug 19, 2019
6d929bf
[FIX] Fixed theming issues and removed unnecessary code.
noor-binte-amir Aug 19, 2019
30b7c07
[FIX] Fixed switch theming in bottom_sheet_fragment_directory_sorting…
noor-binte-amir Aug 20, 2019
c6e938a
Merge pull request #43 from NBAMIR/theme-32
noor-binte-amir Aug 20, 2019
2ac576c
Merge branch 'develop' into develop_theme
noor-binte-amir Aug 21, 2019
7da8bcc
[FIX] Resolved Build Error.
noor-binte-amir Aug 21, 2019
509906f
[FIX] Fixed layout issue in ThemesActivity.
noor-binte-amir Aug 21, 2019
c30e056
[IMPROVEMENT] Added new theme colors.
noor-binte-amir Aug 24, 2019
394d106
Merge branch 'develop' into develop_theme
noor-binte-amir Aug 24, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ dependencies {
implementation project(':util')
implementation project(':core')
implementation project(':suggestions')
implementation project(':themelibrary')

implementation libraries.kotlin
implementation libraries.coroutinesCore
Expand All @@ -121,6 +122,9 @@ dependencies {

implementation libraries.dagger
implementation libraries.daggerSupport
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
kapt libraries.daggerProcessor
kapt libraries.daggerAndroidApt

Expand Down Expand Up @@ -180,6 +184,7 @@ dependencies {
testImplementation libraries.truth
androidTestImplementation libraries.espressoCore
androidTestImplementation libraries.espressoIntents
implementation 'com.google.code.gson:gson:2.8.5'
}

androidExtensions {
Expand All @@ -200,4 +205,4 @@ task compileSdk(type: Exec) {
preBuild.dependsOn compileSdk
if (isPlay) {
apply plugin: 'com.google.gms.google-services'
}
}
35 changes: 9 additions & 26 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,21 @@
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:name">

<activity android:name=".thememanager.ui.CreateThemesActivity"></activity>
<activity
android:name=".authentication.ui.AuthenticationActivity"
android:configChanges="orientation"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize">

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand All @@ -45,7 +43,6 @@
<data
android:host="auth"
android:scheme="rocketchat" />

<data
android:host="go.rocket.chat"
android:path="/auth"
Expand All @@ -64,50 +61,35 @@

</intent-filter>
</activity>

<activity
android:name=".server.ui.ChangeServerActivity"
android:theme="@style/AppTheme" />

/>
<activity
android:name=".main.ui.MainActivity"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />

<activity
android:name=".webview.ui.WebViewActivity"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />

<activity
android:name=".webview.sso.ui.SsoWebViewActivity"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />

<activity
android:name=".webview.oauth.ui.OauthWebViewActivity"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />

<activity
android:name=".videoconference.ui.VideoConferenceActivity"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />

<activity
android:name=".chatroom.ui.ChatRoomActivity"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />

<activity
android:name=".chatinformation.ui.MessageInfoActivity"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />

<!-- TODO: Change to fragment -->
<activity
android:name=".settings.password.ui.PasswordActivity"
android:theme="@style/AppTheme" />
android:name=".thememanager.ui.ThemesActivity"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" /> <!-- TODO: Change to fragment -->
<activity android:name=".settings.password.ui.PasswordActivity" />
<activity android:name=".thememanager.BaseActivity" />

<receiver
android:name=".push.DirectReplyReceiver"
Expand Down Expand Up @@ -137,4 +119,5 @@
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>

</manifest>
10 changes: 10 additions & 0 deletions app/src/main/java/chat/rocket/android/app/DrawableHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ object DrawableHelper {
textView.setCompoundDrawablesWithIntrinsicBounds(startDrawable, null, endDrawable, null)
}

/**
* Compounds a Drawable (to appear on top of a text) into a TextView.
*
* @param textView The TextView.
* @param drawable The Drawable.
* @see compoundDrawables
*/
fun compoundTopDrawable(textView: TextView, drawable: Drawable) =
textView.setCompoundDrawablesWithIntrinsicBounds(null, drawable, null, null)

/**
* Returns the user status drawable.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ import chat.rocket.android.helper.getCredentials
import chat.rocket.android.helper.hasCredentialsSupport
import chat.rocket.android.helper.requestStoredCredentials
import chat.rocket.android.helper.saveCredentials
import chat.rocket.android.thememanager.util.ThemeUtil
import chat.rocket.android.util.extension.asObservable
import chat.rocket.android.util.extensions.clearLightStatusBar
import chat.rocket.android.util.extensions.inflate
import chat.rocket.android.util.extensions.showToast
import chat.rocket.android.util.extensions.textContent
import chat.rocket.android.util.extensions.ui
import chat.rocket.android.util.extensions.*
import dagger.android.support.AndroidSupportInjection
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.rxkotlin.Observables
import kotlinx.android.synthetic.main.app_bar.*
import kotlinx.android.synthetic.main.fragment_authentication_log_in.*
import kotlinx.android.synthetic.main.fragment_authentication_log_in.view_loading
import javax.inject.Inject

private const val SERVER_NAME = "server_name"
Expand Down Expand Up @@ -73,6 +71,11 @@ class LoginFragment : Fragment(), LoginView {
setupToolbar()
presenter.setupView()
subscribeEditTexts()

// if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
tintEditTextDrawableStart()
// }

setupOnClickListener()
analyticsManager.logScreenView(ScreenViewEvent.Login)
}
Expand Down Expand Up @@ -111,7 +114,7 @@ class LoginFragment : Fragment(), LoginView {

private fun setupToolbar() {
with(activity as AuthenticationActivity) {
this.clearLightStatusBar()
view?.let {this.clearInvisibleStatusBar(it)}
toolbar.isVisible = true
toolbar.title = serverName?.replace(getString(R.string.default_protocol), "")
}
Expand Down Expand Up @@ -167,7 +170,7 @@ class LoginFragment : Fragment(), LoginView {
override fun enableButtonLogin() {
context?.let {
ViewCompat.setBackgroundTintList(
button_log_in, ContextCompat.getColorStateList(it, R.color.colorAccent)
button_log_in, ContextCompat.getColorStateList(it, ThemeUtil.getThemeColorResource(R.attr.colorAccent))
)
button_log_in.isEnabled = true
}
Expand All @@ -178,7 +181,7 @@ class LoginFragment : Fragment(), LoginView {
context?.let {
ViewCompat.setBackgroundTintList(
button_log_in,
ContextCompat.getColorStateList(it, R.color.colorAuthenticationButtonDisabled)
ContextCompat.getColorStateList(it, ThemeUtil.getThemeColorResource(R.attr.colorButtonDisabled))
)
button_log_in.isEnabled = false
}
Expand All @@ -187,17 +190,15 @@ class LoginFragment : Fragment(), LoginView {
override fun enableButtonForgetPassword() {
context?.let {
button_forgot_your_password.isEnabled = true
button_forgot_your_password.setTextColor(
ContextCompat.getColorStateList(it, R.color.colorAccent)
)
button_forgot_your_password.setTextColor(ThemeUtil.getThemeColor(R.attr.colorAccent))
}
}

override fun disableButtonForgetPassword() {
context?.let {
button_forgot_your_password.isEnabled = false
button_forgot_your_password.setTextColor(
ContextCompat.getColorStateList(it, R.color.colorAuthenticationButtonDisabled)
ContextCompat.getColorStateList(it, ThemeUtil.getThemeColorResource(R.attr.colorButtonDisabled))
)
}
}
Expand Down Expand Up @@ -253,4 +254,15 @@ class LoginFragment : Fragment(), LoginView {
text_password.isEnabled = false
}
}

private fun tintEditTextDrawableStart() {
ui {
val atDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_at_black_20dp, it)
val keyDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_key_black_20dp, it)
val drawables = arrayOf(atDrawable, keyDrawable)
DrawableHelper.wrapDrawables(drawables)
DrawableHelper.tintDrawables(drawables, it, ThemeUtil.getThemeColorResource(R.attr.colorDrawableStrongTint))
DrawableHelper.compoundDrawables( arrayOf(text_username_or_email, text_password), drawables)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,14 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {

private fun setupToolbar() {
with(activity as AuthenticationActivity) {
this.clearLightStatusBar()
view?.let {this.clearInvisibleStatusBar(it)}
toolbar.isVisible = true
toolbar.title = serverName?.replace(getString(R.string.default_protocol), "")
val overflowIcon = toolbar.overflowIcon
overflowIcon?.let{
val wrappedDrawable = DrawableHelper.wrapDrawable(it)
DrawableHelper.tintDrawable(wrappedDrawable, this, R.color.colorWhite)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import chat.rocket.android.analytics.event.ScreenViewEvent
import chat.rocket.android.authentication.onboarding.presentation.OnBoardingPresenter
import chat.rocket.android.authentication.onboarding.presentation.OnBoardingView
import chat.rocket.android.authentication.ui.AuthenticationActivity
import chat.rocket.android.util.extensions.inflate
import chat.rocket.android.util.extensions.setLightStatusBar
import chat.rocket.android.util.extensions.showToast
import chat.rocket.android.util.extensions.ui
import chat.rocket.android.util.extensions.*
import dagger.android.support.AndroidSupportInjection
import kotlinx.android.synthetic.main.app_bar.*
import kotlinx.android.synthetic.main.fragment_authentication_on_boarding.*
Expand Down Expand Up @@ -48,7 +45,7 @@ class OnBoardingFragment : Fragment(), OnBoardingView {

private fun setupToolbar() {
with(activity as AuthenticationActivity) {
view?.let { this.setLightStatusBar(it) }
view?.let { this.setInvisibleStatusBar(it) }
toolbar.isVisible = false
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package chat.rocket.android.authentication.registerusername.ui

import DrawableHelper
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
Expand All @@ -15,6 +14,7 @@ import chat.rocket.android.analytics.AnalyticsManager
import chat.rocket.android.analytics.event.ScreenViewEvent
import chat.rocket.android.authentication.registerusername.presentation.RegisterUsernamePresenter
import chat.rocket.android.authentication.registerusername.presentation.RegisterUsernameView
import chat.rocket.android.thememanager.util.ThemeUtil
import chat.rocket.android.util.extension.asObservable
import chat.rocket.android.util.extensions.inflate
import chat.rocket.android.util.extensions.showKeyboard
Expand Down Expand Up @@ -71,9 +71,9 @@ class RegisterUsernameFragment : Fragment(), RegisterUsernameView {
showKeyboard(text_username)
}

if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
// if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
tintEditTextDrawableStart()
}
// }

setupOnClickListener()
subscribeEditText()
Expand All @@ -89,7 +89,7 @@ class RegisterUsernameFragment : Fragment(), RegisterUsernameView {
override fun enableButtonUseThisUsername() {
context?.let {
ViewCompat.setBackgroundTintList(
button_use_this_username, ContextCompat.getColorStateList(it, R.color.colorAccent)
button_use_this_username, ContextCompat.getColorStateList(it, ThemeUtil.getThemeColorResource(R.attr.colorAccent))
)
button_use_this_username.isEnabled = true
}
Expand All @@ -99,7 +99,7 @@ class RegisterUsernameFragment : Fragment(), RegisterUsernameView {
context?.let {
ViewCompat.setBackgroundTintList(
button_use_this_username,
ContextCompat.getColorStateList(it, R.color.colorAuthenticationButtonDisabled)
ContextCompat.getColorStateList(it, ThemeUtil.getThemeColorResource(R.attr.colorButtonDisabled))
)
button_use_this_username.isEnabled = false
}
Expand Down Expand Up @@ -139,7 +139,7 @@ class RegisterUsernameFragment : Fragment(), RegisterUsernameView {
ui {
val atDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_at_black_20dp, it)
DrawableHelper.wrapDrawable(atDrawable)
DrawableHelper.tintDrawable(atDrawable, it, R.color.colorDrawableTintGrey)
DrawableHelper.tintDrawable(atDrawable, it, ThemeUtil.getThemeColorResource(R.attr.colorDrawableStrongTint))
DrawableHelper.compoundStartDrawable(text_username, atDrawable)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import chat.rocket.android.analytics.AnalyticsManager
import chat.rocket.android.analytics.event.ScreenViewEvent
import chat.rocket.android.authentication.resetpassword.presentation.ResetPasswordPresenter
import chat.rocket.android.authentication.resetpassword.presentation.ResetPasswordView
import chat.rocket.android.thememanager.util.ThemeUtil
import chat.rocket.android.util.extension.asObservable
import chat.rocket.android.util.extensions.inflate
import chat.rocket.android.util.extensions.isEmail
Expand Down Expand Up @@ -55,6 +56,10 @@ class ResetPasswordFragment : Fragment(), ResetPasswordView {
showKeyboard(text_email)
}

// if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
tintEditTextDrawableStart()
// }

setupOnClickListener()
subscribeEditText()

Expand All @@ -74,7 +79,7 @@ class ResetPasswordFragment : Fragment(), ResetPasswordView {
override fun enableButtonConnect() {
context?.let {
ViewCompat.setBackgroundTintList(
button_reset_password, ContextCompat.getColorStateList(it, R.color.colorAccent)
button_reset_password, ContextCompat.getColorStateList(it, ThemeUtil.getThemeColorResource(R.attr.colorAccent))
)
button_reset_password.isEnabled = true
}
Expand All @@ -84,7 +89,7 @@ class ResetPasswordFragment : Fragment(), ResetPasswordView {
context?.let {
ViewCompat.setBackgroundTintList(
button_reset_password,
ContextCompat.getColorStateList(it, R.color.colorAuthenticationButtonDisabled)
ContextCompat.getColorStateList(it, ThemeUtil.getThemeColorResource(R.attr.colorButtonDisabled))
)
button_reset_password.isEnabled = false
}
Expand Down Expand Up @@ -147,4 +152,13 @@ class ResetPasswordFragment : Fragment(), ResetPasswordView {
}

private fun unsubscribeEditText() = emailAddressDisposable.dispose()

private fun tintEditTextDrawableStart() {
ui {
val atDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_email_black_20dp, it)
DrawableHelper.wrapDrawable(atDrawable)
DrawableHelper.tintDrawable(atDrawable, it, ThemeUtil.getThemeColorResource(R.attr.colorDrawableStrongTint))
DrawableHelper.compoundStartDrawable(text_email, atDrawable)
}
}
}
Loading