ui: adapt the share fragment for landscape

In landscape mode, the "infos" textView is layed out to the left of the
QR code.
Also fix the case where the shareURI is empty.

Change-Id: I4999bd80bc8bd791f9296f8fffc76b58459e47a1
Tuleap: #1430
diff --git a/ring-android/app/src/main/java/cx/ring/share/ShareFragment.java b/ring-android/app/src/main/java/cx/ring/share/ShareFragment.java
index a85456c..29ef67b 100644
--- a/ring-android/app/src/main/java/cx/ring/share/ShareFragment.java
+++ b/ring-android/app/src/main/java/cx/ring/share/ShareFragment.java
@@ -140,6 +140,10 @@
     public void showViewModel(final ShareViewModel viewModel) {
         final QRCodeUtils.QRCodeData qrCodeData = viewModel.getAccountQRCodeData();
 
+        if (mQrImage == null || mShareInstruction == null) {
+            return;
+        }
+
         RingApplication.uiHandler.post(new Runnable() {
             @Override
             public void run() {
diff --git a/ring-android/app/src/main/res/layout-land/frag_share.xml b/ring-android/app/src/main/res/layout-land/frag_share.xml
new file mode 100644
index 0000000..1b35dc7
--- /dev/null
+++ b/ring-android/app/src/main/res/layout-land/frag_share.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_above="@+id/share_button_layout"
+        android:gravity="center"
+        android:orientation="horizontal"
+        android:padding="@dimen/padding_small">
+
+        <TextView
+            android:id="@+id/share_instruction"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_gravity="center"
+            android:layout_weight="0.5"
+            android:gravity="center"
+            android:padding="24dp"
+            android:text="@string/share_message"
+            android:textColor="@color/text_color_primary"
+            android:textSize="16sp" />
+
+        <RelativeLayout
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_gravity="center"
+            android:layout_weight="0.5"
+            android:gravity="center">
+
+            <ImageView
+                android:id="@+id/qr_image"
+                android:layout_width="300dp"
+                android:layout_height="300dp"
+                android:background="@null"
+                android:gravity="center"
+                android:padding="@dimen/padding_small"
+                android:scaleType="fitCenter" />
+
+        </RelativeLayout>
+
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:id="@+id/share_button_layout"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:background="@color/color_primary_dark">
+
+        <android.support.v7.widget.AppCompatButton
+            android:id="@+id/share_button"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="?attr/selectableItemBackground"
+            android:paddingBottom="5dp"
+            android:paddingTop="5dp"
+            android:text="@string/share_your_account_information"
+            android:textColor="@color/white" />
+
+    </LinearLayout>
+
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/ring-android/app/src/main/res/layout/frag_share.xml b/ring-android/app/src/main/res/layout/frag_share.xml
index 6680f6b..1d246d4 100644
--- a/ring-android/app/src/main/res/layout/frag_share.xml
+++ b/ring-android/app/src/main/res/layout/frag_share.xml
@@ -3,37 +3,6 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <TextView
-        android:id="@+id/share_instruction"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_above="@+id/qr_image_panel"
-        android:layout_alignEnd="@+id/qr_image_panel"
-        android:layout_alignLeft="@+id/qr_image_panel"
-        android:layout_alignRight="@+id/qr_image_panel"
-        android:layout_alignStart="@+id/qr_image_panel"
-        android:paddingBottom="24sp"
-        android:paddingTop="16sp"
-        android:text="@string/share_message"
-        android:textColor="@color/text_color_primary"
-        android:textSize="16sp" />
-
-    <LinearLayout
-        android:id="@+id/qr_image_panel"
-        android:layout_width="300dp"
-        android:layout_height="300dp"
-        android:layout_centerHorizontal="true"
-        android:layout_centerInParent="true"
-        android:background="@color/black"
-        android:padding="10dp">
-
-        <ImageView
-            android:id="@+id/qr_image"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:background="@null" />
-
-    </LinearLayout>
 
     <LinearLayout
         android:layout_width="match_parent"
@@ -53,5 +22,33 @@
 
     </LinearLayout>
 
+    <ImageView
+        android:id="@+id/qr_image"
+        android:layout_width="300dp"
+        android:layout_height="300dp"
+        android:layout_centerHorizontal="true"
+        android:layout_centerVertical="true"
+
+        android:gravity="center"
+        android:padding="@dimen/padding_small"
+        android:scaleType="fitCenter" />
+
+    <TextView
+        android:id="@+id/share_instruction"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_above="@+id/qr_image"
+        android:layout_alignEnd="@+id/qr_image"
+        android:layout_alignLeft="@+id/qr_image"
+        android:layout_alignParentTop="true"
+        android:layout_alignRight="@+id/qr_image"
+        android:layout_alignStart="@+id/qr_image"
+        android:gravity="center"
+        android:paddingBottom="24sp"
+        android:paddingTop="16sp"
+        android:text="@string/share_message"
+        android:textColor="@color/text_color_primary"
+        android:textSize="16sp" />
+
 
 </RelativeLayout>
\ No newline at end of file