Skip to content

Commit 47e11b9

Browse files
fix(theming): Improve color theming and general layouting
Resolves #16245 Signed-off-by: Andy Scherzinger <[email protected]>
1 parent e8d3cf5 commit 47e11b9

File tree

11 files changed

+42
-30
lines changed

11 files changed

+42
-30
lines changed

app/src/main/java/com/owncloud/android/ui/activity/EditorWebView.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import android.webkit.WebView;
2626

2727
import com.google.android.material.snackbar.Snackbar;
28+
import com.nextcloud.android.common.ui.theme.utils.ColorRole;
2829
import com.nextcloud.client.account.User;
2930
import com.nextcloud.utils.extensions.IntentExtensionsKt;
3031
import com.owncloud.android.R;
@@ -130,6 +131,8 @@ protected void bindView() {
130131
protected void postOnCreate() {
131132
super.postOnCreate();
132133

134+
viewThemeUtils.platform.colorCircularProgressBar(binding.progressBar2, ColorRole.PRIMARY);
135+
133136
getWebView().setWebChromeClient(new WebChromeClient() {
134137
final EditorWebView activity = EditorWebView.this;
135138

app/src/main/java/com/owncloud/android/ui/activity/InternalTwoWaySyncActivity.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class InternalTwoWaySyncActivity :
5050
override fun onCreate(savedInstanceState: Bundle?) {
5151
super.onCreate(savedInstanceState)
5252

53-
internalTwoWaySyncAdapter = InternalTwoWaySyncAdapter(fileDataStorageManager, user.get(), this, this)
53+
internalTwoWaySyncAdapter = InternalTwoWaySyncAdapter(fileDataStorageManager, user.get(), this, this, viewThemeUtils)
5454

5555
binding = InternalTwoWaySyncLayoutBinding.inflate(layoutInflater)
5656
setContentView(binding.root)
@@ -163,6 +163,7 @@ class InternalTwoWaySyncActivity :
163163
handleDurationSelected(durations[position].first.inWholeMinutes)
164164
}
165165
}
166+
viewThemeUtils.material.colorTextInputLayout(binding.twoWaySyncIntervalLayout)
166167
}
167168

168169
private fun handleDurationSelected(duration: Long) {
@@ -184,6 +185,7 @@ class InternalTwoWaySyncActivity :
184185
backgroundJobManager.cancelTwoWaySyncJob()
185186
}
186187
}
188+
viewThemeUtils.material.colorMaterialSwitch(binding.twoWaySyncToggle)
187189
}
188190

189191
private fun checkLayoutVisibilities(condition: Boolean) {

app/src/main/java/com/owncloud/android/ui/adapter/InternalTwoWaySyncAdapter.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@ import android.content.Context
1212
import android.view.LayoutInflater
1313
import android.view.ViewGroup
1414
import androidx.recyclerview.widget.RecyclerView
15+
import com.nextcloud.android.common.ui.theme.utils.ColorRole
1516
import com.nextcloud.client.account.User
1617
import com.owncloud.android.databinding.InternalTwoWaySyncViewHolderBinding
1718
import com.owncloud.android.datamodel.FileDataStorageManager
1819
import com.owncloud.android.datamodel.OCFile
20+
import com.owncloud.android.utils.theme.ViewThemeUtils
1921

2022
class InternalTwoWaySyncAdapter(
2123
private val dataStorageManager: FileDataStorageManager,
2224
private val user: User,
2325
val context: Context,
24-
private val onUpdateListener: InternalTwoWaySyncAdapterOnUpdate
26+
private val onUpdateListener: InternalTwoWaySyncAdapterOnUpdate,
27+
private val viewThemeUtils: ViewThemeUtils
2528
) : RecyclerView.Adapter<InternalTwoWaySyncViewHolder>() {
2629

2730
interface InternalTwoWaySyncAdapterOnUpdate {
@@ -30,14 +33,11 @@ class InternalTwoWaySyncAdapter(
3033

3134
var folders: List<OCFile> = dataStorageManager.getInternalTwoWaySyncFolders(user)
3235

33-
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InternalTwoWaySyncViewHolder =
34-
InternalTwoWaySyncViewHolder(
35-
InternalTwoWaySyncViewHolderBinding.inflate(
36-
LayoutInflater.from(parent.context),
37-
parent,
38-
false
39-
)
40-
)
36+
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InternalTwoWaySyncViewHolder {
37+
val binding = InternalTwoWaySyncViewHolderBinding.inflate(LayoutInflater.from(parent.context), parent, false)
38+
viewThemeUtils.platform.colorImageView(binding.folderIcon, ColorRole.PRIMARY)
39+
return InternalTwoWaySyncViewHolder(binding)
40+
}
4141

4242
override fun getItemCount(): Int = folders.size
4343

app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
276276
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
277277
if (getFile() != null && user != null) {
278278
viewThemeUtils.platform.themeHorizontalProgressBar(binding.progressBar);
279+
viewThemeUtils.platform.themeCheckbox(binding.folderSyncButton);
279280
progressListener = new DownloadProgressListener(binding.progressBar);
280281
binding.cancelBtn.setOnClickListener(this);
281282
binding.favorite.setOnClickListener(this);

app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ private void setupView() {
301301
binding.sharesListInternalShowAll.setText(textRes);
302302
});
303303

304+
viewThemeUtils.material.colorMaterialButtonPrimaryOutlined(binding.createLink);
305+
304306
viewThemeUtils.material.colorMaterialTextButton(binding.sharesListExternalShowAll);
305307
binding.sharesListExternalShowAll.setOnClickListener(view -> {
306308
externalShareeListAdapter.toggleShowAll();

app/src/main/res/layout/file_details_fragment.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@
198198
<TextView
199199
android:layout_width="match_parent"
200200
android:layout_height="wrap_content"
201+
android:textSize="@dimen/two_line_primary_text_size"
201202
android:text="@string/sync" />
202203
</LinearLayout>
203204

app/src/main/res/layout/file_details_sharing_fragment.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@
172172
style="@style/Widget.Material3.Button.OutlinedButton"
173173
android:layout_width="match_parent"
174174
android:layout_height="wrap_content"
175-
android:layout_marginStart="@dimen/standard_double_margin"
176-
android:layout_marginEnd="@dimen/standard_double_margin"
175+
android:layout_marginStart="@dimen/standard_margin"
176+
android:layout_marginEnd="@dimen/standard_margin"
177177
app:icon="@drawable/file_link"
178178
app:iconGravity="textStart"
179179
android:text="@string/create_link" />

app/src/main/res/layout/internal_two_way_sync_layout.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@
2222

2323
<com.google.android.material.materialswitch.MaterialSwitch
2424
android:id="@+id/twoWaySyncToggle"
25-
android:text="@string/prefs_two_way_sync_switch_title"
26-
android:textSize="@dimen/txt_size_16sp"
27-
android:minHeight="48dp"
28-
android:layout_marginHorizontal="@dimen/standard_half_padding"
25+
android:layout_width="match_parent"
26+
android:layout_height="wrap_content"
27+
android:layout_marginHorizontal="@dimen/standard_margin"
2928
android:layout_marginTop="@dimen/alternate_margin"
3029
android:layout_marginBottom="@dimen/alternate_margin"
31-
android:layout_width="match_parent"
32-
android:layout_height="wrap_content" />
30+
android:minHeight="@dimen/minimum_size_for_touchable_area"
31+
android:text="@string/prefs_two_way_sync_title"
32+
android:textSize="@dimen/txt_size_16sp" />
3333

3434
<com.google.android.material.textfield.TextInputLayout
3535
android:id="@+id/two_way_sync_interval_layout"
36-
android:layout_marginHorizontal="@dimen/standard_half_padding"
37-
style="@style/Widget.Material3.TextInputLayout.FilledBox.ExposedDropdownMenu"
36+
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
3837
android:layout_width="match_parent"
3938
android:layout_height="wrap_content"
39+
android:layout_marginHorizontal="@dimen/standard_margin"
4040
android:layout_marginBottom="@dimen/alternate_margin"
4141
android:hint="@string/prefs_two_way_sync_interval">
4242

app/src/main/res/layout/internal_two_way_sync_view_holder.xml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@
22
<!--
33
~ Nextcloud - Android Client
44
~
5-
~ SPDX-FileCopyrightText: 2024 Andy Scherzinger <[email protected]>
5+
~ SPDX-FileCopyrightText: 2024-2026 Andy Scherzinger <[email protected]>
66
~ SPDX-FileCopyrightText: 2024 Tobias Kaminsky <[email protected]>
77
~ SPDX-License-Identifier: AGPL-3.0-or-later
8-
-->
8+
-->
99
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
1010
xmlns:tools="http://schemas.android.com/tools"
1111
android:layout_width="match_parent"
1212
android:layout_height="@dimen/min_list_item_size"
13-
android:orientation="horizontal"
14-
android:paddingStart="@dimen/standard_half_padding"
15-
android:paddingEnd="@dimen/standard_half_padding">
13+
android:orientation="horizontal">
1614

1715
<ImageView
16+
android:id="@+id/folder_icon"
1817
android:layout_width="@dimen/file_icon_size"
1918
android:layout_height="@dimen/file_icon_size"
2019
android:layout_gravity="center_vertical"
20+
android:layout_marginStart="@dimen/standard_margin"
21+
android:layout_marginEnd="@dimen/standard_half_margin"
2122
android:contentDescription="@null"
2223
android:src="@drawable/folder" />
2324

2425
<LinearLayout
2526
android:layout_width="0dp"
26-
android:layout_weight="1"
2727
android:layout_height="@dimen/min_list_item_size"
28-
android:layout_marginStart="@dimen/standard_half_margin"
28+
android:layout_weight="1"
2929
android:gravity="center_vertical|start"
3030
android:orientation="vertical">
3131

3232
<TextView
3333
android:id="@+id/name"
34-
android:layout_width="wrap_content"
34+
android:layout_width="match_parent"
3535
android:layout_height="wrap_content"
3636
android:ellipsize="middle"
3737
android:gravity="center_vertical"
@@ -97,10 +97,11 @@
9797

9898
<ImageView
9999
android:id="@+id/unset"
100-
android:layout_width="wrap_content"
101-
android:layout_height="wrap_content"
100+
android:layout_width="@dimen/minimum_size_for_touchable_area"
101+
android:layout_height="@dimen/minimum_size_for_touchable_area"
102102
android:layout_gravity="center_vertical"
103103
android:contentDescription="@string/unset_internal_two_way_sync_description"
104+
android:padding="@dimen/minimum_size_for_touchable_area_icon_padding"
104105
android:src="@drawable/ic_close" />
105106

106107
</LinearLayout>

app/src/main/res/values/dims.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@
142142
<dimen name="account_action_button_vertical_margin">10dp</dimen>
143143
<dimen name="online_status_item_height">60dp</dimen>
144144
<dimen name="minimum_size_for_touchable_area">48dp</dimen>
145+
<dimen name="minimum_size_for_touchable_area_icon_padding">12dp</dimen>
145146
<dimen name="dialog_elevation">24dp</dimen>
146147
<dimen name="default_login_width">400dp</dimen>
147148
<dimen name="dialogBorderRadius">24dp</dimen>

0 commit comments

Comments
 (0)