use of androidx.appcompat.app.ActionBar in project Tehreer-Android by mta452.
the class VariableFontsActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_variable_fonts);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
mVariableInstanceSpinner = findViewById(R.id.spinner_variable_instance);
mVariableInstanceSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
InstanceAdapter instanceAdapter = (InstanceAdapter) adapterView.getAdapter();
setupTypeface(instanceAdapter.getItem(i));
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
mColorPaletteSpinner = findViewById(R.id.spinner_color_palette);
mColorPaletteSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
ColorPaletteAdapter paletteAdapter = (ColorPaletteAdapter) adapterView.getAdapter();
setupPalette(paletteAdapter.getItem(i).colors());
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
Spinner variableFontSpinner = findViewById(R.id.spinner_variable_font);
variableFontSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
VariableFontAdapter fontAdapter = (VariableFontAdapter) adapterView.getAdapter();
setupFont(fontAdapter.getFontFile(i));
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
variableFontSpinner.setAdapter(new VariableFontAdapter(this));
variableFontSpinner.setSelection(0);
ListView listViewAxis = findViewById(R.id.list_view_axis);
listViewAxis.setAdapter(mAxisAdapter);
mPreviewLabel = findViewById(R.id.label_preview);
}
use of androidx.appcompat.app.ActionBar in project apps-android-commons by commons-app.
the class MediaDetailPagerFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_media_detail_pager, container, false);
ButterKnife.bind(this, view);
pager.addOnPageChangeListener(this);
adapter = new MediaDetailAdapter(getChildFragmentManager());
((BaseActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (getActivity() != null) {
final ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
pager.setAdapter(adapter);
if (savedInstanceState != null) {
final int pageNumber = savedInstanceState.getInt("current-page");
pager.setCurrentItem(pageNumber, false);
getActivity().invalidateOptionsMenu();
}
adapter.notifyDataSetChanged();
if (getActivity() instanceof MainActivity) {
((MainActivity) getActivity()).hideTabs();
}
return view;
}
use of androidx.appcompat.app.ActionBar in project apps-android-commons by commons-app.
the class LocationPickerActivity method onCreate.
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.hide();
}
setContentView(R.layout.activity_location_picker);
if (savedInstanceState == null) {
cameraPosition = getIntent().getParcelableExtra(LocationPickerConstants.MAP_CAMERA_POSITION);
activity = getIntent().getStringExtra(LocationPickerConstants.ACTIVITY_KEY);
}
final LocationPickerViewModel viewModel = new ViewModelProvider(this).get(LocationPickerViewModel.class);
viewModel.getResult().observe(this, this);
bindViews();
addBackButtonListener();
addPlaceSelectedButton();
addCredits();
getToolbarUI();
if (activity.equals("UploadActivity")) {
placeSelectedButton.setVisibility(View.GONE);
modifyLocationButton.setVisibility(View.VISIBLE);
showInMapButton.setVisibility(View.VISIBLE);
largeToolbarText.setText(getResources().getString(R.string.image_location));
smallToolbarText.setText(getResources().getString(R.string.check_whether_location_is_correct));
}
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
}
use of androidx.appcompat.app.ActionBar in project AmazeFileManager by TeamAmaze.
the class ErrorActivity method onCreate.
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_error);
final Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final Intent intent = getIntent();
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(R.string.error_report_title);
actionBar.setDisplayShowTitleEnabled(true);
}
final Button reportEmailButton = findViewById(R.id.errorReportEmailButton);
final Button reportTelegramButton = findViewById(R.id.errorReportTelegramButton);
final Button copyButton = findViewById(R.id.errorReportCopyButton);
final Button reportGithubButton = findViewById(R.id.errorReportGitHubButton);
userCommentBox = findViewById(R.id.errorCommentBox);
final TextView errorView = findViewById(R.id.errorView);
final TextView errorMessageView = findViewById(R.id.errorMessageView);
returnActivity = MainActivity.class;
errorInfo = intent.getParcelableExtra(ERROR_INFO);
errorList = intent.getStringArrayExtra(ERROR_LIST);
// important add guru meditation
addGuruMeditation();
currentTimeStamp = getCurrentTimeStamp();
reportEmailButton.setOnClickListener((View v) -> sendReportEmail());
reportTelegramButton.setOnClickListener((View v) -> {
FileUtils.copyToClipboard(this, buildMarkdown());
Toast.makeText(this, R.string.crash_report_copied, Toast.LENGTH_SHORT).show();
Utils.openTelegramURL(this);
});
copyButton.setOnClickListener((View v) -> {
FileUtils.copyToClipboard(this, buildMarkdown());
Toast.makeText(this, R.string.crash_report_copied, Toast.LENGTH_SHORT).show();
});
reportGithubButton.setOnClickListener((View v) -> {
FileUtils.copyToClipboard(this, buildMarkdown());
Toast.makeText(this, R.string.crash_report_copied, Toast.LENGTH_SHORT).show();
Utils.openURL(ERROR_GITHUB_ISSUE_URL, this);
});
// normal bugreport
buildInfo(errorInfo);
if (errorInfo.message != 0) {
errorMessageView.setText(errorInfo.message);
} else {
errorMessageView.setVisibility(View.GONE);
findViewById(R.id.messageWhatHappenedView).setVisibility(View.GONE);
}
errorView.setText(formErrorText(errorList));
// print stack trace once again for debugging:
for (final String e : errorList) {
Log.e(TAG, e);
}
initStatusBarResources(findViewById(R.id.parent_view));
}
use of androidx.appcompat.app.ActionBar in project SwipeRecyclerView by yanzhenjie.
the class MenuActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_group_menu);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
assert actionBar != null;
actionBar.setDisplayHomeAsUpEnabled(true);
SwipeRecyclerView recyclerView = findViewById(R.id.recycler_view);
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.addItemDecoration(new DefaultItemDecoration(ContextCompat.getColor(this, R.color.divider_color)));
recyclerView.setSwipeMenuCreator(mSwipeMenuCreator);
mAdapter = new GroupAdapter();
recyclerView.setAdapter(mAdapter);
mAdapter.setListItems(createDataList());
}
Aggregations