summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2014-10-19 23:30:46 (GMT)
committerAdnan Begovic <adnan@cyngn.com>2014-10-28 00:14:53 (GMT)
commitfa59cf3f97ac76bc8da10b788d2b9931350e2468 (patch)
tree48e24cf5347f1548553f8aa11920ebb2266f60fc
parentd742d21fd093382cd3a63e3630079c1eb9c611e7 (diff)
downloadandroid_packages_apps_Trebuchet-fa59cf3f97ac76bc8da10b788d2b9931350e2468.zip
android_packages_apps_Trebuchet-fa59cf3f97ac76bc8da10b788d2b9931350e2468.tar.gz
android_packages_apps_Trebuchet-fa59cf3f97ac76bc8da10b788d2b9931350e2468.tar.bz2
Trebuchet: RTL support for Settings Screens
Change-Id: I9e6d812a81aa4358e230bd1d58877695eaeee0ac
-rw-r--r--res/drawable-hdpi/action_navigation_previous_light.pngbin627 -> 0 bytes
-rw-r--r--res/drawable-hdpi/ic_navigation_next.pngbin0 -> 625 bytes
-rw-r--r--res/drawable-hdpi/ic_navigation_prev.pngbin0 -> 637 bytes
-rw-r--r--res/drawable-mdpi/action_navigation_previous_light.pngbin409 -> 0 bytes
-rw-r--r--res/drawable-mdpi/ic_navigation_next.pngbin0 -> 386 bytes
-rw-r--r--res/drawable-mdpi/ic_navigation_prev.pngbin0 -> 408 bytes
-rw-r--r--res/drawable-xhdpi/action_navigation_previous_light.pngbin810 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/ic_navigation_next.pngbin0 -> 801 bytes
-rw-r--r--res/drawable-xhdpi/ic_navigation_prev.pngbin0 -> 870 bytes
-rw-r--r--res/drawable-xxhdpi/action_navigation_previous_light.pngbin1327 -> 0 bytes
-rw-r--r--res/drawable-xxhdpi/ic_navigation_next.pngbin0 -> 1350 bytes
-rw-r--r--res/drawable-xxhdpi/ic_navigation_prev.pngbin0 -> 1360 bytes
-rw-r--r--res/layout/dynamic_grid_size_screen.xml3
-rw-r--r--res/layout/settings_pane_list_item.xml27
-rw-r--r--res/layout/settings_transitions_screen.xml29
-rw-r--r--src/com/android/launcher3/DynamicGridSizeFragment.java25
-rw-r--r--src/com/android/launcher3/Launcher.java20
-rw-r--r--src/com/android/launcher3/TransitionEffectsFragment.java23
-rw-r--r--src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java15
19 files changed, 94 insertions, 48 deletions
diff --git a/res/drawable-hdpi/action_navigation_previous_light.png b/res/drawable-hdpi/action_navigation_previous_light.png
deleted file mode 100644
index 874466f..0000000
--- a/res/drawable-hdpi/action_navigation_previous_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_navigation_next.png b/res/drawable-hdpi/ic_navigation_next.png
new file mode 100644
index 0000000..fb3e40b
--- /dev/null
+++ b/res/drawable-hdpi/ic_navigation_next.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_navigation_prev.png b/res/drawable-hdpi/ic_navigation_prev.png
new file mode 100644
index 0000000..2e08702
--- /dev/null
+++ b/res/drawable-hdpi/ic_navigation_prev.png
Binary files differ
diff --git a/res/drawable-mdpi/action_navigation_previous_light.png b/res/drawable-mdpi/action_navigation_previous_light.png
deleted file mode 100644
index f50c8f2..0000000
--- a/res/drawable-mdpi/action_navigation_previous_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_navigation_next.png b/res/drawable-mdpi/ic_navigation_next.png
new file mode 100644
index 0000000..c86cf60
--- /dev/null
+++ b/res/drawable-mdpi/ic_navigation_next.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_navigation_prev.png b/res/drawable-mdpi/ic_navigation_prev.png
new file mode 100644
index 0000000..080e723
--- /dev/null
+++ b/res/drawable-mdpi/ic_navigation_prev.png
Binary files differ
diff --git a/res/drawable-xhdpi/action_navigation_previous_light.png b/res/drawable-xhdpi/action_navigation_previous_light.png
deleted file mode 100644
index 22bd163..0000000
--- a/res/drawable-xhdpi/action_navigation_previous_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_navigation_next.png b/res/drawable-xhdpi/ic_navigation_next.png
new file mode 100644
index 0000000..11c943d
--- /dev/null
+++ b/res/drawable-xhdpi/ic_navigation_next.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_navigation_prev.png b/res/drawable-xhdpi/ic_navigation_prev.png
new file mode 100644
index 0000000..b817dbb
--- /dev/null
+++ b/res/drawable-xhdpi/ic_navigation_prev.png
Binary files differ
diff --git a/res/drawable-xxhdpi/action_navigation_previous_light.png b/res/drawable-xxhdpi/action_navigation_previous_light.png
deleted file mode 100644
index ca3d00c..0000000
--- a/res/drawable-xxhdpi/action_navigation_previous_light.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_navigation_next.png b/res/drawable-xxhdpi/ic_navigation_next.png
new file mode 100644
index 0000000..3259520
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_navigation_next.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_navigation_prev.png b/res/drawable-xxhdpi/ic_navigation_prev.png
new file mode 100644
index 0000000..1e763d3
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_navigation_prev.png
Binary files differ
diff --git a/res/layout/dynamic_grid_size_screen.xml b/res/layout/dynamic_grid_size_screen.xml
index f7cafaf..dcf399f 100644
--- a/res/layout/dynamic_grid_size_screen.xml
+++ b/res/layout/dynamic_grid_size_screen.xml
@@ -17,11 +17,12 @@
android:clickable="true" >
<ImageView
+ android:id="@+id/nav_prev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:adjustViewBounds="true"
- android:src="@drawable/action_navigation_previous_light" />
+ android:src="@drawable/ic_navigation_prev" />
<TextView
android:layout_width="wrap_content"
diff --git a/res/layout/settings_pane_list_item.xml b/res/layout/settings_pane_list_item.xml
index 0053f4c..75a6b32 100644
--- a/res/layout/settings_pane_list_item.xml
+++ b/res/layout/settings_pane_list_item.xml
@@ -3,42 +3,35 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:background="@drawable/listitem_bg"
- android:paddingLeft="@dimen/overview_panel_list_padding"
- android:paddingRight="@dimen/overview_panel_list_padding"
+ android:paddingStart="@dimen/overview_panel_list_padding"
+ android:paddingEnd="@dimen/overview_panel_list_padding"
+ android:paddingBottom="@dimen/overview_panel_list_padding"
+ android:paddingTop="@dimen/overview_panel_list_padding"
android:orientation="horizontal" >
<TextView
- android:id="@+id/item_name"
+ android:id="@+id/item_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="4dp"
android:fontFamily="sans-serif-condensed"
- android:gravity="left"
- android:paddingBottom="@dimen/overview_panel_list_padding"
- android:paddingTop="@dimen/overview_panel_list_padding"
android:textSize="20sp"
+ android:textAllCaps="true"
android:textColor="@color/listitem_text"
- android:layout_alignParentLeft="true"
- android:scrollHorizontally="true"
+ android:layout_alignParentEnd="true"
android:ellipsize="end"
android:maxLines="1"/>
<TextView
- android:id="@+id/item_state"
+ android:id="@+id/item_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="4dp"
android:fontFamily="sans-serif-condensed"
- android:gravity="right"
- android:paddingBottom="@dimen/overview_panel_list_padding"
- android:paddingTop="@dimen/overview_panel_list_padding"
android:textSize="20sp"
- android:textAllCaps="true"
android:textColor="@color/listitem_text"
- android:layout_alignParentRight="true"
- android:layout_toRightOf="@id/item_name"
- android:scrollHorizontally="true"
+ android:layout_toStartOf="@id/item_state"
+ android:layout_alignParentStart="true"
android:ellipsize="end"
android:maxLines="1"/>
-
</RelativeLayout> \ No newline at end of file
diff --git a/res/layout/settings_transitions_screen.xml b/res/layout/settings_transitions_screen.xml
index 4fdf3b9..fca36a8 100644
--- a/res/layout/settings_transitions_screen.xml
+++ b/res/layout/settings_transitions_screen.xml
@@ -17,15 +17,16 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/listitem_bg"
- android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
android:clickable="true" >
<ImageView
+ android:id="@+id/nav_prev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:adjustViewBounds="true"
- android:src="@drawable/action_navigation_previous_light" />
+ android:src="@drawable/ic_navigation_prev" />
<TextView
android:id="@+id/transition_effect_title"
@@ -38,24 +39,16 @@
android:textSize="16sp" />
</LinearLayout>
- <LinearLayout
+ <ImageView
+ android:id="@+id/transition_options_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:layout_alignParentRight="true"
- android:background="@drawable/listitem_bg"
- android:clickable="true" >
-
- <ImageView
- android:id="@+id/transition_options_menu"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right"
- android:paddingStart="10dip"
- android:paddingEnd="10dip"
- android:adjustViewBounds="true"
- android:src="@drawable/overflow_options_menu" />
- </LinearLayout>
+ android:layout_gravity="right"
+ android:paddingStart="10dip"
+ android:paddingEnd="10dip"
+ android:adjustViewBounds="true"
+ android:layout_alignParentEnd="true"
+ android:src="@drawable/overflow_options_menu" />
</RelativeLayout>
<ImageView
diff --git a/src/com/android/launcher3/DynamicGridSizeFragment.java b/src/com/android/launcher3/DynamicGridSizeFragment.java
index 69720a5..74e47ea 100644
--- a/src/com/android/launcher3/DynamicGridSizeFragment.java
+++ b/src/com/android/launcher3/DynamicGridSizeFragment.java
@@ -23,14 +23,15 @@ import android.app.Dialog;
import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.res.Configuration;
import android.content.res.Resources;
-import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
+import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -42,7 +43,6 @@ import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.NumberPicker;
import android.widget.TextView;
-
import com.android.launcher3.settings.SettingsProvider;
public class DynamicGridSizeFragment extends Fragment
@@ -122,6 +122,13 @@ public class DynamicGridSizeFragment extends Fragment
R.layout.settings_pane_list_item, values);
mListView.setAdapter(mAdapter);
+ // RTL
+ ImageView navPrev = (ImageView) v.findViewById(R.id.nav_prev);
+ Configuration config = getResources().getConfiguration();
+ if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ navPrev.setImageResource(R.drawable.ic_navigation_next);
+ }
+
return v;
}
@@ -141,7 +148,13 @@ public class DynamicGridSizeFragment extends Fragment
DisplayMetrics displaymetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int width = displaymetrics.widthPixels;
- final ObjectAnimator anim = ObjectAnimator.ofFloat(this, "translationX", width, 0);
+ Configuration config = getResources().getConfiguration();
+ final ObjectAnimator anim;
+ if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ anim = ObjectAnimator.ofFloat(this, "translationX", -width, 0);
+ } else {
+ anim = ObjectAnimator.ofFloat(this, "translationX", width, 0);
+ }
final View darkPanel = ((Launcher) getActivity()).getDarkPanel();
darkPanel.setVisibility(View.VISIBLE);
@@ -276,6 +289,12 @@ public class DynamicGridSizeFragment extends Fragment
TextView textView = (TextView) convertView.findViewById(R.id.item_name);
textView.setText(mTitles[position]);
+ // RTL
+ Configuration config = getResources().getConfiguration();
+ if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ textView.setGravity(Gravity.RIGHT);
+ }
+
// Set selected state
if (position == mCurrentSize.getValue()) {
if (mCurrentSelection != null) {
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 17ddb7e..d56eda5 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1394,8 +1394,14 @@ public class Launcher extends Activity
mOverviewSettingsPanel.notifyDataSetInvalidated();
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
- fragmentTransaction
- .setCustomAnimations(0, R.anim.exit_out_right);
+ Configuration config = getResources().getConfiguration();
+ if(config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ fragmentTransaction
+ .setCustomAnimations(0, R.anim.exit_out_left);
+ } else {
+ fragmentTransaction
+ .setCustomAnimations(0, R.anim.exit_out_right);
+ }
fragmentTransaction
.remove(mDynamicGridSizeFragment).commit();
@@ -1438,8 +1444,14 @@ public class Launcher extends Activity
mOverviewSettingsPanel.notifyDataSetInvalidated();
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
- fragmentTransaction
- .setCustomAnimations(0, R.anim.exit_out_right);
+ Configuration config = getResources().getConfiguration();
+ if(config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ fragmentTransaction
+ .setCustomAnimations(0, R.anim.exit_out_left);
+ } else {
+ fragmentTransaction
+ .setCustomAnimations(0, R.anim.exit_out_right);
+ }
fragmentTransaction
.remove(mTransitionEffectsFragment).commit();
diff --git a/src/com/android/launcher3/TransitionEffectsFragment.java b/src/com/android/launcher3/TransitionEffectsFragment.java
index 8f51e24..d490a00 100644
--- a/src/com/android/launcher3/TransitionEffectsFragment.java
+++ b/src/com/android/launcher3/TransitionEffectsFragment.java
@@ -4,11 +4,13 @@ import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.app.Fragment;
import android.content.Context;
+import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.util.DisplayMetrics;
+import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@@ -120,6 +122,12 @@ public class TransitionEffectsFragment extends Fragment {
mListView.setSelection(mCurrentPosition);
+ // RTL
+ ImageView navPrev = (ImageView) v.findViewById(R.id.nav_prev);
+ Configuration config = getResources().getConfiguration();
+ if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ navPrev.setImageResource(R.drawable.ic_navigation_next);
+ }
return v;
}
@@ -163,7 +171,13 @@ public class TransitionEffectsFragment extends Fragment {
DisplayMetrics displaymetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int width = displaymetrics.widthPixels;
- final ObjectAnimator anim = ObjectAnimator.ofFloat(this, "translationX", width, 0);
+ Configuration config = getResources().getConfiguration();
+ final ObjectAnimator anim;
+ if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ anim = ObjectAnimator.ofFloat(this, "translationX", -width, 0);
+ } else {
+ anim = ObjectAnimator.ofFloat(this, "translationX", width, 0);
+ }
final View darkPanel = ((Launcher) getActivity()).getDarkPanel();
darkPanel.setVisibility(View.VISIBLE);
@@ -211,6 +225,13 @@ public class TransitionEffectsFragment extends Fragment {
parent, false);
TextView textView = (TextView) convertView
.findViewById(R.id.item_name);
+
+ // RTL
+ Configuration config = getResources().getConfiguration();
+ if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ textView.setGravity(Gravity.RIGHT);
+ }
+
textView.setText(titles[position]);
// Set Selected State
if (position == mCurrentPosition) {
diff --git a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
index 35949e0..eca6492 100644
--- a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
+++ b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
@@ -2,23 +2,24 @@ package com.android.launcher3.list;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Typeface;
import android.util.TypedValue;
+import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;
+import com.android.launcher3.AppsCustomizePagedView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.OverviewSettingsPanel;
-import com.android.launcher3.AppsCustomizePagedView;
import com.android.launcher3.R;
-
import com.android.launcher3.settings.SettingsProvider;
-import android.view.View.OnClickListener;
-import android.content.SharedPreferences;
public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
private static final int PARTITION_TAG = 0;
@@ -76,6 +77,12 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
@Override
protected void bindView(View v, int partition, Cursor cursor, int position) {
TextView text = (TextView)v.findViewById(R.id.item_name);
+ // RTL
+ Configuration config = mLauncher.getResources().getConfiguration();
+ if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ text.setGravity(Gravity.RIGHT);
+ }
+
String title = cursor.getString(1);
text.setText(title);