Android Open Source - HistoryCleanerPro Bread Crumber






From Project

Back to project page HistoryCleanerPro.

License

The source code is released under:

Copyright (c) 2014, John Phillips All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...

If you think the Android project HistoryCleanerPro listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright 2013 two forty four a.m. LLC <http://www.twofortyfouram.com>
 *//  w  w  w. j  av a 2  s .  c o m
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * <http://www.apache.org/licenses/LICENSE-2.0>
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and limitations under the License.
 */

package com.twofortyfouram.locale;

import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.twofortyfouram.locale.api.R;

/**
 * Utility class to generate a breadcrumb title string for {@code Activity} instances in Locale.
 * <p>
 * This class cannot be instantiated.
 */
public final class BreadCrumber
{
    /**
     * Static helper method to generate bread crumbs. Bread crumb strings will be properly formatted for the
     * current language, including right-to-left languages, as long as the proper
     * {@link com.twofortyfouram.locale.platform.R.string#twofortyfouram_locale_breadcrumb_format} string
     * resources have been created.
     *
     * @param context {@code Context} for loading platform resources. Cannot be null.
     * @param intent {@code Intent} to extract the bread crumb from.
     * @param currentCrumb The last element of the bread crumb path.
     * @return {@code String} presentation of the bread crumb. If the intent parameter is null, then this
     *         method returns currentCrumb. If currentCrumb is null, then this method returns the empty string
     *         "". If intent contains a private Serializable instances as an extra, then this method returns
     *         the empty string "".
     * @throws IllegalArgumentException if {@code context} is null.
     */
    public static CharSequence generateBreadcrumb(final Context context, final Intent intent,
                                                  final String currentCrumb)
    {
        if (null == context)
        {
            throw new IllegalArgumentException("context cannot be null"); //$NON-NLS-1$
        }

        try
        {
            if (null == currentCrumb)
            {
                Log.w(Constants.LOG_TAG, "currentCrumb cannot be null"); //$NON-NLS-1$
                return ""; //$NON-NLS-1$
            }
            if (null == intent)
            {
                Log.w(Constants.LOG_TAG, "intent cannot be null"); //$NON-NLS-1$
                return currentCrumb;
            }

            /*
             * Note: this is vulnerable to a private serializable attack, but the try-catch will solve that.
             */
            final String breadcrumbString = intent.getStringExtra(com.twofortyfouram.locale.Intent.EXTRA_STRING_BREADCRUMB);
            if (null != breadcrumbString)
            {
                return context.getString(R.string.twofortyfouram_locale_breadcrumb_format, breadcrumbString, context.getString(R.string.twofortyfouram_locale_breadcrumb_separator), currentCrumb);
            }
            return currentCrumb;
        }
        catch (final Exception e)
        {
            Log.e(Constants.LOG_TAG, "Encountered error generating breadcrumb", e); //$NON-NLS-1$
            return ""; //$NON-NLS-1$
        }
    }

    /**
     * Private constructor prevents instantiation.
     *
     * @throws UnsupportedOperationException because this class cannot be instantiated.
     */
    private BreadCrumber()
    {
        throw new UnsupportedOperationException("This class is non-instantiable"); //$NON-NLS-1$
    }
}




Java Source Code List

com.ayros.historycleaner.Globals.java
com.ayros.historycleaner.ProfileAdapter.java
com.ayros.historycleaner.UIRunner.java
com.ayros.historycleaner.cleaning.CategoryList.java
com.ayros.historycleaner.cleaning.Category.java
com.ayros.historycleaner.cleaning.CleanItem.java
com.ayros.historycleaner.cleaning.CleanListener.java
com.ayros.historycleaner.cleaning.Cleaner.java
com.ayros.historycleaner.cleaning.ProfileList.java
com.ayros.historycleaner.cleaning.Profile.java
com.ayros.historycleaner.cleaning.SimpleDatabaseItem.java
com.ayros.historycleaner.cleaning.SimpleFileItem.java
com.ayros.historycleaner.cleaning.items._AdobeReader_Recent.java
com.ayros.historycleaner.cleaning.items._FirefoxBeta_Cache.java
com.ayros.historycleaner.cleaning.items._FirefoxBeta_Cookies.java
com.ayros.historycleaner.cleaning.items._FirefoxBeta_History.java
com.ayros.historycleaner.cleaning.items._FirefoxBeta_LocalStorage.java
com.ayros.historycleaner.cleaning.items._FirefoxBeta_OpenTabs.java
com.ayros.historycleaner.cleaning.items._Firefox_Cache.java
com.ayros.historycleaner.cleaning.items._Firefox_Cookies.java
com.ayros.historycleaner.cleaning.items._Firefox_History.java
com.ayros.historycleaner.cleaning.items._Firefox_LocalStorage.java
com.ayros.historycleaner.cleaning.items._Firefox_OpenTabs.java
com.ayros.historycleaner.cleaning.items._ONEBrowser_Cache.java
com.ayros.historycleaner.cleaning.items._ONEBrowser_LocalStorage.java
com.ayros.historycleaner.cleaning.items._System_BrowserHistory.java
com.ayros.historycleaner.cleaning.items._System_Cache.java
com.ayros.historycleaner.cleaning.items._System_Clipboard.java
com.ayros.historycleaner.cleaning.items._System_FrequentContacts.java
com.ayros.historycleaner.cleaning.items._System_RecentCalls.java
com.ayros.historycleaner.cleaning.items._System_SMS.java
com.ayros.historycleaner.helpers.DBHelper.java
com.ayros.historycleaner.helpers.DatabaseModifier.java
com.ayros.historycleaner.helpers.Helper.java
com.ayros.historycleaner.helpers.Logger.java
com.ayros.historycleaner.helpers.PrefsModifier.java
com.ayros.historycleaner.helpers.RootHelper.java
com.ayros.historycleaner.helpers.XML.java
com.ayros.historycleaner.locale.Constants.java
com.ayros.historycleaner.locale.bundle.BundleScrubber.java
com.ayros.historycleaner.locale.bundle.PluginBundleManager.java
com.ayros.historycleaner.locale.receiver.FireReceiver.java
com.ayros.historycleaner.locale.ui.AbstractPluginActivity.java
com.ayros.historycleaner.locale.ui.EditPluginActivity.java
com.ayros.historycleaner.ui.CleanFragment.java
com.ayros.historycleaner.ui.DataViewActivity.java
com.ayros.historycleaner.ui.HelpActivity.java
com.ayros.historycleaner.ui.MainActivity.java
com.ayros.historycleaner.ui.OnProfileUpdated.java
com.ayros.historycleaner.ui.ProfileFragment.java
com.ayros.historycleaner.ui.ShortcutActivity.java
com.ayros.historycleaner.ui.ShortcutCleanActivity.java
com.twofortyfouram.locale.BreadCrumber.java
com.twofortyfouram.locale.Constants.java
com.twofortyfouram.locale.Intent.java
com.twofortyfouram.locale.PackageUtilities.java