Search in sources :

Example 61 with ActionBar

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);
}
Also used : Spinner(android.widget.Spinner) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) ActionBar(androidx.appcompat.app.ActionBar)

Example 62 with ActionBar

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;
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) MainActivity(fr.free.nrw.commons.contributions.MainActivity) BindView(butterknife.BindView) View(android.view.View) ActionBar(androidx.appcompat.app.ActionBar) SuppressLint(android.annotation.SuppressLint)

Example 63 with ActionBar

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);
}
Also used : ActionBar(androidx.appcompat.app.ActionBar) ViewModelProvider(androidx.lifecycle.ViewModelProvider)

Example 64 with ActionBar

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));
}
Also used : Button(android.widget.Button) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) TextView(android.widget.TextView) ActionBar(androidx.appcompat.app.ActionBar) Toolbar(androidx.appcompat.widget.Toolbar)

Example 65 with ActionBar

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());
}
Also used : DefaultItemDecoration(com.yanzhenjie.recyclerview.widget.DefaultItemDecoration) SwipeRecyclerView(com.yanzhenjie.recyclerview.SwipeRecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) ActionBar(androidx.appcompat.app.ActionBar) Toolbar(androidx.appcompat.widget.Toolbar)

Aggregations

ActionBar (androidx.appcompat.app.ActionBar)139 View (android.view.View)30 Toolbar (androidx.appcompat.widget.Toolbar)29 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)26 TextView (android.widget.TextView)18 Intent (android.content.Intent)11 Bundle (android.os.Bundle)11 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)8 SuppressLint (android.annotation.SuppressLint)7 AdapterView (android.widget.AdapterView)7 ImageView (android.widget.ImageView)7 Uri (android.net.Uri)6 DefaultItemDecoration (com.yanzhenjie.recyclerview.widget.DefaultItemDecoration)6 SharedPreferences (android.content.SharedPreferences)5 ListView (android.widget.ListView)5 Spinner (android.widget.Spinner)5 Typeface (com.mta.tehreer.graphics.Typeface)5 File (java.io.File)5 MenuItem (android.view.MenuItem)4 Button (android.widget.Button)4