Java Code Examples for android.app.ActionBar#setDisplayHomeAsUpEnabled()

The following examples show how to use android.app.ActionBar#setDisplayHomeAsUpEnabled() . 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: DConnectServiceListActivity.java    From DeviceConnect-Android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_service_list);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_HOME);
        actionBar.setTitle(R.string.activity_service_list_title);
    }

    mManualActivity = getSettingManualActivityClass();

    bindMessageService();
}
 
Example 2
Source File: WebViewActivity.java    From Bitocle with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.webview);

    Intent intent = getIntent();
    String title = intent.getStringExtra(getString(R.string.webview_intent_title));
    String subTitle = intent.getStringExtra(getString(R.string.webview_intent_subtitle));

    ActionBar actionBar = getActionBar();
    actionBar.setTitle(title);
    actionBar.setSubtitle(subTitle);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(true);

    fragment = (WebViewFragment) getSupportFragmentManager().findFragmentById(R.id.webview_fragment);
}
 
Example 3
Source File: DeveloperSettingFragment.java    From VIA-AI with MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Resources resource = getResources();

    // set name of actionbar.
    ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(resource.getString(R.string.prefTitle_Developer));
    }

    // load default value
    PreferenceManager.setDefaultValues(getActivity(), R.xml.pref_developer_setting, false);

    // config xml
    addPreferencesFromResource(R.xml.pref_developer_setting);
}
 
Example 4
Source File: MoreSettingsActivity.java    From Blackbulb with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    Settings settings = Settings.getInstance(this);

    if (settings.isDarkTheme()) {
        setTheme(android.R.style.Theme_Material);
    }

    super.onCreate(savedInstanceState);

    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setSubtitle(R.string.app_name);
    }

    getFragmentManager().beginTransaction()
            .replace(android.R.id.content, new SettingsFragment())
            .commit();
}
 
Example 5
Source File: PackagesSelectorActivity.java    From DocUIProxy-Android with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_packages_selector_content);

    final Intent intent = getIntent();
    if (intent != null) {
        mLastSelectedPackages = intent.getStringArrayListExtra(EXTRA_SELECTED);
    }

    final ActionBar actionBar = requireNonNull(getActionBar());
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeAsUpIndicator(R.drawable.ic_close_black_24dp);

    mRecyclerView = findViewById(android.R.id.list);
    mProgressBar = findViewById(android.R.id.progress);

    mAdapter.onRestoreInstanceState(savedInstanceState);
    mRecyclerView.setAdapter(mAdapter);

    if (savedInstanceState == null) {
        loadAppInfoListAsync();
    }
}
 
Example 6
Source File: SettingsFragment.java    From currency with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
                                     Preference preference)
{
    boolean result =
        super.onPreferenceTreeClick(preferenceScreen, preference);

    // Set home as up
    if (preference instanceof PreferenceScreen)
    {
        Dialog dialog = ((PreferenceScreen) preference).getDialog();
        ActionBar actionBar = dialog.getActionBar();
        actionBar.setDisplayHomeAsUpEnabled(false);
    }

    return result;
}
 
Example 7
Source File: LicensesActivity.java    From MoeGallery with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_licenses);

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

    webView = (WebView) findViewById(R.id.webView);
    webView.loadUrl("file:///android_res/raw/licenses.html");
}
 
Example 8
Source File: Preferences.java    From XInstaller with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent,
                         Bundle savedInstanceState) {
    super.onCreateView(inflater, parent, savedInstanceState);

    WebView v = new WebView(getActivity());

    ActionBar ab = getActivity().getActionBar();
    if (ab != null) {
        ab.setDisplayHomeAsUpEnabled(true);
        ab.setHomeButtonEnabled(true);
    }
    return v;
}
 
Example 9
Source File: ExampleDetailsActivity.java    From floating-action-button with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle state) {
    super.onCreate(state);

    setContentView(R.layout.a_example_details);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ActionBar ab = getActionBar();
        if (ab != null) {
            ab.setDisplayHomeAsUpEnabled(true);
        }
    }
}
 
Example 10
Source File: ShowLocationActivity.java    From ShareLocationPlugin with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

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

	setContentView(R.layout.show_locaction_activity);
	MapFragment fragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map_fragment);
	fragment.getMapAsync(this);
}
 
Example 11
Source File: ConfigurationActivity.java    From Noyze with Apache License 2.0 5 votes vote down vote up
public static void setupActionBar(Activity activity) {

        // Tint the status bar, if available.
        SystemBarTintManager tintManager = new SystemBarTintManager(activity);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setTintColor(activity.getResources().getColor(R.color.action_bar_dark));

        ActionBar actionBar = activity.getActionBar();
        if (null != actionBar) {
            actionBar.setIcon(DateUtils.AppIcon());
            actionBar.setDisplayHomeAsUpEnabled(!activity.isTaskRoot());
            actionBar.setDisplayShowTitleEnabled(true);
        }
    }
 
Example 12
Source File: SettingsActivity.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(final Bundle savedState) {
    super.onCreate(savedState);
    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);
    }
}
 
Example 13
Source File: SettingsActivity.java    From Android-Keyboard with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(final Bundle savedState) {
    super.onCreate(savedState);
    final ActionBar actionBar = getActionBar();
    final Intent intent = getIntent();
    if (actionBar != null) {
        mShowHomeAsUp = intent.getBooleanExtra(EXTRA_SHOW_HOME_AS_UP, true);
        actionBar.setDisplayHomeAsUpEnabled(mShowHomeAsUp);
        actionBar.setHomeButtonEnabled(mShowHomeAsUp);
    }
    StatsUtils.onSettingsActivity(
            intent.hasExtra(EXTRA_ENTRY_KEY) ? intent.getStringExtra(EXTRA_ENTRY_KEY)
                    : EXTRA_ENTRY_VALUE_SYSTEM_SETTINGS);
}
 
Example 14
Source File: SystemSettingFragment.java    From VIA-AI with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);

    // set name of actionbar.
    ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(getResources().getString(R.string.prefTitle_System));
    }
    return view;
}
 
Example 15
Source File: DisplayActivity.java    From AndroidPerformanceMonitor with Apache License 2.0 5 votes vote down vote up
private void renderBlockDetail(final BlockInfoEx blockInfo) {
    ListAdapter listAdapter = mListView.getAdapter();
    final DetailAdapter adapter;
    if (listAdapter instanceof DetailAdapter) {
        adapter = (DetailAdapter) listAdapter;
    } else {
        adapter = new DetailAdapter();
        mListView.setAdapter(adapter);
        mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                adapter.toggleRow(position);
            }
        });
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            invalidateOptionsMenu();
            ActionBar actionBar = getActionBar();
            if (actionBar != null) {
                actionBar.setDisplayHomeAsUpEnabled(true);
            }
        }
        mActionButton.setVisibility(VISIBLE);
        mActionButton.setText(R.string.block_canary_delete);
    }
    mActionButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (blockInfo != null) {
                blockInfo.logFile.delete();
                mBlockStartTime = null;
                mBlockInfoEntries.remove(blockInfo);
                updateUi();
            }
        }
    });
    adapter.update(blockInfo);
    setTitle(getString(R.string.block_canary_class_has_blocked, blockInfo.timeCost));
}
 
Example 16
Source File: PreviewActivity.java    From something.apk with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.reply_preview_activity);
    ActionBar ab = getActionBar();
    if(ab != null){
        ab.setHomeButtonEnabled(true);
        ab.setDisplayHomeAsUpEnabled(true);
    }
}
 
Example 17
Source File: CoreMaterialActivity.java    From MaterialDesignSupport with MIT License 5 votes vote down vote up
private void setupActionBarAttributes() {
    final ActionBar actionBar = getActionBar();
    if (actionBar == null) {
        return;
    }

    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);
}
 
Example 18
Source File: OrderActivity.java    From HeadFirstAndroid with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_order);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
}
 
Example 19
Source File: CameraSettingFragment.java    From VIA-AI with MIT License 5 votes vote down vote up
@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      View view = super.onCreateView(inflater, container, savedInstanceState);
//      view.setBackgroundColor(getResources().getColor(R.color.prefBkg_CameraResource));

      // set name of actionbar.
      ActionBar actionBar = getActivity().getActionBar();
      if (actionBar != null) {
          actionBar.setDisplayHomeAsUpEnabled(true);
          actionBar.setTitle(getResources().getString(R.string.prefTitle_CameraSource));
      }
      return view;
  }
 
Example 20
Source File: SettingsActivity.java    From prettygoodmusicplayer with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayHomeAsUpEnabled(true);
}