Java Code Examples for android.support.v7.app.ActionBar#setIcon()

The following examples show how to use android.support.v7.app.ActionBar#setIcon() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: android-apps   File: SecondActivity.java    License: MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_second);

    Button btnGotoThird = (Button) findViewById(R.id.btnGotoThird);
    btnGotoThird.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(SecondActivity.this, ThirdActivity.class);
            startActivity(intent);
        }
    });

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setIcon(R.drawable.ic_launcher);
}
 
Example 2
@AfterViews
    void afterViews() {
        UploadService.register(drawerHandleView);
        UploadService.register(drawerContentView);
        UploadService.register(uploadProgressListener);
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setTitle(null);
            actionBar.setIcon(null);
            actionBar.setDisplayShowHomeEnabled(false);
        }
        slidingDrawer.setOnDrawerOpenListener(new SlidingDrawer.OnDrawerOpenListener() {
            @Override
            public void onDrawerOpened() {
                Utils.setBooleanProperty(STR.show_sliding_demo, false);
                drawerContentView.updateLists();
            }
        });
        swipeContainer.setOnRefreshListener(this);
//        swipeContainer.setColorScheme(android.R.color.white, android.R.color.white, android.R.color.black, android.R.color.darker_gray);
    }
 
Example 3
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setIcon(R.drawable.preferences);
    }
    PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
    addPreferencesFromResource(R.xml.preferences_notification);
    if (Utils.isPremium()) {
        Preference end_of_trial = findPreference(STR.end_of_trial);
        getPreferenceScreen().removePreference(end_of_trial);
    }
}
 
Example 4
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(mTitle);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setIcon(R.drawable.ic_launcher_transparent);
    }
}
 
Example 5
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(getTitle());
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setIcon(R.mipmap.ic_launcher);
    }

    startService();
}
 
Example 6
Source Project: android-apps   File: ThirdActivity.java    License: MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_third);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setIcon(R.drawable.ic_launcher);
}
 
Example 7
Source Project: trust   File: TrustActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    if (!check_done)
        checkPattern(this);

    ActionBar actionBar = getSupportActionBar();
    if (checkPro(this)) {
        actionBar.setIcon(R.drawable.pro_icon);
        actionBar.setTitle(R.string.app_name_pro);
    } else {
        actionBar.setIcon(R.drawable.ic_launcher);
        actionBar.setTitle(R.string.app_name);
    }
}
 
Example 8
@Override
protected void setActionBarSettings(Activity activity) {
    ActionBar actionBar = ((ActionBarActivity) activity).getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setIcon(getDrawable());
}
 
Example 9
@Override
protected void setActionBarSettings(Activity activity) {
    ActionBar actionBar = ((ActionBarActivity) activity).getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setIcon(getDrawable());
}
 
Example 10
Source Project: TypedPreferences   File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setIcon(R.drawable.ic_launcher);
    }
    mPreferenceHelper = ((DemoApplication) getApplication())
            .getPreferenceHelper();
}
 
Example 11
@Override
public void onConfigureActionBar(ActionBar actionBar) {
    super.onConfigureActionBar(actionBar);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setIcon(R.drawable.ic_app_notify);
}
 
Example 12
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Turn on MBTiles HTTP server.
        /**
         * We are waiting to enable this until we need it for a new map renderer.
         */
//        initializeMBTilesServer();

        determineVersion();
        
        if(android.os.Build.VERSION.SDK_INT >= 21) {
            Window window = getWindow();
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            window.setStatusBarColor(getResources().getColor(R.color.osm_light_green));
        }

        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setIcon(R.mipmap.ic_omk_nobg);
        }

        // App crashes without some permissions.
        // TODO We can be more refined about where and when we ask for permissions
        if(!hasPermissions(this, PERMISSIONS)){
            ActivityCompat.requestPermissions(this, PERMISSIONS, PERMISSION_ALL);
        }


        // create directory structure for app if needed
        ExternalStorage.checkOrCreateAppDirs();

        // Move constraints assets to ExternalStorage if necessary
        ExternalStorage.copyConstraintsToExternalStorageIfNeeded(this);
        
        // Register the intent to the ODKCollect handler
        // This will determine if we are in ODK Collect Mode or not.
        ODKCollectHandler.registerIntent(getIntent());

        // Initialize the constraints singleton.
        // Loads up all the constraints JSON configs.
        Constraints.initialize();

        //set layout
        setContentView(R.layout.activity_map);

        //get the layout the ListView is nested in
        mBottomLinearLayout = (LinearLayout)findViewById(R.id.bottomLinearLayout);

        //the ListView from layout
        mTagListView = (ListView)findViewById(R.id.tagListView);

        //the ListView close image button
        mCloseListViewButton = (ImageButton)findViewById(R.id.imageViewCloseList);

        //get the layout the Map is nested in
        mTopLinearLayout = (LinearLayout)findViewById(R.id.topLinearLayout);

        //get map from layout
        mapView = (MapView)findViewById(R.id.mapView);

        // get Field Papers Message
        fieldPapersMsg = (TextView)findViewById(R.id.fieldPapersMsg);
        
        // initialize basemap object
        basemap = new Basemap(this);

        initializeFP();

        initializeOsmXml();

        // add user location toggle button
        initializeLocationButton();

        // setup move button
        initializeMoveButton();

        initializeNodeModeButton();
        initializeAddNodeButtons();
        initializeMoveNodeButtons();

        positionMap();

        initializeListView();
    }