From d38b41687c233d6363ae5ae49f8b341581b971ef Mon Sep 17 00:00:00 2001 From: Cory McWilliams <cory@unprompted.com> Date: Wed, 15 Mar 2023 23:08:57 +0000 Subject: [PATCH] Throw in the towel on swipe refresh and add a refresh button. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4225 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- .../com/unprompted/tildefriends/MainActivity.java | 10 ++++++++++ src/android/res/layout/activity_main.xml | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/android/com/unprompted/tildefriends/MainActivity.java b/src/android/com/unprompted/tildefriends/MainActivity.java index 8f6650bd5..628a6746d 100644 --- a/src/android/com/unprompted/tildefriends/MainActivity.java +++ b/src/android/com/unprompted/tildefriends/MainActivity.java @@ -10,12 +10,14 @@ import android.os.CountDownTimer; import android.os.SystemClock; import android.util.Log; import android.view.KeyEvent; +import android.view.View; import android.view.Window; import android.webkit.JsResult; import android.webkit.WebChromeClient; import android.webkit.WebResourceRequest; import android.webkit.WebView; import android.webkit.WebViewClient; +import android.widget.Button; import java.lang.Process; import java.lang.Thread; @@ -128,6 +130,14 @@ public class MainActivity extends Activity { }); web_view.loadUrl("http://127.0.0.1:12345/"); + + + Button refresh = (Button)findViewById(R.id.refresh); + refresh.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + web_view.reload(); + } + }); } @Override diff --git a/src/android/res/layout/activity_main.xml b/src/android/res/layout/activity_main.xml index 12d30a3f5..d4251cc9b 100644 --- a/src/android/res/layout/activity_main.xml +++ b/src/android/res/layout/activity_main.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" @@ -7,5 +7,14 @@ <WebView android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/web"/> -</LinearLayout> + android:id="@+id/web"> + </WebView> + <Button + android:id="@+id/refresh" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:text="REFRESH"/> +</RelativeLayout>