Merge pull request #766 from karmac2015/master

Support RTL
This commit is contained in:
Tibor Kaputa 2019-02-07 18:33:43 +01:00 committed by GitHub
commit 5e327d351f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 7 deletions

View File

@ -1,6 +1,7 @@
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
@ -8,6 +9,7 @@ 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
@ -76,6 +78,19 @@ 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,6 +2,7 @@ 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
@ -9,6 +10,8 @@ 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
@ -131,6 +134,19 @@ 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

@ -458,7 +458,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/small_margin"
android:layout_marginLeft="@dimen/small_margin"
android:layout_marginEnd="@dimen/medium_margin"
android:layout_toStartOf="@+id/event_type_color"
android:paddingTop="@dimen/normal_margin"

View File

@ -10,9 +10,10 @@
android:layout_height="match_parent"
android:layout_alignBottom="@+id/top_value"
android:layout_alignTop="@+id/top_value"
android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:src="@drawable/ic_pointer_left"/>
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:src="@drawable/ic_pointer_left"
android:autoMirrored="true"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/top_value"
@ -34,8 +35,9 @@
android:layout_alignBottom="@+id/top_value"
android:layout_alignParentEnd="true"
android:layout_alignTop="@+id/top_value"
android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:src="@drawable/ic_pointer_right"/>
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:src="@drawable/ic_pointer_right"
android:autoMirrored="true"/>
</merge>