diff --git a/app/src/main/java/be/scri/fragments/MainFragment.kt b/app/src/main/java/be/scri/fragments/MainFragment.kt index 997086be..004b4715 100644 --- a/app/src/main/java/be/scri/fragments/MainFragment.kt +++ b/app/src/main/java/be/scri/fragments/MainFragment.kt @@ -5,15 +5,19 @@ import android.content.Intent import android.content.res.Configuration import android.os.Bundle import android.provider.Settings +import android.util.LayoutDirection import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.ImageView import androidx.activity.addCallback import androidx.appcompat.app.AppCompatDelegate +import androidx.core.text.layoutDirection import be.scri.R import be.scri.activities.MainActivity import be.scri.databinding.FragmentMainBinding +import java.util.Locale class MainFragment : ScribeFragment("Main") { private var _binding: FragmentMainBinding? = null @@ -39,9 +43,17 @@ class MainFragment : ScribeFragment("Main") { } (requireActivity() as MainActivity).setActionBarButtonVisibility(false) callback.isEnabled = true + moveCorner() return binding.root } + private fun moveCorner() { + val cornerTriangleImageView: ImageView = binding.cornerTriangle + if (Locale.getDefault().layoutDirection == LayoutDirection.RTL) { + cornerTriangleImageView.scaleX = -1f + } + } + private fun applyUserDarkModePreference() { val sharedPref = requireActivity().getSharedPreferences("app_preferences", Context.MODE_PRIVATE) val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml index 485179b2..13f2cba8 100644 --- a/app/src/main/res/layout/fragment_main.xml +++ b/app/src/main/res/layout/fragment_main.xml @@ -109,12 +109,14 @@ + android:src="@drawable/corner_polygon"/>