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

The following examples show how to use android.support.v7.app.ActionBar#setIcon() . 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 check out the related API usage on the sidebar.
Example 1
Source File: SecondActivity.java    From android-apps with 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
Source File: FlickrUploaderActivity.java    From flickr-uploader with GNU General Public License v2.0 6 votes vote down vote up
@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
Source File: PreferencesNotificationActivity.java    From flickr-uploader with GNU General Public License v2.0 6 votes vote down vote up
@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
Source File: MainActivity.java    From android-overlay-protection with Apache License 2.0 5 votes vote down vote up
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
Source File: MainActivity.java    From android-overlay-malware-example with MIT License 5 votes vote down vote up
@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 File: ThirdActivity.java    From android-apps with 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 File: TrustActivity.java    From trust with 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
Source File: MaterialMenuIconCompat.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@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
Source File: MaterialMenuIconCompat.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@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 File: MainActivity.java    From TypedPreferences with 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
Source File: RootFragmentEx.java    From actor-platform with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void onConfigureActionBar(ActionBar actionBar) {
    super.onConfigureActionBar(actionBar);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setIcon(R.drawable.ic_app_notify);
}
 
Example 12
Source File: MapActivity.java    From OpenMapKitAndroid with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@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();
    }