summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2014-11-10 18:35:02 (GMT)
committerAdnan <adnan@cyngn.com>2014-11-19 23:53:59 (GMT)
commit48de8c6b2bbb00cb25d3d012b84fbd5e5f125241 (patch)
tree591129d7bea07a6e0edbd0e5a0937b1db3f496fb
parent616cf2e20604062f98fad8d3e3bb43f5b6fa5a6c (diff)
downloadandroid_packages_apps_Trebuchet-48de8c6b2bbb00cb25d3d012b84fbd5e5f125241.zip
android_packages_apps_Trebuchet-48de8c6b2bbb00cb25d3d012b84fbd5e5f125241.tar.gz
android_packages_apps_Trebuchet-48de8c6b2bbb00cb25d3d012b84fbd5e5f125241.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.xml26
-rw-r--r--res/layout/settings_transitions_screen.xml27
-rw-r--r--src/com/android/launcher3/DynamicGridSizeFragment.java26
-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, 96 insertions, 44 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 234c3b9..984f24a 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 4bfb288..b968dc5 100644
--- a/res/layout/settings_pane_list_item.xml
+++ b/res/layout/settings_pane_list_item.xml
@@ -3,42 +3,36 @@
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:layout_alignParentRight="true"
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_toRightOf="@id/item_name"
- android:scrollHorizontally="true"
+ android:layout_toStartOf="@id/item_state"
+ android:layout_alignParentStart="true"
android:ellipsize="end"
android:maxLines="1"/>
-
</RelativeLayout>
diff --git a/res/layout/settings_transitions_screen.xml b/res/layout/settings_transitions_screen.xml
index 5850e27..b87c1fc 100644
--- a/res/layout/settings_transitions_screen.xml
+++ b/res/layout/settings_transitions_screen.xml
@@ -18,15 +18,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"
@@ -39,22 +40,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: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 586c2bd..f8ada16 100644
--- a/src/com/android/launcher3/DynamicGridSizeFragment.java
+++ b/src/com/android/launcher3/DynamicGridSizeFragment.java
@@ -6,6 +6,7 @@ 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.BitmapFactory;
@@ -15,6 +16,7 @@ import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.DisplayMetrics;
+import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -96,6 +98,13 @@ public class DynamicGridSizeFragment extends Fragment implements NumberPicker.On
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;
}
@@ -163,7 +172,13 @@ public class DynamicGridSizeFragment extends Fragment implements NumberPicker.On
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);
@@ -303,7 +318,14 @@ public class DynamicGridSizeFragment extends Fragment implements NumberPicker.On
TextView textView = (TextView) convertView
.findViewById(R.id.item_name);
textView.setText(mTitles[position]);
- // Set Selected State
+
+ // RTL
+ Configuration config = getResources().getConfiguration();
+ if (config.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ textView.setGravity(Gravity.RIGHT);
+ }
+
+ // Set selected state
if (position == mCurrentSize.getValue()) {
mCurrentSelection = convertView;
setSelected(mCurrentSelection);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 0f80f8c..9cc28dc 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1283,8 +1283,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();
@@ -1327,8 +1333,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 cb038b2..f03aeab 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;
@@ -121,6 +123,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;
}
@@ -164,7 +172,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);
@@ -212,6 +226,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 5fcba7a..8a77502 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);