Android Open Source - Simple-Dilbert App Controller






From Project

Back to project page Simple-Dilbert.

License

The source code is released under:

Apache License

If you think the Android project Simple-Dilbert 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

package com.mareksebera.simpledilbert;
/*from   w w w.  j  av a  2 s. c o m*/
import android.app.Application;
import android.content.Context;
import android.view.ViewConfiguration;

import com.mareksebera.simpledilbert.preferences.DilbertPreferences;
import com.mareksebera.simpledilbert.utilities.FailSafeBitmapDisplayer;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;

import org.joda.time.DateTimeZone;

import java.lang.reflect.Field;

public final class AppController extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        forceMenuOverflow();
        configureImageLoader(this);
    }

    static {
        /**
         * Set default time-zone, because strips are published in New York
         * timezone on midnight
         * */
        DateTimeZone.setDefault(DilbertPreferences.TIME_ZONE);
    }

    public static void configureImageLoader(Context c) {
        if (!ImageLoader.getInstance().isInited()) {
            DisplayImageOptions displayOptions = new DisplayImageOptions.Builder()
                    .cacheInMemory(true).cacheOnDisk(true)
                    .displayer(new FailSafeBitmapDisplayer()).build();
            ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(
                    c)
                    .defaultDisplayImageOptions(displayOptions).build();
            ImageLoader.getInstance().init(configuration);
            ImageLoader.getInstance().handleSlowNetwork(true);

        }
    }

    private void forceMenuOverflow() {
        try {
            ViewConfiguration config = ViewConfiguration.get(this);
            Field menuKeyField = ViewConfiguration.class
                    .getDeclaredField("sHasPermanentMenuKey");
            if (menuKeyField != null) {
                menuKeyField.setAccessible(true);
                menuKeyField.setBoolean(config, false);
            }
        } catch (Throwable ignored) {
        }
    }

}




Java Source Code List

com.mareksebera.simpledilbert.AppController.java
com.mareksebera.simpledilbert.core.DilbertFragmentActivity.java
com.mareksebera.simpledilbert.core.DilbertFragmentAdapter.java
com.mareksebera.simpledilbert.core.DilbertFragmentInterface.java
com.mareksebera.simpledilbert.core.DilbertFragment.java
com.mareksebera.simpledilbert.favorites.DilbertFavoritedActivity.java
com.mareksebera.simpledilbert.favorites.DilbertFavoritedFragmentAdapter.java
com.mareksebera.simpledilbert.favorites.FavoritedItem.java
com.mareksebera.simpledilbert.picker.FolderPickerActivity.java
com.mareksebera.simpledilbert.picker.FolderPickerAdapter.java
com.mareksebera.simpledilbert.picker.FolderPickerFragment.java
com.mareksebera.simpledilbert.preferences.DilbertPreferencesActivity.java
com.mareksebera.simpledilbert.preferences.DilbertPreferences.java
com.mareksebera.simpledilbert.utilities.ActionBarUtility.java
com.mareksebera.simpledilbert.utilities.DownloadManagerBroadcastReceiver.java
com.mareksebera.simpledilbert.utilities.FailSafeBitmapDisplayer.java
com.mareksebera.simpledilbert.utilities.FindUrls.java
com.mareksebera.simpledilbert.utilities.FixedViewPager.java
com.mareksebera.simpledilbert.utilities.GetStripUrlInterface.java
com.mareksebera.simpledilbert.utilities.GetStripUrl.java
com.mareksebera.simpledilbert.widget.WidgetProvider.java