Adding go back and refresh to the possible actions.
This commit is contained in:
parent
7b162d0e58
commit
d51ff34751
@ -39,4 +39,6 @@ dependencies {
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||
|
||||
}
|
Binary file not shown.
@ -2,6 +2,10 @@ package info.burguillos.bi;
|
||||
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.util.Log;
|
||||
|
||||
import android.view.ViewTreeObserver;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
@ -9,15 +13,39 @@ import android.os.Bundle;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private WebView webView;
|
||||
private SwipeRefreshLayout swipeRefreshLayout;
|
||||
private ViewTreeObserver.OnScrollChangedListener mOnScrollChangedListener;
|
||||
boolean isReloading = true;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
WebView webView = findViewById(R.id.web);
|
||||
webView = findViewById(R.id.web);
|
||||
swipeRefreshLayout = findViewById(R.id.swipeContainer);
|
||||
|
||||
swipeRefreshLayout.setOnRefreshListener( new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
Log.w("BurguillosInfo", "hola");
|
||||
webView.reload();
|
||||
}
|
||||
});
|
||||
|
||||
webView.loadUrl("https://burguillos.info");
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
webView.setWebViewClient(new WebViewClient());
|
||||
webView.setWebViewClient(new WebViewClient() {
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
swipeRefreshLayout.setEnabled(true);
|
||||
}
|
||||
|
||||
public void onPageStarted(WebView view, String url) {
|
||||
swipeRefreshLayout.setEnabled(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,11 +6,23 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
<RelativeLayout
|
||||
android:id="@+id/nonVideoLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<WebView
|
||||
android:id="@+id/web"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:layout_editor_absoluteX="8dp"
|
||||
tools:layout_editor_absoluteY="8dp" />
|
||||
</RelativeLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@ -1,3 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">b_info_android</string>
|
||||
<string name="app_name">Burguillos.info</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user