Skip to content

Commit

Permalink
Merge branch 'develop' into dark_mode_image_distorted
Browse files Browse the repository at this point in the history
  • Loading branch information
MohitGupta121 authored Sep 8, 2023
2 parents f0837d2 + a1ba8bd commit 28b5d35
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 8 deletions.
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
5 changes: 5 additions & 0 deletions app/src/main/res/color/component_color_text_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/color_palette_edit_text_inactive_color" android:state_focused="false"/>
<item android:color="@color/color_palette_edit_text_active_color" android:state_focused="true"/>
</selector>
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
2 changes: 2 additions & 0 deletions app/src/main/res/values-night/color_palette.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,6 @@
<color name="color_palette_nps_selected_text_color">@color/color_def_white</color>
<color name="color_palette_nps_selected_background_color">@color/color_def_oppia_green</color>
<color name="color_palette_nps_unselected_background_color">@color/color_def_pale_green</color>
<color name="color_palette_edit_text_inactive_color">@color/color_def_black_87</color>
<color name="color_palette_edit_text_active_color">@color/color_def_white</color>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/color_palette.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,6 @@
<color name="color_palette_survey_disabled_button_text_color">@color/color_def_chooser_grey</color>
<color name="color_palette_button_text_color">@color/color_def_persian_green</color>
<color name="color_palette_edit_text_unselected_color">@color/color_def_grey</color>
<color name="color_palette_edit_text_inactive_color">@color/color_def_black_87</color>
<color name="color_palette_edit_text_active_color">@color/color_def_black_87</color>
</resources>
6 changes: 5 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
<item name="boxCornerRadiusBottomStart">@dimen/text_input_layout_corner_radius</item>
<item name="boxCornerRadiusTopEnd">@dimen/text_input_layout_corner_radius</item>
<item name="boxCornerRadiusTopStart">@dimen/text_input_layout_corner_radius</item>
<item name="boxStrokeColor">@color/component_color_shared_text_input_layout_stroke_color</item>
<item name="boxStrokeColor">@color/component_color_text_layout</item>
<item name="boxStrokeWidth">@dimen/text_input_layout_stroke_width</item>
<item name="errorEnabled">true</item>
<item name="errorIconTint">@color/component_color_shared_text_input_layout_error_color</item>
Expand Down 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>
36 changes: 36 additions & 0 deletions wiki/Troubleshooting-Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ Here are some general troubleshooting tips for oppia-android. The specific platf

1. If you find any error related to `cURL`, please set up cURL on your machine. For Linux, you can use `sudo apt install curl`. No need to set up `cURL` for Windows as you are using git bash command line.<br>


2. If you find any error which says `java: command not found`, please check you have Java installed correctly in your machine and the [environment path variable](https://www.java.com/en/download/help/path.html) is also set up correctly.


3. If you find any error related to Kotlin or Java/Checkstyle while pushing the code, please check [this link](https://github.com/oppia/oppia-android/wiki/Android-Studio-UI-based-Github-workflow#how-to-fix-push-failures).


4. If you see the error

```
Expand All @@ -22,6 +25,7 @@ Here are some general troubleshooting tips for oppia-android. The specific platf

then please follow the 2nd step mentioned in [this wiki](https://github.com/oppia/oppia-android/wiki/Installing-Oppia-Android#install-oppia-android) for Mac with Apple silicon(M1/M2) chips.


5. If you see the error

```
Expand Down Expand Up @@ -70,6 +74,7 @@ Here are some general troubleshooting tips for oppia-android. The specific platf
```
[Steps](https://docs.bazel.build/versions/main/tutorial/android-app.html#integrate-with-the-android-sdk) to add ANDROID_HOME environment variable.
2. If you encounter the following:
```
Expand All @@ -79,11 +84,42 @@ Here are some general troubleshooting tips for oppia-android. The specific platf
Try to delete the `.bazelrc` file to solve the above error.
3. **java.lang.ClassNotFoundException: com.android.tools.r8.compatdx.CompatDx**
If, when building the app binary, you encounter a failure that indicates that the CompatDx file cannot be found, this is likely due to you using a newer version of the Android build tools. You can manually downgrade to an older version of build-tools (particularly 29.0.2). Unfortunately, this can't be done through Android Studio but it can be done over a terminal. Follow the instructions listed [here](https://github.com/oppia/oppia-android/issues/3024#issuecomment-884513455) to downgrade your build tools & then try to build the app again.
4. If you encounter this error while building bazel in Mac M1:
```
ERROR: /Users/OpenSource/oppia-android/model/src/main/proto/BUILD.bazel:167:20: Generating JavaLite proto_library //model/src/main/proto:profile_proto failed: (Segmentation fault): protoc failed: error executing command bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/protoc '--proto_path=bazel-out/android-armeabi-v7a-fastbuild/bin/model/src/main/proto/_virtual_imports/languages_proto' ... (remaining 8 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox protoc failed: error executing command bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/protoc '--proto_path=bazel-out/android-armeabi-v7a-fastbuild/bin/model/src/main/proto/_virtual_imports/languages_proto' ... (remaining 8 argument(s) skipped)
```
Bazel requires Xcode commandline tools to build on M1, and the Xcode license also needs to be accepted.
**Follow these steps to solve this error:**
- Install the commandline tools: `xcode-select --install`
- Accept the Xcode licence: `sudo xcodebuild -licence`
- Reset the xcode select path: `sudo xcode-select -r `
- Set the xcode select path to use CommandLineTools: `sudo xcode-select -s /Library/Developer/CommandLineTools`
- Confirm that the path was correctly set. The expected output is: `/Library/Developer/CommandLineTools`
xcode-select -p
After successfully running the above commands, build the app using Bazel by running the following command:
```
bazel clean --expunge
bazel build //:oppia --noexperimental_check_desugar_deps
```
The `--noexperimental_check_desugar_deps` flag is explained in the [bazel blog](https://blog.bazel.build/2018/12/19/bazel-0.21.html#android).
### Can’t find a particular issue?
If the error you get is not in the Troubleshooting section above, please create an issue providing all the necessary information and assign it to **@MohitGupta121**.

0 comments on commit 28b5d35

Please sign in to comment.