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

The following are Jave code examples for showing how to use setHomeButtonEnabled() of the android.support.v7.app.ActionBar class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: wirtualnaApteczka   File: PreviewPhotoActivity.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_preview_photo);

    initializeMembers();

    Bitmap bitmap = PhotoUtils.prepareBitmap(photoUri, photoImage);
    photoImage.setImageBitmap(bitmap);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setTitle(R.string.medicine_photo);
    actionBar.show();
}
 
Example 2
Project: content-farm-blocker-android   File: MainActivity.java   View Source Code Vote up 6 votes
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_container);
	ButterKnife.bind(this);
	setSupportActionBar(toolbar);

	ActionBar ab = initActionBar(getSupportActionBar(), R.string.title_activity_main);
	ab.setDisplayHomeAsUpEnabled(false);
	ab.setHomeButtonEnabled(false);

	boolean isNoBrowser = false;
	if (getIntent() != null) {
		isNoBrowser = getIntent().getBooleanExtra("no_browser", false);
	}

	Fragment fragment = MainFragment.newInstance(isNoBrowser);
	FragmentManager fragmentManager = getSupportFragmentManager();
	fragmentManager.beginTransaction()
			.replace(R.id.container, fragment)
			.commit();
}
 
Example 3
Project: CatchSpy   File: EditActivity.java   View Source Code Vote up 5 votes
private void setAllView() {
    setContentView(R.layout.activity_edit);
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
    editListAdapter = new EditListAdapter(this, EditWordMethod.viewExtraWordList(ExtraWordsPath));
    RecyclerView recyclerView = findViewById(R.id.list_edit);
    recyclerView.setAdapter(editListAdapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
}
 
Example 4
Project: zxing_qrcode_demo   File: BaseActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

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

    mActivity = this;
}
 
Example 5
Project: CatchSpy   File: RuleActivity.java   View Source Code Vote up 5 votes
private void setAllView() {
    setContentView(R.layout.activity_rule);
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
    String data = IOMethod.getFromAssets(this, Config.DEFAULT_RULE_FILE_NAME);
    if (data != null) {
        ((TextView) findViewById(R.id.textview_rule)).setText(data);
    }
}
 
Example 6
Project: IslamicLibraryAndroid   File: BookInformationMoreDialogFragment.java   View Source Code Vote up 5 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.dialog_book_info_read_more, container, false);

    Bundle args = getArguments();
    String title = args.getString(KEY_DIALOG_FRAGMENT_TITLE, getResources().getString(R.string.authors));
    Toolbar toolbar = rootView.findViewById(R.id.toolbar);
    toolbar.setTitle(title);

    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);

    ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);

        Drawable drawable = getResources()
                .getDrawable(R.drawable.ic_close_white_24dp);
        drawable = DrawableCompat.wrap(drawable);
        DrawableCompat.setTint(drawable, Color.WHITE);
        actionBar.setHomeAsUpIndicator(drawable);
    }


    String body = args.getString(KEY_DIALOG_BODY, getResources().getString(R.string.authors));
    TextView bodyTextView = rootView.findViewById(R.id.more_dialog_body_text_view);
    bodyTextView.setText(body);
    setHasOptionsMenu(true);
    return rootView;
}
 
Example 7
Project: WiFiView   File: RestoreActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_restore);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);

    // address
    mAdView = (AdView) findViewById(R.id.adView1);
    mText = (TextView) findViewById(R.id.textView);
    mList = (ListView) findViewById(R.id.list1);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swiperefresh1);

    // ads
    MobileAds.initialize(this, "ca-app-pub-9646303341923759~9003031985");
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);

    show_list();

    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            mSwipeRefreshLayout.setRefreshing(true);
            refreshItems();
        }
    });

}
 
Example 8
Project: FormMaster   File: LoginFormActivity.java   View Source Code Vote up 5 votes
private void setupToolBar() {

        final ActionBar actionBar = getSupportActionBar();

        if (actionBar != null) {
            actionBar.setDisplayShowTitleEnabled(false);
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setHomeButtonEnabled(true);
        }

    }
 
Example 9
Project: UnforgetIt   File: AddTaskDialogFragment.java   View Source Code Vote up 5 votes
@Override
protected void createMenu() {
    Toolbar toolbar = (Toolbar) mRootView.findViewById(R.id.toolbar);
    toolbar.setTitle(R.string.add_title);

    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);

    ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);
        actionBar.setHomeAsUpIndicator(R.drawable.ic_clear_white_24dp);
    }
}
 
Example 10
Project: home-automation   File: MainActivity.java   View Source Code Vote up 5 votes
/**
 * Initialize the toolbar.
 */
private void initToolbar() {
    final Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);
    }
}
 
Example 11
Project: LifeSaver   File: Main4Activity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar actionBar=getSupportActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_black_24dp);
    actionBar.setDisplayShowHomeEnabled(true);
    setContentView(R.layout.activity_main4);
    go();
}
 
Example 12
Project: freehkkai-android   File: BaseActivity.java   View Source Code Vote up 5 votes
protected ActionBar initActionBar(ActionBar ab, int titleId, int subtitleId) {
	if (ab != null) {
		ab.setElevation(100);
		ab.setDisplayHomeAsUpEnabled(true);
		ab.setHomeButtonEnabled(true);
		ab.setTitle(titleId);

		if (subtitleId != 0) {
			ab.setSubtitle(subtitleId);
		}
	}
	return ab;
}
 
Example 13
Project: OSchina_resources_android   File: BaseBackActivity.java   View Source Code Vote up 5 votes
@Override
protected void initWindow() {
    super.initWindow();
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(false);
    }
}
 
Example 14
Project: Nird2   File: PanicPreferencesActivity.java   View Source Code Vote up 5 votes
@Override
public void onCreate(Bundle bundle) {
	super.onCreate(bundle);

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

	setContentView(R.layout.activity_panic_preferences);
}
 
Example 15
Project: LoriApp   File: BaseActivity.java   View Source Code Vote up 5 votes
protected void enableHomeUp() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
Example 16
Project: OSchina_resources_android   File: BackActivity.java   View Source Code Vote up 5 votes
@Override
protected void initWindow() {
    super.initWindow();
    mToolBar = (Toolbar) findViewById(R.id.toolbar);
    if (mToolBar != null) {
        setSupportActionBar(mToolBar);
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setHomeButtonEnabled(false);
        }
    }
}
 
Example 17
Project: Nird2   File: SettingsActivity.java   View Source Code Vote up 5 votes
@Override
public void onCreate(Bundle bundle) {
	super.onCreate(bundle);

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

	setContentView(R.layout.activity_settings);
}
 
Example 18
Project: androidgithub   File: PTActivity.java   View Source Code Vote up 5 votes
@Override
    protected final void onCreate(@Nullable Bundle savedInstanceState) {
        // define the IconicsLayoutInflater
        // this is compatible with calligraphy and other libs which wrap the baseContext
        LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
        super.onCreate(savedInstanceState);

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

        mActivity = this;
        mApplication = (PTApplication) getApplication();
        mBundle = getIntent().getExtras() != null ? getIntent().getExtras() : new Bundle();
        unbinder = ButterKnife.bind(this);
        mLoadingView = new LoadingView(this, getLoadingMessage());
//        loadState = (ILoadState) findViewById(R.id.load_state_view);
//        mPTLoading = new PTLoading.Builder(this)
//                .setCanceledOnTouchOutside(false)
//                .setIcon(R.drawable.button_loading_icon)
//                .setMsg(getString(R.string.loading_data))
//                .build();
//        mPTToast = new PTToast.Builder(this)
//                .setShowTime(1300)
//                .build();
        if (useEventBus())
            EventBusUtils.register(this);
        onViewCreated(savedInstanceState);
    }
 
Example 19
Project: simple-stack   File: MortarDemoActivity.java   View Source Code Vote up 4 votes
@Override
public void setUpButtonEnabled(boolean enabled) {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(enabled);
    actionBar.setHomeButtonEnabled(enabled);
}
 
Example 20
Project: TrackPlan-app   File: Main99Activity.java   View Source Code Vote up 4 votes
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main99);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        ActionBar actionBar=getSupportActionBar();
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_black_24dp);
        actionBar.setDisplayShowHomeEnabled(true);
        stringArrayList= new ArrayList<String>();

        DesertPlaceholder desertPlaceholder = (DesertPlaceholder) findViewById(R.id.placeholder);
        desertPlaceholder.setOnButtonClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // do stuff

            }
        });



        listView=(ListView) findViewById(R.id.listView65);

        checkdata();
        lviewAdapter=new ListViewAdapterAttendance(this,stringArrayList);
        listView.setAdapter(lviewAdapter);
        TextView t=(TextView)findViewById(R.id.textView59);
if(lviewAdapter.isEmpty())
{t.setVisibility(View.INVISIBLE);
   desertPlaceholder.setVisibility(View.VISIBLE);
}
else {
    desertPlaceholder.setVisibility(View.GONE);
t.setVisibility(View.VISIBLE);
}







    }