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

Top left corner triangle for Arabic #241

Merged
merged 5 commits into from
Nov 14, 2024
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
12 changes: 12 additions & 0 deletions app/src/main/java/be/scri/fragments/MainFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/fragment_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,14 @@
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/corner_triangle"
android:layout_width="75dp"
android:layout_height="76dp"
android:layout_gravity="top|end"
android:alpha="0.9"
android:src="@drawable/corner_polygon" />
android:src="@drawable/corner_polygon"/>
<ImageView
android:id="@+id/corner_cog"
android:layout_width="26dp"
android:layout_height="25dp"
android:layout_gravity="top|end"
Expand Down
Loading