]> hydra-www.ietfng.org Git - acmetensortoys-ctfws-android/commitdiff
Landscape layout
authorNathaniel Wesley Filardo <nwfilardo@gmail.com>
Sat, 27 Oct 2018 03:41:27 +0000 (04:41 +0100)
committerNathaniel Wesley Filardo <nwfilardo@gmail.com>
Sat, 27 Oct 2018 14:11:43 +0000 (15:11 +0100)
mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainActivity.java
mobile/src/main/res/layout-land/activity_about.xml [new file with mode: 0644]
mobile/src/main/res/layout-land/activity_main.xml [new file with mode: 0644]
mobile/src/main/res/layout/activity_main.xml
mobile/src/main/res/values-w820dp/dimens.xml [deleted file]

index eef71ca127afcfaaf3371e514c7162e07ff50c4b..6bfe73848d43ee477d0ff866ae08f6217f18ce26 100644 (file)
@@ -63,7 +63,6 @@ public class MainActivity extends AppCompatActivity {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);
 
-        // TODO: should probably look better in landscape, too.
         setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
 
         SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
diff --git a/mobile/src/main/res/layout-land/activity_about.xml b/mobile/src/main/res/layout-land/activity_about.xml
new file mode 100644 (file)
index 0000000..ba3ed2b
--- /dev/null
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/activity_about"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:paddingBottom="@dimen/activity_vertical_margin"
+    android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    tools:context="com.acmetensortoys.ctfwstimer.AboutActivity">
+
+    <TabHost
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:id="@+id/about_tab_host">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical">
+
+            <TabWidget
+                android:id="@android:id/tabs"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" >
+
+            </TabWidget>
+
+            <FrameLayout
+                android:id="@android:id/tabcontent"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent">
+
+                <LinearLayout
+                        android:orientation="horizontal"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:id="@+id/about_tab_program">
+
+                    <ImageView
+                        android:layout_weight="1"
+                        android:layout_width="wrap_content"
+                        android:layout_height="match_parent"
+                        app:srcCompat="@drawable/shield1"
+                        android:id="@+id/about_image"
+                        android:contentDescription="@string/about_imagealt"/>
+
+                    <WebView
+                        android:layout_weight="2"
+                        android:layout_width="wrap_content"
+                        android:layout_height="match_parent"
+                        android:id="@+id/about_text" />
+                </LinearLayout>
+
+
+                <LinearLayout
+                    android:id="@+id/about_tab_lic"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:orientation="vertical">
+
+                    <WebView
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:id="@+id/about_licenses" />
+                </LinearLayout>
+
+            </FrameLayout>
+        </LinearLayout>
+    </TabHost>
+
+</RelativeLayout>
diff --git a/mobile/src/main/res/layout-land/activity_main.xml b/mobile/src/main/res/layout-land/activity_main.xml
new file mode 100644 (file)
index 0000000..b27aa51
--- /dev/null
@@ -0,0 +1,280 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/activity_main"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingBottom="@dimen/activity_vertical_margin"
+    tools:context="com.acmetensortoys.ctfwstimer.MainActivity">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:baselineAligned="false"
+            android:orientation="horizontal">
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:orientation="vertical">
+
+                <TextView
+                    android:id="@+id/header_gamestate"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:gravity="center"
+                    android:text="@string/header_gamestate0" />
+
+                <TableLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:stretchColumns="1">
+
+                    <TableRow
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:gravity="center"
+                        android:paddingBottom="1dp">
+
+                        <TextView
+                            android:id="@+id/tv_jailbreak"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:gravity="center"
+                            android:text="@string/ctfws_gamestart" />
+
+                        <ProgressBar
+                            android:id="@+id/pb_jailbreak"
+                            style="@android:style/Widget.DeviceDefault.ProgressBar.Horizontal"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:layout_gravity="center_vertical"
+                            android:layout_weight="1"
+                            android:indeterminate="false"
+                            android:max="100"
+                            android:padding="5dp"
+                            android:progress="0"
+                            android:rotation="180" />
+
+                        <Chronometer
+                            android:id="@+id/ch_jailbreak"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_gravity="center_vertical"
+                            android:visibility="invisible" />
+
+                    </TableRow>
+
+                    <TableRow
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:gravity="center"
+                        android:paddingTop="1dp"
+                        android:paddingBottom="1dp">
+
+                        <TextView
+                            android:id="@+id/tv_gameProgress"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="1"
+                            android:gravity="center"
+                            android:text="@string/header_gametimeela" />
+
+                        <ProgressBar
+                            android:id="@+id/pb_gameProgress"
+                            style="@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:layout_gravity="center_vertical"
+                            android:layout_weight="1"
+                            android:indeterminate="false"
+                            android:padding="5dp" />
+
+                        <Chronometer
+                            android:id="@+id/ch_gameProgress"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_gravity="center_vertical"
+                            android:visibility="invisible" />
+
+                    </TableRow>
+
+                    <TableRow
+                        android:id="@+id/tr_flags"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:paddingTop="1dp">
+
+                        <TextView
+                            android:id="@+id/tv_flags_label"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:gravity="center" />
+
+                        <TextView
+                            android:id="@+id/tv_flags"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:gravity="center" />
+
+                    </TableRow>
+
+                </TableLayout>
+            </LinearLayout>
+
+            <TableLayout
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_weight="1">
+
+                <TableRow
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent">
+
+                    <Button
+                        android:id="@+id/btn_wait_short"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/wait_short" />
+
+                    <ProgressBar
+                        android:id="@+id/pb_wait_short"
+                        style="@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="center_vertical"
+                        android:layout_weight="1"
+                        android:indeterminate="false"
+                        android:padding="5dp"
+                        android:rotation="180"
+                        android:visibility="invisible" />
+
+                    <Chronometer
+                        android:id="@+id/ch_wait_short"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="center_vertical"
+                        android:visibility="invisible" />
+
+                </TableRow>
+
+                <TableRow
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent">
+
+                    <Button
+                        android:id="@+id/btn_wait_long"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/wait_long" />
+
+                    <ProgressBar
+                        android:id="@+id/pb_wait_long"
+                        style="@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="center_vertical"
+                        android:layout_weight="1"
+                        android:indeterminate="false"
+                        android:padding="5dp"
+                        android:rotation="180"
+                        android:visibility="invisible" />
+
+                    <Chronometer
+                        android:id="@+id/ch_wait_long"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="center_vertical"
+                        android:visibility="invisible" />
+                </TableRow>
+
+            </TableLayout>
+
+
+        </LinearLayout>
+
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:text="@string/header_messages" />
+
+        <TextView
+            android:id="@+id/msgs"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:ems="10"
+            android:gravity="bottom"
+            android:inputType="none"
+            android:lines="10"
+            android:scrollbars="vertical" />
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:id="@+id/connmeta"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:onClick="onclick_connmeta"
+        android:orientation="vertical">
+
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:text="@string/mqtt_header" />
+
+        <TableLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:stretchColumns="1">
+
+            <TableRow
+                android:layout_width="match_parent"
+                android:layout_height="match_parent">
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:gravity="end"
+                    android:text="@string/mqtt_uri_label" />
+
+                <TextView
+                    android:id="@+id/tv_mqtt_server_uri"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:gravity="center" />
+            </TableRow>
+
+            <TableRow
+                android:layout_width="match_parent"
+                android:layout_height="match_parent">
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:gravity="end"
+                    android:text="@string/mqtt_state_label" />
+
+                <TextView
+                    android:id="@+id/tv_mqtt_state"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:gravity="center" />
+
+            </TableRow>
+
+        </TableLayout>
+    </LinearLayout>
+
+</RelativeLayout>
index d1072a7217239d69e2e2927cd3c792606da0f352..9387c1b26a9824559e0e277016bd8ce0e7bff92d 100644 (file)
@@ -1,25 +1,27 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main"
-    android:layout_width="match_parent" android:layout_height="match_parent"
-    android:paddingBottom="@dimen/activity_vertical_margin"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/activity_main"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:paddingLeft="@dimen/activity_horizontal_margin"
-    android:paddingRight="@dimen/activity_horizontal_margin"
     android:paddingTop="@dimen/activity_vertical_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingBottom="@dimen/activity_vertical_margin"
     tools:context="com.acmetensortoys.ctfwstimer.MainActivity">
 
     <LinearLayout
-        android:orientation="vertical"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content">
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
 
         <TextView
-            android:text="@string/header_gamestate0"
+            android:id="@+id/header_gamestate"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:gravity="center"
             android:onClick="onclick_gamestate"
-            android:id="@+id/header_gamestate" />
+            android:text="@string/header_gamestate0" />
 
         <TableLayout
             android:layout_width="match_parent"
                 android:paddingBottom="1dp">
 
                 <TextView
+                    android:id="@+id/tv_jailbreak"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:id="@+id/tv_jailbreak"
-                    android:text="@string/ctfws_gamestart"
-                    android:gravity="center" />
+                    android:gravity="center"
+                    android:text="@string/ctfws_gamestart" />
 
                 <ProgressBar
+                    android:id="@+id/pb_jailbreak"
                     style="@android:style/Widget.DeviceDefault.ProgressBar.Horizontal"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:id="@+id/pb_jailbreak"
                     android:layout_gravity="center_vertical"
                     android:layout_weight="1"
                     android:indeterminate="false"
                     android:max="100"
-                    android:progress="0"
                     android:padding="5dp"
+                    android:progress="0"
                     android:rotation="180" />
 
                 <Chronometer
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:gravity="center"
-                android:paddingBottom="1dp"
-                android:paddingTop="1dp">
+                android:paddingTop="1dp"
+                android:paddingBottom="1dp">
 
                 <TextView
-                    android:text="@string/header_gametimeela"
-                    android:layout_height="wrap_content"
                     android:id="@+id/tv_gameProgress"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
                     android:layout_weight="1"
                     android:gravity="center"
-                    android:layout_width="wrap_content" />
+                    android:text="@string/header_gametimeela" />
 
                 <ProgressBar
+                    android:id="@+id/pb_gameProgress"
                     style="@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:id="@+id/pb_gameProgress"
                     android:layout_gravity="center_vertical"
                     android:layout_weight="1"
                     android:indeterminate="false"
                     android:padding="5dp" />
 
                 <Chronometer
+                    android:id="@+id/ch_gameProgress"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:id="@+id/ch_gameProgress"
                     android:layout_gravity="center_vertical"
                     android:visibility="invisible" />
 
             </TableRow>
 
             <TableRow
+                android:id="@+id/tr_flags"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
-                android:id="@+id/tr_flags"
                 android:paddingTop="1dp">
 
                 <TextView
+                    android:id="@+id/tv_flags_label"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:gravity="center"
-                    android:id="@+id/tv_flags_label" />
+                    android:gravity="center" />
 
                 <TextView
+                    android:id="@+id/tv_flags"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:id="@+id/tv_flags"
                     android:gravity="center" />
 
             </TableRow>
                     android:layout_weight="1"
                     android:indeterminate="false"
                     android:padding="5dp"
-                    android:visibility="invisible"
-                    android:rotation="180"/>
+                    android:rotation="180"
+                    android:visibility="invisible" />
 
                 <Chronometer
                     android:id="@+id/ch_wait_short"
                     android:layout_weight="1"
                     android:indeterminate="false"
                     android:padding="5dp"
-                    android:visibility="invisible"
-                    android:rotation="180"/>
+                    android:rotation="180"
+                    android:visibility="invisible" />
 
                 <Chronometer
                     android:id="@+id/ch_wait_long"
             android:text="@string/header_messages" />
 
         <TextView
+            android:id="@+id/msgs"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:inputType="none"
             android:ems="10"
-            android:id="@+id/msgs"
+            android:gravity="bottom"
+            android:inputType="none"
             android:lines="10"
-            android:scrollbars="vertical"
-            android:gravity="bottom" />
+            android:scrollbars="vertical" />
 
     </LinearLayout>
 
     <LinearLayout
-        android:orientation="vertical"
+        android:id="@+id/connmeta"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
-        android:id="@+id/connmeta"
-        android:onClick="onclick_connmeta">
+        android:onClick="onclick_connmeta"
+        android:orientation="vertical">
 
         <TextView
             android:layout_width="match_parent"
                 <TextView
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:text="@string/mqtt_uri_label"
-                    android:gravity="end" />
+                    android:gravity="end"
+                    android:text="@string/mqtt_uri_label" />
 
                 <TextView
+                    android:id="@+id/tv_mqtt_server_uri"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:id="@+id/tv_mqtt_server_uri"
                     android:gravity="center" />
             </TableRow>
 
                 <TextView
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:text="@string/mqtt_state_label"
-                    android:gravity="end" />
+                    android:gravity="end"
+                    android:text="@string/mqtt_state_label" />
 
                 <TextView
+                    android:id="@+id/tv_mqtt_state"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:id="@+id/tv_mqtt_state"
                     android:gravity="center" />
 
             </TableRow>
diff --git a/mobile/src/main/res/values-w820dp/dimens.xml b/mobile/src/main/res/values-w820dp/dimens.xml
deleted file mode 100644 (file)
index 63fc816..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<resources>
-    <!-- Example customization of dimensions originally defined in res/values/dimens.xml
-         (such as screen margins) for screens with more than 820dp of available width. This
-         would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
-    <dimen name="activity_horizontal_margin">64dp</dimen>
-</resources>