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

The following examples show how to use android.support.v7.app.ActionBar#setDisplayShowHomeEnabled() . 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   File: PlayerDetailsActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  AnimationUtil.setupActivityTransition(this);
  setContentView(R.layout.activity_player_details);
  ButterKnife.bind(this);
  setSupportActionBar(toolbar);
  ActionBar actionBar = checkNotNull(getSupportActionBar());
  actionBar.setDisplayShowHomeEnabled(true);
  actionBar.setDisplayHomeAsUpEnabled(true);

  if (savedInstanceState == null) {
    Intent intent = getIntent();
    player = intent.getParcelableExtra(EXTRA_PLAYER);
    club = intent.getParcelableExtra(EXTRA_CLUB);
  }

  LargePlayerViewHolder viewHolder = new LargePlayerViewHolder(rootLayout, club);
  viewHolder.bind(player);
  rootLayout.addView(viewHolder.itemView);

  colorizeToolbar(club, toolbar, colorPrimary);
}
 
Example 2
Source Project: Yahala-Messenger   File: ChatActivity.java    License: MIT License 6 votes vote down vote up
@Override
public void applySelfActionBar() {
    if (parentActivity == null) {
        return;
    }

    try {
        ActionBar actionBar = parentActivity.getSupportActionBar();
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayUseLogoEnabled(false);
        actionBar.setDisplayShowCustomEnabled(false);
        actionBar.setCustomView(null);
        updateSubtitle();
        ((LaunchActivity) parentActivity).fixBackButton();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 3
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings_about);
    setTitle(R.string.settings_about);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayUseLogoEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);

    TextView aboutVersion = (TextView)findViewById(R.id.about_version);
    aboutVersion.setText(RumbleApplication.BUILD_VERSION);


    TextView aboutProject = (TextView)findViewById(R.id.about_project);
    aboutProject.setText("DisruptedSystems (http://disruptedsystems.org/)");

    TextView aboutDeveloper = (TextView)findViewById(R.id.about_developer);
    aboutDeveloper.setText("Marlinski (http://marlinski.org/)");
}
 
Example 4
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_select_history_apps);

    // load DB
    DaoSession daoSession = ((DBApp) getApplication()).getDaoSession();
    reportEntityDao = daoSession.getReportEntityDao();

    ActionBar ab = getSupportActionBar();
    if (ab != null) {
        ab.setDisplayShowHomeEnabled(true);
    }

    selectedAppsPreferences = getSharedPreferences("SELECTEDAPPS", 0);
    editor = selectedAppsPreferences.edit();

    show_APP_list();

}
 
Example 5
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_display_options);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }

    MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment);
    if (mapFragment == null) {
        mapFragment = MapFragment.newInstance(new NaverMapOptions()
            .camera(new CameraPosition(NaverMap.DEFAULT_CAMERA_POSITION.target, 16, 40, 0))
            .enabledLayerGroups(NaverMap.LAYER_GROUP_BUILDING));
        getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit();
    }
    mapFragment.getMapAsync(this);
}
 
Example 6
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_map_fragment);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }

    MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment);
    if (mapFragment == null) {
        mapFragment = MapFragment.newInstance();
        getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit();
    }
    mapFragment.getMapAsync(this);
}
 
Example 7
@Override
public void onCreate(@Nullable final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setSupportActionBar(toolbar);

    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }

    final Intent intent = getIntent();
    if (intent == null) {
        throw new IllegalStateException("Missing intent");
    }
    final Item item = (Item) intent.getSerializableExtra(EXTRA_ITEM);
    if (item instanceof Weapon) {
        showFragment(WeaponDetailFragment.newInstance((Weapon) item), WeaponDetailFragment.TAG);
    } else if (item instanceof Ammo) {
        showFragment(AmmoDetailFragment.newInstance((Ammo) item), WeaponDetailFragment.TAG);
    } else {
        Toast.makeText(this, "We're still working on this feature!", Toast.LENGTH_SHORT).show();
        finish();
    }
}
 
Example 8
@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 9
Source Project: android-weather   File: MainActivity.java    License: MIT License 6 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        if (getSupportActionBar() != null) {
            ActionBar actionBar = getSupportActionBar();
            actionBar.setDisplayShowHomeEnabled(false);
            View mActionBarView = getLayoutInflater().inflate(R.layout.main_action_bar, null);
            actionBar.setCustomView(mActionBarView);
            actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
        }

        mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
//        mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MAX_TIME,
//                MAX_DISTANCE, mLocationListener);

        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container, new TenDayForecastFragment())
                    .commit();
        }
    }
 
Example 10
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings_debug);
    setTitle(R.string.settings_debug);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayUseLogoEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);

    CheckBox checkBox = (CheckBox)findViewById(R.id.debug_check_box);
    checkBox.setChecked(RumblePreferences.isLogcatDebugEnabled(this));
    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            RumblePreferences.setLogcatDebugging(DebugActivity.this, isChecked);
            EventLogger.getInstance().init();
        }
    });
}
 
Example 11
Source Project: rcloneExplorer   File: RemoteConfig.java    License: MIT License 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    applyTheme();
    setContentView(R.layout.activity_remote_config);
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }

    FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();

    if (savedInstanceState != null) {
        fragment = getSupportFragmentManager().findFragmentByTag("new config");
        if (fragment != null) {
            fragmentTransaction.replace(R.id.flFragment, fragment, "new config");
            fragmentTransaction.commit();

            String title = savedInstanceState.getString(OUTSTATE_TITLE);
            if (title != null) {
                getSupportActionBar().setTitle(title);
            }
            return;
        }
    }
    fragment = RemotesConfigList.newInstance();
    fragmentTransaction.replace(R.id.flFragment, fragment, "config list");
    fragmentTransaction.commit();
}
 
Example 12
Source Project: CycleViewPager   File: BaseActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar bar = getSupportActionBar();
    if (bar != null) {
        bar.setDisplayHomeAsUpEnabled(true);
        bar.setDisplayShowHomeEnabled(true);
    }

    TAG = getClass().getSimpleName();
}
 
Example 13
Source Project: droidkaigi2016   File: WebViewActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void initToolbar(@NonNull String title) {
    setSupportActionBar(binding.toolbar);

    ActionBar bar = getSupportActionBar();
    if (bar != null) {
        bar.setDisplayHomeAsUpEnabled(true);
        bar.setDisplayShowHomeEnabled(true);
        bar.setDisplayShowTitleEnabled(false);
        bar.setHomeButtonEnabled(true);
    }
    binding.toolbar.setTitle(title);
}
 
Example 14
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Configure ActionBar
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setElevation(0);
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayShowCustomEnabled(false);

        if (STYLE.getToolBarColor() != 0) {
            actionBar.setBackgroundDrawable(new ColorDrawable(STYLE.getToolBarColor()));
        }
    }

    // Setting basic content
    FrameLayout rootLayout = new FrameLayout(this);
    rootLayout.setLayoutParams(new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    rootLayout.setBackgroundColor(STYLE.getMainBackgroundColor());
    rootLayout.setId(R.id.content_frame);
    setContentView(rootLayout);

    // Setting Background Color
    getWindow().setBackgroundDrawable(new ColorDrawable(STYLE.getMainBackgroundColor()));
}
 
Example 15
Source Project: px-android   File: PaymentVaultActivity.java    License: MIT License 5 votes vote down vote up
private void initializeToolbar() {
    final Toolbar toolbar = findViewById(R.id.mpsdkToolbar);
    setSupportActionBar(toolbar);
    final ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null) {
        supportActionBar.setDisplayShowTitleEnabled(false);
        supportActionBar.setDisplayHomeAsUpEnabled(true);
        supportActionBar.setDisplayShowHomeEnabled(true);
    }

    toolbar.setNavigationOnClickListener(v -> onBackPressed());

    FontHelper.setFont(mAppBarLayout, PxFont.REGULAR);
}
 
Example 16
Source Project: NovelReader   File: BaseActivity.java    License: MIT License 5 votes vote down vote up
protected ActionBar supportActionBar(Toolbar toolbar){
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null){
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }
    mToolbar.setNavigationOnClickListener(
            (v) -> finish()
    );
    return actionBar;
}
 
Example 17
private void initToolbar(SearchGroup searchGroup) {
    setSupportActionBar(binding.toolbar);

    ActionBar bar = getSupportActionBar();
    if (bar != null) {
        bar.setDisplayHomeAsUpEnabled(true);
        bar.setDisplayShowHomeEnabled(true);
        bar.setDisplayShowTitleEnabled(false);
        bar.setHomeButtonEnabled(true);
    }

    binding.toolbar.setTitle(searchGroup.getName());
}
 
Example 18
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    Defaults.setupInitialValues(getApplicationContext(), getIntent());

    if (!Defaults.ACTIVITY_THEME.isEmpty()) {
    		setTheme(Utils.getR("style." + Defaults.ACTIVITY_THEME));
    }

    setupIds();
    setContentView(main_layout_id);

    isMultipleSelection = (1 != Defaults.MAX_IMAGE_SELECTION);
    isShapeCircle = Defaults.SHAPE_CIRCLE == Defaults.SHAPE;

    if (Build.VERSION.SDK_INT >= 21) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

        if (!Defaults.STATUS_BAR_COLOR.isEmpty()) {
        	window.setStatusBarColor(TiConvert.toColor(Defaults.STATUS_BAR_COLOR));
        }

        window.setBackgroundDrawable(TiConvert.toColorDrawable(Defaults.BACKGROUND_COLOR));
    }

    ActionBar actionBar = getSupportActionBar();

    if (actionBar != null) {
    		if (!Defaults.BAR_COLOR.isEmpty()) {
    			actionBar.setBackgroundDrawable(TiConvert.toColorDrawable(Defaults.BAR_COLOR));
        }

        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(Defaults.TITLE);

    } else {
    		Log.e(TAG, Defaults.ACTION_BAR_ERROR_MSG);
    }


    mRecyclerView = new RecyclerView(TiApplication.getInstance());
    mRecyclerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    mRecyclerView.setLayoutManager(new GridLayoutManager(ImagePickerActivity.this, Defaults.GRID_SIZE));

    FrameLayout frame_container = (FrameLayout) findViewById(container);
    frame_container.addView(mRecyclerView);
    frame_container.setBackgroundColor(TiConvert.toColor(Defaults.BACKGROUND_COLOR));

    adapterSet = new PhotoAdapter(adapter);
    mRecyclerView.setAdapter(adapterSet);

    if ( (1 == Defaults.SHOW_DIVIDER) && (!isShapeCircle) ) {
    	mRecyclerView.addItemDecoration(new DividerDecoration());
    }

    setupGlideOptions(); // set glide-options to apply on image

    // Get gallery photos in a new UI thread like AsyncTask to update UI changes properly
    new FetchImages().execute();
}
 
Example 19
Source Project: AnotherRSS   File: MainActivity.java    License: The Unlicense 4 votes vote down vote up
/**
 * Beinhaltet alle Start-Funktionen der App.
 * Funktionen:
 * <ul>
 *     <li>Alarm (neu) Starten</li>
 *     <li>Datenbank bereinigen (gelöschte Feeds entfernen)</li>
 *     <li>Ein BroadcastReceiver() wird registriert, um nach neuen Feeds durch den Alarm zu horchen</li>
 * </ul>
 * Außerdem wird das Icon in die ActionBar eingefügt.
 *
 * @param savedInstanceState
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(AnotherRSS.TAG, "onCreate");
    ctx = this;
    mPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());

    setContentView(R.layout.activity_main);
    umm = (UiModeManager) getSystemService(Context.UI_MODE_SERVICE);
    AnotherRSS.alarm.restart(this);;

    try {
        ActionBar ab = getSupportActionBar();
        if (ab != null) {
            ab.setDisplayShowHomeEnabled(true);
            ab.setHomeButtonEnabled(true);
            ab.setDisplayUseLogoEnabled(true);
            ab.setLogo(R.drawable.ic_launcher);
            ab.setTitle(" " + getString(R.string.app_name));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    alarmReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (action.equals(getString(R.string.serviceHasNews))) {
                int countNews = intent.getIntExtra("count", 0);
                Toast.makeText(
                        ctx,
                        getString(R.string.newFeeds) + ": " + countNews,
                        Toast.LENGTH_SHORT
                ).show();
            }
        }
    };

    videoView = (VideoView) findViewById(R.id.videoView);
    webView = (WebView) findViewById(R.id.webView);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);

    IntentFilter filter = new IntentFilter();
    filter.addAction(getString(R.string.serviceHasNews));
    registerReceiver(alarmReceiver, filter);
}
 
Example 20
@Override
public void onConfigureActionBar(ActionBar actionBar) {
    super.onConfigureActionBar(actionBar);

    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowCustomEnabled(true);

    // Loading Toolbar header views
    ActorStyle style = ActorSDK.sharedActor().style;
    barView = LayoutInflater.from(getActivity()).inflate(R.layout.bar_conversation, null);
    actionBar.setCustomView(barView, new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT));
    Toolbar parent = (Toolbar) barView.getParent();
    parent.setContentInsetsAbsolute(0, 0);

    barView.findViewById(R.id.home).setOnClickListener(v -> {
        Activity activity = getActivity();
        if (activity != null) {
            activity.onBackPressed();
        }
    });

    counter = (TextView) barView.findViewById(R.id.counter);

    counter.setTextColor(style.getDialogsCounterTextColor());
    counter.setBackgroundResource(R.drawable.ic_counter_circle);
    counter.getBackground().setColorFilter(style.getDialogsCounterBackgroundColor(), PorterDuff.Mode.MULTIPLY);
    barTitle = (TextView) barView.findViewById(R.id.title);
    barSubtitleContainer = barView.findViewById(R.id.subtitleContainer);
    barTypingIcon = (ImageView) barView.findViewById(R.id.typingImage);
    barTypingIcon.setImageDrawable(new TypingDrawable());
    barTyping = (TextView) barView.findViewById(R.id.typing);
    barSubtitle = (TextView) barView.findViewById(R.id.subtitle);
    barTypingContainer = barView.findViewById(R.id.typingContainer);
    barTypingContainer.setVisibility(View.INVISIBLE);
    barAvatar = (AvatarView) barView.findViewById(R.id.avatarPreview);
    barAvatar.init(Screen.dp(32), 18);

    barView.findViewById(R.id.titleContainer).setOnClickListener(v -> {
        if (peer.getPeerType() == PeerType.PRIVATE) {
            ActorSDKLauncher.startProfileActivity(getActivity(), peer.getPeerId());
        } else if (peer.getPeerType() == PeerType.GROUP) {
            ActorSDK.sharedActor().startGroupInfoActivity(getActivity(), peer.getPeerId());
        } else {
            // Nothing to do
        }
    });
}