fixing some rtl code

This commit is contained in:
tibbi 2019-02-07 18:42:50 +01:00
parent 0a3a170852
commit dd25df5738
3 changed files with 24 additions and 39 deletions

View file

@ -1,7 +1,6 @@
package com.simplemobiletools.calendar.pro.fragments
import android.content.Intent
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@ -9,7 +8,6 @@ import android.view.ViewGroup
import android.widget.DatePicker
import android.widget.RelativeLayout
import androidx.appcompat.app.AlertDialog
import androidx.core.content.res.ResourcesCompat
import androidx.fragment.app.Fragment
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.EventActivity
@ -37,7 +35,7 @@ class DayFragment : Fragment() {
private var mDayCode = ""
private var lastHash = 0
lateinit var mHolder: RelativeLayout
private lateinit var mHolder: RelativeLayout
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_day, container, false)
@ -62,6 +60,10 @@ class DayFragment : Fragment() {
setOnClickListener {
mListener?.goLeft()
}
val pointerLeft = context!!.getDrawable(R.drawable.ic_pointer_left)
pointerLeft?.isAutoMirrored = true
setImageDrawable(pointerLeft)
}
mHolder.top_right_arrow.apply {
@ -70,6 +72,10 @@ class DayFragment : Fragment() {
setOnClickListener {
mListener?.goRight()
}
val pointerRight = context!!.getDrawable(R.drawable.ic_pointer_right)
pointerRight?.isAutoMirrored = true
setImageDrawable(pointerRight)
}
val day = Formatter.getDayTitle(context!!, mDayCode)
@ -78,19 +84,6 @@ class DayFragment : Fragment() {
setOnClickListener { pickDay() }
setTextColor(context.config.textColor)
}
// support RTL
val pointerLeft : Drawable? = ResourcesCompat.getDrawable(resources,R.drawable.ic_pointer_left,null)
if(pointerLeft != null) {
pointerLeft.isAutoMirrored = true
mHolder.top_left_arrow.setImageDrawable(pointerLeft)
}
val pointerRight : Drawable? = ResourcesCompat.getDrawable(resources,R.drawable.ic_pointer_right,null)
if(pointerRight != null) {
pointerRight.isAutoMirrored = true
mHolder.top_right_arrow.setImageDrawable(pointerRight)
}
}
private fun pickDay() {

View file

@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.pro.fragments
import android.content.Context
import android.content.res.Resources
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@ -10,8 +9,6 @@ import android.view.ViewGroup
import android.widget.DatePicker
import android.widget.RelativeLayout
import androidx.appcompat.app.AlertDialog
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
import androidx.fragment.app.Fragment
import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.MainActivity
@ -118,6 +115,10 @@ class MonthFragment : Fragment(), MonthlyCalendar {
setOnClickListener {
listener?.goLeft()
}
val pointerLeft = context!!.getDrawable(R.drawable.ic_pointer_left)
pointerLeft?.isAutoMirrored = true
setImageDrawable(pointerLeft)
}
mHolder.top_right_arrow.apply {
@ -126,6 +127,10 @@ class MonthFragment : Fragment(), MonthlyCalendar {
setOnClickListener {
listener?.goRight()
}
val pointerRight = context!!.getDrawable(R.drawable.ic_pointer_right)
pointerRight?.isAutoMirrored = true
setImageDrawable(pointerRight)
}
mHolder.top_value.apply {
@ -134,19 +139,6 @@ class MonthFragment : Fragment(), MonthlyCalendar {
showMonthDialog()
}
}
// support RTL
val pointerLeft :Drawable? = ResourcesCompat.getDrawable(resources,R.drawable.ic_pointer_left,null)
if(pointerLeft != null) {
pointerLeft.isAutoMirrored = true
mHolder.top_left_arrow.setImageDrawable(pointerLeft)
}
val pointerRight :Drawable? = ResourcesCompat.getDrawable(resources,R.drawable.ic_pointer_right,null)
if(pointerRight != null) {
pointerRight.isAutoMirrored = true
mHolder.top_right_arrow.setImageDrawable(pointerRight)
}
}
private fun showMonthDialog() {

View file

@ -8,12 +8,12 @@
style="@style/ArrowStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/top_value"
android:layout_alignTop="@+id/top_value"
android:layout_alignBottom="@+id/top_value"
android:autoMirrored="true"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:src="@drawable/ic_pointer_left"
android:autoMirrored="true"/>
android:src="@drawable/ic_pointer_left"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/top_value"
@ -23,8 +23,8 @@
android:layout_toStartOf="@+id/top_right_arrow"
android:layout_toEndOf="@+id/top_left_arrow"
android:gravity="center"
android:paddingBottom="@dimen/normal_margin"
android:paddingTop="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin"
android:textSize="@dimen/month_text_size"/>
<ImageView
@ -32,12 +32,12 @@
style="@style/ArrowStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignTop="@+id/top_value"
android:layout_alignBottom="@+id/top_value"
android:layout_alignParentEnd="true"
android:layout_alignTop="@+id/top_value"
android:autoMirrored="true"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:src="@drawable/ic_pointer_right"
android:autoMirrored="true"/>
android:src="@drawable/ic_pointer_right"/>
</merge>