Search in sources :

Example 21 with Toolbar

use of androidx.appcompat.widget.Toolbar in project ETSMobile-Android2 by ApplETS.

the class MoodleAssignmentsActivity method setUpTitleBar.

private void setUpTitleBar() {
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(getString(R.string.moodle_assignments_title));
    actionBar.setDisplayHomeAsUpEnabled(true);
    toolbar.setNavigationOnClickListener(v -> onBackPressed());
}
Also used : ActionBar(androidx.appcompat.app.ActionBar) Toolbar(androidx.appcompat.widget.Toolbar)

Example 22 with Toolbar

use of androidx.appcompat.widget.Toolbar in project AntennaPod by AntennaPod.

the class AddFeedFragment method onCreateView.

@Override
@Nullable
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    viewBinding = AddfeedBinding.inflate(getLayoutInflater());
    activity = (MainActivity) getActivity();
    Toolbar toolbar = viewBinding.toolbar;
    displayUpArrow = getParentFragmentManager().getBackStackEntryCount() != 0;
    if (savedInstanceState != null) {
        displayUpArrow = savedInstanceState.getBoolean(KEY_UP_ARROW);
    }
    ((MainActivity) getActivity()).setupToolbarToggle(toolbar, displayUpArrow);
    viewBinding.searchItunesButton.setOnClickListener(v -> activity.loadChildFragment(OnlineSearchFragment.newInstance(ItunesPodcastSearcher.class)));
    viewBinding.searchFyydButton.setOnClickListener(v -> activity.loadChildFragment(OnlineSearchFragment.newInstance(FyydPodcastSearcher.class)));
    viewBinding.searchGPodderButton.setOnClickListener(v -> activity.loadChildFragment(new GpodnetMainFragment()));
    viewBinding.searchPodcastIndexButton.setOnClickListener(v -> activity.loadChildFragment(OnlineSearchFragment.newInstance(PodcastIndexPodcastSearcher.class)));
    viewBinding.combinedFeedSearchEditText.setOnEditorActionListener((v, actionId, event) -> {
        performSearch();
        return true;
    });
    viewBinding.addViaUrlButton.setOnClickListener(v -> showAddViaUrlDialog());
    viewBinding.opmlImportButton.setOnClickListener(v -> {
        try {
            chooseOpmlImportPathLauncher.launch("*/*");
        } catch (ActivityNotFoundException e) {
            e.printStackTrace();
            ((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.unable_to_start_system_file_manager, Snackbar.LENGTH_LONG);
        }
    });
    viewBinding.addLocalFolderButton.setOnClickListener(v -> {
        if (Build.VERSION.SDK_INT < 21) {
            return;
        }
        try {
            addLocalFolderLauncher.launch(null);
        } catch (ActivityNotFoundException e) {
            e.printStackTrace();
            ((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.unable_to_start_system_file_manager, Snackbar.LENGTH_LONG);
        }
    });
    if (Build.VERSION.SDK_INT < 21) {
        viewBinding.addLocalFolderButton.setVisibility(View.GONE);
    }
    viewBinding.searchButton.setOnClickListener(view -> performSearch());
    return viewBinding.getRoot();
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) MainActivity(de.danoeh.antennapod.activity.MainActivity) Toolbar(androidx.appcompat.widget.Toolbar) GpodnetMainFragment(de.danoeh.antennapod.fragment.gpodnet.GpodnetMainFragment) Nullable(androidx.annotation.Nullable)

Example 23 with Toolbar

use of androidx.appcompat.widget.Toolbar in project AntennaPod by AntennaPod.

the class CompletedDownloadsFragment method onCreateView.

@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.simple_list_fragment, container, false);
    Toolbar toolbar = root.findViewById(R.id.toolbar);
    toolbar.setVisibility(View.GONE);
    recyclerView = root.findViewById(R.id.recyclerView);
    recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool());
    adapter = new CompletedDownloadsListAdapter((MainActivity) getActivity());
    adapter.setOnSelectModeListener(this);
    recyclerView.setAdapter(adapter);
    progressBar = root.findViewById(R.id.progLoading);
    speedDialView = root.findViewById(R.id.fabSD);
    speedDialView.setOverlayLayout(root.findViewById(R.id.fabSDOverlay));
    speedDialView.inflate(R.menu.episodes_apply_action_speeddial);
    speedDialView.removeActionItemById(R.id.download_batch);
    speedDialView.removeActionItemById(R.id.mark_read_batch);
    speedDialView.removeActionItemById(R.id.mark_unread_batch);
    speedDialView.removeActionItemById(R.id.remove_from_queue_batch);
    speedDialView.setOnChangeListener(new SpeedDialView.OnChangeListener() {

        @Override
        public boolean onMainActionSelected() {
            return false;
        }

        @Override
        public void onToggleChanged(boolean open) {
            if (open && adapter.getSelectedCount() == 0) {
                ((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.no_items_selected, Snackbar.LENGTH_SHORT);
                speedDialView.close();
            }
        }
    });
    speedDialView.setOnActionSelectedListener(actionItem -> {
        new EpisodeMultiSelectActionHandler(((MainActivity) getActivity()), adapter.getSelectedItems()).handleAction(actionItem.getId());
        adapter.endSelectMode();
        return true;
    });
    addEmptyView();
    EventBus.getDefault().register(this);
    return root;
}
Also used : EpisodeMultiSelectActionHandler(de.danoeh.antennapod.fragment.actions.EpisodeMultiSelectActionHandler) MainActivity(de.danoeh.antennapod.activity.MainActivity) SpeedDialView(com.leinardi.android.speeddial.SpeedDialView) EpisodeItemListRecyclerView(de.danoeh.antennapod.view.EpisodeItemListRecyclerView) View(android.view.View) SpeedDialView(com.leinardi.android.speeddial.SpeedDialView) Toolbar(androidx.appcompat.widget.Toolbar)

Example 24 with Toolbar

use of androidx.appcompat.widget.Toolbar in project AntennaPod by AntennaPod.

the class EpisodesFragment method onCreateView.

public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View rootView = inflater.inflate(R.layout.pager_fragment, container, false);
    Toolbar toolbar = rootView.findViewById(R.id.toolbar);
    toolbar.setTitle(R.string.episodes_label);
    toolbar.inflateMenu(R.menu.episodes);
    displayUpArrow = getParentFragmentManager().getBackStackEntryCount() != 0;
    if (savedInstanceState != null) {
        displayUpArrow = savedInstanceState.getBoolean(KEY_UP_ARROW);
    }
    ((MainActivity) getActivity()).setupToolbarToggle(toolbar, displayUpArrow);
    ViewPager2 viewPager = rootView.findViewById(R.id.viewpager);
    viewPager.setAdapter(new EpisodesPagerAdapter(this));
    viewPager.setOffscreenPageLimit(2);
    super.setupPagedToolbar(toolbar, viewPager);
    // Give the TabLayout the ViewPager
    tabLayout = rootView.findViewById(R.id.sliding_tabs);
    new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> {
        switch(position) {
            case POS_NEW_EPISODES:
                tab.setText(R.string.new_episodes_label);
                break;
            case POS_ALL_EPISODES:
                tab.setText(R.string.all_episodes_short_label);
                break;
            case POS_FAV_EPISODES:
                tab.setText(R.string.favorite_episodes_label);
                break;
            default:
                break;
        }
    }).attach();
    // restore our last position
    SharedPreferences prefs = getActivity().getSharedPreferences(TAG, Context.MODE_PRIVATE);
    int lastPosition = prefs.getInt(PREF_LAST_TAB_POSITION, 0);
    viewPager.setCurrentItem(lastPosition, false);
    return rootView;
}
Also used : ViewPager2(androidx.viewpager2.widget.ViewPager2) Context(android.content.Context) Bundle(android.os.Bundle) TabLayout(com.google.android.material.tabs.TabLayout) LayoutInflater(android.view.LayoutInflater) NonNull(androidx.annotation.NonNull) R(de.danoeh.antennapod.R) ViewPager2(androidx.viewpager2.widget.ViewPager2) ViewGroup(android.view.ViewGroup) FragmentStateAdapter(androidx.viewpager2.adapter.FragmentStateAdapter) MainActivity(de.danoeh.antennapod.activity.MainActivity) SharedPreferences(android.content.SharedPreferences) Fragment(androidx.fragment.app.Fragment) View(android.view.View) Toolbar(androidx.appcompat.widget.Toolbar) TabLayoutMediator(com.google.android.material.tabs.TabLayoutMediator) SharedPreferences(android.content.SharedPreferences) TabLayoutMediator(com.google.android.material.tabs.TabLayoutMediator) MainActivity(de.danoeh.antennapod.activity.MainActivity) View(android.view.View) Toolbar(androidx.appcompat.widget.Toolbar)

Example 25 with Toolbar

use of androidx.appcompat.widget.Toolbar in project kcanotify by antest1.

the class UpdateCheckActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_rescheck);
    Intent intent = this.getIntent();
    if (intent != null && intent.getExtras() != null) {
        main_flag = intent.getExtras().getBoolean("main_flag", false);
    }
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle(getResources().getString(R.string.setting_menu_kand_title_game_data_down));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    dbHelper = new KcaDBHelper(getApplicationContext(), null, KCANOTIFY_DB_VERSION);
    KcaApiData.setDBHelper(dbHelper);
    downloader = KcaUtils.getInfoDownloader(getApplicationContext());
    FetchConfiguration fetchConfiguration = new FetchConfiguration.Builder(getApplicationContext()).setDownloadConcurrentLimit(80).build();
    fetch = Fetch.Impl.getInstance(fetchConfiguration);
    handler = new UpdateHandler(this);
    gamedata_adapter.setHandler(handler);
    resource_adapter.setHandler(handler);
    checkstart_chkbox = findViewById(R.id.reschk_checkatstart);
    checkstart_chkbox.setText(getStringWithLocale(R.string.download_setting_checkatstart));
    checkstart_chkbox.setChecked(getBooleanPreferences(getApplicationContext(), PREF_CHECK_UPDATE_START));
    checkstart_chkbox.setOnCheckedChangeListener((buttonView, isChecked) -> setPreferences(getApplicationContext(), PREF_CHECK_UPDATE_START, isChecked));
    localonly_chkbox = findViewById(R.id.reschk_local);
    localonly_chkbox.setText(getStringWithLocale(R.string.download_use_internal_data));
    localonly_chkbox.setChecked(getBooleanPreferences(getApplicationContext(), PREF_RES_USELOCAL));
    localonly_chkbox.setOnCheckedChangeListener((buttonView, isChecked) -> setPreferences(getApplicationContext(), PREF_RES_USELOCAL, isChecked));
    resource_reset = findViewById(R.id.reschk_reset);
    resource_reset.setText(getStringWithLocale(R.string.download_reset));
    resource_reset.setOnCheckedChangeListener((buttonView, isChecked) -> {
        if (isChecked) {
            AlertDialog.Builder alertDialog = new AlertDialog.Builder(UpdateCheckActivity.this);
            alertDialog.setMessage(getString(R.string.download_reset_message));
            alertDialog.setPositiveButton(getStringWithLocale(R.string.dialog_ok), (dialog, which) -> {
                dbHelper.clearResVer();
                setPreferences(getApplicationContext(), PREF_KCARESOURCE_VERSION, 0);
                Intent mainIntent = new Intent(this, InitStartActivity.class);
                mainIntent.putExtra(ACTION_RESET, true);
                startActivity(mainIntent);
                finish();
            });
            alertDialog.setNegativeButton(getStringWithLocale(R.string.dialog_cancel), (dialog, which) -> {
                resource_reset.setChecked(false);
                dialog.dismiss();
            });
            AlertDialog alert = alertDialog.create();
            alert.setIcon(R.mipmap.ic_launcher);
            alert.show();
        }
    });
    data_list = findViewById(R.id.gamedata_list);
    resource_list = findViewById(R.id.resources_list);
    data_list.setAdapter(gamedata_adapter);
    resource_list.setAdapter(resource_adapter);
    gamedata_load = findViewById(R.id.gamedata_loading);
    resource_load = findViewById(R.id.resources_loading);
    gamedata_chk = findViewById(R.id.gamedata_updatecheck);
    resource_chk = findViewById(R.id.resources_updatecheck);
    resource_downall = findViewById(R.id.resources_downloadall);
    gamedata_chk.setOnClickListener(v -> checkVersionUpdate());
    resource_chk.setOnClickListener(v -> checkResourceUpdate());
    resource_downall.setOnClickListener(v -> downloadAllResources());
    resource_downall.setVisibility(View.GONE);
    gamedata_server = findViewById(R.id.gamedata_server);
    gamedata_server.setText(getStringWithLocale(R.string.action_server));
    gamedata_server.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            final int initValue = checked;
            String[] listItems = getResources().getStringArray(R.array.ServerLocation);
            String[] listEntry = getResources().getStringArray(R.array.ServerLocationValue);
            AlertDialog.Builder mBuilder = new AlertDialog.Builder(UpdateCheckActivity.this);
            mBuilder.setTitle(getStringWithLocale(R.string.setting_menu_app_title_updatecheckserver));
            String currentServer = getStringPreferences(getApplicationContext(), PREF_UPDATE_SERVER);
            for (int i = 0; i < listEntry.length; i++) if (currentServer.equals(listEntry[i])) {
                checked = i;
                break;
            }
            mBuilder.setSingleChoiceItems(listItems, checked, (dialog, which) -> {
                checked = which;
            });
            mBuilder.setPositiveButton(getStringWithLocale(R.string.dialog_ok), (dialog, which) -> {
                Log.e("KCA", "selected: " + checked);
                if (checked != -1) {
                    String selectedServer = listEntry[checked];
                    setPreferences(getApplicationContext(), PREF_UPDATE_SERVER, selectedServer);
                }
            });
            mBuilder.setNegativeButton(getStringWithLocale(R.string.dialog_cancel), ((dialog, which) -> {
                checked = initValue;
            }));
            AlertDialog mDialog = mBuilder.create();
            mDialog.show();
        }
    });
    checkVersionUpdate();
    checkResourceUpdate();
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) JsonObject(com.google.gson.JsonObject) Bundle(android.os.Bundle) TypeToken(com.google.gson.reflect.TypeToken) NonNull(androidx.annotation.NonNull) FetchListener(com.tonyodev.fetch2.FetchListener) PREF_KCARESOURCE_VERSION(com.antest1.kcanotify.KcaConstants.PREF_KCARESOURCE_VERSION) PREF_RES_USELOCAL(com.antest1.kcanotify.KcaConstants.PREF_RES_USELOCAL) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) CheckBox(android.widget.CheckBox) Gson(com.google.gson.Gson) Locale(java.util.Locale) DB_KEY_STARTDATA(com.antest1.kcanotify.KcaConstants.DB_KEY_STARTDATA) Handler(android.os.Handler) View(android.view.View) PREF_CHECK_UPDATE_START(com.antest1.kcanotify.KcaConstants.PREF_CHECK_UPDATE_START) ERROR_TYPE_SETTING(com.antest1.kcanotify.KcaConstants.ERROR_TYPE_SETTING) Log(android.util.Log) AsyncTask(android.os.AsyncTask) KcaApiData.loadTranslationData(com.antest1.kcanotify.KcaApiData.loadTranslationData) KcaUtils.getStringPreferences(com.antest1.kcanotify.KcaUtils.getStringPreferences) FetchConfiguration(com.tonyodev.fetch2.FetchConfiguration) JsonArray(com.google.gson.JsonArray) List(java.util.List) KcaUtils.getStringFromException(com.antest1.kcanotify.KcaUtils.getStringFromException) TextView(android.widget.TextView) Message(android.os.Message) Type(java.lang.reflect.Type) KcaUtils.compareVersion(com.antest1.kcanotify.KcaUtils.compareVersion) Toolbar(androidx.appcompat.widget.Toolbar) ListView(android.widget.ListView) Download(com.tonyodev.fetch2.Download) NotNull(org.jetbrains.annotations.NotNull) Call(retrofit2.Call) KcaUtils.getBooleanPreferences(com.antest1.kcanotify.KcaUtils.getBooleanPreferences) Fetch(com.tonyodev.fetch2.Fetch) Context(android.content.Context) AlertDialog(androidx.appcompat.app.AlertDialog) Intent(android.content.Intent) KCANOTIFY_DB_VERSION(com.antest1.kcanotify.KcaConstants.KCANOTIFY_DB_VERSION) Response(retrofit2.Response) JsonParser(com.google.gson.JsonParser) ACTION_RESET(com.antest1.kcanotify.InitStartActivity.ACTION_RESET) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) PREF_UPDATE_SERVER(com.antest1.kcanotify.KcaConstants.PREF_UPDATE_SERVER) Toast(android.widget.Toast) PREF_KCA_LANGUAGE(com.antest1.kcanotify.KcaConstants.PREF_KCA_LANGUAGE) PREF_KCA_DATA_VERSION(com.antest1.kcanotify.KcaConstants.PREF_KCA_DATA_VERSION) ContextWrapper(android.content.ContextWrapper) Build(android.os.Build) WeakReference(java.lang.ref.WeakReference) PREF_KCA_VERSION(com.antest1.kcanotify.KcaConstants.PREF_KCA_VERSION) RESCHK_KEY(com.antest1.kcanotify.KcaResCheckItemAdpater.RESCHK_KEY) ProgressDialog(android.app.ProgressDialog) File(java.io.File) PREF_FAIRY_DOWN_FLAG(com.antest1.kcanotify.KcaConstants.PREF_FAIRY_DOWN_FLAG) Callback(retrofit2.Callback) Configuration(android.content.res.Configuration) KcaUtils.setPreferences(com.antest1.kcanotify.KcaUtils.setPreferences) Request(com.tonyodev.fetch2.Request) Activity(android.app.Activity) Intent(android.content.Intent) FetchConfiguration(com.tonyodev.fetch2.FetchConfiguration) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView)

Aggregations

Toolbar (androidx.appcompat.widget.Toolbar)271 View (android.view.View)110 TextView (android.widget.TextView)55 RecyclerView (androidx.recyclerview.widget.RecyclerView)44 Bundle (android.os.Bundle)42 NonNull (androidx.annotation.NonNull)36 Intent (android.content.Intent)34 Fragment (androidx.fragment.app.Fragment)32 ActionBar (androidx.appcompat.app.ActionBar)29 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)29 Nullable (androidx.annotation.Nullable)28 BarPainter (com.xabber.android.ui.color.BarPainter)26 R (org.thoughtcrime.securesms.R)26 ViewGroup (android.view.ViewGroup)25 Context (android.content.Context)24 EditText (android.widget.EditText)22 MenuItem (android.view.MenuItem)21 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)20 Navigation (androidx.navigation.Navigation)20 Drawable (android.graphics.drawable.Drawable)18