Search in sources :

Example 51 with StringUtils.join

use of org.apache.commons.lang3.StringUtils.join in project Awful.apk by Awful.

the class SettingsActivity method onCreateDialog.

@Override
protected Dialog onCreateDialog(int dialogId) {
    switch(dialogId) {
        case DIALOG_ABOUT:
            CharSequence app_version = getText(R.string.app_name);
            try {
                app_version = app_version + " " + getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
            } catch (PackageManager.NameNotFoundException e) {
            // rather unlikely, just show app_name without version
            }
            // Build the text for the About dialog
            Resources res = getResources();
            String aboutText = getString(R.string.about_contributors_title) + "\n\n";
            aboutText += StringUtils.join(res.getStringArray(R.array.about_contributors_array), '\n');
            aboutText += "\n\n" + getString(R.string.about_libraries_title) + "\n\n";
            aboutText += StringUtils.join(res.getStringArray(R.array.about_libraries_array), '\n');
            return new AlertDialog.Builder(this).setTitle(app_version).setMessage(aboutText).setNeutralButton(android.R.string.ok, (dialog, which) -> {
            }).create();
        default:
            return super.onCreateDialog(dialogId);
    }
}
Also used : Context(android.content.Context) Constants(com.ferg.awfulapp.constants.Constants) Bundle(android.os.Bundle) PackageManager(android.content.pm.PackageManager) Uri(android.net.Uri) Dialog(android.app.Dialog) Intent(android.content.Intent) FragmentTransaction(android.app.FragmentTransaction) NonNull(android.support.annotation.NonNull) SettingsFragment(com.ferg.awfulapp.preferences.fragments.SettingsFragment) StringUtils(org.apache.commons.lang3.StringUtils) MenuItem(android.view.MenuItem) Manifest(android.Manifest) Toast(android.widget.Toast) View(android.view.View) R(com.ferg.awfulapp.R) PreferenceManager(android.preference.PreferenceManager) ActionBar(android.support.v7.app.ActionBar) Fragment(android.app.Fragment) AwfulActivity(com.ferg.awfulapp.AwfulActivity) AwfulUtils(com.ferg.awfulapp.util.AwfulUtils) ContextCompat(android.support.v4.content.ContextCompat) ActivityCompat(android.support.v4.app.ActivityCompat) Timber(timber.log.Timber) AlertDialog(android.app.AlertDialog) RootSettings(com.ferg.awfulapp.preferences.fragments.RootSettings) Toolbar(android.support.v7.widget.Toolbar) Activity(android.app.Activity) FragmentManager(android.app.FragmentManager) Resources(android.content.res.Resources) PackageManager(android.content.pm.PackageManager) Resources(android.content.res.Resources)

Aggregations

StringUtils (org.apache.commons.lang3.StringUtils)34 List (java.util.List)30 Collectors (java.util.stream.Collectors)23 ArrayList (java.util.ArrayList)21 Map (java.util.Map)17 HashMap (java.util.HashMap)15 Set (java.util.Set)14 Logger (org.slf4j.Logger)14 LoggerFactory (org.slf4j.LoggerFactory)14 IOException (java.io.IOException)13 HashSet (java.util.HashSet)11 Arrays (java.util.Arrays)10 Collections (java.util.Collections)10 Date (java.util.Date)9 File (java.io.File)6 StopWatch (org.apache.commons.lang3.time.StopWatch)6 InputStream (java.io.InputStream)5 java.util (java.util)5 Pair (org.apache.commons.lang3.tuple.Pair)5 Path (java.nio.file.Path)4