Added pull to refresh page

This commit is contained in:
massimiliano 2018-12-30 12:24:59 +01:00
parent 8d5024b04f
commit 05374832c4
3 changed files with 19 additions and 1 deletions

View File

@ -29,6 +29,7 @@ import android.support.annotation.RequiresApi;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.widget.Toolbar;
@ -175,6 +176,18 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL
check.edit().putBoolean("checkPix",false).apply();
}
//pull to refresh
final SwipeRefreshLayout swipe = (SwipeRefreshLayout)findViewById(R.id.swipe);
swipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
{
@Override
public void onRefresh(){
swipe.setRefreshing( false );
String url = webView.getUrl();
webView.loadUrl(url);
}
});
//Set buttons
// Locate the button in activity_main.xml
button = findViewById(R.id.MailBtn);//MailBtn

View File

@ -23,13 +23,17 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/webView_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible" />
<include layout="@layout/view_loading"/>
</android.support.v4.widget.SwipeRefreshLayout>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"

View File

@ -4,6 +4,7 @@
<change>Added more info for notes app</change>
<change>Corrected some typos</change>
<change>Spanish, Serbian and French translation updated</change>
<change>Added pull to refresh page</change>
</release>
<release version="1.1.0" versioncode="13" >
<change>State page is api based instead of webview</change>