Comments (9)
There's nothing special here. It's all standard Android. E.g. you can use standard Android style menus for the launch button, e.g. something like this to setup the menu item (with icon etc):
MenuInflater menuInflater = activity.getMenuInflater();
menuInflater.inflate(R.menu.about_screen_menu, menu);
and then launch it with:
case R.id.open_about:
AboutActivity.launch(activity);
return true;
from android-about-box.
@Kvaibhav01 I'm afraid these are Android programming questions and really don't have much to do with this library. I'd love to help more, but there are plenty of references for this elsewhere. Good luck!
from android-about-box.
I setup AboutActivity
in the initial app startup. Then, later in the app, I access it. That way, it's all configured and ready to go.
I.e. like this:
public class LogicApp extends android.app.Application {
....
@Override
public void onCreate() {
super.onCreate();
...
initAboutBox();
}
...
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);
}
};
}
And then I can call it with the code I shared above, i.e.
AboutActivity.launch(activity);
Hope this helps!
from android-about-box.
Take a look at the source code, after you've setup with AboutConfig
as shown above, you need to call AboutActivity.launch(yourActivity)
. This code that is already in the library will then do what you're doing above:
public static void launch(Activity activity) {
Intent intent = new Intent(activity, AboutActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
activity.startActivity(intent);
}
from android-about-box.
after you've setup with AboutConfig as shown above, you need to call AboutActivity.launch(yourActivity)
Sorry, I didn't mean immediately call AboutActivity.launch
.
In the app startup, ONLY do the configuration. Later, when they tap the button, THEN call ``AboutActivity.launch(activity)`.
I.e. it is two separate things: configure at app startup, then launch when the user requests it.
Good luck!
from android-about-box.
It's done! 😃 I removed AboutActivity.launch
from onCreate()
and added the following in onOptionsItemSelected()
:
if (id == R.id.action_about) {
Intent intent = new Intent(this, AboutActivity.class);
startActivity(intent);
return true;
}
Everything works fine now! Thank you 😃.
from android-about-box.
Thank you for that but I'm a bit confused here.
- Do I need to create a new java file for implementing this? (It will contain all the code from the setup part).
- How do I add an icon for this in my menu bar?
from android-about-box.
So I added the relevant code to do this as:
- Added a new
<item>
in menu.xml - Copied all the code of this library to a new java file named AboutActivity.java
- Added the following code in my MainActivity.java file in
onOptionsItemSelected
method:
if (id == R.id.action_about) {
Intent intent = new Intent(this, AboutActivity.class);
startActivity(intent);
return true;
}
- Updated the manifest by:
<activity android:name=".AboutActivity"></activity>
But when I run the app on emulator, it shows up the following screen when the action_about
icon is tapped:
I have already added more informations like acknowledgements, privacy policy et cetera but it's showing something weird!
from android-about-box.
Everything is going good, I implemented the above. One thing, every time I open the app the about activity launches instead of main activity. How to solve this? I don't wan't my app users to see the about page every time they open the app, it's quite annoying.
from android-about-box.
Related Issues (20)
- Fix "show publisher" for Amazon
- Fix crash for Facebook link
- Fix email subject line
- Change string "app_name" to something like "app_name_aboutbox" HOT 2
- Theme support HOT 2
- Add Guide as an option first item on the menu
- Force close on launching AboutActivity HOT 3
- Remove dependancy on Branch.io
- Copyright & Author & About Company HOT 2
- Update to latest Materal About Library HOT 3
- Which activity to add in launch()? HOT 2
- Adding other categories in the activity HOT 3
- Twitter profile doesn't opens HOT 2
- Remove cards from About Activity HOT 3
- Privacy policy is not shown HOT 1
- Facebook link do not open HOT 5
- Web link is opened in general browser intent HOT 10
- Check for leaks
- Add accessibility labels
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-about-box.