Support RTL

This commit is contained in:
karmac 2019-01-30 14:35:42 +02:00
parent 21b112b265
commit 6602f843e6
10 changed files with 79 additions and 45 deletions

View file

@ -22,7 +22,8 @@
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_launcher_name" android:label="@string/app_launcher_name"
android:roundIcon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme"
android:supportsRtl="true">
<activity <activity
android:name=".activities.SplashActivity" android:name=".activities.SplashActivity"

View file

@ -1,6 +1,7 @@
package com.simplemobiletools.calendar.pro.fragments package com.simplemobiletools.calendar.pro.fragments
import android.content.Intent import android.content.Intent
import android.graphics.drawable.Drawable
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -8,6 +9,7 @@ import android.view.ViewGroup
import android.widget.DatePicker import android.widget.DatePicker
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.core.content.res.ResourcesCompat
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.EventActivity import com.simplemobiletools.calendar.pro.activities.EventActivity
@ -76,6 +78,19 @@ class DayFragment : Fragment() {
setOnClickListener { pickDay() } setOnClickListener { pickDay() }
setTextColor(context.config.textColor) 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() { private fun pickDay() {

View file

@ -2,6 +2,7 @@ package com.simplemobiletools.calendar.pro.fragments
import android.content.Context import android.content.Context
import android.content.res.Resources import android.content.res.Resources
import android.graphics.drawable.Drawable
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -9,6 +10,8 @@ import android.view.ViewGroup
import android.widget.DatePicker import android.widget.DatePicker
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.R
import com.simplemobiletools.calendar.pro.activities.MainActivity import com.simplemobiletools.calendar.pro.activities.MainActivity
@ -131,6 +134,19 @@ class MonthFragment : Fragment(), MonthlyCalendar {
showMonthDialog() 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() { private fun showMonthDialog() {

View file

@ -14,8 +14,8 @@
android:background="@null" android:background="@null"
android:clickable="false" android:clickable="false"
android:paddingBottom="@dimen/activity_margin" android:paddingBottom="@dimen/activity_margin"
android:paddingLeft="@dimen/big_margin" android:paddingStart="@dimen/big_margin"
android:paddingRight="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
tools:text="Calendar name"/> tools:text="Calendar name"/>

View file

@ -9,7 +9,7 @@
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:foreground="@drawable/selector" android:foreground="@drawable/selector"
android:paddingLeft="@dimen/activity_margin"> android:paddingStart="@dimen/activity_margin">
<RelativeLayout <RelativeLayout
android:id="@+id/event_item_holder" android:id="@+id/event_item_holder"
@ -24,7 +24,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_item_description" android:layout_alignBottom="@+id/event_item_description"
android:layout_alignTop="@+id/event_item_title" android:layout_alignTop="@+id/event_item_title"
android:layout_marginRight="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@drawable/event_list_color_bar" android:background="@drawable/event_list_color_bar"
android:paddingBottom="@dimen/tiny_margin" android:paddingBottom="@dimen/tiny_margin"
android:paddingTop="@dimen/tiny_margin"/> android:paddingTop="@dimen/tiny_margin"/>
@ -33,7 +33,7 @@
android:id="@+id/event_item_start" android:id="@+id/event_item_start"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/event_item_color_bar" android:layout_toEndOf="@+id/event_item_color_bar"
android:textSize="@dimen/day_text_size" android:textSize="@dimen/day_text_size"
tools:text="13:00"/> tools:text="13:00"/>
@ -42,7 +42,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/event_item_start" android:layout_below="@+id/event_item_start"
android:layout_toRightOf="@+id/event_item_color_bar" android:layout_toEndOf="@+id/event_item_color_bar"
android:text="15:00" android:text="15:00"
android:textSize="@dimen/day_text_size"/> android:textSize="@dimen/day_text_size"/>
@ -50,11 +50,11 @@
android:id="@+id/event_item_title" android:id="@+id/event_item_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_margin" android:layout_marginStart="@dimen/activity_margin"
android:layout_toRightOf="@+id/event_item_start" android:layout_toEndOf="@+id/event_item_start"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:paddingRight="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:textSize="@dimen/day_text_size" android:textSize="@dimen/day_text_size"
tools:text="Event title"/> tools:text="Event title"/>
@ -63,11 +63,11 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/event_item_title" android:layout_below="@+id/event_item_title"
android:layout_marginLeft="@dimen/activity_margin" android:layout_marginStart="@dimen/activity_margin"
android:layout_toRightOf="@+id/event_item_end" android:layout_toEndOf="@+id/event_item_end"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:paddingRight="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:textSize="@dimen/day_text_size" android:textSize="@dimen/day_text_size"
tools:text="Event description"/> tools:text="Event description"/>

View file

@ -9,14 +9,14 @@
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:foreground="@drawable/selector" android:foreground="@drawable/selector"
android:paddingLeft="@dimen/activity_margin"> android:paddingStart="@dimen/activity_margin">
<RelativeLayout <RelativeLayout
android:id="@+id/event_item_holder" android:id="@+id/event_item_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="@dimen/medium_margin" android:paddingBottom="@dimen/medium_margin"
android:paddingRight="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:paddingTop="@dimen/medium_margin"> android:paddingTop="@dimen/medium_margin">
<ImageView <ImageView
@ -25,7 +25,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_item_start" android:layout_alignBottom="@+id/event_item_start"
android:layout_alignTop="@+id/event_item_start" android:layout_alignTop="@+id/event_item_start"
android:layout_marginRight="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@drawable/event_list_color_bar" android:background="@drawable/event_list_color_bar"
android:paddingBottom="@dimen/tiny_margin" android:paddingBottom="@dimen/tiny_margin"
android:paddingTop="@dimen/tiny_margin"/> android:paddingTop="@dimen/tiny_margin"/>
@ -34,7 +34,7 @@
android:id="@+id/event_item_start" android:id="@+id/event_item_start"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/event_item_color_bar" android:layout_toEndOf="@+id/event_item_color_bar"
android:textSize="@dimen/day_text_size" android:textSize="@dimen/day_text_size"
tools:text="13:00"/> tools:text="13:00"/>
@ -42,11 +42,11 @@
android:id="@+id/event_item_title" android:id="@+id/event_item_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_margin" android:layout_marginStart="@dimen/activity_margin"
android:layout_toRightOf="@+id/event_item_start" android:layout_toEndOf="@+id/event_item_start"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:paddingRight="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:textSize="@dimen/day_text_size" android:textSize="@dimen/day_text_size"
tools:text="Event title"/> tools:text="Event title"/>

View file

@ -9,14 +9,14 @@
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:foreground="@drawable/selector" android:foreground="@drawable/selector"
android:paddingLeft="@dimen/activity_margin"> android:paddingStart="@dimen/activity_margin">
<RelativeLayout <RelativeLayout
android:id="@+id/event_item_holder" android:id="@+id/event_item_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="@dimen/medium_margin" android:paddingBottom="@dimen/medium_margin"
android:paddingRight="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:paddingTop="@dimen/small_margin"> android:paddingTop="@dimen/small_margin">
<ImageView <ImageView
@ -25,7 +25,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_item_end" android:layout_alignBottom="@+id/event_item_end"
android:layout_alignTop="@+id/event_item_start" android:layout_alignTop="@+id/event_item_start"
android:layout_marginRight="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@drawable/event_list_color_bar" android:background="@drawable/event_list_color_bar"
android:paddingBottom="@dimen/tiny_margin" android:paddingBottom="@dimen/tiny_margin"
android:paddingTop="@dimen/tiny_margin"/> android:paddingTop="@dimen/tiny_margin"/>
@ -34,7 +34,7 @@
android:id="@+id/event_item_start" android:id="@+id/event_item_start"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/event_item_color_bar" android:layout_toEndOf="@+id/event_item_color_bar"
android:textSize="@dimen/day_text_size" android:textSize="@dimen/day_text_size"
tools:text="13:00"/> tools:text="13:00"/>
@ -43,7 +43,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/event_item_start" android:layout_below="@+id/event_item_start"
android:layout_toRightOf="@+id/event_item_color_bar" android:layout_toEndOf="@+id/event_item_color_bar"
android:includeFontPadding="false" android:includeFontPadding="false"
android:text="15:00" android:text="15:00"
android:textSize="@dimen/day_text_size"/> android:textSize="@dimen/day_text_size"/>
@ -52,11 +52,11 @@
android:id="@+id/event_item_title" android:id="@+id/event_item_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_margin" android:layout_marginStart="@dimen/activity_margin"
android:layout_toRightOf="@+id/event_item_start" android:layout_toEndOf="@+id/event_item_start"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:paddingRight="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:textSize="@dimen/day_text_size" android:textSize="@dimen/day_text_size"
tools:text="Event title"/> tools:text="Event title"/>
@ -65,12 +65,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/event_item_title" android:layout_below="@+id/event_item_title"
android:layout_marginLeft="@dimen/activity_margin" android:layout_marginStart="@dimen/activity_margin"
android:layout_toRightOf="@+id/event_item_end" android:layout_toEndOf="@+id/event_item_end"
android:ellipsize="end" android:ellipsize="end"
android:includeFontPadding="false" android:includeFontPadding="false"
android:maxLines="1" android:maxLines="1"
android:paddingRight="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:textSize="@dimen/day_text_size" android:textSize="@dimen/day_text_size"
tools:text="Event description"/> tools:text="Event description"/>

View file

@ -9,14 +9,14 @@
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:foreground="@drawable/selector" android:foreground="@drawable/selector"
android:paddingLeft="@dimen/activity_margin"> android:paddingStart="@dimen/activity_margin">
<RelativeLayout <RelativeLayout
android:id="@+id/event_item_holder" android:id="@+id/event_item_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="@dimen/medium_margin" android:paddingBottom="@dimen/medium_margin"
android:paddingRight="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:paddingTop="@dimen/small_margin"> android:paddingTop="@dimen/small_margin">
<ImageView <ImageView
@ -25,7 +25,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_item_start" android:layout_alignBottom="@+id/event_item_start"
android:layout_alignTop="@+id/event_item_start" android:layout_alignTop="@+id/event_item_start"
android:layout_marginRight="@dimen/small_margin" android:layout_marginEnd="@dimen/small_margin"
android:background="@drawable/event_list_color_bar" android:background="@drawable/event_list_color_bar"
android:paddingBottom="@dimen/tiny_margin" android:paddingBottom="@dimen/tiny_margin"
android:paddingTop="@dimen/tiny_margin"/> android:paddingTop="@dimen/tiny_margin"/>
@ -34,7 +34,7 @@
android:id="@+id/event_item_start" android:id="@+id/event_item_start"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/event_item_color_bar" android:layout_toEndOf="@+id/event_item_color_bar"
android:textSize="@dimen/day_text_size" android:textSize="@dimen/day_text_size"
tools:text="13:00"/> tools:text="13:00"/>
@ -42,11 +42,11 @@
android:id="@+id/event_item_title" android:id="@+id/event_item_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_margin" android:layout_marginStart="@dimen/activity_margin"
android:layout_toRightOf="@+id/event_item_start" android:layout_toEndOf="@+id/event_item_start"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:paddingRight="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"
android:textSize="@dimen/day_text_size" android:textSize="@dimen/day_text_size"
tools:text="Event title"/> tools:text="Event title"/>

View file

@ -16,7 +16,7 @@
android:id="@+id/week_view_hours_divider" android:id="@+id/week_view_hours_divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignRight="@+id/week_view_hours_scrollview" android:layout_alignEnd="@+id/week_view_hours_scrollview"
android:background="@drawable/stroke_bottom_right" android:background="@drawable/stroke_bottom_right"
android:importantForAccessibility="no"/> android:importantForAccessibility="no"/>
@ -43,7 +43,7 @@
android:id="@+id/week_view_view_pager" android:id="@+id/week_view_view_pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_toRightOf="@+id/week_view_hours_scrollview"/> android:layout_toEndOf="@+id/week_view_hours_scrollview"/>
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>

View file

@ -12,15 +12,16 @@
android:layout_alignTop="@+id/top_value" android:layout_alignTop="@+id/top_value"
android:paddingLeft="@dimen/activity_margin" android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" android:paddingRight="@dimen/activity_margin"
android:src="@drawable/ic_pointer_left"/> android:src="@drawable/ic_pointer_left"
android:autoMirrored="true"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/top_value" android:id="@+id/top_value"
style="@style/MonthStyle" style="@style/MonthStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/top_right_arrow" android:layout_toStartOf="@+id/top_right_arrow"
android:layout_toRightOf="@+id/top_left_arrow" android:layout_toEndOf="@+id/top_left_arrow"
android:gravity="center" android:gravity="center"
android:paddingBottom="@dimen/normal_margin" android:paddingBottom="@dimen/normal_margin"
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
@ -32,10 +33,11 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignBottom="@+id/top_value" android:layout_alignBottom="@+id/top_value"
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
android:layout_alignTop="@+id/top_value" android:layout_alignTop="@+id/top_value"
android:paddingLeft="@dimen/activity_margin" android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin" android:paddingRight="@dimen/activity_margin"
android:src="@drawable/ic_pointer_right"/> android:src="@drawable/ic_pointer_right"
android:autoMirrored="true"/>
</merge> </merge>