How can I close click pragmatically ?
Opened this issue · 6 comments
has anyone figured this out yet?
@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......
@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 can you explain this code?
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'