Update layout of servoshell android app (#33294)

* Update layout of servoshell android app

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* Remove gap after loop/idle text

Signed-off-by: Daniel Adams <msub2official@gmail.com>

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
This commit is contained in:
Daniel Adams 2024-09-04 11:30:52 +00:00 committed by GitHub
parent 961fcfc46d
commit a976db3ec0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 109 additions and 78 deletions

View file

@ -12,7 +12,8 @@
<application android:label="Servo" android:icon="@mipmap/servo"> <application android:label="Servo" android:icon="@mipmap/servo">
<activity android:name=".MainActivity" <activity android:name=".MainActivity"
android:configChanges="density|keyboardHidden|navigation|orientation|screenSize|uiMode" android:configChanges="density|keyboardHidden|navigation|orientation|screenSize|uiMode"
android:exported="true"> android:exported="true"
android:theme="@style/AppTheme">
<meta-data android:name="android.app.lib_name" android:value="servo" /> <meta-data android:name="android.app.lib_name" android:value="servo" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View file

@ -19,6 +19,7 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
@ -32,10 +33,10 @@ public class MainActivity extends Activity implements Servo.Client {
private static final String LOGTAG = "MainActivity"; private static final String LOGTAG = "MainActivity";
ServoView mServoView; ServoView mServoView;
Button mBackButton; ImageButton mBackButton;
Button mFwdButton; ImageButton mFwdButton;
Button mReloadButton; ImageButton mReloadButton;
Button mStopButton; ImageButton mStopButton;
EditText mUrlField; EditText mUrlField;
ProgressBar mProgressBar; ProgressBar mProgressBar;
TextView mIdleText; TextView mIdleText;
@ -60,6 +61,9 @@ public class MainActivity extends Activity implements Servo.Client {
mBackButton.setEnabled(false); mBackButton.setEnabled(false);
mFwdButton.setEnabled(false); mFwdButton.setEnabled(false);
// Avoid reload/stop icons doubling up on launch
mReloadButton.setVisibility(View.GONE);
mServoView.setClient(this); mServoView.setClient(this);
mServoView.requestFocus(); mServoView.requestFocus();

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -16,90 +16,117 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<LinearLayout <androidx.appcompat.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="?attr/actionBarSize"
android:orientation="horizontal"> android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<Button <EditText
android:id="@+id/backbutton" android:id="@+id/urlfield"
style="@android:style/Widget.Material.Button" style="@android:style/Widget.Material.EditText"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:onClick="onBackClicked" android:ems="10"
android:text="Back" android:hint="URL or Search"
android:textSize="10sp" /> android:inputType="textUri"
android:selectAllOnFocus="true"
android:singleLine="true"
android:imeOptions="actionDone"/>
<Button <ProgressBar
android:id="@+id/forwardbutton" android:id="@+id/progressbar"
style="@android:style/Widget.Material.Button" style="@android:style/Widget.ProgressBar"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:onClick="onForwardClicked" android:indeterminate="true"
android:text="Fwd" android:gravity="center" />
android:textSize="10sp" />
<EditText <ImageButton
android:id="@+id/urlfield" android:id="@+id/stopbutton"
style="@android:style/Widget.Material.EditText" style="@android:style/Widget.Material.ImageButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:ems="10" android:scaleType="centerInside"
android:hint="URL or Search" android:adjustViewBounds="true"
android:inputType="textUri" android:onClick="onStopClicked"
android:selectAllOnFocus="true" android:src="@drawable/cancel"
android:singleLine="true" android:gravity="center" />
android:imeOptions="actionDone"/>
<ProgressBar <ImageButton
android:id="@+id/progressbar" android:id="@+id/reloadbutton"
style="@android:style/Widget.ProgressBar" style="@android:style/Widget.Material.ImageButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:indeterminate="true" /> android:scaleType="centerInside"
android:adjustViewBounds="true"
android:onClick="onReloadClicked"
android:src="@drawable/refresh"
android:gravity="center" />
<Button <TextView
android:id="@+id/stopbutton" android:id="@+id/redrawing"
style="@android:style/Widget.Material.Button" android:layout_width="wrap_content"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_weight="1" android:fontFamily="monospace"
android:onClick="onStopClicked" android:text="idle"
android:text="Stop" android:textAlignment="center"
android:textSize="10sp" /> android:textSize="10sp"
android:visibility="visible"
android:gravity="center" />
<Button </LinearLayout>
android:id="@+id/reloadbutton"
style="@android:style/Widget.Material.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="onReloadClicked"
android:text="Rld"
android:textSize="10sp" />
<TextView </androidx.appcompat.widget.Toolbar>
android:id="@+id/redrawing"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="monospace"
android:text="idle"
android:textAlignment="center"
android:textSize="10sp"
android:visibility="visible" />
</LinearLayout>
<org.servo.servoview.ServoView <org.servo.servoview.ServoView
android:id="@+id/servoview" android:id="@+id/servoview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1"
android:focusable="true"/> android:focusable="true"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<ImageButton
android:id="@+id/backbutton"
style="@android:style/Widget.Material.ImageButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="centerInside"
android:adjustViewBounds="true"
android:onClick="onBackClicked"
android:src="@drawable/history_back" />
<ImageButton
android:id="@+id/forwardbutton"
style="@android:style/Widget.Material.ImageButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="centerInside"
android:adjustViewBounds="true"
android:onClick="onForwardClicked"
android:src="@drawable/history_forward" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,9 +1,8 @@
<resources> <resources>
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowNoTitle">true</item> <item name="android:statusBarColor">#212121</item>
<!-- Customize your theme here. -->
</style> </style>
</resources> </resources>