Skip to content

Commit

Permalink
Code refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder-tsys committed May 17, 2023
1 parent 03b7a43 commit 406551c
Show file tree
Hide file tree
Showing 8 changed files with 300 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AppVersionPreference : Preference {
private fun updatePreferenceView(title: TextView, summary: TextView) {
val appVersion = appVersion
val titleColor: Int = context.resources.getColor(R.color.fontAppbar, null)
title.text = StringUtils.getColoredSpan(
title.text = StringUtils.getColorSpan(
context.getString(R.string.app_name),
titleColor
)
Expand Down
151 changes: 124 additions & 27 deletions app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java

Large diffs are not rendered by default.

20 changes: 9 additions & 11 deletions app/src/main/java/com/owncloud/android/utils/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ String searchAndColor(@Nullable String text, @Nullable String searchText,
}
}

public static Spannable getColorSpan(@NonNull String title, @ColorInt int color) {
Spannable text = new SpannableString(title);
text.setSpan(new ForegroundColorSpan(color),
0,
text.length(),
Spannable.SPAN_INCLUSIVE_INCLUSIVE);
return text;
}

public static
@NonNull
String removePrefix(@NonNull String s, @NonNull String prefix) {
Expand All @@ -81,15 +90,4 @@ String removePrefix(@NonNull String s, @NonNull String prefix) {
}
return s;
}

public static Spannable getColoredSpan(String title, int color) {
Spannable text = new SpannableString(title);
text.setSpan(
new ForegroundColorSpan(color),
0,
text.length(),
Spannable.SPAN_INCLUSIVE_INCLUSIVE
);
return text;
}
}
16 changes: 8 additions & 8 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,14 @@
<string name="uploader_error_title_file_cannot_be_uploaded">Diese Datei kann nicht hochgeladen werden</string>
<string name="uploader_error_title_no_file_to_upload">Keine Datei zum Hochladen</string>
<string name="uploader_info_dirname">Ordnername</string>
<string name="prefs_category_account_info">Kontoinformationen</string>
<string name="prefs_category_data_privacy">Datenschutz</string>
<string name="privacy_settings">Datenschutz</string>
<string name="privacy_policy">Datenschutzbestimmungen</string>
<string name="prefs_open_source">Verwendete OpenSource Software</string>
<string name="prefs_category_info">Info</string>
<string name="prefs_category_service">Bedienung</string>
<string name="prefs_keys_exist_summary">Die Ende-zu-Ende Verschlüsselung wurde bereits auf einem anderen Gerät eingerichtet. Bitte geben Sie Ihre Passphrase ein, damit die Dateien synchronisiert und entschlüsselt werden.</string>
<string name="uploader_top_message">Hochladeordner auswählen</string>
<string name="uploader_upload_failed_content_single">Konnte %1$s nicht hochladen</string>
<string name="uploader_upload_failed_credentials_error">Hochladen fehlgeschlagen, bitte erneut anmelden</string>
Expand Down Expand Up @@ -921,14 +929,6 @@
<string name="write_email">E-Mail senden</string>
<string name="wrong_storage_path">Speicherordner existiert nicht!</string>
<string name="wrong_storage_path_desc">Ursache könnte die Wiederherstellung einer Sicherungskopie auf einem anderen Gerät sein. Der Standard-Ordner wird jetzt wieder verwendet. Bitte überprüfen Sie die Einstellungen bezüglich des Speicherortes.</string>
<string name="prefs_category_account_info">Kontoinformationen</string>
<string name="prefs_category_data_privacy">Datenschutz</string>
<string name="privacy_settings">Datenschutz</string>
<string name="privacy_policy">Datenschutzbestimmungen</string>
<string name="prefs_open_source">Verwendete OpenSource Software</string>
<string name="prefs_category_info">Info</string>
<string name="prefs_category_service">Bedienung</string>
<string name="prefs_keys_exist_summary">Die Ende-zu-Ende Verschlüsselung wurde bereits auf einem anderen Gerät eingerichtet. Bitte geben Sie Ihre Passphrase ein, damit die Dateien synchronisiert und entschlüsselt werden.</string>
<plurals name="sync_fail_in_favourites_content">
<item quantity="one">Inhalte von %1$d Datei konnten nicht synchronisiert werden (Konflikte: %2$d)</item>
<item quantity="other">Inhalte von %1$d Dateien konnten nicht synchronisiert werden (Konflikte: %2$d)</item>
Expand Down
73 changes: 66 additions & 7 deletions app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,9 @@
<color name="bg_default">#121212</color>
<color name="primary_button_text_color">#000000</color>
<color name="grey_200">#818181</color>
<color name="divider_color">@color/grey_70</color>
<color name="nc_grey">#222222</color>
<color name="icon_on_nc_grey">#ffffff</color>

<!-- Switch Compat Colors -->
<color name="switch_thumb_checked_disabled">@color/grey_70</color>
<color name="switch_track_checked_disabled">@color/grey_60</color>
<color name="switch_thumb_unchecked_disabled">@color/grey_70</color>
<color name="switch_track_unchecked_disabled">@color/grey_60</color>

<!-- Multiselect backgrounds -->
<color name="action_mode_background">@color/appbar</color>
<color name="selected_item_background">#373535</color>
Expand All @@ -55,4 +48,70 @@
<!-- App bar -->
<color name="appbar">#1E1E1E</color>
<color name="fontAppbar">@android:color/white</color>

<!-- NMC Colors -->
<color name="icon_color">#FFFFFF</color>
<color name="sort_text_color">@color/grey_30</color>
<color name="list_icon_color">@color/grey_30</color>
<color name="warning_icon_color">#CCCCCC</color>
<color name="divider_color">@color/grey_70</color>
<color name="spinner_bg_color">@color/grey_80</color>
<color name="refresh_layout_bg_color">#2D2D2D</color>
<color name="primary_button_disabled_color">@color/grey_70</color>
<color name="toolbar_divider_color">@color/grey_70</color>

<!-- Snackbar Colors -->
<color name="snackbar_bg_color">@color/grey_80</color>
<color name="snackbar_txt_color">@color/grey_0</color>

<!-- Alert Dialog Colors -->
<color name="alert_bg_color">@color/grey_80</color>
<color name="alert_txt_color">@color/grey_0</color>

<!-- NavigationView colors -->
<color name="nav_selected_bg_color">@color/grey_60</color>
<color name="nav_txt_unselected_color">@color/grey_0</color>
<color name="nav_txt_selected_color">@color/grey_0</color>
<color name="nav_icon_unselected_color">@color/grey_30</color>
<color name="nav_icon_selected_color">#FFFFFF</color>
<color name="nav_divider_color">@color/grey_30</color>
<color name="nav_bg_color">@color/grey_80</color>
<color name="drawer_quota_txt_color">#FFFFFF</color>

<!-- Bottom Sheet Colors -->
<color name="bottom_sheet_bg_color">@color/grey_80</color>
<color name="bottom_sheet_icon_color">@color/grey_30</color>
<color name="bottom_sheet_txt_color">@color/grey_0</color>

<!-- Popup Menu Colors -->
<color name="popup_menu_bg">@color/grey_80</color>
<color name="popup_menu_txt_color">@color/grey_0</color>
<color name="overflow_bg_color">@color/grey_80</color>

<!-- Switch Compat Colors -->
<color name="switch_thumb_checked_disabled">@color/grey_70</color>
<color name="switch_track_checked_disabled">@color/grey_60</color>
<color name="switch_thumb_unchecked_disabled">@color/grey_70</color>
<color name="switch_track_unchecked_disabled">@color/grey_60</color>

<!-- Checkbox Colors -->
<color name="checkbox_checked_disabled">@color/grey_70</color>
<color name="checkbox_unchecked_disabled">@color/grey_70</color>

<!-- Share Colors -->
<color name="share_title_txt_color">#FFFFFF</color>
<color name="share_subtitle_txt_color">@color/grey_30</color>
<color name="share_info_txt_color">@color/grey_0</color>
<color name="share_search_border_color">@color/grey_0</color>
<color name="share_btn_txt_color">@color/grey_0</color>
<color name="share_list_item_txt_color">@color/grey_0</color>
<color name="share_disabled_txt_color">@color/grey_60</color>
<color name="share_txt_color">@color/grey_0</color>
<color name="share_et_divider">#FFFFFF</color>

<!-- Scan Colors -->
<color name="scan_doc_bg_color">#121212</color>
<color name="scan_text_color">@color/grey_0</color>
<color name="scan_edit_bottom_color">@color/grey_80</color>
<color name="scan_count_bg_color">@color/grey_80</color>
</resources>
95 changes: 85 additions & 10 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,13 @@
<color name="dark_background_text_color">#EEEEEE</color>
<color name="transparent">#00000000</color>
<color name="secondary_text_color">#666666</color>
<color name="divider_color">@color/grey_30</color>
<color name="highlight_textColor_Warning">#e53935</color>

<!-- Colors -->
<color name="standard_grey">#757575</color>
<color name="actionbar_shadow">#222222</color>
<color name="grey_200">#EEEEEE</color>
<color name="grey_400">#BDBDBD</color>
<color name="grey_60">#666666</color>
<color name="grey_0">#F2F2F2</color>
<color name="grey_30">#B2B2B2</color>
<color name="grey_70">#4C4C4C</color>
<color name="dark_grey">#101010</color>
<color name="grey_600">#666666</color>

<!-- standard material color definitions -->
Expand Down Expand Up @@ -83,6 +77,62 @@
<color name="bg_fallback_highlight">#616161</color>
<color name="drawer_active_item_background">#80000000</color>

<!-- App bar -->
<color name="appbar">@android:color/white</color>
<color name="fontAppbar">#666666</color>
<color name="fontSecondaryAppbar">#A5A5A5</color>

<!-- NMC Colors -->
<color name="icon_color">#191919</color>
<color name="sort_text_color">@color/primary</color>
<color name="list_icon_color">#191919</color>
<color name="warning_icon_color">#191919</color>
<color name="divider_color">@color/grey_30</color>
<color name="spinner_bg_color">@android:color/white</color>
<color name="refresh_layout_bg_color">#FFFFFF</color>
<color name="primary_button_disabled_color">@color/grey_0</color>
<color name="toolbar_divider_color">#CCCCCC</color>
<color name="et_highlight_color">#77c4ff</color>
<color name="white_trans_70">#B3FFFFFF</color>
<color name="progress_bar_background">@color/grey_10</color>

<!-- Grey Colors -->
<color name="dark_grey">#101010</color>
<color name="grey_0">#F2F2F2</color>
<color name="grey_10">#E5E5E5</color>
<color name="grey_30">#B2B2B2</color>
<color name="grey_60">#666666</color>
<color name="grey_70">#4C4C4C</color>
<color name="grey_80">#333333</color>

<!-- Snackbar Colors -->
<color name="snackbar_bg_color">@color/design_snackbar_background_color</color>
<color name="snackbar_txt_color">@color/white</color>

<!-- Alert Dialog Colors -->
<color name="alert_bg_color">#FFFFFF</color>
<color name="alert_txt_color">#191919</color>

<!-- NavigationView colors -->
<color name="nav_selected_bg_color">@color/grey_0</color>
<color name="nav_txt_unselected_color">#191919</color>
<color name="nav_txt_selected_color">@color/primary</color>
<color name="nav_icon_unselected_color">#191919</color>
<color name="nav_icon_selected_color">@color/primary</color>
<color name="nav_divider_color">@color/grey_30</color>
<color name="nav_bg_color">@color/white</color>
<color name="drawer_quota_txt_color">#191919</color>

<!-- Bottom Sheet Colors -->
<color name="bottom_sheet_bg_color">#FFFFFF</color>
<color name="bottom_sheet_icon_color">#191919</color>
<color name="bottom_sheet_txt_color">#191919</color>

<!-- Popup Menu Colors -->
<color name="popup_menu_bg">#FFFFFF</color>
<color name="popup_menu_txt_color">#191919</color>
<color name="overflow_bg_color">#FFFFFF</color>

<!-- Switch Compat Colors -->
<color name="switch_thumb_checked_enabled">@color/primary</color>
<color name="switch_track_checked_enabled">#F399C7</color>
Expand All @@ -93,8 +143,33 @@
<color name="switch_thumb_unchecked_disabled">@color/grey_0</color>
<color name="switch_track_unchecked_disabled">@color/grey_0</color>

<!-- App bar -->
<color name="appbar">@android:color/white</color>
<color name="fontAppbar">#666666</color>
<color name="fontSecondaryAppbar">#A5A5A5</color>
<!-- Checkbox Colors -->
<color name="checkbox_checked_enabled">@color/primary</color>
<color name="checkbox_unchecked_enabled">@color/grey_30</color>
<color name="checkbox_checked_disabled">@color/grey_30</color>
<color name="checkbox_unchecked_disabled">#CCCCCC</color>

<!-- Share Colors -->
<color name="share_title_txt_color">#191919</color>
<color name="share_subtitle_txt_color">@color/grey_30</color>
<color name="share_info_txt_color">#191919</color>
<color name="share_search_border_color">#191919</color>
<color name="share_btn_txt_color">#191919</color>
<color name="share_list_item_txt_color">#191919</color>
<color name="share_disabled_txt_color">@color/grey_30</color>
<color name="share_txt_color">#191919</color>
<color name="share_et_divider">#000000</color>
<color name="share_warning_txt_color">#191919</color>
<color name="sharing_warning_bg_color">#F6E5EB</color>
<color name="sharing_warning_border_color">#C16F81</color>
<color name="share_color">#0D39DF</color>
<color name="shared_with_me_color">#0099ff</color>

<!-- Scan Colors -->
<color name="scan_doc_bg_color">@color/grey_0</color>
<color name="scan_text_color">#191919</color>
<color name="scan_edit_bottom_color">@color/grey_0</color>
<color name="scan_count_bg_color">@color/grey_30</color>
<color name="neptune">#77b6bb</color>
<color name="neptune_50">#5077b6bb</color>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
<dimen name="notification_row_item_height">145dp</dimen>
<dimen name="button_stroke_width">1dp</dimen>
<dimen name="txt_size_13sp">13sp</dimen>
</resources>
</resources>
12 changes: 6 additions & 6 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -995,12 +995,6 @@
<string name="delete_link">Delete Link</string>
<string name="share_settings">Settings</string>
<string name="common_confirm">Confirm</string>
<string name="prefs_category_info">Info</string>
<string name="prefs_category_data_privacy">Data Privacy</string>
<string name="privacy_settings">Privacy Settings</string>
<string name="privacy_policy">Privacy Policy</string>
<string name="prefs_open_source">Used OpenSource Software</string>
<string name="prefs_category_service">Service</string>
<string name="strict_mode">Strict mode: no HTTP connection allowed!</string>
<string name="destination_filename">Destination filename</string>
<string name="suggest">Suggest</string>
Expand Down Expand Up @@ -1080,6 +1074,12 @@
<string name="add_new_secure_file_drop">Add new secure file drop</string>
<string name="scan_page">Scan page</string>
<string name="done">Done</string>
<string name="prefs_category_info">Info</string>
<string name="prefs_category_data_privacy">Data Privacy</string>
<string name="privacy_settings">Privacy Settings</string>
<string name="privacy_policy">Privacy Policy</string>
<string name="prefs_open_source">Used OpenSource Software</string>
<string name="prefs_category_service">Service</string>
<string name="document_scan_pdf_generation_in_progress">Generating PDF…</string>
<string name="error_starting_doc_scan">Error starting document scan</string>
<string name="document_scan_pdf_generation_failed">PDF generation failed</string>
Expand Down

0 comments on commit 406551c

Please sign in to comment.