Skip to content

Commit 5c9316e

Browse files
committed
Rework colors management
1 parent d4f48da commit 5c9316e

File tree

667 files changed

+3212
-3278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

667 files changed

+3212
-3278
lines changed

.idea/dictionaries/bmarty.xml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ To install the template (to be done only once):
2626

2727
To create a new screen:
2828
- First create a new package in your code.
29-
- Then right click on the package, and select `New/New Vector/RiotX Feature`.
29+
- Then right click on the package, and select `New/New Vector/Element Feature`.
3030
- Follow the Wizard, especially replace `Main` by something more relevant to your feature.
3131
- Click on `Finish`.
3232
- Remaining steps are described as TODO in the generated files, or will be pointed out by the compiler, or at runtime :)

docs/color_migration_guide.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Color migration
2+
3+
Some colors and color attribute has been removed, here is the list and what has to be used now.
4+
5+
This file can help Element Android forks maintainers to migrate their code.
6+
7+
- ?vctr_background -> ?android:colorBackground
8+
- riotx_background_light -> element_background_light
9+
- riotx_background_dark -> element_background_dark
10+
- riotx_background_black -> element_background_black
11+
12+
- riotx_accent -> ?colorPrimary
13+
- riotx_positive_accent -> ?colorPrimary
14+
- riotx_accent_alpha25 -> color_primary_alpha25
15+
- riotx_notice -> ?colorError
16+
- riotx_destructive_accent -> ?colorError
17+
- vector_error_color -> ?colorError
18+
- vector_warning_color -> ?colorError
19+
20+
- riotx_bottom_sheet_background -> ?colorSurface
21+
- riotx_alerter_background -> ?colorSurface
22+
23+
- riotx_username_1 -> element_name_01
24+
- riotx_username_2 -> element_name_02
25+
- riotx_username_3 -> element_name_03
26+
- riotx_username_4 -> element_name_04
27+
- riotx_username_5 -> element_name_05
28+
- riotx_username_6 -> element_name_06
29+
- riotx_username_7 -> element_name_07
30+
- riotx_username_8 -> element_name_08
31+
32+
- riotx_avatar_fill_1 -> element_room_01
33+
- riotx_avatar_fill_2 -> element_room_02
34+
- riotx_avatar_fill_3 -> element_room_03
35+
36+
- white -> @android:color/white
37+
- black -> @android:color/black or emoji_color
38+
39+
- riotx_list_header_background_color -> ?vctr_header_background
40+
- riotx_header_panel_background -> ?vctr_header_background
41+
- riotx_list_bottom_sheet_divider_color -> ?vctr_list_separator_on_surface
42+
- riotx_list_divider_color -> ?vctr_list_separator
43+
- list_divider_color -> ?vctr_list_separator
44+
- riotx_header_panel_border_mobile -> ?vctr_list_separator
45+
- riotx_bottom_nav_background_border_color -> ?vctr_list_separator
46+
- riotx_header_panel_text_secondary -> ?vctr_content_primary
47+
48+
- link_color_light -> element_link_light
49+
- link_color_dark -> element_link_dark
50+
51+
- riotx_toolbar_primary_text_color -> vctr_content_primary
52+
- riotx_toolbar_secondary_text_color -> vctr_content_primary
53+
- riot_primary_text_color -> vctr_content_primary
54+
55+
- riotx_android_secondary -> vctr_content_secondary

matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/identity/IdentityService.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface IdentityService {
3535
/**
3636
* Check if the identity server is valid
3737
* See https://matrix.org/docs/spec/identity_service/latest#status-check
38-
* RiotX SDK only supports identity server API v2
38+
* Matrix Android SDK2 only supports identity server API v2
3939
*/
4040
suspend fun isValidIdentityServer(url: String)
4141

matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ internal class DefaultCryptoService @Inject constructor(
388388
cryptoStore.close()
389389
}
390390

391-
// Aways enabled on RiotX
391+
// Always enabled on Matrix Android SDK2
392392
override fun isCryptoEnabled() = true
393393

394394
/**

matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmDecryption.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ internal class MXMegolmDecryption(private val userId: String,
155155
withHeldInfo.code?.value ?: "",
156156
withHeldInfo.reason)
157157
} else {
158-
// This is un-used in riotX SDK, not sure if needed
158+
// This is un-used in Matrix Android SDK2, not sure if needed
159159
// addEventToPendingList(event, timeline)
160160
if (requestKeysOnFail) {
161161
requestKeysForEvent(event, false)

matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/legacy/DefaultLegacySessionImporter.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ internal class DefaultLegacySessionImporter @Inject constructor(
153153
}
154154

155155
private fun importCryptoDb(legacyConfig: LegacyHomeServerConnectionConfig) {
156-
// Here we migrate the DB, we copy the crypto DB to the location specific to RiotX, and we encrypt it.
156+
// Here we migrate the DB, we copy the crypto DB to the location specific to Matrix SDK2, and we encrypt it.
157157
val userMd5 = legacyConfig.credentials.userId.md5()
158158

159159
val sessionId = legacyConfig.credentials.let { (if (it.deviceId.isNullOrBlank()) it.userId else "${it.userId}|${it.deviceId}").md5() }
@@ -177,12 +177,12 @@ internal class DefaultLegacySessionImporter @Inject constructor(
177177

178178
Timber.d("Migration: copy DB to encrypted DB")
179179
Realm.getInstance(realmConfiguration).use {
180-
// Move the DB to the new location, handled by RiotX
180+
// Move the DB to the new location, handled by Matrix SDK2
181181
it.writeEncryptedCopyTo(File(newLocation, realmConfiguration.realmFileName), realmKeysUtils.getRealmEncryptionKey(keyAlias))
182182
}
183183
}
184184

185-
// Delete all the files created by Riot Android which will not be used anymore by RiotX
185+
// Delete all the files created by Riot Android which will not be used anymore by Element
186186
private fun clearFileSystem(legacyConfig: LegacyHomeServerConnectionConfig) {
187187
val cryptoFolder = legacyConfig.credentials.userId.md5()
188188

matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ internal class UserAgentHolder @Inject constructor(private val context: Context,
3636

3737
/**
3838
* Create an user agent with the application version.
39-
* Ex: RiotX/1.0.0 (Linux; U; Android 6.0.1; SM-A510F Build/MMB29; Flavour GPlay; MatrixAndroidSDK_X 1.0)
39+
* Ex: Element/1.0.0 (Linux; U; Android 6.0.1; SM-A510F Build/MMB29; Flavour GPlay; MatrixAndroidSDK_X 1.0)
4040
*
4141
* @param flavorDescription the flavor description
4242
*/

newsfragment/3459.feature

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Migrate to new colors and cleanup the style and theme
2+
Ref: https://material.io/blog/migrate-android-material-components

tools/check/forbidden_strings_in_code.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ android\.R\.id\.home===2
136136
### Kotlin conversion tools introduce this, but is can be replace by trim()
137137
trim \{ it \<\= \' \' \}
138138

139-
### Use AlertDialog form v7 compat lib
139+
### Use MaterialAlertDialogBuilder
140140
android\.app\.AlertDialog
141+
androidx\.appcompat\.app\.AlertDialog===4
141142

142143
### Put the operator at the beginning of next line
143144
&&$

tools/check/forbidden_strings_in_resources.txt

+19
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,22 @@ layout_constraintLeft_
8484

8585
### Use androidx.recyclerview.widget.RecyclerView because EpoxyRecyclerViews add behavior we do not want to
8686
<com\.airbnb\.epoxy\.EpoxyRecyclerView
87+
88+
### Use Button instead of MaterialButton, the inflater will automatically inflate MaterialButton.
89+
<com\.google\.android\.material\.button\.MaterialButton
90+
<androidx\.appcompat\.widget\.AppCompatButton
91+
92+
### Use CheckBox instead of MaterialCheckBox, the inflater will automatically inflate MaterialCheckBox.
93+
<com\.google\.android\.material\.checkbox\.MaterialCheckBox
94+
95+
### Use RadioButton instead of MaterialRadioButton, the inflater will automatically inflate Material Views.
96+
<com\.google\.android\.material\.radiobutton\.MaterialRadioButton
97+
98+
### Use com.google.android.material.switchmaterial.SwitchMaterial instead of Switch, the inflater will not automatically inflate Material Views for Switch.
99+
<Switch
100+
101+
### Use colorSecondary
102+
colorAccent
103+
104+
### Use MaterialCardView
105+
<androidx\.cardview\.widget\.CardView

vector/src/debug/AndroidManifest.xml

+17-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,26 @@
66
<activity android:name=".features.debug.TestLinkifyActivity" />
77
<activity android:name=".features.debug.sas.DebugSasEmojiActivity" />
88
<activity
9-
android:name=".features.debug.DebugMaterialThemeLightActivity"
9+
android:name=".features.debug.DebugMaterialThemeLightDefaultActivity"
1010
android:theme="@style/VectorMaterialThemeDebugLight" />
1111
<activity
12-
android:name=".features.debug.DebugMaterialThemeDarkActivity"
12+
android:name=".features.debug.DebugMaterialThemeLightTestActivity"
13+
android:theme="@style/VectorMaterialThemeDebugLight.Test" />
14+
<activity
15+
android:name=".features.debug.DebugMaterialThemeLightVectorActivity"
16+
android:theme="@style/AppTheme.Light" />
17+
<activity
18+
android:name=".features.debug.DebugMaterialThemeDarkDefaultActivity"
1319
android:theme="@style/VectorMaterialThemeDebugDark" />
20+
<activity
21+
android:name=".features.debug.DebugMaterialThemeDarkTestActivity"
22+
android:theme="@style/VectorMaterialThemeDebugDark.Test" />
23+
<activity
24+
android:name=".features.debug.DebugMaterialThemeDarkVectorActivity"
25+
android:theme="@style/AppTheme.Dark" />
26+
<activity
27+
android:name=".features.debug.DebugVectorButtonStylesActivity"
28+
android:theme="@style/AppTheme.Light" />
1429
</application>
1530

1631
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2021 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package im.vector.app.features.debug
18+
19+
import android.os.Bundle
20+
import android.view.LayoutInflater
21+
import android.view.View
22+
import android.view.ViewGroup
23+
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
24+
import im.vector.app.databinding.ActivityTestMaterialThemeBinding
25+
26+
class DebugBottomSheet : BottomSheetDialogFragment() {
27+
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
28+
// Reuse tha Activity layout
29+
val binding = ActivityTestMaterialThemeBinding.inflate(inflater, container, false)
30+
return binding.root
31+
}
32+
}

vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeActivity.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ package im.vector.app.features.debug
1818

1919
import android.os.Bundle
2020
import android.view.Menu
21-
import androidx.appcompat.app.AlertDialog
2221
import androidx.appcompat.app.AppCompatActivity
23-
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
22+
import com.google.android.material.dialog.MaterialAlertDialogBuilder
2423
import com.google.android.material.snackbar.Snackbar
2524
import im.vector.app.R
2625
import im.vector.app.core.utils.toast
@@ -45,7 +44,8 @@ abstract class DebugMaterialThemeActivity : AppCompatActivity() {
4544
}
4645

4746
views.debugShowDialog.setOnClickListener {
48-
AlertDialog.Builder(this)
47+
MaterialAlertDialogBuilder(this)
48+
.setTitle("Dialog title")
4949
.setMessage("Dialog content")
5050
.setIcon(R.drawable.ic_settings_x)
5151
.setPositiveButton("Positive", null)
@@ -55,7 +55,7 @@ abstract class DebugMaterialThemeActivity : AppCompatActivity() {
5555
}
5656

5757
views.debugShowBottomSheet.setOnClickListener {
58-
BottomSheetDialogFragment().show(supportFragmentManager, "TAG")
58+
DebugBottomSheet().show(supportFragmentManager, "TAG")
5959
}
6060
}
6161

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2019 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package im.vector.app.features.debug
18+
19+
class DebugMaterialThemeDarkDefaultActivity : DebugMaterialThemeActivity()

vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeDarkActivity.kt renamed to vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeDarkTestActivity.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
package im.vector.app.features.debug
1818

19-
class DebugMaterialThemeDarkActivity : DebugMaterialThemeActivity()
19+
class DebugMaterialThemeDarkTestActivity : DebugMaterialThemeActivity()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2019 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package im.vector.app.features.debug
18+
19+
class DebugMaterialThemeDarkVectorActivity : DebugMaterialThemeActivity()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2019 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package im.vector.app.features.debug
18+
19+
class DebugMaterialThemeLightDefaultActivity : DebugMaterialThemeActivity()

vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeLightActivity.kt renamed to vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeLightTestActivity.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
package im.vector.app.features.debug
1818

19-
class DebugMaterialThemeLightActivity : DebugMaterialThemeActivity()
19+
class DebugMaterialThemeLightTestActivity : DebugMaterialThemeActivity()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2019 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package im.vector.app.features.debug
18+
19+
class DebugMaterialThemeLightVectorActivity : DebugMaterialThemeActivity()

0 commit comments

Comments
 (0)