From dc84f878f9a0869d41f0793bdd60863dfffb27af Mon Sep 17 00:00:00 2001 From: Konstantin Ivanov <54908981+konstantiniiv@users.noreply.github.com> Date: Fri, 14 Apr 2023 15:57:27 +0200 Subject: [PATCH] DROID-1086 Design | Typography, core ui module (#3089) * DROID-1086 legacy * DROID-1086 core ui design * DROID-1086 legacy * DROID-1086 legacy * DROID-1086 legacy * DROID-1086 legacy * DROID-1086 legacy archive screen * DROID-1086 core-ui module design * DROID-1086 cutom widgets fix * DROID-1086 legacy * DROID-1086 legacy * DROID-1086 legacy styles * DROID-1086 legacy * DROID-1086 legacy * DROID-1086 legacy * DROID-1086 design fixes * DROID-1086 design system font fix --- .../anytype/di/common/ComponentManager.kt | 7 - .../anytypeio/anytype/di/feature/ArchiveDI.kt | 65 --- .../anytype/di/main/MainComponent.kt | 2 - .../anytypeio/anytype/navigation/Navigator.kt | 8 - .../anytype/ui/archive/ArchiveFragment.kt | 133 ----- .../anytype/ui/base/NavigationRouter.kt | 1 - .../anytype/ui/menu/AnytypeContextMenu.kt | 259 ---------- .../anytype/ui/menu/ContextPopupWindow.kt | 380 -------------- .../ui/profile/SelectProfileAdapter.kt | 108 ---- .../anytype/ui/profile/SelectProfileDialog.kt | 51 -- app/src/main/res/layout/activity_settings.xml | 16 +- .../main/res/layout/dialog_select_profile.xml | 3 +- app/src/main/res/layout/fragment_archive.xml | 67 --- .../res/layout/fragment_choose_pin_code.xml | 3 - .../res/layout/fragment_create_account.xml | 3 - .../main/res/layout/fragment_dashboard.xml | 313 ------------ .../main/res/layout/fragment_date_picker.xml | 6 +- .../res/layout/fragment_debug_settings.xml | 19 +- .../res/layout/fragment_doc_cover_gallery.xml | 5 +- app/src/main/res/layout/fragment_filter.xml | 5 +- .../res/layout/fragment_link_to_object.xml | 80 --- .../layout/fragment_link_to_object_or_web.xml | 7 +- app/src/main/res/layout/fragment_list.xml | 2 +- .../layout/fragment_object_type_change.xml | 4 +- .../res/layout/fragment_page_icon_picker.xml | 4 +- .../res/layout/fragment_page_navigation.xml | 81 --- .../res/layout/fragment_select_account.xml | 2 - .../fragment_select_filter_condition.xml | 2 +- .../fragment_setup_selected_account.xml | 2 +- app/src/main/res/layout/fragment_splash.xml | 6 +- .../main/res/layout/fragment_start_login.xml | 1 - .../layout/item_choose_profile_profile.xml | 5 +- .../item_select_profile_add_profile.xml | 37 -- .../layout/item_select_profile_profile.xml | 43 -- .../main/res/layout/popup_context_menu.xml | 234 --------- .../res/layout/view_link_to_object_bottom.xml | 61 --- .../layout/view_link_to_object_preview.xml | 100 ---- .../main/res/layout/view_move_to_bottom.xml | 61 --- .../main/res/layout/view_move_to_preview.xml | 100 ---- .../view_page_navigation_open_bottom.xml | 61 --- app/src/main/res/layout/view_page_preview.xml | 100 ---- app/src/main/res/navigation/graph.xml | 14 - app/src/main/res/values/styles.xml | 191 +------ .../features/dataview/ViewerListAdapter.kt | 25 - .../features/dataview/ViewerTabItemAdapter.kt | 80 --- .../features/dataview/ViewerTitleAdapter.kt | 21 - .../features/dataview/ViewerTypeAdapter.kt | 138 ----- .../features/dataview/modals/TagAdapter.kt | 32 -- .../core_ui/features/navigation/FilterView.kt | 83 --- .../features/navigation/PageLinksAdapter.kt | 61 --- .../navigation/PageLinksListHolder.kt | 43 -- .../navigation/PageNavigationAdapter.kt | 43 -- .../navigation/PageNavigationLinksFragment.kt | 23 - .../features/sets/CreateSetHeaderAdapter.kt | 41 -- .../core_ui/widgets/ButtonPrimaryNumber.kt | 8 +- .../widgets/dv/GalleryViewContentWidget.kt | 46 +- .../widgets/toolbar/ArchiveToolbarWidget.kt | 30 -- core-ui/src/main/res/layout/dialog_layout.xml | 7 +- .../main/res/layout/item_block_bookmark.xml | 5 +- .../main/res/layout/item_block_file_error.xml | 2 +- .../res/layout/item_block_file_uploading.xml | 2 +- .../item_block_relation_placeholder.xml | 4 +- .../res/layout/item_block_title_profile.xml | 8 +- .../main/res/layout/item_block_title_todo.xml | 3 - .../src/main/res/layout/item_block_toc.xml | 2 +- .../src/main/res/layout/item_block_toggle.xml | 2 +- .../res/layout/item_block_unsupported.xml | 5 +- .../res/layout/item_block_video_error.xml | 3 +- .../res/layout/item_block_video_uploading.xml | 4 +- .../item_bottom_detail_toolbar_option.xml | 36 -- .../res/layout/item_cover_unsplash_image.xml | 2 +- .../layout/item_create_filter_checkbox.xml | 4 +- .../res/layout/item_create_filter_date.xml | 9 +- .../res/layout/item_create_filter_object.xml | 9 +- .../res/layout/item_create_set_header.xml | 92 ---- .../layout/item_create_set_object_type.xml | 45 -- .../res/layout/item_default_list_section.xml | 3 +- .../layout/item_doc_cover_gallery_header.xml | 3 +- .../item_dv_viewer_filter_condition.xml | 5 +- .../item_dv_viewer_filter_tag_value.xml | 1 - .../main/res/layout/item_dv_viewer_tab.xml | 17 - .../res/layout/item_dv_viewer_tab_group.xml | 11 - .../res/layout/item_dv_viewer_tab_plus.xml | 11 - .../main/res/layout/item_filter_condition.xml | 18 - .../main/res/layout/item_filter_operator.xml | 18 - .../src/main/res/layout/item_list_base.xml | 34 -- .../item_modify_viewer_relation_order.xml | 4 +- .../res/layout/item_object_menu_action.xml | 3 +- .../item_object_preview_relation_name.xml | 4 +- .../item_object_preview_relation_toggle.xml | 4 +- .../layout/item_object_preview_section.xml | 3 +- .../layout/item_object_preview_setting.xml | 7 +- .../res/layout/item_object_relation_text.xml | 5 +- .../layout/item_object_type_empty_state.xml | 9 +- .../main/res/layout/item_object_type_item.xml | 5 +- .../res/layout/item_object_type_picker.xml | 9 +- ...object_type_picker_without_description.xml | 4 +- .../res/layout/item_object_type_search.xml | 3 +- .../main/res/layout/item_page_link_list.xml | 82 --- .../main/res/layout/item_paginator_page.xml | 3 +- .../main/res/layout/item_property_add_new.xml | 31 -- .../res/layout/item_property_checkbox.xml | 62 --- .../main/res/layout/item_property_date.xml | 62 --- .../main/res/layout/item_property_email.xml | 62 --- .../main/res/layout/item_property_file.xml | 62 --- .../res/layout/item_property_multiple.xml | 62 --- .../main/res/layout/item_property_number.xml | 62 --- .../main/res/layout/item_property_person.xml | 62 --- .../main/res/layout/item_property_phone.xml | 62 --- .../main/res/layout/item_property_select.xml | 62 --- .../main/res/layout/item_property_text.xml | 63 --- .../main/res/layout/item_property_title.xml | 63 --- .../src/main/res/layout/item_property_url.xml | 62 --- .../item_relation_create_from_scratch.xml | 4 +- ...ation_create_from_scratch_connect_with.xml | 4 +- ...create_from_scratch_limit_object_types.xml | 13 +- ...elation_create_from_scratch_name_input.xml | 11 +- .../res/layout/item_relation_list_section.xml | 5 +- .../res/layout/item_relation_value_action.xml | 4 +- .../main/res/layout/item_search_relation.xml | 3 +- .../item_select_programming_language.xml | 6 +- .../res/layout/item_simple_table_action.xml | 3 +- .../res/layout/item_slash_widget_main.xml | 4 +- .../layout/item_slash_widget_subheader.xml | 26 +- .../src/main/res/layout/item_sorting_key.xml | 18 - .../main/res/layout/item_toolbar_action.xml | 3 +- .../layout/item_toolbar_background_color.xml | 18 - .../main/res/layout/item_toolbar_section.xml | 19 - .../res/layout/item_toolbar_text_color.xml | 16 - .../res/layout/item_viewer_cover_section.xml | 2 +- .../src/main/res/layout/item_viewer_grid.xml | 37 -- .../res/layout/item_viewer_grid_column.xml | 21 - .../res/layout/item_viewer_grid_row_title.xml | 14 - .../layout/item_viewer_list_cell_object.xml | 21 - .../res/layout/item_viewer_relation_list.xml | 4 +- .../item_viewer_relation_list_section.xml | 4 +- .../item_viewer_relation_list_setting.xml | 7 +- ...em_viewer_relation_list_setting_toggle.xml | 6 +- .../main/res/layout/item_viewer_sort_add.xml | 35 -- .../res/layout/item_viewer_sort_apply.xml | 19 - .../main/res/layout/item_viewer_sort_set.xml | 80 --- .../src/main/res/layout/item_viewer_title.xml | 19 - .../layout/item_wallpaper_select_section.xml | 3 +- .../layout_bottom_multi_select_toolbar.xml | 2 - .../layout/layout_object_set_dv_header.xml | 1 - .../src/main/res/layout/menu_media_block.xml | 13 - .../src/main/res/layout/modal_item_delete.xml | 31 -- .../main/res/layout/modal_item_duplicate.xml | 31 -- .../src/main/res/layout/modal_item_filter.xml | 58 --- .../layout/modal_item_filter_tag_value.xml | 17 - .../main/res/layout/modal_item_gallery.xml | 46 -- .../res/layout/modal_item_gallery_arrow.xml | 43 -- .../src/main/res/layout/modal_item_kanban.xml | 46 -- .../res/layout/modal_item_kanban_arrow.xml | 43 -- .../src/main/res/layout/modal_item_list.xml | 47 -- .../main/res/layout/modal_item_list_arrow.xml | 44 -- .../main/res/layout/modal_item_relations.xml | 42 -- .../src/main/res/layout/modal_item_sort.xml | 58 --- .../src/main/res/layout/modal_item_table.xml | 46 -- .../res/layout/modal_item_table_arrow.xml | 43 -- .../res/layout/view_page_links_filter.xml | 59 --- core-ui/src/main/res/layout/viewer_cell.xml | 18 - .../main/res/layout/widget_action_toolbar.xml | 35 -- .../res/layout/widget_archive_toolbar.xml | 33 -- core-ui/src/main/res/layout/widget_avatar.xml | 5 +- .../res/layout/widget_block_style_toolbar.xml | 68 --- .../widget_block_style_toolbar_markup.xml | 65 --- .../layout/widget_block_style_toolbar_new.xml | 64 --- .../res/layout/widget_block_toolbar_new.xml | 60 --- .../layout/widget_bottom_detail_toolbar.xml | 36 -- .../main/res/layout/widget_color_toolbar.xml | 44 -- .../layout/widget_default_search_toolbar.xml | 4 +- .../widget_dv_list_view_relation_object.xml | 8 +- .../widget_dv_list_view_relation_tag.xml | 8 +- ...widget_gallery_view_default_title_icon.xml | 3 +- .../widget_object_deletion_progress_bar.xml | 6 +- .../main/res/layout/widget_object_icon.xml | 6 +- .../res/layout/widget_object_icon_card.xml | 3 +- .../layout/widget_scroll_and_move_action.xml | 1 - core-ui/src/main/res/values/colors.xml | 3 - core-ui/src/main/res/values/design_system.xml | 59 ++- core-ui/src/main/res/values/strings.xml | 1 + core-ui/src/main/res/values/styles.xml | 471 +++--------------- .../layout/action_toolbar_page_icon_item.xml | 28 -- .../item_page_icon_picker_choose_emoji.xml | 25 - ...page_icon_picker_emoji_category_header.xml | 5 +- .../item_page_icon_picker_emoji_filter.xml | 52 -- ...m_page_icon_picker_pick_emoji_randomly.xml | 25 - .../item_page_icon_picker_upload_photo.xml | 25 - .../layout_page_icon_picker_bottom_sheet.xml | 62 --- .../src/main/res/values/colors.xml | 6 - .../src/main/res/values/styles.xml | 12 - .../editor/archive/ArchiveViewModel.kt | 284 ----------- .../editor/archive/ArchiveViewModelFactory.kt | 43 -- .../presentation/navigation/AppNavigation.kt | 2 - .../anytype/sample/LongClickActivity.kt | 5 - .../anytypeio/anytype/sample/StyleActivity.kt | 9 - .../main/res/layout/activity_clipboard.xml | 1 - .../layout/activity_disabled_animation.xml | 2 - .../res/layout/activity_scroll_and_move.xml | 1 - .../res/layout/activity_search_on_page.xml | 2 - .../src/main/res/layout/fragment_buttons.xml | 1 + sample/src/main/res/layout/item_editable.xml | 1 - .../main/res/layout/item_scroll_and_move.xml | 1 - 204 files changed, 255 insertions(+), 7050 deletions(-) delete mode 100644 app/src/main/java/com/anytypeio/anytype/di/feature/ArchiveDI.kt delete mode 100644 app/src/main/java/com/anytypeio/anytype/ui/archive/ArchiveFragment.kt delete mode 100644 app/src/main/java/com/anytypeio/anytype/ui/menu/AnytypeContextMenu.kt delete mode 100644 app/src/main/java/com/anytypeio/anytype/ui/menu/ContextPopupWindow.kt delete mode 100644 app/src/main/java/com/anytypeio/anytype/ui/profile/SelectProfileAdapter.kt delete mode 100644 app/src/main/java/com/anytypeio/anytype/ui/profile/SelectProfileDialog.kt delete mode 100644 app/src/main/res/layout/fragment_archive.xml delete mode 100644 app/src/main/res/layout/fragment_dashboard.xml delete mode 100644 app/src/main/res/layout/fragment_link_to_object.xml delete mode 100644 app/src/main/res/layout/fragment_page_navigation.xml delete mode 100644 app/src/main/res/layout/item_select_profile_add_profile.xml delete mode 100644 app/src/main/res/layout/item_select_profile_profile.xml delete mode 100644 app/src/main/res/layout/popup_context_menu.xml delete mode 100644 app/src/main/res/layout/view_link_to_object_bottom.xml delete mode 100644 app/src/main/res/layout/view_link_to_object_preview.xml delete mode 100644 app/src/main/res/layout/view_move_to_bottom.xml delete mode 100644 app/src/main/res/layout/view_move_to_preview.xml delete mode 100644 app/src/main/res/layout/view_page_navigation_open_bottom.xml delete mode 100644 app/src/main/res/layout/view_page_preview.xml delete mode 100644 core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/dataview/ViewerListAdapter.kt delete mode 100644 core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/dataview/ViewerTabItemAdapter.kt delete mode 100644 core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/dataview/ViewerTitleAdapter.kt delete mode 100644 core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/dataview/ViewerTypeAdapter.kt delete mode 100644 core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/dataview/modals/TagAdapter.kt delete mode 100644 core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/navigation/FilterView.kt delete mode 100644 core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/navigation/PageLinksListHolder.kt delete mode 100644 core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/navigation/PageNavigationAdapter.kt delete mode 100644 core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/navigation/PageNavigationLinksFragment.kt delete mode 100644 core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/sets/CreateSetHeaderAdapter.kt delete mode 100644 core-ui/src/main/java/com/anytypeio/anytype/core_ui/widgets/toolbar/ArchiveToolbarWidget.kt delete mode 100644 core-ui/src/main/res/layout/item_bottom_detail_toolbar_option.xml delete mode 100644 core-ui/src/main/res/layout/item_create_set_header.xml delete mode 100644 core-ui/src/main/res/layout/item_create_set_object_type.xml delete mode 100644 core-ui/src/main/res/layout/item_dv_viewer_tab.xml delete mode 100644 core-ui/src/main/res/layout/item_dv_viewer_tab_group.xml delete mode 100644 core-ui/src/main/res/layout/item_dv_viewer_tab_plus.xml delete mode 100644 core-ui/src/main/res/layout/item_filter_condition.xml delete mode 100644 core-ui/src/main/res/layout/item_filter_operator.xml delete mode 100644 core-ui/src/main/res/layout/item_list_base.xml delete mode 100644 core-ui/src/main/res/layout/item_page_link_list.xml delete mode 100644 core-ui/src/main/res/layout/item_property_add_new.xml delete mode 100644 core-ui/src/main/res/layout/item_property_checkbox.xml delete mode 100644 core-ui/src/main/res/layout/item_property_date.xml delete mode 100644 core-ui/src/main/res/layout/item_property_email.xml delete mode 100644 core-ui/src/main/res/layout/item_property_file.xml delete mode 100644 core-ui/src/main/res/layout/item_property_multiple.xml delete mode 100644 core-ui/src/main/res/layout/item_property_number.xml delete mode 100644 core-ui/src/main/res/layout/item_property_person.xml delete mode 100644 core-ui/src/main/res/layout/item_property_phone.xml delete mode 100644 core-ui/src/main/res/layout/item_property_select.xml delete mode 100644 core-ui/src/main/res/layout/item_property_text.xml delete mode 100644 core-ui/src/main/res/layout/item_property_title.xml delete mode 100644 core-ui/src/main/res/layout/item_property_url.xml delete mode 100644 core-ui/src/main/res/layout/item_sorting_key.xml delete mode 100644 core-ui/src/main/res/layout/item_toolbar_background_color.xml delete mode 100644 core-ui/src/main/res/layout/item_toolbar_section.xml delete mode 100644 core-ui/src/main/res/layout/item_toolbar_text_color.xml delete mode 100644 core-ui/src/main/res/layout/item_viewer_grid.xml delete mode 100644 core-ui/src/main/res/layout/item_viewer_grid_column.xml delete mode 100644 core-ui/src/main/res/layout/item_viewer_grid_row_title.xml delete mode 100644 core-ui/src/main/res/layout/item_viewer_list_cell_object.xml delete mode 100644 core-ui/src/main/res/layout/item_viewer_sort_add.xml delete mode 100644 core-ui/src/main/res/layout/item_viewer_sort_apply.xml delete mode 100644 core-ui/src/main/res/layout/item_viewer_sort_set.xml delete mode 100644 core-ui/src/main/res/layout/item_viewer_title.xml delete mode 100644 core-ui/src/main/res/layout/menu_media_block.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_delete.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_duplicate.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_filter.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_filter_tag_value.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_gallery.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_gallery_arrow.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_kanban.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_kanban_arrow.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_list.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_list_arrow.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_relations.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_sort.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_table.xml delete mode 100644 core-ui/src/main/res/layout/modal_item_table_arrow.xml delete mode 100644 core-ui/src/main/res/layout/view_page_links_filter.xml delete mode 100644 core-ui/src/main/res/layout/viewer_cell.xml delete mode 100644 core-ui/src/main/res/layout/widget_action_toolbar.xml delete mode 100644 core-ui/src/main/res/layout/widget_archive_toolbar.xml delete mode 100644 core-ui/src/main/res/layout/widget_block_style_toolbar.xml delete mode 100644 core-ui/src/main/res/layout/widget_block_style_toolbar_markup.xml delete mode 100644 core-ui/src/main/res/layout/widget_block_style_toolbar_new.xml delete mode 100644 core-ui/src/main/res/layout/widget_block_toolbar_new.xml delete mode 100644 core-ui/src/main/res/layout/widget_bottom_detail_toolbar.xml delete mode 100644 core-ui/src/main/res/layout/widget_color_toolbar.xml delete mode 100644 library-page-icon-picker-widget/src/main/res/layout/action_toolbar_page_icon_item.xml delete mode 100644 library-page-icon-picker-widget/src/main/res/layout/item_page_icon_picker_choose_emoji.xml delete mode 100644 library-page-icon-picker-widget/src/main/res/layout/item_page_icon_picker_emoji_filter.xml delete mode 100644 library-page-icon-picker-widget/src/main/res/layout/item_page_icon_picker_pick_emoji_randomly.xml delete mode 100644 library-page-icon-picker-widget/src/main/res/layout/item_page_icon_picker_upload_photo.xml delete mode 100644 library-page-icon-picker-widget/src/main/res/layout/layout_page_icon_picker_bottom_sheet.xml delete mode 100644 library-page-icon-picker-widget/src/main/res/values/colors.xml delete mode 100644 library-page-icon-picker-widget/src/main/res/values/styles.xml delete mode 100644 presentation/src/main/java/com/anytypeio/anytype/presentation/editor/archive/ArchiveViewModel.kt delete mode 100644 presentation/src/main/java/com/anytypeio/anytype/presentation/editor/archive/ArchiveViewModelFactory.kt diff --git a/app/src/main/java/com/anytypeio/anytype/di/common/ComponentManager.kt b/app/src/main/java/com/anytypeio/anytype/di/common/ComponentManager.kt index 0cb90410aa..b3a91cb379 100644 --- a/app/src/main/java/com/anytypeio/anytype/di/common/ComponentManager.kt +++ b/app/src/main/java/com/anytypeio/anytype/di/common/ComponentManager.kt @@ -5,7 +5,6 @@ import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.di.feature.AddFileRelationModule import com.anytypeio.anytype.di.feature.AddObjectRelationModule import com.anytypeio.anytype.di.feature.AddObjectRelationValueModule -import com.anytypeio.anytype.di.feature.ArchiveModule import com.anytypeio.anytype.di.feature.AuthModule import com.anytypeio.anytype.di.feature.CreateAccountModule import com.anytypeio.anytype.di.feature.CreateBookmarkModule @@ -232,12 +231,6 @@ class ComponentManager( .build() } - val archiveComponent = ComponentMap { - main.archiveComponentBuilder() - .module(ArchiveModule) - .build() - } - val objectIconPickerComponent = DependentComponentMap { ctx -> editorComponent .get(ctx) diff --git a/app/src/main/java/com/anytypeio/anytype/di/feature/ArchiveDI.kt b/app/src/main/java/com/anytypeio/anytype/di/feature/ArchiveDI.kt deleted file mode 100644 index 6641d0ec41..0000000000 --- a/app/src/main/java/com/anytypeio/anytype/di/feature/ArchiveDI.kt +++ /dev/null @@ -1,65 +0,0 @@ -package com.anytypeio.anytype.di.feature - -import com.anytypeio.anytype.analytics.base.Analytics -import com.anytypeio.anytype.core_utils.di.scope.PerScreen -import com.anytypeio.anytype.domain.event.interactor.InterceptEvents -import com.anytypeio.anytype.domain.objects.SetObjectIsArchived -import com.anytypeio.anytype.domain.page.CloseBlock -import com.anytypeio.anytype.domain.page.OpenPage -import com.anytypeio.anytype.presentation.editor.DocumentExternalEventReducer -import com.anytypeio.anytype.presentation.editor.archive.ArchiveViewModelFactory -import com.anytypeio.anytype.presentation.editor.editor.Orchestrator -import com.anytypeio.anytype.presentation.editor.render.DefaultBlockViewRenderer -import com.anytypeio.anytype.presentation.editor.selection.SelectionStateHolder -import com.anytypeio.anytype.ui.archive.ArchiveFragment -import dagger.Module -import dagger.Provides -import dagger.Subcomponent - -@Subcomponent( - modules = [ - ArchiveModule::class, - EditorUseCaseModule::class, - EditorUseCaseModule.Bindings::class, - EditorSessionModule::class - ] -) -@PerScreen -interface ArchiveSubComponent { - - @Subcomponent.Builder - interface Builder { - fun module(module: ArchiveModule): Builder - fun build(): ArchiveSubComponent - } - - fun inject(fragment: ArchiveFragment) -} - -@Module -object ArchiveModule { - - @JvmStatic - @Provides - fun provideArchiveViewModelFactory( - openPage: OpenPage, - closePage: CloseBlock, - setObjectIsArchived: SetObjectIsArchived, - interceptEvents: InterceptEvents, - renderer: DefaultBlockViewRenderer, - selectionStateHolder: SelectionStateHolder, - documentExternalEventReducer: DocumentExternalEventReducer, - interactor: Orchestrator, - analytics: Analytics - ): ArchiveViewModelFactory = ArchiveViewModelFactory( - openPage = openPage, - closePage = closePage, - setObjectIsArchived = setObjectIsArchived, - interceptEvents = interceptEvents, - renderer = renderer, - selectionStateHolder = selectionStateHolder, - reducer = documentExternalEventReducer, - orchestrator = interactor, - analytics = analytics - ) -} \ No newline at end of file diff --git a/app/src/main/java/com/anytypeio/anytype/di/main/MainComponent.kt b/app/src/main/java/com/anytypeio/anytype/di/main/MainComponent.kt index 5a3da66849..2464d5b17e 100644 --- a/app/src/main/java/com/anytypeio/anytype/di/main/MainComponent.kt +++ b/app/src/main/java/com/anytypeio/anytype/di/main/MainComponent.kt @@ -3,7 +3,6 @@ package com.anytypeio.anytype.di.main import com.anytypeio.anytype.app.AndroidApplication import com.anytypeio.anytype.di.common.ComponentDependencies import com.anytypeio.anytype.di.common.ComponentDependenciesKey -import com.anytypeio.anytype.di.feature.ArchiveSubComponent import com.anytypeio.anytype.di.feature.AuthSubComponent import com.anytypeio.anytype.di.feature.CreateBookmarkSubComponent import com.anytypeio.anytype.di.feature.CreateObjectSubComponent @@ -78,7 +77,6 @@ interface MainComponent : fun inject(app: AndroidApplication) fun editorComponentBuilder(): EditorSubComponent.Builder - fun archiveComponentBuilder(): ArchiveSubComponent.Builder fun createBookmarkBuilder(): CreateBookmarkSubComponent.Builder fun linkToObjectBuilder(): LinkToObjectSubComponent.Builder fun moveToBuilder(): MoveToSubComponent.Builder diff --git a/app/src/main/java/com/anytypeio/anytype/navigation/Navigator.kt b/app/src/main/java/com/anytypeio/anytype/navigation/Navigator.kt index c9ba80d205..6d582439cc 100644 --- a/app/src/main/java/com/anytypeio/anytype/navigation/Navigator.kt +++ b/app/src/main/java/com/anytypeio/anytype/navigation/Navigator.kt @@ -9,7 +9,6 @@ import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.presentation.navigation.AppNavigation import com.anytypeio.anytype.presentation.settings.EditorSettings import com.anytypeio.anytype.presentation.widgets.collection.Subscription -import com.anytypeio.anytype.ui.archive.ArchiveFragment import com.anytypeio.anytype.ui.auth.Keys import com.anytypeio.anytype.ui.auth.account.CreateAccountFragment.Companion.ARGS_CODE import com.anytypeio.anytype.ui.auth.account.DeletedAccountFragment @@ -203,13 +202,6 @@ class Navigator : AppNavigation { ) } - override fun openArchive(target: String) { - navController?.navigate( - R.id.archiveFragment, - bundleOf(ArchiveFragment.ID_KEY to target) - ) - } - override fun openObjectSet(target: String, isPopUpToDashboard: Boolean) { if (isPopUpToDashboard) { navController?.navigate( diff --git a/app/src/main/java/com/anytypeio/anytype/ui/archive/ArchiveFragment.kt b/app/src/main/java/com/anytypeio/anytype/ui/archive/ArchiveFragment.kt deleted file mode 100644 index b8f964f3c5..0000000000 --- a/app/src/main/java/com/anytypeio/anytype/ui/archive/ArchiveFragment.kt +++ /dev/null @@ -1,133 +0,0 @@ -package com.anytypeio.anytype.ui.archive - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import androidx.fragment.app.viewModels -import androidx.recyclerview.widget.LinearLayoutManager -import com.anytypeio.anytype.R -import com.anytypeio.anytype.core_ui.features.archive.ArchiveAdapter -import com.anytypeio.anytype.core_ui.tools.FirstItemInvisibilityDetector -import com.anytypeio.anytype.core_utils.ext.hideSoftInput -import com.anytypeio.anytype.core_utils.ext.invisible -import com.anytypeio.anytype.core_utils.ext.visible -import com.anytypeio.anytype.databinding.FragmentArchiveBinding -import com.anytypeio.anytype.di.common.componentManager -import com.anytypeio.anytype.presentation.editor.archive.ArchiveViewModel -import com.anytypeio.anytype.presentation.editor.archive.ArchiveViewModelFactory -import com.anytypeio.anytype.presentation.editor.archive.ArchiveViewState -import com.anytypeio.anytype.ui.base.NavigationFragment -import com.google.android.material.bottomsheet.BottomSheetBehavior -import javax.inject.Inject - -open class ArchiveFragment : NavigationFragment(R.layout.fragment_archive) { - - @Inject - lateinit var factory: ArchiveViewModelFactory - - private val vm by viewModels { factory } - - private val archiveAdapter by lazy { - ArchiveAdapter( - blocks = mutableListOf(), - onClickListener = { vm.onPageClicked(it) } - ) - } - - private val titleVisibilityDetector by lazy { - FirstItemInvisibilityDetector { isVisible -> - if (isVisible) { - binding.topToolbar.title.invisible() - } else { - binding.topToolbar.title.visible() - } - } - } - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - - vm.state.observe(viewLifecycleOwner) { render(it) } - vm.navigation.observe(viewLifecycleOwner, navObserver) - - BottomSheetBehavior.from(binding.sheet).apply { - state = BottomSheetBehavior.STATE_EXPANDED - isHideable = true - addBottomSheetCallback( - object : BottomSheetBehavior.BottomSheetCallback() { - override fun onSlide(bottomSheet: View, slideOffset: Float) {} - override fun onStateChanged(bottomSheet: View, newState: Int) { - if (newState == BottomSheetBehavior.STATE_HIDDEN) { - activity?.hideSoftInput() - vm.onBottomSheetHidden() - } - } - } - ) - } - - binding.topToolbar.menu.invisible() - - with(binding.bottomMenu) { - update(COUNTER_INIT) - findViewById(R.id.btnRestore).setOnClickListener { - vm.onPutBackClicked() - } - } - - binding.recycler.apply { - layoutManager = LinearLayoutManager(requireContext()) - setHasFixedSize(true) - adapter = archiveAdapter - addOnScrollListener(titleVisibilityDetector) - } - } - - private fun render(state: ArchiveViewState) { - when (state) { - ArchiveViewState.Loading -> {} - is ArchiveViewState.Success -> { - archiveAdapter.update(state.blocks) - binding.bottomMenu.update(state.selections) - } - } - } - - override fun onStart() { - vm.onStart(extractDocumentId()) - super.onStart() - } - - override fun onStop() { - vm.onStop() - super.onStop() - } - - override fun injectDependencies() { - componentManager().archiveComponent.get(extractDocumentId()).inject(this) - } - - override fun releaseDependencies() { - componentManager().archiveComponent.release(extractDocumentId()) - } - - private fun extractDocumentId(): String = - requireArguments() - .getString(ID_KEY) - ?: throw IllegalStateException("Document id missing") - - - override fun inflateBinding( - inflater: LayoutInflater, - container: ViewGroup? - ): FragmentArchiveBinding = FragmentArchiveBinding.inflate( - inflater, container, false - ) - - companion object { - const val ID_KEY = "args.id" - const val COUNTER_INIT = 0 - } -} \ No newline at end of file diff --git a/app/src/main/java/com/anytypeio/anytype/ui/base/NavigationRouter.kt b/app/src/main/java/com/anytypeio/anytype/ui/base/NavigationRouter.kt index a6d4e26984..d145967c64 100644 --- a/app/src/main/java/com/anytypeio/anytype/ui/base/NavigationRouter.kt +++ b/app/src/main/java/com/anytypeio/anytype/ui/base/NavigationRouter.kt @@ -34,7 +34,6 @@ class NavigationRouter( command.id, command.editorSettings ) - is AppNavigation.Command.OpenArchive -> navigation.openArchive(command.target) is AppNavigation.Command.OpenObjectSet -> navigation.openObjectSet( command.target, command.isPopUpToDashboard diff --git a/app/src/main/java/com/anytypeio/anytype/ui/menu/AnytypeContextMenu.kt b/app/src/main/java/com/anytypeio/anytype/ui/menu/AnytypeContextMenu.kt deleted file mode 100644 index 5569f61adb..0000000000 --- a/app/src/main/java/com/anytypeio/anytype/ui/menu/AnytypeContextMenu.kt +++ /dev/null @@ -1,259 +0,0 @@ -package com.anytypeio.anytype.ui.menu - -import android.animation.ValueAnimator -import android.content.Context -import android.content.res.ColorStateList -import android.graphics.Point -import android.text.Editable -import android.text.Spanned -import android.view.Gravity -import android.view.MotionEvent -import android.view.View -import android.view.ViewTreeObserver -import android.widget.PopupWindow -import android.widget.TextView -import com.anytypeio.anytype.R -import com.anytypeio.anytype.core_ui.extensions.color -import com.anytypeio.anytype.core_ui.menu.ContextMenuType -import com.anytypeio.anytype.core_utils.ext.PopupExtensions.calculateContentBounds -import com.anytypeio.anytype.core_utils.ext.PopupExtensions.calculateRectInWindow -import com.anytypeio.anytype.core_utils.ext.PopupExtensions.lerp -import com.anytypeio.anytype.presentation.editor.editor.Markup -import java.lang.ref.WeakReference - -class AnytypeContextMenu constructor( - context: Context, - anchorView: TextView, - parent: View, - type: ContextMenuType, - private val onMarkupActionClicked: (Markup.Type) -> Unit, - private val dismissOnTouchOutside: Boolean = false -) : PopupWindow.OnDismissListener { - - companion object { - const val DEFAULT_X = 20 - const val WIDTH_CHANGE_IGNORE = -1 - const val HEIGHT_CHANGE_IGNORE = -1 - const val ANIM_DURATION = 150L - } - - private val contextRef: WeakReference - private val anchorViewRef: WeakReference - private val parentViewRef: WeakReference - - private var scrollListener: ViewTreeObserver.OnScrollChangedListener? = null - - private val isShowable: Boolean - get() = !isDismissed && contextRef.get() != null && popupWindowRef.get() != null && anchorViewRef.get() != null - private var isDismissed: Boolean = false - private var popupWindowRef: WeakReference - private var popupWindowCurrentLocation = Point() - - /** - * We need to add this bottom padding below selected content, - * because of [android.widget.Editor.SelectionHandleView] - */ - private var bottomAllowance: Int = 0 - - /** - * Callback for all touch events being dispatched to the popup - * window. - */ - private var onTouchListener = View.OnTouchListener { v, event -> - if (!isShowable) return@OnTouchListener false - when { - (!dismissOnTouchOutside && event.action == MotionEvent.ACTION_OUTSIDE) -> { - v.performClick() - return@OnTouchListener true - } - else -> return@OnTouchListener false - } - } - - init { - - scrollListener = ViewTreeObserver.OnScrollChangedListener { - updatePosition() - } - anchorView.viewTreeObserver?.addOnScrollChangedListener( - scrollListener - ) - - val popupWindow = ContextPopupWindow( - context = context, - onContextMenuButtonClicked = this::onContextMenuButtonClicked, - onDismissListener = this, - onTouchInterceptor = onTouchListener, - type = type, - editable = anchorView.text as Editable, - textRange = IntRange(anchorView.selectionStart, anchorView.selectionEnd), - tintColor = ColorStateList.valueOf(context.color(R.color.context_menu_selected_item)), - textDefaultColor = context.color(R.color.white) - ) - contextRef = WeakReference(context) - anchorViewRef = WeakReference(anchorView) - parentViewRef = WeakReference(parent) - popupWindowRef = WeakReference(popupWindow) - bottomAllowance = context.resources - .getDimensionPixelSize(R.dimen.popup_context_menu_bottom_allowance) - } - - private fun cleanup() { - anchorViewRef.get()?.viewTreeObserver?.removeOnScrollChangedListener(scrollListener) - scrollListener = null - } - - private fun updatePosition() { - val anchorView = anchorViewRef.get() - val popupWindow = popupWindowRef.get() - val parentView = parentViewRef.get() - if (anchorView != null && popupWindow != null && parentView != null) { - if (popupWindow.isShowing) { - val updatedLocation = getUpdatedCoordinates( - parentView = parentView, - anchorView = anchorView, - bottomAllowance = bottomAllowance, - popupWindow = popupWindow - ) - if (updatedLocation != popupWindowCurrentLocation) { - popupWindowCurrentLocation = updatedLocation - popupWindow.update( - DEFAULT_X, - popupWindowCurrentLocation.y, - WIDTH_CHANGE_IGNORE, - HEIGHT_CHANGE_IGNORE - ) - } - } - } - } - - private fun onContextMenuButtonClicked(click: ContextMenuButtonClick) { - when (click) { - ContextMenuButtonClick.Copy -> anchorViewRef.get() - ?.onTextContextMenuItem(android.R.id.copy) - ContextMenuButtonClick.Cut -> anchorViewRef.get() - ?.onTextContextMenuItem(android.R.id.cut) - ContextMenuButtonClick.Paste -> anchorViewRef.get() - ?.onTextContextMenuItem(android.R.id.paste) - ContextMenuButtonClick.Bold -> onMarkupActionClicked(Markup.Type.BOLD) - ContextMenuButtonClick.Italic -> onMarkupActionClicked(Markup.Type.ITALIC) - ContextMenuButtonClick.Stroke -> onMarkupActionClicked(Markup.Type.STRIKETHROUGH) - ContextMenuButtonClick.Code -> onMarkupActionClicked(Markup.Type.KEYBOARD) - ContextMenuButtonClick.Color -> onMarkupActionClicked(Markup.Type.TEXT_COLOR) - ContextMenuButtonClick.Background -> onMarkupActionClicked(Markup.Type.BACKGROUND_COLOR) - ContextMenuButtonClick.Link -> onMarkupActionClicked(Markup.Type.LINK) - } - } - - override fun onDismiss() { - isDismissed = true - } - - fun showAtLocation() { - val anchorView = anchorViewRef.get() - val popupWindow = popupWindowRef.get() - val parentView = parentViewRef.get() - if (anchorView != null && popupWindow != null && parentView != null) { - if (popupWindow.isShowing) { - val contentView = popupWindow.contentView - contentView?.handler?.removeCallbacksAndMessages(null) - contentView.post { - val updatedLocation = getUpdatedCoordinates( - parentView = parentView, - anchorView = anchorView, - bottomAllowance = bottomAllowance, - popupWindow = popupWindow - ) - popupWindow.updateMarkupButtons( - textRange = IntRange( - anchorView.selectionStart, - anchorView.selectionEnd - ), - spanned = anchorView.text as Spanned - ) - if (updatedLocation != popupWindowCurrentLocation) { - val currY = popupWindowCurrentLocation.y - popupWindowCurrentLocation = updatedLocation - ValueAnimator.ofFloat(0f, 1f).apply { - addUpdateListener { animation -> - val v = animation.animatedValue as Float - val y = lerp(currY, updatedLocation.y, v) - popupWindow.update( - DEFAULT_X, - y, - WIDTH_CHANGE_IGNORE, - HEIGHT_CHANGE_IGNORE - ) - } - duration = ANIM_DURATION - start() - } - } - } - } else { - with(popupWindow) { - popupWindowCurrentLocation = getUpdatedCoordinates( - parentView = parentView, - anchorView = anchorView, - bottomAllowance = bottomAllowance, - popupWindow = this - ) - updateMarkupButtons( - textRange = IntRange( - anchorView.selectionStart, - anchorView.selectionEnd - ), - spanned = anchorView.text as Spanned - ) - showAtLocation( - anchorView, - Gravity.NO_GRAVITY, - DEFAULT_X, - popupWindowCurrentLocation.y - ) - runShowAnimation() - } - } - } - } - - private fun getUpdatedCoordinates( - parentView: View, - anchorView: TextView, - popupWindow: ContextPopupWindow, - bottomAllowance: Int - ): Point { - val windowPointOnScreen = getWindowPointOnScreen(parentView) - val contentRect = calculateContentBounds(anchorView, bottomAllowance) - val parentRect = calculateRectInWindow(parentView) - return popupWindow.refreshCoordinates( - selectedContentBounds = contentRect, - viewPortOnScreen = parentRect, - windowTopOnScreen = windowPointOnScreen.y, - windowLeftOnScreen = windowPointOnScreen.x - ) - } - - private fun getWindowPointOnScreen(parentView: View): Point { - val tempCoords = IntArray(2) - var windowLeftOnScreen = 0 - var windowTopOnScreen = 0 - parentView.rootView?.let { - it.getLocationOnScreen(tempCoords) - val rootViewLeftOnScreen = tempCoords[0] - val rootViewTopOnScreen = tempCoords[1] - it.getLocationInWindow(tempCoords) - val rootViewLeftOnWindow = tempCoords[0] - val rootViewTopOnWindow = tempCoords[1] - windowLeftOnScreen = rootViewLeftOnScreen - rootViewLeftOnWindow - windowTopOnScreen = rootViewTopOnScreen - rootViewTopOnWindow - } - return Point(windowLeftOnScreen, windowTopOnScreen) - } - - fun finish() { - popupWindowRef.get()?.dismiss() - cleanup() - } -} \ No newline at end of file diff --git a/app/src/main/java/com/anytypeio/anytype/ui/menu/ContextPopupWindow.kt b/app/src/main/java/com/anytypeio/anytype/ui/menu/ContextPopupWindow.kt deleted file mode 100644 index cae9595b1f..0000000000 --- a/app/src/main/java/com/anytypeio/anytype/ui/menu/ContextPopupWindow.kt +++ /dev/null @@ -1,380 +0,0 @@ -package com.anytypeio.anytype.ui.menu - -import android.animation.AnimatorSet -import android.animation.ObjectAnimator -import android.content.Context -import android.content.res.ColorStateList -import android.graphics.Color -import android.graphics.Point -import android.graphics.Rect -import android.graphics.drawable.ColorDrawable -import android.text.Editable -import android.text.Spanned -import android.util.AttributeSet -import android.view.Gravity -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.* -import com.anytypeio.anytype.R -import com.anytypeio.anytype.core_ui.common.Span -import com.anytypeio.anytype.core_ui.menu.ContextMenuType -import com.anytypeio.anytype.core_utils.ext.invisible -import com.anytypeio.anytype.core_utils.ext.visible -import com.anytypeio.anytype.ext.isSpanInRange - -class ContextPopupWindow @JvmOverloads constructor( - type: ContextMenuType, - context: Context, - attrs: AttributeSet? = null, - defStyle: Int = 0, - defStyleRes: Int = 0, - onDismissListener: OnDismissListener, - onTouchInterceptor: View.OnTouchListener, - editable: Editable, - textRange: IntRange, - private val onContextMenuButtonClicked: (ContextMenuButtonClick) -> Unit, - private val gravity: Int = Gravity.NO_GRAVITY, - private val tintColor: ColorStateList, - private val textDefaultColor: Int -) : PopupWindow(context, attrs, defStyle, defStyleRes) { - - companion object { - val HEADER = listOf( - R.id.btnCopy, - R.id.btnCut, - R.id.btnPaste, - R.id.btnItalic, - R.id.btnLink, - R.id.btnCode, - R.id.btnColor, - R.id.btnStroke, - R.id.btnBackground - ) - val HIGHLIGHT = listOf( - R.id.btnCopy, - R.id.btnCut, - R.id.btnPaste, - R.id.btnBold, - R.id.btnLink, - R.id.btnCode, - R.id.btnColor, - R.id.btnStroke, - R.id.btnBackground - ) - val DEFAULT = listOf( - R.id.btnCopy, - R.id.btnCut, - R.id.btnPaste, - R.id.btnBold, - R.id.btnItalic, - R.id.btnLink, - R.id.btnCode, - R.id.btnColor, - R.id.btnStroke, - R.id.btnBackground - ) - } - - private var popupHeight: Int - private var popupMargin: Int - private var mShowAnimation: AnimatorSet? - - init { - contentView = LayoutInflater.from(context).inflate(R.layout.popup_context_menu, null) - width = ViewGroup.LayoutParams.WRAP_CONTENT - height = ViewGroup.LayoutParams.WRAP_CONTENT - setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) - isOutsideTouchable = true - isTouchable = true - isClippingEnabled = false - isFocusable = false - setOnDismissListener(onDismissListener) - setTouchInterceptor(onTouchInterceptor) - popupHeight = context.resources - .getDimensionPixelSize(R.dimen.popup_context_menu_height) - popupMargin = context.resources - .getDimensionPixelSize(R.dimen.popup_context_menu_margin) - mShowAnimation = createEnterAnimation(contentView) - when (type) { - ContextMenuType.TEXT -> init(contentView, DEFAULT, editable, textRange) - ContextMenuType.HEADER -> init(contentView, HEADER, editable, textRange) - ContextMenuType.HIGHLIGHT -> init(contentView, HIGHLIGHT, editable, textRange) - } - } - - private fun init(view: View, ids: List, editable: Editable, textRange: IntRange) { - view.findViewById(R.id.btnCopy).apply { - if (this.id in ids) { - visible() - view.findViewById(R.id.divCopy).visible() - } - setOnClickListener { - onContextMenuButtonClicked(ContextMenuButtonClick.Copy) - } - } - view.findViewById(R.id.btnCut).apply { - if (this.id in ids) { - visible() - view.findViewById(R.id.divCut).visible() - } - setOnClickListener { - onContextMenuButtonClicked(ContextMenuButtonClick.Cut) - } - } - view.findViewById(R.id.btnPaste).apply { - if (this.id in ids) { - visible() - view.findViewById(R.id.divPaste).visible() - } - setOnClickListener { - onContextMenuButtonClicked(ContextMenuButtonClick.Paste) - } - } - view.findViewById(R.id.btnBold).apply { - if (this.id in ids) { - visible() - view.findViewById(R.id.divBold).visible() - } - setOnClickListener { - onContextMenuButtonClicked(ContextMenuButtonClick.Bold) - } - if (editable.isSpanInRange( - textRange = textRange, - type = Span.Bold::class.java - ) - ) { - imageTintList = tintColor - } - } - view.findViewById(R.id.btnItalic).apply { - if (this.id in ids) { - visible() - view.findViewById(R.id.divItalic).visible() - } - setOnClickListener { - onContextMenuButtonClicked(ContextMenuButtonClick.Italic) - } - if (editable.isSpanInRange( - textRange = textRange, - type = Span.Italic::class.java - ) - ) { - imageTintList = tintColor - } - } - view.findViewById(R.id.btnStroke).apply { - if (this.id in ids) { - visible() - view.findViewById(R.id.divStroke).visible() - } - setOnClickListener { - onContextMenuButtonClicked(ContextMenuButtonClick.Stroke) - } - if (editable.isSpanInRange( - textRange = textRange, - type = Span.Strikethrough::class.java - ) - ) { - imageTintList = tintColor - } - } - view.findViewById(R.id.btnCode).apply { - if (this.id in ids) { - visible() - view.findViewById(R.id.divCode).visible() - } - setOnClickListener { - onContextMenuButtonClicked(ContextMenuButtonClick.Code) - } - if (editable.isSpanInRange( - textRange = textRange, - type = Span.Keyboard::class.java - ) - ) { - imageTintList = tintColor - } - } - view.findViewById(R.id.btnLink).apply { - if (this.id in ids) { - visible() - view.findViewById(R.id.divLink).visible() - } - setOnClickListener { - onContextMenuButtonClicked(ContextMenuButtonClick.Link) - } - if (editable.isSpanInRange( - textRange = textRange, - type = Span.Url::class.java - ) - ) { - imageTintList = tintColor - } - } - view.findViewById(R.id.btnColor).apply { - if (this.id in ids) { - visible() - view.findViewById(R.id.divColor).visible() - } - setOnClickListener { - onContextMenuButtonClicked(ContextMenuButtonClick.Color) - } - if (editable.isSpanInRange( - textRange = textRange, - type = Span.TextColor::class.java - ) - ) { - setTextColor(tintColor) - } - } - view.findViewById(R.id.btnBackground).apply { - if (this.id in ids) { - visible() - } - setOnClickListener { - onContextMenuButtonClicked(ContextMenuButtonClick.Background) - } - if (editable.isSpanInRange( - textRange = textRange, - type = Span.Highlight::class.java - ) - ) { - setTextColor(tintColor) - } - } - - val arrowRight = view.findViewById(R.id.arrowRightContainer) - arrowRight.setOnClickListener { - view.findViewById(R.id.scrollContainer) - .fullScroll(HorizontalScrollView.FOCUS_RIGHT) - } - view.findViewById(R.id.scrollContainer) - .setOnScrollChangeListener { _, scrollX, _, oldScrollX, _ -> - if (scrollX != oldScrollX) { - if (scrollX == 0) arrowRight.visible() else arrowRight.invisible() - } else { - arrowRight.visible() - } - } - } - - private fun createEnterAnimation(view: View): AnimatorSet? { - val animation = AnimatorSet() - animation.playTogether( - ObjectAnimator.ofFloat(view, View.ALPHA, 0f, 1f) - .setDuration(200) - ) - return animation - } - - /** - * Get the coordinates of this popup for positioning on the screen.. - * - * @param viewPortOnScreen portion of screen we can draw in. - * @param selectedContentBounds This is the area of the interesting content that this popup - * should avoid obstructing - * @param windowLeftOnScreen parent window X margins - * @param windowTopOnScreen parent window Y margins - * - * @return x and y coordinates of popup window - */ - fun refreshCoordinates( - viewPortOnScreen: Rect, - selectedContentBounds: Rect, - windowLeftOnScreen: Int, - windowTopOnScreen: Int - ): Point { - - val availableHeightAboveContent = selectedContentBounds.top - viewPortOnScreen.top - val availableHeightBelowContent = viewPortOnScreen.bottom - selectedContentBounds.bottom - val margin = popupMargin * 2 - val toolbarHeightWithVerticalMargin = popupHeight + margin - - val y = if (availableHeightAboveContent >= toolbarHeightWithVerticalMargin) { - // There is enough space at the top of the content. - selectedContentBounds.top - toolbarHeightWithVerticalMargin - } else if (availableHeightBelowContent >= toolbarHeightWithVerticalMargin) { - // There is enough space at the bottom of the content. - selectedContentBounds.bottom - } else if (availableHeightBelowContent >= popupHeight) { - // Just enough space to fit the toolbar with no vertical margins. - selectedContentBounds.bottom - popupMargin - } else { - // Not enough space. Prefer to position as high as possible. - viewPortOnScreen.top.coerceAtLeast(selectedContentBounds.top - toolbarHeightWithVerticalMargin) - } - return Point(0, 0.coerceAtLeast(y - windowTopOnScreen)) - } - - fun runShowAnimation() { - mShowAnimation?.start() - } - - /** - * Updates buttons state, when markup changed in text - */ - fun updateMarkupButtons(textRange: IntRange, spanned: Spanned) { - contentView.findViewById(R.id.btnBold).apply { - imageTintList = if (spanned.isSpanInRange( - textRange = textRange, - type = Span.Bold::class.java - ) - ) tintColor else null - } - contentView.findViewById(R.id.btnItalic).apply { - imageTintList = if (spanned.isSpanInRange( - textRange = textRange, - type = Span.Italic::class.java - ) - ) tintColor else null - } - contentView.findViewById(R.id.btnStroke).apply { - imageTintList = if (spanned.isSpanInRange( - textRange = textRange, - type = Span.Strikethrough::class.java - ) - ) tintColor else null - } - contentView.findViewById(R.id.btnCode).apply { - imageTintList = if (spanned.isSpanInRange( - textRange = textRange, - type = Span.Keyboard::class.java - ) - ) tintColor else null - } - contentView.findViewById(R.id.btnLink).apply { - imageTintList = if (spanned.isSpanInRange( - textRange = textRange, - type = Span.Url::class.java - ) - ) tintColor else null - } - contentView.findViewById(R.id.btnColor).apply { - if (spanned.isSpanInRange( - textRange = textRange, - type = Span.TextColor::class.java - ) - ) setTextColor(tintColor) else setTextColor(textDefaultColor) - } - contentView.findViewById(R.id.btnBackground).apply { - if (spanned.isSpanInRange( - textRange = textRange, - type = Span.Highlight::class.java - ) - ) setTextColor(tintColor) else setTextColor(textDefaultColor) - } - } -} - -sealed class ContextMenuButtonClick { - object Copy : ContextMenuButtonClick() - object Cut : ContextMenuButtonClick() - object Paste : ContextMenuButtonClick() - object Bold : ContextMenuButtonClick() - object Italic : ContextMenuButtonClick() - object Stroke : ContextMenuButtonClick() - object Code : ContextMenuButtonClick() - object Color : ContextMenuButtonClick() - object Background : ContextMenuButtonClick() - object Link : ContextMenuButtonClick() -} diff --git a/app/src/main/java/com/anytypeio/anytype/ui/profile/SelectProfileAdapter.kt b/app/src/main/java/com/anytypeio/anytype/ui/profile/SelectProfileAdapter.kt deleted file mode 100644 index af32778078..0000000000 --- a/app/src/main/java/com/anytypeio/anytype/ui/profile/SelectProfileAdapter.kt +++ /dev/null @@ -1,108 +0,0 @@ -package com.anytypeio.anytype.ui.profile - -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import com.anytypeio.anytype.core_utils.ui.ViewType -import com.anytypeio.anytype.databinding.ItemSelectProfileAddProfileBinding -import com.anytypeio.anytype.databinding.ItemSelectProfileProfileBinding - -class SelectProfileAdapter( - private val models: MutableList, - private val onAddProfileClicked: () -> Unit, - private val onProfileClicked: (Model.Profile) -> Unit -) : RecyclerView.Adapter() { - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { - return LayoutInflater.from(parent.context).let { inflater -> - when (viewType) { - PROFILE_HOLDER -> { - ViewHolder.ProfileViewHolder( - ItemSelectProfileProfileBinding.inflate( - inflater, parent, false - ) - ) - } - ADD_PROFILE_HOLDER -> { - ViewHolder.AddProfileViewHolder( - ItemSelectProfileAddProfileBinding.inflate( - inflater, parent, false - ) - ) - } - else -> throw IllegalStateException("Unexpected type: $viewType") - } - } - } - - override fun getItemViewType(position: Int) = models[position].getViewType() - override fun getItemCount(): Int = models.size - - override fun onBindViewHolder(holder: ViewHolder, position: Int) { - when (holder) { - is ViewHolder.ProfileViewHolder -> holder.bind( - model = models[position], - onClick = onProfileClicked - ) - is ViewHolder.AddProfileViewHolder -> holder.bind( - onClick = onAddProfileClicked - ) - } - } - - fun update(update: List) { - models.apply { - clear() - addAll(update) - } - notifyDataSetChanged() - } - - sealed class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { - - class ProfileViewHolder(val binding: ItemSelectProfileProfileBinding) : - ViewHolder(binding.root) { - - fun bind( - model: Model, - onClick: (Model.Profile) -> Unit - ) { - check(model is Model.Profile) - binding.apply { - root.isSelected = model.active - name.text = model.name - status.text = model.status - root.setOnClickListener { onClick(model) } - } - } - } - - class AddProfileViewHolder(val binding: ItemSelectProfileAddProfileBinding) : - ViewHolder(binding.root) { - fun bind(onClick: () -> Unit) { - itemView.setOnClickListener { onClick() } - } - } - } - - sealed class Model : ViewType { - data class Profile( - val id: String, - val name: String, - val status: String, - val active: Boolean = false - ) : Model() { - override fun getViewType() = PROFILE_HOLDER - } - - object AddProfile : Model() { - override fun getViewType() = ADD_PROFILE_HOLDER - } - } - - companion object { - const val PROFILE_HOLDER = 0 - const val ADD_PROFILE_HOLDER = 1 - } -} \ No newline at end of file diff --git a/app/src/main/java/com/anytypeio/anytype/ui/profile/SelectProfileDialog.kt b/app/src/main/java/com/anytypeio/anytype/ui/profile/SelectProfileDialog.kt deleted file mode 100644 index 44662ce8fc..0000000000 --- a/app/src/main/java/com/anytypeio/anytype/ui/profile/SelectProfileDialog.kt +++ /dev/null @@ -1,51 +0,0 @@ -package com.anytypeio.anytype.ui.profile - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.recyclerview.widget.LinearLayoutManager -import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment -import com.anytypeio.anytype.databinding.DialogSelectProfileBinding - -class SelectProfileDialog : BaseBottomSheetFragment() { - - private val selectProfileAdapter by lazy { - SelectProfileAdapter( - models = mutableListOf( - SelectProfileAdapter.Model.Profile( - name = "Konstantin Ivanov", - id = "id", - status = "20/100 peers", - active = true - ), - SelectProfileAdapter.Model.Profile( - name = "Evgenii Kozlov", - id = "id", - status = "20/100 peers" - ), - SelectProfileAdapter.Model.AddProfile - ), - onProfileClicked = {}, - onAddProfileClicked = {} - ) - } - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - binding.selectProfileRecycler.apply { - layoutManager = LinearLayoutManager(requireContext()) - adapter = selectProfileAdapter - } - } - - override fun injectDependencies() {} - override fun releaseDependencies() {} - - override fun inflateBinding( - inflater: LayoutInflater, - container: ViewGroup? - ): DialogSelectProfileBinding = DialogSelectProfileBinding.inflate( - inflater, container, false - ) -} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 79081d5546..fe929bf3f7 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -4,20 +4,20 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/dashboard_background" - android:orientation="vertical"> + android:orientation="vertical" + tools:context=".ui.settings.system.SettingsActivity"> + android:padding="@dimen/dp_16" + android:gravity="center" + android:text="@string/settings_screen" /> - + android:layout_height="wrap_content" /> \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_select_profile.xml b/app/src/main/res/layout/dialog_select_profile.xml index a906014667..dd9c9704af 100644 --- a/app/src/main/res/layout/dialog_select_profile.xml +++ b/app/src/main/res/layout/dialog_select_profile.xml @@ -19,6 +19,5 @@ android:layout_height="match_parent" android:layout_marginStart="10dp" android:layout_marginTop="8dp" - android:layout_marginEnd="10dp" - tools:listitem="@layout/item_select_profile_profile" /> + android:layout_marginEnd="10dp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_archive.xml b/app/src/main/res/layout/fragment_archive.xml deleted file mode 100644 index 452399a227..0000000000 --- a/app/src/main/res/layout/fragment_archive.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_choose_pin_code.xml b/app/src/main/res/layout/fragment_choose_pin_code.xml index 7d56e74e94..87d510f18b 100644 --- a/app/src/main/res/layout/fragment_choose_pin_code.xml +++ b/app/src/main/res/layout/fragment_choose_pin_code.xml @@ -51,10 +51,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="16dp" - android:alpha="0.5" android:text="@string/do_it_later" - android:textSize="18sp" - android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> diff --git a/app/src/main/res/layout/fragment_create_account.xml b/app/src/main/res/layout/fragment_create_account.xml index 8e7ef76407..2e2f039619 100644 --- a/app/src/main/res/layout/fragment_create_account.xml +++ b/app/src/main/res/layout/fragment_create_account.xml @@ -40,9 +40,6 @@ android:gravity="center" android:scaleType="center" android:src="@drawable/ic_add_photo" - android:textColor="@color/white" - android:textSize="36sp" - android:textStyle="bold" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/fragment_dashboard.xml b/app/src/main/res/layout/fragment_dashboard.xml deleted file mode 100644 index 002b5eb546..0000000000 --- a/app/src/main/res/layout/fragment_dashboard.xml +++ /dev/null @@ -1,313 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_date_picker.xml b/app/src/main/res/layout/fragment_date_picker.xml index 59e9b75927..a2fac09351 100644 --- a/app/src/main/res/layout/fragment_date_picker.xml +++ b/app/src/main/res/layout/fragment_date_picker.xml @@ -27,11 +27,11 @@ android:paddingBottom="16dp"> + android:text="@string/choose" + android:textColor="@color/glyph_active" /> diff --git a/app/src/main/res/layout/fragment_debug_settings.xml b/app/src/main/res/layout/fragment_debug_settings.xml index 7cddc7810b..8277edb367 100644 --- a/app/src/main/res/layout/fragment_debug_settings.xml +++ b/app/src/main/res/layout/fragment_debug_settings.xml @@ -7,39 +7,31 @@ -