Skip to content

Commit

Permalink
Merge branch 'develop' into app-and-os-deprecation-milestone-3
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmurerwa authored Aug 1, 2023
2 parents 61ea673 + 3e81ff6 commit cd5ea5e
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class HintsAndSolutionDialogFragmentPresenter @Inject constructor(
HintsAndSolutionFragmentBinding.inflate(inflater, container, /* attachToRoot= */ false)
binding.hintsAndSolutionToolbar.setNavigationIcon(R.drawable.ic_close_white_24dp)
binding.hintsAndSolutionToolbar.setNavigationContentDescription(
R.string.hints_andSolution_close_icon_description
R.string.hints_and_solution_close_icon_description
)
binding.hintsAndSolutionToolbar.setNavigationOnClickListener {
(fragment.requireActivity() as? HintsAndSolutionListener)?.dismiss()
Expand Down
12 changes: 8 additions & 4 deletions app/src/main/res/layout-sw600dp/revision_card_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@

<com.google.android.material.card.MaterialCardView
android:id="@+id/previous_navigation_card"
android:layout_width="144dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="144dp"
android:layout_marginStart="28dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="28dp"
Expand Down Expand Up @@ -97,10 +98,11 @@
style="@style/TextViewStart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="144dp"
android:background="@color/component_color_shared_revision_card_text_background_color"
android:ellipsize="end"
android:fontFamily="sans-serif"
android:lines="3"
android:minLines="3"
android:paddingStart="@dimen/topic_revision_summary_view_subtopic_title_text_view_padding_start"
android:paddingTop="8dp"
android:paddingEnd="@dimen/topic_revision_summary_view_subtopic_title_text_view_padding_end"
Expand All @@ -115,8 +117,9 @@

<com.google.android.material.card.MaterialCardView
android:id="@+id/next_navigation_card"
android:layout_width="144dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="144dp"
android:layout_marginStart="28dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="28dp"
Expand Down Expand Up @@ -153,10 +156,11 @@
style="@style/TextViewStart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="144dp"
android:background="@color/component_color_shared_revision_card_text_background_color"
android:ellipsize="end"
android:fontFamily="sans-serif"
android:lines="3"
android:minLines="3"
android:paddingStart="@dimen/topic_revision_summary_view_subtopic_title_text_view_padding_start"
android:paddingTop="8dp"
android:paddingEnd="@dimen/topic_revision_summary_view_subtopic_title_text_view_padding_end"
Expand Down
12 changes: 8 additions & 4 deletions app/src/main/res/layout/revision_card_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@

<com.google.android.material.card.MaterialCardView
android:id="@+id/previous_navigation_card"
android:layout_width="144dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="144dp"
android:layout_marginStart="28dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="28dp"
Expand Down Expand Up @@ -95,10 +96,11 @@
style="@style/TextViewStart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="144dp"
android:background="@color/component_color_shared_revision_card_text_background_color"
android:ellipsize="end"
android:fontFamily="sans-serif"
android:lines="3"
android:minLines="3"
android:paddingStart="@dimen/topic_revision_summary_view_subtopic_title_text_view_padding_start"
android:paddingTop="8dp"
android:paddingEnd="@dimen/topic_revision_summary_view_subtopic_title_text_view_padding_end"
Expand All @@ -113,8 +115,9 @@

<com.google.android.material.card.MaterialCardView
android:id="@+id/next_navigation_card"
android:layout_width="144dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="144dp"
android:layout_marginStart="28dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="28dp"
Expand Down Expand Up @@ -151,10 +154,11 @@
style="@style/TextViewStart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="144dp"
android:background="@color/component_color_shared_revision_card_text_background_color"
android:ellipsize="end"
android:fontFamily="sans-serif"
android:lines="3"
android:minLines="3"
android:paddingStart="@dimen/topic_revision_summary_view_subtopic_title_text_view_padding_start"
android:paddingTop="8dp"
android:paddingEnd="@dimen/topic_revision_summary_view_subtopic_title_text_view_padding_end"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@
<string name="no_new_hint_available">لا يوجد تلميح جديد متاح</string>
<string name="show_hints_and_solution">إظهار الملاحظات والحل</string>
<string name="hint_list_item_number">تلميح %s</string>
<string name="hints_andSolution_close_icon_description">العودة للسابق</string>
<string name="hints_and_solution_close_icon_description" fuzzy="true">العودة للسابق</string>
<string name="hints_toolbar_title">الملاحظات</string>
<string name="show_solution">عرض الحل</string>
<string name="reveal_solution">عرض الحل</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-pcm-rNG/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@
<string name="no_new_hint_available">No new hint dey</string>
<string name="show_hints_and_solution">Show hints and solution</string>
<string name="hint_list_item_number">Hint %s</string>
<string name="hints_andSolution_close_icon_description">Go up</string>
<string name="hints_and_solution_close_icon_description" fuzzy="true">Go up</string>
<string name="hints_toolbar_title">Hints</string>
<string name="show_solution">Show solution</string>
<string name="reveal_solution">Show Solution</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@
<string name="new_hint_available">Nova dica disponível</string>
<string name="no_new_hint_available">Nova dica disponível</string>
<string name="show_hints_and_solution">Mostrar dicas e solução</string>
<string name="hints_andSolution_close_icon_description">Navegar para cima</string>
<string name="hints_and_solution_close_icon_description" fuzzy="true">Navegar para cima</string>
<string name="hints_toolbar_title">Dicas</string>
<string name="show_solution" fuzzy="true">Exibir</string>
<string name="reveal_solution" fuzzy="true">Revelar Solução</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-sw/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
<string name="are_you_interested">Je, unavutiwa na:\n%s?</string>
<string name="new_hint_available">Kidokezo kipya kinapatikana</string>
<string name="show_hints_and_solution">Onyesha vidokezo na suluhisho</string>
<string name="hints_andSolution_close_icon_description">Nenda juu</string>
<string name="hints_and_solution_close_icon_description">Funga</string>
<string name="hints_toolbar_title">Vidokezo</string>
<string name="reveal_solution" fuzzy="true">Fichua Suluhisho</string>
<string name="reveal_hint" fuzzy="true">Fichua Kidokezo</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@
<string name="no_new_hint_available">No new hint available</string>
<string name="show_hints_and_solution">Show hints and solution</string>
<string name="hint_list_item_number">Hint %s</string>
<string name="hints_andSolution_close_icon_description">Navigate up</string>
<string name="hints_and_solution_close_icon_description">Close</string>
<string name="hints_toolbar_title">Hints</string>
<string name="show_solution">Show solution</string>
<string name="reveal_solution">Show Solution</string>
Expand Down
24 changes: 12 additions & 12 deletions scripts/assets/todo_open_exemptions.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -294,16 +294,16 @@ todo_open_exemption {

todo_open_exemption {
exempted_file_path: "wiki/Static-Analysis-Checks.md"
line_number: 169
line_number: 177
line_number: 182
line_number: 186
line_number: 190
line_number: 192
line_number: 207
line_number: 217
line_number: 220
line_number: 223
line_number: 226
line_number: 229
line_number: 170
line_number: 178
line_number: 183
line_number: 187
line_number: 191
line_number: 193
line_number: 208
line_number: 218
line_number: 221
line_number: 224
line_number: 227
line_number: 230
}
26 changes: 13 additions & 13 deletions wiki/Overview-of-the-Oppia-Android-codebase-and-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,43 +152,43 @@ Following these steps would lead to completing the entire task with all the code

**Task:**

Finding code from a string ( e g., topic description under topic info tab) that you see in UI when running the app all the way to the UI components, domain controllers and the tests ultimately behind that text appearing.
Finding code from a string ( e g., story name under lessons tab) that you see in UI when running the app all the way to the UI components, domain controllers and the tests ultimately behind that text appearing.

<img width="300" height="600" alt="example 2 task image" src="https://user-images.githubusercontent.com/53645584/167693638-fbd3455f-3b10-4992-9c19-4e2892e75119.png">
<img width="300" height="600" alt="example 2 task image" src="https://github.com/oppia/oppia-android/assets/76530270/a1785b0e-7c8e-4ece-a375-e9042f1002da">

**Walkthrough:**

**Finding the UI component (topic description)**
**Finding the UI component (story name)**

1. The first step is to identify the id of the UI component that is responsible for displaying the text. We can do this by using the layout inspector of the android studio.

2. To do this, run the app on an emulator. Now navigate to the screen that displays the UI component, i.e. the topic info tab.
2. To do this, run the app on an emulator. Now navigate to the screen that displays the UI component, i.e. the lessons tab.

3. Next, open the layout inspector from the android studio, and click on the UI component displaying the topic description. Now all the attributes of this UI component are displayed on the right side of the layout inspector. Here, you can see this UI component's id, i.e. topic_description text_view.
3. Next, open the layout inspector from the android studio, and click on the UI component displaying the story name. Now all the attributes of this UI component are displayed on the right side of the layout inspector. Here, you can see this UI component's id, i.e. story_name_text_view.

<img width="750" alt="example 2 layout inspector screenshot" src="https://lh5.googleusercontent.com/_3fkwPRvaQa4LU_ag-q7lq4AA3Qn5iofINL0ReVxufK27CVu-abIA972_ZBz6Mo38R1ZFK4q_JB-2N8c51TZ1jDOM-YO8IBGrb29ECJbnnSOGmYg4-nBhYCLcCuBvOi_y4TFSYVmweIMyn8Ucg">
<img width="750" alt="example 2 layout inspector screenshot" src="https://github.com/oppia/oppia-android/assets/76530270/e4a198a8-d257-47d1-9e4a-dc08f159843f">

4. Now we have to find the file with a UI component with this id. We can do this by pressing double shift and then typing the id. Doing this, we see the id is the id of a text view present in the file topic_info_fragment.xml.
4. Now we have to find the file with a UI component with this id. We can do this by pressing double shift and then typing the id. Doing this, we see the id is the id of a text view present in the file topic_lessons_story_summary.xml.

5. Now that we know that the text view is present in topic_info_fragment.xml, according to the app architecture, we know that the name of this fragment is TopicInfoFragment. The files responsible for displaying this fragment are TopicInfoFragment.kt and TopicInfoFragmentPresenter.kt.
5. Now that we know that the text view is present in topic_lessons_story_summary.xml, according to the app architecture, we know that the name of this fragment is TopicLessonsFragment. The files responsible for displaying this fragment are TopicLessonsFragment.kt and TopicLessonsFragmentPresenter.kt.

6. Looking at the XML code for topic_description_text_view, we can see that TopicInfoViewModel sets the text in the text view using databinding.
6. Looking at the XML code for story_name_text_view, we can see that StorySummaryViewModel sets the text in the text view using databinding.

**Finding the business logic for the UI component, i.e. domain controllers**

1. Following the app architecture used by Oppia, TopicInfoViewModel should be initialized in the TopicInfoFragmentPresenter.
1. Following the app architecture used by Oppia, StorySummaryViewModel should be initialized in the TopicLessonsFragmentPresenter.

2. Here we can see that the topic description is being updated in the viewModel by the TopicController. Therefore the business logic for getting the topic description will be present in the file TopicController.
2. Here we can see that the story name is being updated in the viewModel by the TranslationController. Therefore the business logic for getting the story name will be present in the file TranslationController.

**Finding the tests**

There are two sets of tests:
- Tests to test the UI component
- Tests to test the business logic of the UI component

Since the UI component is present in the TopicInfoFramgnet, the UI component tests are present in the file TopicInfoFragmentTest.
Since the UI component is present in the TopicLessonsFragment, the UI component tests are present in the file TopicLessonsFragmentTest.

Similarly, since the business logic is present in the file TopicController, the tests for this controller can be found in the file TopicControllerTest.
Similarly, since the business logic is present in the file TranslationController, the tests for this controller can be found in the file TranslationControllerTest.

## Dependency Injection

Expand Down
9 changes: 9 additions & 0 deletions wiki/Static-Analysis-Checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [KDoc validity check](#kdoc-validity-check)
- [TODO open checks](#todo-open-checks)
- [TODO issue resolved check](#todo-issue-resolved-check)
- [How to run static checks locally](#how-to-run-static-checks-locally)

# Background
Static analysis is a method of debugging by examining source code before a program is run. It’s done by analyzing a set of code against a set (or multiple sets) of coding rules.
Expand Down Expand Up @@ -227,3 +228,11 @@ To fix the failures for this check: resolve the TODO items and then close the is

# How to add a new Static analysis check
// TODO([#3690](https://github.com/oppia/oppia-android/issues/3690)): Complete static checks Wiki

# How to run static checks locally

- Go to the failing CI check in your GitHub PR.
- Scroll to the top of the failing CI check logs, and find the Bazel command that was run for this script.
- Alternatively, in Android Studio, go to the `.github` folder and find the [static_checks.yml](https://github.com/oppia/oppia-android/blob/develop/.github/workflows/static_checks.yml) file. Search for the line that corresponds to the name of the job that failed. You can then run the same script on your local terminal.

Note: Before running the script command in your local terminal, make sure you have Bazel installed. To learn how to set up Bazel for Oppia Android, follow these [instructions](https://github.com/oppia/oppia-android/wiki/Oppia-Bazel-Setup-Instructions).

0 comments on commit cd5ea5e

Please sign in to comment.