Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/src/org/commcare/activities/connect/ConnectActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ public void onPostCreate(@Nullable Bundle savedInstanceState) {
getSupportActionBar().setTitle(getString(R.string.connect_title));
}

@Override
public void setTitle(CharSequence title) {
super.setTitle(title);
setActionBarTitle(title);
}

@Override
protected void onResume() {
super.onResume();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import org.commcare.views.connect.ConnectCtaBar
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Rule
Expand Down Expand Up @@ -213,6 +214,19 @@ class ConnectDeliveryHomeFragmentTest {
)
}

@Test
fun `a later screen's title replaces the delivery title and subtitle`() {
every { job.title } returns "Delivery Opportunity"
val activity = launchHome().requireActivity() as ConnectActivity
val actionBar = activity.supportActionBar!!
assertEquals("Delivery Opportunity", actionBar.title)

activity.setTitle(R.string.connect_learn_title)

assertEquals(app.getString(R.string.connect_learn_title), actionBar.title)
assertNull(actionBar.subtitle)
}

private fun launchHome(): ConnectDeliveryHomeFragment {
val intent =
Intent(app, ConnectActivity::class.java).apply {
Expand Down
Loading