Open unix14 opened 4 years ago
@unix14 What’s the benefit? Do you know if the custom web view is available back to Android 15? Thanks!
Well im not sure about backwards compabilities issues, but i was talking about this: Once you overrided open Url function, it works for only some of the links, but whenever you click on "Web" link it's using the default and not overrided implementations, also called webHomePage.
@unix14 Sorry, it's been a long time since I worked with this code. Perhaps you can add code to show me. FWIW, this is what we typically have in our apps to use this library. Not sure this helps to be honest, but I see it's a different override on open
compared to the README:
public void initAboutBox() {
final AboutConfig aboutConfig = AboutConfig.getInstance();
aboutConfig.appName = getString(R.string.app_name);
aboutConfig.appIcon = R.mipmap.ic_launcher;
aboutConfig.version = BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")";
aboutConfig.aboutLabelTitle = getString(R.string.about_egghead_games);
aboutConfig.packageName = getApplicationContext().getPackageName();
aboutConfig.buildType = "google".equalsIgnoreCase(BuildConfig.FLAVOR_appstore)
? AboutConfig.BuildType.GOOGLE : AboutConfig.BuildType.AMAZON;
aboutConfig.logUiEventName = LOG_UI_EVENT_NAME;
aboutConfig.facebookUserName = FACEBOOK_USER_NAME;
aboutConfig.twitterUserName = TWITTER_USER_NAME;
aboutConfig.webHomePage = WEB_HOME_PAGE;
aboutConfig.appPublisher = APP_PUBLISHER;
aboutConfig.guideHtmlPath = GUIDE_HTML_PATH;
aboutConfig.companyHtmlPath = COMPANY_HTML_PATH;
aboutConfig.privacyHtmlPath = PRIVACY_HTML_PATH;
aboutConfig.acknowledgmentHtmlPath = ACKNOWLEDGMENT_HTML_PATH;
aboutConfig.emailAddress = EMAIL_ADDRESS;
aboutConfig.emailSubject = getResources().getString(R.string.app_name) + " Question";
aboutConfig.emailBody = "";
aboutConfig.shareMessage = getString(R.string.share_message);
aboutConfig.sharingTitle = getString(R.string.sharing_title);
aboutConfig.dialog = new IDialog() {
@Override
public void open(AppCompatActivity appCompatActivity, String url, String tag) {
GuideDialog guideDialog = GuideDialog.createDialog(url, tag, true);
guideDialog.show(appCompatActivity.getSupportFragmentManager(), tag);
}
};
}
Our GuideDialog
extends DialogFragment
and it uses a WebView
with the passed url
(within a view that adds a toolbar at the top with an "X" to handle closing).
Well i didn't used GuideDialog but implemented my own open URL imlepemntation.. and it does work with all of the links, but "Web" link
if im still being not clear i can provide code but it's using CustomTabs in order to launch a mini in-app browser, and it's kinda out-of-scope of the About Box.
So it works ok PrivacyPolicy but not for an external web page? Interesting. Perhaps because of the CustomTabs need? Yes, perhaps provide a PR that demonstrates what you need (code is often easier than English!), and if it's general enough we can add it.
FWIW, the relevant code is this (from here, though I suspect you know that:
public static void openHTMLPage(Activity context, String htmlPath) {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(htmlPath)));
}
That same code is used in both the PrivacyPolicy and view web page scenarios, so I'm a bit confused. Sorry!
Lol The code is the same code you entered here above, which is the same code in documentation, I will try to make it simple. Whenever i override this function : and do whatever i want inside of the implementation, And then click on either of this : It's working the overrided function i provided and works correctly, but if i click on this: It's just opens a regular browser intent, basically it's working this implementation: Instead of running my implementation of open URL function
Hope everything is clear now
Thanks! Ok, we’ll chat about this and think about fixes.
BTW - I'd recommend to use LeakCanary to detect leaks in this library, because I've found it to leak without even starting the AboutActivity...
updated now to 2.0.1, and I still see leaks reports (am using LeakCanary), Also i would make the DarkMode optional, and maybe even with a black(ish) background and white textColor and icon's tint.. because the traditional dark mode should not be with a white background, obviously 😄
Keep up the great work!
edit::::
Web link STILL opens in general browser intent INSTEAD of using the custom implementation i provided
AboutUsActivity:
instead of line 212 you should enter the same as in here
Web link is opened in general browser intent instead of opening the custom web view implementation.
if not clear enough, i can add code