FinestWebView-Android icon indicating copy to clipboard operation
FinestWebView-Android copied to clipboard

How can I close click pragmatically ?

Open raj9686 opened this issue 6 years ago • 6 comments

https://stackoverflow.com/questions/45208977/how-can-i-close-pragmatically-finestwebview

raj9686 avatar Jul 20 '17 08:07 raj9686

@raj9686 did you figure it out

ismdcf avatar Aug 29 '17 11:08 ismdcf

has anyone figured this out yet?

atebsy avatar Dec 17 '17 12:12 atebsy

@raj9686 @ismdcf I found a way to work around this: Add the finestwebview activity to the manifest with the attribute noHistory set to true like this <activity android:name="com.thefinestartist.finestwebview.FinestWebViewActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:screenOrientation="sensor" android:theme="@style/FinestWebViewTheme.Light" android:noHistory="true"/> And then just start the activity you want to show after the finestwebview is close. I hope it helps......

atebsy avatar Dec 18 '17 23:12 atebsy

@Override public void onActivityCreated(Activity activity, Bundle bundle) { if (activity instanceof FinestWebViewActivity) { mCurrentWebViewActivity = activity; } } and

final FinestWebView.Builder builder = new FinestWebView.Builder(getActivity());
builder.setWebViewListener(new WebViewListener() {
    @Override
    public void onPageStarted(String url) {
        super.onPageStarted(url);

        if (url.startsWith(Constants.THANK_YOU_PAGE)) {
            Activity webViewActivity = AppController.getInstance().getCurrentWebViewActivity();
            if (webViewActivity != null) {
                webViewActivity.finish();
            }
        }
    }
});
builder.show(url);

shimiuh avatar Feb 13 '18 12:02 shimiuh

@shimiuh can you explain this code?

shanecontinued avatar Aug 28 '18 21:08 shanecontinued

I implemented some code to allow us to programmatically close the activity. You can do Builder.close()

Kotlin Example:

val webviewBuilder = FinestWebView.Builder(this)
webviewBuilder.setWebViewListener(object : WebViewListener() {
            override fun onPageFinished(url: String?) {
                Handler().postDelayed({
                    webviewBuilder.close()
                }, 5000)
            }
})

implementation 'com.github.gintechsystems:FinestWebView-Android:1.2.7'

gintechsystems avatar Sep 21 '20 03:09 gintechsystems