Skip to content

Commit cd3bb2a

Browse files
committed
Merge naming cleanup
2 parents 0aba5dc + ab80ca8 commit cd3bb2a

File tree

20 files changed

+119
-112
lines changed

20 files changed

+119
-112
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Android Architecture Blueprints v2
22
<p align="center">
3-
<img src="https://github.com/googlesamples/android-architecture/wiki/images/aab-logov2.png" alt="Android Architecture Blueprints"/>
3+
<img src="https://github.com/googlesamples/android-architecture/wiki/images/aab-logov2.png" alt="Illustration by Virginia Poltrack"/>
44
</p>
55

66
Android Architecture Blueprints is a project to showcase different architectural approaches to developing Android apps. In its different branches you'll find the same app (a TODO app) implemented with small differences.

app/src/androidTest/java/com/example/android/architecture/blueprints/todoapp/tasks/AppNavigationTest.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,21 @@ class AppNavigationTest {
102102

103103
// Start statistics screen.
104104
onView(withId(R.id.nav_view))
105-
.perform(navigateTo(R.id.statisticsFragment))
105+
.perform(navigateTo(R.id.statistics_fragment_dest))
106106

107107
// Check that statistics screen was opened.
108-
onView(withId(R.id.statistics)).check(matches(isDisplayed()))
108+
onView(withId(R.id.statistics_layout)).check(matches(isDisplayed()))
109109

110110
onView(withId(R.id.drawer_layout))
111111
.check(matches(isClosed(Gravity.START))) // Left Drawer should be closed.
112112
.perform(open()) // Open Drawer
113113

114114
// Start tasks screen.
115115
onView(withId(R.id.nav_view))
116-
.perform(navigateTo(R.id.tasksFragment))
116+
.perform(navigateTo(R.id.tasks_fragment_dest))
117117

118118
// Check that tasks screen was opened.
119-
onView(withId(R.id.tasksContainer)).check(matches(isDisplayed()))
119+
onView(withId(R.id.tasks_container_layout)).check(matches(isDisplayed()))
120120
}
121121

122122
@Test
@@ -150,7 +150,7 @@ class AppNavigationTest {
150150

151151
// When the user navigates to the stats screen
152152
activityScenario.onActivity {
153-
it.findNavController(R.id.nav_host_fragment).navigate(R.id.statisticsFragment)
153+
it.findNavController(R.id.nav_host_fragment).navigate(R.id.statistics_fragment_dest)
154154
}
155155

156156
// Then check that left drawer is closed at startup
@@ -182,7 +182,7 @@ class AppNavigationTest {
182182
// Click on the task on the list
183183
onView(withText("UI <- button")).perform(click())
184184
// Click on the edit task button
185-
onView(withId(R.id.fab_edit_task)).perform(click())
185+
onView(withId(R.id.edit_task_fab)).perform(click())
186186

187187
// Confirm that if we click "<-" once, we end up back at the task details page
188188
onView(
@@ -191,7 +191,7 @@ class AppNavigationTest {
191191
.getToolbarNavigationContentDescription()
192192
)
193193
).perform(click())
194-
onView(withId(R.id.task_detail_title)).check(matches(isDisplayed()))
194+
onView(withId(R.id.task_detail_title_text)).check(matches(isDisplayed()))
195195

196196
// Confirm that if we click "<-" a second time, we end up back at the home screen
197197
onView(
@@ -200,7 +200,7 @@ class AppNavigationTest {
200200
.getToolbarNavigationContentDescription()
201201
)
202202
).perform(click())
203-
onView(withId(R.id.tasksContainer)).check(matches(isDisplayed()))
203+
onView(withId(R.id.tasks_container_layout)).check(matches(isDisplayed()))
204204
}
205205

206206
@Test
@@ -215,14 +215,14 @@ class AppNavigationTest {
215215
// Click on the task on the list
216216
onView(withText("Back button")).perform(click())
217217
// Click on the edit task button
218-
onView(withId(R.id.fab_edit_task)).perform(click())
218+
onView(withId(R.id.edit_task_fab)).perform(click())
219219

220220
// Confirm that if we click back once, we end up back at the task details page
221221
pressBack()
222-
onView(withId(R.id.task_detail_title)).check(matches(isDisplayed()))
222+
onView(withId(R.id.task_detail_title_text)).check(matches(isDisplayed()))
223223

224224
// Confirm that if we click back a second time, we end up back at the home screen
225225
pressBack()
226-
onView(withId(R.id.tasksContainer)).check(matches(isDisplayed()))
226+
onView(withId(R.id.tasks_container_layout)).check(matches(isDisplayed()))
227227
}
228228
}

app/src/androidTest/java/com/example/android/architecture/blueprints/todoapp/tasks/TasksActivityTest.kt

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ class TasksActivityTest {
102102

103103
// Click on the task on the list and verify that all the data is correct
104104
onView(withText("TITLE1")).perform(click())
105-
onView(withId(R.id.task_detail_title)).check(matches(withText("TITLE1")))
106-
onView(withId(R.id.task_detail_description)).check(matches(withText("DESCRIPTION")))
107-
onView(withId(R.id.task_detail_complete)).check(matches(not(isChecked())))
105+
onView(withId(R.id.task_detail_title_text)).check(matches(withText("TITLE1")))
106+
onView(withId(R.id.task_detail_description_text)).check(matches(withText("DESCRIPTION")))
107+
onView(withId(R.id.task_detail_complete_checkbox)).check(matches(not(isChecked())))
108108

109109
// Click on the edit button, edit, and save
110-
onView(withId(R.id.fab_edit_task)).perform(click())
111-
onView(withId(R.id.add_task_title)).perform(replaceText("NEW TITLE"))
112-
onView(withId(R.id.add_task_description)).perform(replaceText("NEW DESCRIPTION"))
113-
onView(withId(R.id.fab_save_task)).perform(click())
110+
onView(withId(R.id.edit_task_fab)).perform(click())
111+
onView(withId(R.id.add_task_title_edit_text)).perform(replaceText("NEW TITLE"))
112+
onView(withId(R.id.add_task_description_edit_text)).perform(replaceText("NEW DESCRIPTION"))
113+
onView(withId(R.id.save_task_fab)).perform(click())
114114

115115
// Verify task is displayed on screen in the task list.
116116
onView(withText("NEW TITLE")).check(matches(isDisplayed()))
@@ -126,10 +126,10 @@ class TasksActivityTest {
126126
dataBindingIdlingResource.monitorActivity(activityScenario)
127127

128128
// Add active task
129-
onView(withId(R.id.fab_add_task)).perform(click())
130-
onView(withId(R.id.add_task_title)).perform(typeText("TITLE1"), closeSoftKeyboard())
131-
onView(withId(R.id.add_task_description)).perform(typeText("DESCRIPTION"))
132-
onView(withId(R.id.fab_save_task)).perform(click())
129+
onView(withId(R.id.add_task_fab)).perform(click())
130+
onView(withId(R.id.add_task_title_edit_text)).perform(typeText("TITLE1"), closeSoftKeyboard())
131+
onView(withId(R.id.add_task_description_edit_text)).perform(typeText("DESCRIPTION"))
132+
onView(withId(R.id.save_task_fab)).perform(click())
133133

134134
// Open it in details view
135135
onView(withText("TITLE1")).perform(click())
@@ -177,7 +177,7 @@ class TasksActivityTest {
177177
onView(withText(taskTitle)).perform(click())
178178

179179
// Click on the checkbox in task details screen
180-
onView(withId(R.id.task_detail_complete)).perform(click())
180+
onView(withId(R.id.task_detail_complete_checkbox)).perform(click())
181181

182182
// Click on the navigation up button to go back to the list
183183
onView(
@@ -187,7 +187,7 @@ class TasksActivityTest {
187187
).perform(click())
188188

189189
// Check that the task is marked as completed
190-
onView(allOf(withId(R.id.complete), hasSibling(withText(taskTitle))))
190+
onView(allOf(withId(R.id.complete_checkbox), hasSibling(withText(taskTitle))))
191191
.check(matches(isChecked()))
192192
}
193193

@@ -204,7 +204,7 @@ class TasksActivityTest {
204204
// Click on the task on the list
205205
onView(withText(taskTitle)).perform(click())
206206
// Click on the checkbox in task details screen
207-
onView(withId(R.id.task_detail_complete)).perform(click())
207+
onView(withId(R.id.task_detail_complete_checkbox)).perform(click())
208208

209209
// Click on the navigation up button to go back to the list
210210
onView(
@@ -214,7 +214,7 @@ class TasksActivityTest {
214214
).perform(click())
215215

216216
// Check that the task is marked as active
217-
onView(allOf(withId(R.id.complete), hasSibling(withText(taskTitle))))
217+
onView(allOf(withId(R.id.complete_checkbox), hasSibling(withText(taskTitle))))
218218
.check(matches(not(isChecked())))
219219
}
220220

@@ -231,9 +231,9 @@ class TasksActivityTest {
231231
// Click on the task on the list
232232
onView(withText(taskTitle)).perform(click())
233233
// Click on the checkbox in task details screen
234-
onView(withId(R.id.task_detail_complete)).perform(click())
234+
onView(withId(R.id.task_detail_complete_checkbox)).perform(click())
235235
// Click again to restore it to original state
236-
onView(withId(R.id.task_detail_complete)).perform(click())
236+
onView(withId(R.id.task_detail_complete_checkbox)).perform(click())
237237

238238
// Click on the navigation up button to go back to the list
239239
onView(
@@ -243,7 +243,7 @@ class TasksActivityTest {
243243
).perform(click())
244244

245245
// Check that the task is marked as active
246-
onView(allOf(withId(R.id.complete), hasSibling(withText(taskTitle))))
246+
onView(allOf(withId(R.id.complete_checkbox), hasSibling(withText(taskTitle))))
247247
.check(matches(not(isChecked())))
248248
}
249249

@@ -260,9 +260,9 @@ class TasksActivityTest {
260260
// Click on the task on the list
261261
onView(withText(taskTitle)).perform(click())
262262
// Click on the checkbox in task details screen
263-
onView(withId(R.id.task_detail_complete)).perform(click())
263+
onView(withId(R.id.task_detail_complete_checkbox)).perform(click())
264264
// Click again to restore it to original state
265-
onView(withId(R.id.task_detail_complete)).perform(click())
265+
onView(withId(R.id.task_detail_complete_checkbox)).perform(click())
266266

267267
// Click on the navigation up button to go back to the list
268268
onView(
@@ -272,7 +272,7 @@ class TasksActivityTest {
272272
).perform(click())
273273

274274
// Check that the task is marked as active
275-
onView(allOf(withId(R.id.complete), hasSibling(withText(taskTitle))))
275+
onView(allOf(withId(R.id.complete_checkbox), hasSibling(withText(taskTitle))))
276276
.check(matches(isChecked()))
277277
}
278278

@@ -283,10 +283,10 @@ class TasksActivityTest {
283283
dataBindingIdlingResource.monitorActivity(activityScenario)
284284

285285
// Click on the "+" button, add details, and save
286-
onView(withId(R.id.fab_add_task)).perform(click())
287-
onView(withId(R.id.add_task_title)).perform(typeText("title"), closeSoftKeyboard())
288-
onView(withId(R.id.add_task_description)).perform(typeText("description"))
289-
onView(withId(R.id.fab_save_task)).perform(click())
286+
onView(withId(R.id.add_task_fab)).perform(click())
287+
onView(withId(R.id.add_task_title_edit_text)).perform(typeText("title"), closeSoftKeyboard())
288+
onView(withId(R.id.add_task_description_edit_text)).perform(typeText("description"))
289+
onView(withId(R.id.save_task_fab)).perform(click())
290290

291291
// Then verify task is displayed on screen
292292
onView(withText("title")).check(matches(isDisplayed()))

app/src/main/java/com/example/android/architecture/blueprints/todoapp/addedittask/AddEditTaskFragment.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ class AddEditTaskFragment : Fragment() {
4141

4242
private val args: AddEditTaskFragmentArgs by navArgs()
4343

44-
private val viewModel by viewModels<AddEditTaskViewModel> {
45-
getViewModelFactory()
46-
}
44+
private val viewModel by viewModels<AddEditTaskViewModel> { getViewModelFactory() }
4745

4846
override fun onCreateView(
4947
inflater: LayoutInflater, container: ViewGroup?,

app/src/main/java/com/example/android/architecture/blueprints/todoapp/taskdetail/TaskDetailFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class TaskDetailFragment : Fragment() {
7070
}
7171

7272
private fun setupFab() {
73-
activity?.findViewById<View>(R.id.fab_edit_task)?.setOnClickListener {
73+
activity?.findViewById<View>(R.id.edit_task_fab)?.setOnClickListener {
7474
viewModel.editTask()
7575
}
7676
}

app/src/main/java/com/example/android/architecture/blueprints/todoapp/tasks/TasksActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class TasksActivity : AppCompatActivity() {
4444

4545
val navController: NavController = findNavController(R.id.nav_host_fragment)
4646
appBarConfiguration =
47-
AppBarConfiguration.Builder(R.id.tasksFragment, R.id.statisticsFragment)
47+
AppBarConfiguration.Builder(R.id.tasks_fragment_dest, R.id.statistics_fragment_dest)
4848
.setDrawerLayout(drawerLayout)
4949
.build()
5050
setupActionBarWithNavController(navController, appBarConfiguration)

app/src/main/java/com/example/android/architecture/blueprints/todoapp/tasks/TasksFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class TasksFragment : Fragment() {
137137
}
138138

139139
private fun setupFab() {
140-
activity?.findViewById<FloatingActionButton>(R.id.fab_add_task)?.let {
140+
activity?.findViewById<FloatingActionButton>(R.id.add_task_fab)?.let {
141141
it.setOnClickListener {
142142
navigateToAddNewTask()
143143
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</data>
2828

2929
<androidx.coordinatorlayout.widget.CoordinatorLayout
30-
android:id="@+id/coordinatorLayout"
30+
android:id="@+id/coordinator_layout"
3131
android:layout_width="match_parent"
3232
android:layout_height="match_parent">
3333

@@ -53,7 +53,7 @@
5353
android:visibility="@{viewmodel.dataLoading ? View.GONE : View.VISIBLE}">
5454

5555
<EditText
56-
android:id="@+id/add_task_title"
56+
android:id="@+id/add_task_title_edit_text"
5757
android:background="@null"
5858
android:layout_width="match_parent"
5959
android:layout_height="wrap_content"
@@ -65,7 +65,7 @@
6565
android:textAppearance="@style/TextAppearance.AppCompat.Title" />
6666

6767
<EditText
68-
android:id="@+id/add_task_description"
68+
android:id="@+id/add_task_description_edit_text"
6969
android:background="@null"
7070
android:layout_width="match_parent"
7171
android:layout_height="350dp"
@@ -79,7 +79,7 @@
7979
</com.example.android.architecture.blueprints.todoapp.ScrollChildSwipeRefreshLayout>
8080

8181
<com.google.android.material.floatingactionbutton.FloatingActionButton
82-
android:id="@+id/fab_save_task"
82+
android:id="@+id/save_task_fab"
8383
android:layout_width="wrap_content"
8484
android:layout_height="wrap_content"
8585
android:layout_margin="@dimen/fab_margin"

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@
1717
<FrameLayout
1818
xmlns:android="http://schemas.android.com/apk/res/android"
1919
android:layout_width="match_parent"
20-
android:layout_height="192dp"
20+
android:layout_height="@dimen/header_height"
2121
android:background="?attr/colorPrimaryDark"
2222
android:gravity="bottom"
2323
android:orientation="vertical"
24-
android:padding="16dp"
24+
android:padding="@dimen/header_padding"
2525
android:theme="@style/ThemeOverlay.AppCompat.Dark">
2626

2727
<ImageView
28-
android:layout_width="100dp"
28+
android:layout_width="@dimen/header_image_width"
2929
android:layout_height="wrap_content"
3030
android:layout_gravity="center"
31-
android:src="@drawable/logo_no_fill" />
31+
android:src="@drawable/logo_no_fill"
32+
android:contentDescription="@string/tasks_header_image_content_description" />
3233

3334
<TextView
3435
android:layout_width="wrap_content"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
android:paddingBottom="@dimen/activity_vertical_margin">
4343

4444
<LinearLayout
45-
android:id="@+id/statistics"
45+
android:id="@+id/statistics_layout"
4646
android:layout_width="match_parent"
4747
android:layout_height="match_parent"
4848
android:orientation="vertical"

0 commit comments

Comments
 (0)