Skip to content

Commit

Permalink
Fix issues from self review
Browse files Browse the repository at this point in the history
  • Loading branch information
adhiamboperes committed Feb 12, 2024
1 parent 57c3533 commit 76df4f0
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,9 @@ VIEWS_WITH_RESOURCE_IMPORTS = [
"src/main/java/org/oppia/android/app/customview/ChapterNotStartedContainerConstraintLayout.kt",
"src/main/java/org/oppia/android/app/customview/ContinueButtonView.kt",
"src/main/java/org/oppia/android/app/customview/LessonThumbnailImageView.kt",
"src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt",
"src/main/java/org/oppia/android/app/customview/PromotedStoryCardView.kt",
"src/main/java/org/oppia/android/app/customview/SegmentedCircularProgressView.kt",
"src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt",
"src/main/java/org/oppia/android/app/customview/VerticalDashedLineView.kt",
"src/main/java/org/oppia/android/app/survey/SurveyMultipleChoiceOptionView.kt",
"src/main/java/org/oppia/android/app/survey/SurveyNpsItemOptionView.kt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ class OppiaCurveBackgroundView @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : View(context, attrs, defStyleAttr) {
@Inject
lateinit var resourceHandler: AppLanguageResourceHandler
/**
* Used to retrieve the layout direction that should be used to mirror the direction of the
* curve based on locale.
*/
@Inject lateinit var resourceHandler: AppLanguageResourceHandler

private val isRtl by lazy {
resourceHandler.getLayoutDirection() == ViewCompat.LAYOUT_DIRECTION_RTL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import org.oppia.android.app.model.AudioLanguage
import org.oppia.android.databinding.AudioLanguageSelectionFragmentBinding
import javax.inject.Inject

/** The presenter for [AudioLanguageFragment] V2. */
class AudioLanguageFragmentPresenter @Inject constructor(
private val fragment: Fragment,
private val activity: AppCompatActivity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ import javax.inject.Inject
/** The ViewModel for [NewLearnerProfileFragment]. */
@FragmentScope
class CreateLearnerProfileViewModel @Inject constructor() : ObservableViewModel() {
/** ObservableField that tracks whether a nickname has been entered. */
val hasName = ObservableField(true)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import org.oppia.android.R
import org.oppia.android.app.fragment.FragmentScope
import org.oppia.android.app.onboarding.OnboardingViewModel
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.app.viewmodel.ViewModelProvider
import org.oppia.android.databinding.OnboardingAppLanguageSelectionFragmentBinding
import javax.inject.Inject

Expand All @@ -19,19 +17,18 @@ import javax.inject.Inject
class OnboardingFragmentPresenter @Inject constructor(
private val activity: AppCompatActivity,
private val fragment: Fragment,
private val viewModelProvider: ViewModelProvider<OnboardingViewModel>,
private val appLanguageResourceHandler: AppLanguageResourceHandler
) {
private lateinit var binding: OnboardingAppLanguageSelectionFragmentBinding

/** Handle creation and binding of the [OnboardingFragment] V2 layout. */
fun handleCreateView(inflater: LayoutInflater, container: ViewGroup?): View {
binding = OnboardingAppLanguageSelectionFragmentBinding.inflate(
inflater,
container,
/* attachToRoot= */ false
)
// NB: Both the view model and lifecycle owner must be set in order to correctly bind LiveData elements to
// data-bound view models.

binding.let {
it.lifecycleOwner = fragment
}
Expand All @@ -55,8 +52,4 @@ class OnboardingFragmentPresenter @Inject constructor(

return binding.root
}

private fun getOnboardingViewModel(): OnboardingViewModel {
return viewModelProvider.getForFragment(fragment, OnboardingViewModel::class.java)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ import javax.inject.Inject

private const val TAG_SURVEY_FRAGMENT = "TAG_SURVEY_FRAGMENT"

/** Argument key for bundling the profileId. */
const val PROFILE_ID_ARGUMENT_KEY = "profile_id"

/** Argument key for bundling the topicId. */
const val TOPIC_ID_ARGUMENT_KEY = "topic_id"

/** Argument key for bundling the explorationId. */
const val EXPLORATION_ID_ARGUMENT_KEY = "exploration_id"

/** The Presenter for [SurveyActivity]. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
android:layout_marginStart="@dimen/onboarding_language_dropdown_margin"
android:background="@drawable/transparent_background"
android:textAlignment="center"
android:textColor="@color/component_color_onboarding_language_primary_text_color"
android:textColor="@color/component_color_onboarding_shared_text_color"
android:layout_alignStart="@id/onboarding_language_dropdown_icon"
tools:listheader="English" />

Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/audio_language_selection_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
android:id="@+id/audio_language_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="24dp"
android:layout_marginStart="@dimen/onboarding_shared_margin_medium_large"
android:layout_marginEnd="@dimen/onboarding_shared_margin_medium_large"
android:layout_marginBottom="@dimen/onboarding_shared_margin_large"
android:fontFamily="sans-serif"
android:text="@string/audio_language_fragment_text"
android:textColor="@color/component_color_shared_primary_text_color"
Expand Down Expand Up @@ -88,7 +88,7 @@
android:layout_marginStart="@dimen/onboarding_shared_margin_small"
android:layout_toStartOf="@id/audio_language_dropdown_arrow"
android:background="@drawable/transparent_background"
android:textColor="@color/component_color_onboarding_language_primary_text_color"
android:textColor="@color/component_color_onboarding_shared_text_color"
tools:listheader="English" />

<ImageView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
android:layout_marginStart="@dimen/onboarding_shared_margin_2xl"
android:layout_toStartOf="@id/onboarding_language_dropdown_arrow"
android:background="@drawable/transparent_background"
android:textColor="@color/component_color_onboarding_language_primary_text_color"
android:textColor="@color/component_color_onboarding_shared_text_color"
tools:listheader="English" />

<ImageView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:padding="@dimen/onboarding_shared_padding_medium_small"
android:textColor="@color/component_color_onboarding_language_primary_text_color"
android:textColor="@color/component_color_onboarding_shared_text_color"
android:textSize="@dimen/onboarding_shared_text_size_medium_small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values/component_colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,6 @@
<color name="component_color_onboarding_shared_green_color">@color/color_palette_onboarding_primary_color</color>
<color name="component_color_onboarding_shared_black_color">@color/color_palette_onboarding_black_color</color>
<color name="component_color_onboarding_shared_text_color">@color/color_palette_primary_text_color</color>
<color name="component_color_onboarding_language_primary_text_color">@color/color_palette_onboarding_primary_text_color</color>
<color name="component_color_onboarding_profile_shared_text_color">@color/color_palette_primary_text_color</color>
<color name="component_color_onboarding_learner_intro_background_color">@color/color_palette_onboarding_learner_intro_background_color</color>
<color name="component_color_onboarding_profile_type_background_color">@color/color_palette_onboarding_profile_type_background_color</color>
<color name="component_color_onboarding_profile_edit_icon_color">@color/color_palette_onboarding_edit_icon_color</color>
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 @@ -679,7 +679,7 @@
<string name="onboarding_navigation_back">Back</string>
<string name="onboarding_navigation_continue">Continue</string>

<string name="audio_language_fragment_text">In Oppia, you can listen to lessons!</string>
<string name="audio_language_fragment_text">In %s, you can listen to lessons!</string>
<string name="audio_language_fragment_subtitle">Select the audio language to listen to lessons</string>

</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginBottom">@dimen/onboarding_shared_margin_medium_small</item>
<item name="android:textColor">@color/component_color_onboarding_profile_shared_text_color</item>
<item name="android:textColor">@color/component_color_onboarding_shared_text_color</item>
<item name="android:textSize">@dimen/onboarding_shared_text_size_xl</item>
<item name="android:fontFamily">sans-serif-medium</item>
</style>
Expand Down
1 change: 0 additions & 1 deletion scripts/assets/kdoc_validity_exemptions.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ exempted_file_path: "app/src/main/java/org/oppia/android/app/application/Applica
exempted_file_path: "app/src/main/java/org/oppia/android/app/application/ApplicationInjectorProvider.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/application/ApplicationStartupListenerModule.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/administratorcontrols/RouteToProfileListListener.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/notice/AutomaticAppDeprecationNoticeDialogFragmentPresenter.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/devoptions/DeveloperOptionsActivityPresenter.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/devoptions/DeveloperOptionsFragment.kt"
Expand Down
2 changes: 1 addition & 1 deletion scripts/assets/test_file_exemptions.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ exempted_file_path: "app/src/main/java/org/oppia/android/app/completedstorylist/
exempted_file_path: "app/src/main/java/org/oppia/android/app/completedstorylist/CompletedStoryListViewModel.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/customview/ChapterNotStartedContainerConstraintLayout.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/customview/ContinueButtonView.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/customview/PromotedStoryCardView.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/customview/SegmentedCircularProgressView.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/customview/VerticalDashedLineView.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/customview/interaction/FractionInputInteractionView.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/customview/interaction/NumericInputInteractionView.kt"
Expand Down

0 comments on commit 76df4f0

Please sign in to comment.