Merge branch 'rtl-layout'

This commit is contained in:
Daniel Martí 2014-02-21 00:19:57 +01:00
commit f5c4018fee
14 changed files with 91 additions and 54 deletions

View File

@ -44,7 +44,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:allowBackup="true" android:allowBackup="true"
android:theme="@style/AppThemeDark" android:theme="@style/AppThemeDark"
android:supportsRtl="false" > android:supportsRtl="true" >
<provider <provider
android:authorities="org.fdroid.fdroid.data.AppProvider" android:authorities="org.fdroid.fdroid.data.AppProvider"

View File

@ -15,7 +15,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="5dp" android:padding="5dp"
android:layout_marginRight="4dp" android:layout_marginEnd="4dp"
android:orientation="vertical" > android:orientation="vertical" >
<TextView <TextView
@ -44,7 +44,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dp" android:padding="4dp"
android:layout_toRightOf="@id/icon" android:layout_toEndOf="@id/icon"
android:orientation="vertical" > android:orientation="vertical" >
<TextView <TextView

View File

@ -2,8 +2,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:paddingLeft="8dp" android:paddingStart="8dp"
android:paddingRight="8dp" android:paddingEnd="8dp"
android:paddingTop="6dp" android:paddingTop="6dp"
android:paddingBottom="6dp" android:paddingBottom="6dp"
android:baselineAligned="false" android:baselineAligned="false"
@ -20,7 +20,7 @@
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView android:id="@+id/version" <TextView android:id="@+id/version"
android:paddingLeft="5dp" android:paddingStart="5dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
@ -38,7 +38,7 @@
<TextView android:id="@+id/sitec" <TextView android:id="@+id/sitec"
android:text="@string/about_sitec" android:text="@string/about_sitec"
android:paddingLeft="5dp" android:paddingStart="5dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
@ -57,7 +57,7 @@
<TextView android:id="@+id/mailc" <TextView android:id="@+id/mailc"
android:text="@string/about_mailc" android:text="@string/about_mailc"
android:paddingLeft="5dp" android:paddingStart="5dp"
android:autoLink="email" android:autoLink="email"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />

View File

@ -36,7 +36,7 @@
android:id="@+id/overwrite_message" android:id="@+id/overwrite_message"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableLeft="@android:drawable/ic_dialog_alert" android:drawableStart="@android:drawable/ic_dialog_alert"
android:drawablePadding="20dp" android:drawablePadding="20dp"
android:padding="20dp" android:padding="20dp"
android:text="@string/repo_delete_to_overwrite" android:text="@string/repo_delete_to_overwrite"

View File

@ -30,7 +30,7 @@
<TextView android:id="@+id/buildtype" <TextView android:id="@+id/buildtype"
android:textSize="13sp" android:textSize="13sp"
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_marginBottom="4sp" /> android:layout_marginBottom="4sp" />
@ -38,7 +38,7 @@
<TextView android:id="@+id/size" <TextView android:id="@+id/size"
android:textSize="13sp" android:textSize="13sp"
android:layout_below="@id/buildtype" android:layout_below="@id/buildtype"
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_marginBottom="4sp" /> android:layout_marginBottom="4sp" />
@ -46,22 +46,22 @@
<TextView android:id="@+id/api" <TextView android:id="@+id/api"
android:textSize="13sp" android:textSize="13sp"
android:layout_below="@id/buildtype" android:layout_below="@id/buildtype"
android:layout_toLeftOf="@id/size" android:layout_toStartOf="@id/size"
android:layout_marginRight="16sp" android:layout_marginEnd="16sp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" /> android:layout_width="wrap_content" />
<TextView android:id="@+id/nativecode" <TextView android:id="@+id/nativecode"
android:textSize="13sp" android:textSize="13sp"
android:layout_below="@id/size" android:layout_below="@id/size"
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" /> android:layout_width="wrap_content" />
<TextView android:id="@+id/incompatible_reasons" <TextView android:id="@+id/incompatible_reasons"
android:textSize="13sp" android:textSize="13sp"
android:layout_below="@id/added" android:layout_below="@id/added"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" /> android:layout_width="wrap_content" />

View File

@ -24,7 +24,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toRightOf="@id/icon" android:layout_toEndOf="@id/icon"
android:padding="5dp" android:padding="5dp"
android:baselineAligned="false" android:baselineAligned="false"
android:orientation="vertical" > android:orientation="vertical" >
@ -34,10 +34,10 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
android:singleLine="true" android:singleLine="true"
android:ellipsize="end" android:ellipsize="end"
android:layout_marginLeft="6sp" android:layout_marginStart="6sp"
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <TextView
@ -48,8 +48,8 @@
android:ellipsize="end" android:ellipsize="end"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:layout_toLeftOf="@id/license" /> android:layout_toStartOf="@id/license" />
<TextView <TextView
android:id="@+id/categories" android:id="@+id/categories"
@ -57,8 +57,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:ellipsize="end" android:ellipsize="end"
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
android:layout_marginLeft="6sp" android:layout_marginStart="6sp"
android:layout_below="@id/title" android:layout_below="@id/title"
android:textSize="12sp" /> android:textSize="12sp" />
@ -69,8 +69,8 @@
android:singleLine="true" android:singleLine="true"
android:ellipsize="end" android:ellipsize="end"
android:textSize="12sp" android:textSize="12sp"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:layout_toLeftOf="@id/categories" android:layout_toStartOf="@id/categories"
android:layout_below="@id/title" /> android:layout_below="@id/title" />

View File

@ -19,9 +19,9 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="5dp" android:paddingStart="5dp"
android:paddingRight="5dp" android:paddingEnd="5dp"
android:layout_toRightOf="@id/icon" android:layout_toEndOf="@id/icon"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:baselineAligned="false" > android:baselineAligned="false" >
@ -31,9 +31,9 @@
android:ellipsize="end" android:ellipsize="end"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="6sp" android:layout_marginStart="6sp"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentRight="true" /> android:layout_alignParentEnd="true" />
<TextView android:id="@+id/name" <TextView android:id="@+id/name"
android:textSize="17sp" android:textSize="17sp"
@ -43,8 +43,8 @@
android:ellipsize="end" android:ellipsize="end"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:layout_toLeftOf="@id/status" /> android:layout_toStartOf="@id/status" />
<TextView android:id="@+id/license" <TextView android:id="@+id/license"
android:textSize="12sp" android:textSize="12sp"
@ -52,9 +52,9 @@
android:ellipsize="end" android:ellipsize="end"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="6sp" android:layout_marginStart="6sp"
android:layout_below="@id/name" android:layout_below="@id/name"
android:layout_alignParentRight="true" /> android:layout_alignParentEnd="true" />
<TextView android:id="@+id/summary" <TextView android:id="@+id/summary"
android:textSize="13sp" android:textSize="13sp"
@ -63,8 +63,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/name" android:layout_below="@id/name"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:layout_toLeftOf="@id/license" /> android:layout_toStartOf="@id/license" />
</RelativeLayout> </RelativeLayout>

View File

@ -15,7 +15,7 @@
<ImageView android:id="@+id/img" <ImageView android:id="@+id/img"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" /> android:layout_alignParentStart="true" />
<TextView android:id="@+id/repo_name" <TextView android:id="@+id/repo_name"
android:textSize="21sp" android:textSize="21sp"
@ -24,8 +24,8 @@
android:ellipsize="marquee" android:ellipsize="marquee"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@id/img" android:layout_toEndOf="@id/img"
android:layout_alignParentLeft="true"/> android:layout_alignParentStart="true"/>
<TextView android:id="@+id/repo_unsigned" <TextView android:id="@+id/repo_unsigned"
android:textSize="14sp" android:textSize="14sp"

View File

@ -7,8 +7,8 @@
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:paddingTop="@dimen/padding_top" android:paddingTop="@dimen/padding_top"
android:paddingLeft="@dimen/padding_side" android:paddingStart="@dimen/padding_side"
android:paddingRight="@dimen/padding_side"> android:paddingEnd="@dimen/padding_side">
<!-- Editable URL of this repo --> <!-- Editable URL of this repo -->
<TextView <TextView
@ -16,7 +16,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/label_repo_url" android:id="@+id/label_repo_url"
android:text="@string/repo_url" android:text="@string/repo_url"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:layout_alignParentTop="true" /> android:layout_alignParentTop="true" />
<EditText <EditText
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -32,7 +32,7 @@
android:id="@+id/label_repo_name" android:id="@+id/label_repo_name"
android:text="@string/repo_name" android:text="@string/repo_name"
android:layout_below="@id/input_repo_url" android:layout_below="@id/input_repo_url"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:paddingTop="@dimen/form_label_top"/> android:paddingTop="@dimen/form_label_top"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -48,7 +48,7 @@
android:id="@+id/label_description" android:id="@+id/label_description"
android:text="@string/repo_description" android:text="@string/repo_description"
android:layout_below="@id/text_repo_name" android:layout_below="@id/text_repo_name"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:paddingTop="@dimen/form_label_top"/> android:paddingTop="@dimen/form_label_top"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -65,7 +65,7 @@
android:id="@+id/label_num_apps" android:id="@+id/label_num_apps"
android:text="@string/repo_num_apps" android:text="@string/repo_num_apps"
android:layout_below="@id/text_description" android:layout_below="@id/text_description"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:paddingTop="@dimen/form_label_top" /> android:paddingTop="@dimen/form_label_top" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -80,7 +80,7 @@
android:id="@+id/label_last_update" android:id="@+id/label_last_update"
android:text="@string/repo_last_update" android:text="@string/repo_last_update"
android:layout_below="@id/text_num_apps" android:layout_below="@id/text_num_apps"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:paddingTop="@dimen/form_label_top" /> android:paddingTop="@dimen/form_label_top" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -95,7 +95,7 @@
android:id="@+id/label_repo_fingerprint" android:id="@+id/label_repo_fingerprint"
android:text="@string/repo_fingerprint" android:text="@string/repo_fingerprint"
android:layout_below="@id/text_last_update" android:layout_below="@id/text_last_update"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:paddingTop="@dimen/form_label_top" /> android:paddingTop="@dimen/form_label_top" />
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="fill_parent"

View File

@ -8,7 +8,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:paddingLeft="8sp" android:paddingStart="8sp"
android:text="Discovered Repo Name" android:text="Discovered Repo Name"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" /> android:textStyle="bold" />
@ -19,7 +19,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/reposcanitemname" android:layout_below="@+id/reposcanitemname"
android:layout_marginTop="2dp" android:layout_marginTop="2dp"
android:paddingLeft="8sp" android:paddingStart="8sp"
android:maxLines="1" android:maxLines="1"
android:text="Repo Address" android:text="Repo Address"
android:textSize="14sp" /> android:textSize="14sp" />

View File

@ -8,7 +8,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:paddingTop="8sp" > android:paddingTop="8sp" >
@ -18,7 +18,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginRight="5dp" android:layout_marginEnd="5dp"
android:indeterminate="true" /> android:indeterminate="true" />
<TextView <TextView

View File

@ -2,8 +2,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:paddingLeft="2dp" android:paddingStart="2dp"
android:paddingRight="2dp" android:paddingEnd="2dp"
android:baselineAligned="false" android:baselineAligned="false"
android:orientation="vertical"> android:orientation="vertical">

View File

@ -14,27 +14,63 @@ public abstract class LayoutCompat extends Compatibility {
private static final LayoutCompat impl = LayoutCompat.create(); private static final LayoutCompat impl = LayoutCompat.create();
protected abstract int relativeLayoutStartOf();
protected abstract int relativeLayoutEndOf(); protected abstract int relativeLayoutEndOf();
protected abstract int relativeLayoutAlignParentStart();
protected abstract int relativeLayoutAlignParentEnd();
public static class RelativeLayout { public static class RelativeLayout {
public static final int START_OF = impl.relativeLayoutStartOf();
public static final int END_OF = impl.relativeLayoutEndOf(); public static final int END_OF = impl.relativeLayoutEndOf();
public static final int ALIGN_PARENT_START = impl.relativeLayoutAlignParentStart();
public static final int ALIGN_PARENT_END = impl.relativeLayoutAlignParentEnd();
} }
} }
class OldLayoutCompatImpl extends LayoutCompat { class OldLayoutCompatImpl extends LayoutCompat {
@Override
protected int relativeLayoutStartOf() {
return android.widget.RelativeLayout.LEFT_OF;
}
@Override @Override
protected int relativeLayoutEndOf() { protected int relativeLayoutEndOf() {
return android.widget.RelativeLayout.RIGHT_OF; return android.widget.RelativeLayout.RIGHT_OF;
} }
@Override
protected int relativeLayoutAlignParentStart() {
return android.widget.RelativeLayout.ALIGN_PARENT_LEFT;
}
@Override
protected int relativeLayoutAlignParentEnd() {
return android.widget.RelativeLayout.ALIGN_PARENT_RIGHT;
}
} }
@TargetApi(17) @TargetApi(17)
class JellyBeanMr1LayoutCompatImpl extends LayoutCompat { class JellyBeanMr1LayoutCompatImpl extends LayoutCompat {
@Override
protected int relativeLayoutStartOf() {
return android.widget.RelativeLayout.START_OF;
}
@Override @Override
protected int relativeLayoutEndOf() { protected int relativeLayoutEndOf() {
return android.widget.RelativeLayout.END_OF; return android.widget.RelativeLayout.END_OF;
} }
@Override
protected int relativeLayoutAlignParentStart() {
return android.widget.RelativeLayout.ALIGN_PARENT_START;
}
@Override
protected int relativeLayoutAlignParentEnd() {
return android.widget.RelativeLayout.ALIGN_PARENT_END;
}
} }

View File

@ -12,6 +12,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import org.fdroid.fdroid.R; import org.fdroid.fdroid.R;
import org.fdroid.fdroid.compat.SwitchCompat; import org.fdroid.fdroid.compat.SwitchCompat;
import org.fdroid.fdroid.compat.LayoutCompat;
import org.fdroid.fdroid.data.Repo; import org.fdroid.fdroid.data.Repo;
public class RepoAdapter extends CursorAdapter { public class RepoAdapter extends CursorAdapter {
@ -92,7 +93,7 @@ public class RepoAdapter extends CursorAdapter {
nameView.setText(repo.getName()); nameView.setText(repo.getName());
RelativeLayout.LayoutParams nameViewLayout = RelativeLayout.LayoutParams nameViewLayout =
(RelativeLayout.LayoutParams)nameView.getLayoutParams(); (RelativeLayout.LayoutParams)nameView.getLayoutParams();
nameViewLayout.addRule(RelativeLayout.LEFT_OF, switchView.getId()); nameViewLayout.addRule(LayoutCompat.RelativeLayout.START_OF, switchView.getId());
// If we set the signed view to GONE instead of INVISIBLE, then the // If we set the signed view to GONE instead of INVISIBLE, then the
// height of each list item varies. // height of each list item varies.
@ -112,7 +113,7 @@ public class RepoAdapter extends CursorAdapter {
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT RelativeLayout.LayoutParams.WRAP_CONTENT
); );
layout.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); layout.addRule(LayoutCompat.RelativeLayout.ALIGN_PARENT_END);
layout.addRule(RelativeLayout.CENTER_VERTICAL); layout.addRule(RelativeLayout.CENTER_VERTICAL);
switchView.setLayoutParams(layout); switchView.setLayoutParams(layout);
((RelativeLayout)parent).addView(switchView); ((RelativeLayout)parent).addView(switchView);