Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #4735 Text unit is set in dp instead of sp #5134

Merged
merged 12 commits into from
Sep 5, 2023
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<activity
android:name=".app.profile.AdminPinActivity"
android:label="@string/admin_pin_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".app.profile.PinPasswordActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package org.oppia.android.app.profile
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.widget.Toolbar
import org.oppia.android.R
import org.oppia.android.app.activity.ActivityComponentImpl
import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity
import org.oppia.android.app.model.ScreenName.ADMIN_PIN_ACTIVITY
Expand Down Expand Up @@ -38,6 +40,9 @@ class AdminPinActivity : InjectableAutoLocalizedAppCompatActivity() {
super.onCreate(savedInstanceState)
(activityComponent as ActivityComponentImpl).inject(this)
adminPinActivityPresenter.handleOnCreate()

val toolbar: Toolbar = findViewById(R.id.admin_pin_toolbar)
setSupportActionBar(toolbar)
}

override fun onSupportNavigateUp(): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,22 @@ class AdminPinActivityPresenter @Inject constructor(

/** Binds ViewModel and sets up text and button listeners. */
fun handleOnCreate() {
activity.supportActionBar?.setDisplayHomeAsUpEnabled(true)
activity.supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_close_white_24dp)
activity.supportActionBar?.setHomeActionContentDescription(R.string.admin_auth_close)

val binding =
DataBindingUtil.setContentView<AdminPinActivityBinding>(activity, R.layout.admin_pin_activity)

activity.setSupportActionBar(binding.adminPinToolbar)
activity.supportActionBar?.setDisplayHomeAsUpEnabled(true)
activity.supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_close_white_24dp)
activity.supportActionBar?.setHomeActionContentDescription(R.string.admin_auth_close)

binding.apply {
lifecycleOwner = activity
viewModel = adminViewModel
}

binding.adminPinToolbar.title = resourceHandler
.getStringInLocale(R.string.admin_auth_activity_add_profiles_title)
// [onTextChanged] is a extension function defined at [TextInputEditTextHelper]
binding.adminPinInputPinEditText.onTextChanged { pin ->
pin?.let {
Expand Down
26 changes: 22 additions & 4 deletions app/src/main/res/layout/admin_pin_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,32 @@
android:layout_width="match_parent"
android:layout_height="match_parent">


<androidx.appcompat.widget.Toolbar
android:id="@+id/admin_pin_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:elevation="4dp"
android:theme="@style/OppiaActionBarTheme"
style="@style/AdminPinToolbarTextAppearance"
app:titleTextAppearance="@style/AdminPinToolbarTextAppearance"
app:titleTextColor="@color/component_color_shared_activity_toolbar_text_color"
app:layout_constraintTop_toTopOf="parent" />

<androidx.core.widget.NestedScrollView
android:id="@+id/scrollViewAdminPin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/component_color_shared_screen_secondary_background_color"
android:layout_width="@dimen/admin_auth_activity_layout_width"
android:layout_height="0dp"
android:fillViewport="true"
android:overScrollMode="never"
android:scrollbars="none">
android:scrollbars="none"
android:background="@color/component_color_shared_screen_secondary_background_color"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/admin_pin_toolbar"
>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/admin_auth_container"
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -632,4 +632,8 @@
<item name="android:windowEnterAnimation">@anim/slide_up</item>
<item name="android:windowExitAnimation">@anim/slide_down</item>
</style>

<style name="AdminPinToolbarTextAppearance" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textSize">20sp</item>
</style>
</resources>
Loading