Example usage for android.app ActionBar DISPLAY_SHOW_TITLE

List of usage examples for android.app ActionBar DISPLAY_SHOW_TITLE

Introduction

In this page you can find the example usage for android.app ActionBar DISPLAY_SHOW_TITLE.

Prototype

int DISPLAY_SHOW_TITLE

To view the source code for android.app ActionBar DISPLAY_SHOW_TITLE.

Click Source Link

Document

Show the activity title and subtitle, if present.

Usage

From source file:es.farfuteam.vncpp.controller.NewConnectionActivity.java

/**
 * @param savedInstanceState//from   w w w . java 2s.  c  o m
 * @brief This is the onCreate method
 * @details The onCreate method adds buttons and edittext on the activity
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.connection_window);

    ConnectionName_field = (EditText) findViewById(R.id.ConnectionName_inserted);

    IP_field = (EditText) findViewById(R.id.IP_inserted);

    PORT_field = (EditText) findViewById(R.id.PORT_inserted);

    PSW_field = (EditText) findViewById(R.id.PSW_inserted);

    //desplegable seleccion de colores

    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.color_array,
            android.R.layout.simple_spinner_item);

    Spinner_colors = (Spinner) findViewById(R.id.Spinner_colors);

    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    Spinner_colors.setAdapter(adapter);

    Spinner_colors.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, android.view.View v, int position, long id) {
            setColor_format(getPosEnumQuality(position));
        }

        public void onNothingSelected(AdapterView<?> parent) {
            //por defecto se selecciona la posicion 0, 24-bit color(extra-high)
            setColor_format(QualityArray.SuperHigh);
        }
    });

    Button botonConnect = (Button) findViewById(R.id.buttonConnect);
    botonConnect.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            //primero se verifica que los campos se rellenan bien,
            //y se aade a la BD antes de iniciar Canvas.

            if (verify(v)) {

                //crear usuario si todo ha ido bien
                createNewConnection();

                iniCanvasActivity();

            }

        }
    });

    Button botonCancel = (Button) findViewById(R.id.buttonCancel);
    botonCancel.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            Cancel(v);

        }
    });

    //efectos del actionBar
    final ActionBar actionBar = getActionBar();

    actionBar.setDisplayOptions(
            ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);

}

From source file:com.numberx.kkmctimer.DeskClock.java

private void createTabs(int selectedIndex) {
    mActionBar = getActionBar();//www  .  j av a 2s  .  c  om

    if (mActionBar != null) {
        mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME);
        mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        mAlarmTab = mActionBar.newTab();
        mAlarmTab.setIcon(R.drawable.alarm_tab);
        mAlarmTab.setContentDescription(R.string.menu_alarm);
        mTabsAdapter.addTab(mAlarmTab, AlarmClockFragment.class, ALARM_TAB_INDEX);

        mClockTab = mActionBar.newTab();
        mClockTab.setIcon(R.drawable.clock_tab);
        mClockTab.setContentDescription(R.string.menu_clock);
        mTabsAdapter.addTab(mClockTab, ClockFragment.class, CLOCK_TAB_INDEX);

        mTimerTab = mActionBar.newTab();
        mTimerTab.setIcon(R.mipmap.ic_notification);
        mTimerTab.setContentDescription(R.string.menu_timer);
        mTabsAdapter.addTab(mTimerTab, TimerFragment.class, TIMER_TAB_INDEX);

        //mStopwatchTab = mActionBar.newTab();
        //mStopwatchTab.setIcon(R.drawable.stopwatch_tab);
        //mStopwatchTab.setContentDescription(R.string.menu_stopwatch);
        //mTabsAdapter.addTab(mStopwatchTab, StopwatchFragment.class,STOPWATCH_TAB_INDEX);

        mActionBar.setSelectedNavigationItem(selectedIndex);
        mTabsAdapter.notifySelectedPage(selectedIndex);

        forceTabsInActionBar(mActionBar);
    }
}

From source file:com.embeddedlog.LightUpDroid.DeskClock.java

private void createTabs(int selectedIndex) {
    mActionBar = getActionBar();//from   ww  w.  j av  a2 s.co  m

    if (mActionBar != null) {
        mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME);
        mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        mAlarmTab = mActionBar.newTab();
        mAlarmTab.setIcon(R.drawable.alarm_tab);
        mAlarmTab.setContentDescription(R.string.menu_alarm);
        mTabsAdapter.addTab(mAlarmTab, AlarmClockFragment.class, ALARM_TAB_INDEX);

        mClockTab = mActionBar.newTab();
        mClockTab.setIcon(R.drawable.clock_tab);
        mClockTab.setContentDescription(R.string.menu_clock);
        mTabsAdapter.addTab(mClockTab, ClockFragment.class, CLOCK_TAB_INDEX);

        //mTimerTab = mActionBar.newTab();
        //mTimerTab.setIcon(R.drawable.timer_tab);
        //mTimerTab.setContentDescription(R.string.menu_timer);
        //mTabsAdapter.addTab(mTimerTab, TimerFragment.class, TIMER_TAB_INDEX);

        //mStopwatchTab = mActionBar.newTab();
        //mStopwatchTab.setIcon(R.drawable.stopwatch_tab);
        //mStopwatchTab.setContentDescription(R.string.menu_stopwatch);
        //mTabsAdapter.addTab(mStopwatchTab, StopwatchFragment.class,STOPWATCH_TAB_INDEX);

        mActionBar.setSelectedNavigationItem(selectedIndex);
        mTabsAdapter.notifySelectedPage(selectedIndex);

        forceTabsInActionBar(mActionBar);
    }
}

From source file:com.android.contacts.activities.ContactDetailActivity.java

/** @} */

@Override/*ww w . j a v a 2s .c  om*/
protected void onCreate(Bundle savedState) {
    super.onCreate(savedState);
    LogUtils.i(TAG, "[onCreate][launch]start");
    ///M: Bug Fix for ALPS01022809,JE happens when click the favourite video to choose contact in tablet
    registerPHBReceiver();
    mIsActivitFinished = false;
    /** M: Bug Fix for ALPS00393950 @{ */
    boolean isUsingTwoPanes = PhoneCapabilityTester.isUsingTwoPanes(this);
    if (!isUsingTwoPanes) {
        SetIndicatorUtils.getInstance().registerReceiver(this);
    }
    /** @} */
    if (PhoneCapabilityTester.isUsingTwoPanes(this)) {
        // This activity must not be shown. We have to select the contact in the
        // PeopleActivity instead ==> Create a forward intent and finish
        final Intent originalIntent = getIntent();
        Intent intent = new Intent();
        intent.setAction(originalIntent.getAction());
        intent.setDataAndType(originalIntent.getData(), originalIntent.getType());

        // If we are launched from the outside, we should create a new task, because the user
        // can freely navigate the app (this is different from phones, where only the UP button
        // kicks the user into the full app)
        if (shouldUpRecreateTask(intent)) {
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        } else {
            intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_FORWARD_RESULT
                    | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        }
        intent.setClass(this, PeopleActivity.class);
        startActivity(intent);
        LogUtils.i(TAG, "onCreate(),Using Two Panes...finish Actiivity..");
        finish();
        return;
    }

    setContentView(R.layout.contact_detail_activity);

    mContactDetailLayoutController = new ContactDetailLayoutController(this, savedState, getFragmentManager(),
            null, findViewById(R.id.contact_detail_container), mContactDetailFragmentListener);

    // We want the UP affordance but no app icon.
    // Setting HOME_AS_UP, SHOW_TITLE and clearing SHOW_HOME does the trick.
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        ///@Modify for add Customer view{
        actionBar.setDisplayOptions(
                ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM,
                ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME
                        | ActionBar.DISPLAY_SHOW_CUSTOM);
        ///@}
        actionBar.setTitle("");
    }

    Log.i(TAG, getIntent().getData().toString());
    /** M: New Feature xxx @{ */
    //M:fix CR:ALPS00958663,disconnect to smartbook when contact screen happen JE
    if (getIntent() != null && getIntent().getData() != null) {
        mSimOrPhoneUri = getIntent().getData();
        Log.i(TAG, "mSimOrPhoneUri = " + mSimOrPhoneUri);
    } else {
        Log.e(TAG, "Get intent data error getIntent() = " + getIntent());
    }
    /// M: @ CT contacts detail history set listener{
    ExtensionManager.getInstance().getContactDetailEnhancementExtension().configActionBarExt(getActionBar(),
            ContactPluginDefault.COMMD_FOR_OP09);
    /// @}
    LogUtils.i(TAG, "[onCreate][launch]end");
}

From source file:android.support.v7.widget.ToolbarWidgetWrapper.java

private int detectDisplayOptions() {
    int opts = ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_USE_LOGO;
    if (mToolbar.getNavigationIcon() != null) {
        opts |= ActionBar.DISPLAY_HOME_AS_UP;
        mDefaultNavigationIcon = mToolbar.getNavigationIcon();
    }// w  w  w  .j  a v  a  2s.  co  m
    return opts;
}

From source file:com.android.ex.photo.PhotoViewActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final ActivityManager mgr = (ActivityManager) getApplicationContext()
            .getSystemService(Activity.ACTIVITY_SERVICE);
    sMemoryClass = mgr.getMemoryClass();

    Intent mIntent = getIntent();//w w  w.j  a v  a 2 s. co m

    int currentItem = -1;
    if (savedInstanceState != null) {
        currentItem = savedInstanceState.getInt(STATE_ITEM_KEY, -1);
        mFullScreen = savedInstanceState.getBoolean(STATE_FULLSCREEN_KEY, false);
    }

    // uri of the photos to view; optional
    if (mIntent.hasExtra(Intents.EXTRA_PHOTOS_URI)) {
        mPhotosUri = mIntent.getStringExtra(Intents.EXTRA_PHOTOS_URI);
    }

    // projection for the query; optional
    // I.f not set, the default projection is used.
    // This projection must include the columns from the default projection.
    if (mIntent.hasExtra(Intents.EXTRA_PROJECTION)) {
        mProjection = mIntent.getStringArrayExtra(Intents.EXTRA_PROJECTION);
    } else {
        mProjection = null;
    }

    // Set the current item from the intent if wasn't in the saved instance
    if (mIntent.hasExtra(Intents.EXTRA_PHOTO_INDEX) && currentItem < 0) {
        currentItem = mIntent.getIntExtra(Intents.EXTRA_PHOTO_INDEX, -1);
    }
    mPhotoIndex = currentItem;

    setContentView(R.layout.photo_activity_view);

    // Create the adapter and add the view pager
    mAdapter = new PhotoPagerAdapter(this, getFragmentManager(), null);

    mViewPager = (PhotoViewPager) findViewById(R.id.photo_view_pager);
    mViewPager.setAdapter(mAdapter);
    mViewPager.setOnPageChangeListener(this);
    mViewPager.setOnInterceptTouchListener(this);

    // Kick off the loader
    getLoaderManager().initLoader(LOADER_PHOTO_LIST, null, this);

    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    mActionBarHideDelayTime = getResources().getInteger(R.integer.action_bar_delay_time_in_millis);
    actionBar.addOnMenuVisibilityListener(this);
    actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
}

From source file:com.amaze.filemanager.activities.Preferences.java

@Override
public void onCreate(Bundle savedInstanceState) {
    SharedPreferences Sp = PreferenceManager.getDefaultSharedPreferences(this);
    fabSkin = PreferenceUtils.getAccentString(Sp);

    int th = Integer.parseInt(Sp.getString("theme", "0"));

    theme = th == 2 ? PreferenceUtils.hourOfDay() : th;

    // setting accent theme
    if (Build.VERSION.SDK_INT >= 21) {

        switch (fabSkin) {
        case "#F44336":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_red);
            else/*w  w w.j  ava  2s.  c o m*/
                setTheme(R.style.pref_accent_dark_red);
            break;

        case "#e91e63":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_pink);
            else
                setTheme(R.style.pref_accent_dark_pink);
            break;

        case "#9c27b0":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_purple);
            else
                setTheme(R.style.pref_accent_dark_purple);
            break;

        case "#673ab7":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_deep_purple);
            else
                setTheme(R.style.pref_accent_dark_deep_purple);
            break;

        case "#3f51b5":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_indigo);
            else
                setTheme(R.style.pref_accent_dark_indigo);
            break;

        case "#2196F3":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_blue);
            else
                setTheme(R.style.pref_accent_dark_blue);
            break;

        case "#03A9F4":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_light_blue);
            else
                setTheme(R.style.pref_accent_dark_light_blue);
            break;

        case "#00BCD4":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_cyan);
            else
                setTheme(R.style.pref_accent_dark_cyan);
            break;

        case "#009688":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_teal);
            else
                setTheme(R.style.pref_accent_dark_teal);
            break;

        case "#4CAF50":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_green);
            else
                setTheme(R.style.pref_accent_dark_green);
            break;

        case "#8bc34a":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_light_green);
            else
                setTheme(R.style.pref_accent_dark_light_green);
            break;

        case "#FFC107":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_amber);
            else
                setTheme(R.style.pref_accent_dark_amber);
            break;

        case "#FF9800":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_orange);
            else
                setTheme(R.style.pref_accent_dark_orange);
            break;

        case "#FF5722":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_deep_orange);
            else
                setTheme(R.style.pref_accent_dark_deep_orange);
            break;

        case "#795548":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_brown);
            else
                setTheme(R.style.pref_accent_dark_brown);
            break;

        case "#212121":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_black);
            else
                setTheme(R.style.pref_accent_dark_black);
            break;

        case "#607d8b":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_blue_grey);
            else
                setTheme(R.style.pref_accent_dark_blue_grey);
            break;

        case "#004d40":
            if (theme == 0)
                setTheme(R.style.pref_accent_light_super_su);
            else
                setTheme(R.style.pref_accent_dark_super_su);
            break;
        }
    } else {
        if (theme == 1) {
            setTheme(R.style.appCompatDark);
        } else {
            setTheme(R.style.appCompatLight);
        }
    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.prefsfrag);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    skin = PreferenceUtils.getPrimaryColorString(Sp);
    if (Build.VERSION.SDK_INT >= 21) {
        ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("Amaze",
                ((BitmapDrawable) getResources().getDrawable(R.mipmap.ic_launcher)).getBitmap(),
                Color.parseColor(skin));
        ((Activity) this).setTaskDescription(taskDescription);
    }
    skinStatusBar = PreferenceUtils.getStatusColor(skin);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayOptions(android.support.v7.app.ActionBar.DISPLAY_HOME_AS_UP
            | android.support.v7.app.ActionBar.DISPLAY_SHOW_TITLE);
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor(skin)));
    int sdk = Build.VERSION.SDK_INT;

    if (sdk == 20 || sdk == 19) {
        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setStatusBarTintColor(Color.parseColor(skin));

        FrameLayout.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) findViewById(R.id.preferences)
                .getLayoutParams();
        SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();
        p.setMargins(0, config.getStatusBarHeight(), 0, 0);
    } else if (Build.VERSION.SDK_INT >= 21) {
        boolean colourednavigation = Sp.getBoolean("colorednavigation", true);
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor((PreferenceUtils.getStatusColor(skin)));
        if (colourednavigation)
            window.setNavigationBarColor((PreferenceUtils.getStatusColor(skin)));

    }
    selectItem(0);
}

From source file:android.support.v7.internal.widget.ToolbarWidgetWrapper.java

private int detectDisplayOptions() {
    int opts = ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_USE_LOGO;
    if (mToolbar.getNavigationIcon() != null) {
        opts |= ActionBar.DISPLAY_HOME_AS_UP;
    }/*from  w w w. j  a  va  2s  .c  o  m*/
    return opts;
}

From source file:com.dnielfe.manager.Browser.java

private void setupDrawer() {
    final TypedArray array = obtainStyledAttributes(new int[] { R.attr.themeId });
    final int themeId = array.getInteger(0, SimpleExplorer.THEME_ID_LIGHT);
    array.recycle();// www .  jav  a 2 s  .  c  om

    mDrawer = (LinearLayout) findViewById(R.id.left_drawer);

    // Set shadow of navigation drawer
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

    int icon = themeId == SimpleExplorer.THEME_ID_LIGHT ? R.drawable.holo_light_ic_drawer
            : R.drawable.holo_dark_ic_drawer;

    // Add Navigation Drawer to ActionBar
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, icon, R.string.drawer_open,
            R.string.drawer_close) {

        @Override
        public void onDrawerOpened(View view) {
            super.onDrawerOpened(view);
            mActionBar.setDisplayOptions(
                    ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE);
            mActionBar.setTitle(R.string.app_name);
            invalidateOptionsMenu();
        }

        @Override
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            mActionBar.setDisplayOptions(
                    ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_CUSTOM);
            invalidateOptionsMenu();
        }
    };

    mDrawerLayout.setDrawerListener(mDrawerToggle);
}

From source file:com.nks.nksmod.otaupdater.OTAUpdaterActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Context context = getApplicationContext();
    cfg = Config.getInstance(context);/*from   w  ww.  j  a v a2  s .  co m*/
    final int MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 0;

    if (ContextCompat.checkSelfPermission(OTAUpdaterActivity.this,
            android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {

        if (ActivityCompat.shouldShowRequestPermissionRationale(OTAUpdaterActivity.this,
                android.Manifest.permission.WRITE_EXTERNAL_STORAGE)) {

            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(R.string.alert_permission_storage);
            builder.setMessage(R.string.alert_permission_storage_message);
            builder.setCancelable(false);
            builder.setNegativeButton(R.string.exit, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    finish();
                }
            });
            builder.setNeutralButton(R.string.enable_permission, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    ActivityCompat.requestPermissions(OTAUpdaterActivity.this,
                            new String[] { android.Manifest.permission.WRITE_EXTERNAL_STORAGE },
                            MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
                }
            });

            final AlertDialog dlg = builder.create();

            dlg.setOnShowListener(new DialogInterface.OnShowListener() {
                @Override
                public void onShow(DialogInterface dialog) {
                    onDialogShown(dlg);
                }
            });
            dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialog) {
                    onDialogClosed(dlg);
                }
            });
            dlg.show();

        } else {
            ActivityCompat.requestPermissions(OTAUpdaterActivity.this,
                    new String[] { android.Manifest.permission.WRITE_EXTERNAL_STORAGE },
                    MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);

            if (ActivityCompat.shouldShowRequestPermissionRationale(OTAUpdaterActivity.this,
                    android.Manifest.permission.WRITE_EXTERNAL_STORAGE)) {

                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                builder.setTitle(R.string.alert_permission_storage);
                builder.setMessage(R.string.alert_permission_storage_message);
                builder.setCancelable(false);
                builder.setNegativeButton(R.string.exit, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        finish();
                    }
                });

                final AlertDialog dlg = builder.create();

                dlg.setOnShowListener(new DialogInterface.OnShowListener() {
                    @Override
                    public void onShow(DialogInterface dialog) {
                        onDialogShown(dlg);
                    }
                });
                dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public void onDismiss(DialogInterface dialog) {
                        onDialogClosed(dlg);
                    }
                });
                dlg.show();

            }
        }
    }

    boolean data = Utils.dataAvailable(this);
    boolean wifi = Utils.wifiConnected(this);

    if (!data || !wifi) {
        final boolean nodata = !data && !wifi;

        if ((nodata && !cfg.getIgnoredDataWarn()) || (!nodata && !cfg.getIgnoredWifiWarn())) {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(nodata ? R.string.alert_nodata_title : R.string.alert_nowifi_title);
            builder.setMessage(nodata ? R.string.alert_nodata_message : R.string.alert_nowifi_message);
            builder.setCancelable(false);
            builder.setNegativeButton(R.string.exit, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    finish();
                }
            });
            builder.setNeutralButton(R.string.alert_wifi_settings, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    Intent i = new Intent(Settings.ACTION_WIFI_SETTINGS);
                    startActivity(i);
                }
            });
            builder.setPositiveButton(R.string.ignore, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    if (nodata) {
                        cfg.setIgnoredDataWarn(true);
                    } else {
                        cfg.setIgnoredWifiWarn(true);
                    }
                    dialog.dismiss();
                }
            });

            final AlertDialog dlg = builder.create();

            dlg.setOnShowListener(new DialogInterface.OnShowListener() {
                @Override
                public void onShow(DialogInterface dialog) {
                    onDialogShown(dlg);
                }
            });
            dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialog) {
                    onDialogClosed(dlg);
                }
            });
            dlg.show();
        }
    }

    Utils.updateDeviceRegistration(this);
    CheckinReceiver.setDailyAlarm(this);

    setContentView(R.layout.main);
    ViewPager mViewPager = (ViewPager) findViewById(R.id.pager);

    bar = getActionBar();
    assert bar != null;

    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
    bar.setTitle(R.string.app_name);

    TabsAdapter mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.main_about), AboutTab.class);

    ActionBar.Tab romTab = bar.newTab().setText(R.string.main_rom);
    if (cfg.hasStoredRomUpdate())
        romTab.setIcon(R.drawable.ic_action_warning);
    romTabIdx = mTabsAdapter.addTab(romTab, ROMTab.class);

    /* ActionBar.Tab kernelTab = bar.newTab().setText(R.string.main_kernel);
    if (cfg.hasStoredKernelUpdate()) kernelTab.setIcon(R.drawable.ic_action_warning);
    kernelTabIdx = mTabsAdapter.addTab(kernelTab, KernelTab.class); */

    if (!handleNotifAction(getIntent())) {
        if (cfg.hasStoredRomUpdate() && !cfg.isDownloadingRom()) {
            cfg.getStoredRomUpdate().showUpdateNotif(this);
        }

        /* if (cfg.hasStoredKernelUpdate() && !cfg.isDownloadingKernel()) {
        cfg.getStoredKernelUpdate().showUpdateNotif(this);
        } */

        if (savedInstanceState != null) {
            bar.setSelectedNavigationItem(savedInstanceState.getInt(KEY_TAB, 0));
        }
    }
}