Search in sources :

Example 36 with Toolbar

use of androidx.appcompat.widget.Toolbar in project xabber-android by redsolution.

the class ServerInfoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_server_info);
    final Intent intent = getIntent();
    AccountJid account = getAccount(intent);
    if (account == null) {
        finish();
        return;
    }
    accountItem = AccountManager.getInstance().getAccount(account);
    if (accountItem == null) {
        Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
        finish();
        return;
    }
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    toolbar.setTitle(accountItem.getConnection().getXMPPServiceDomain());
    BarPainter barPainter = new BarPainter(this, toolbar);
    barPainter.updateWithAccountName(account);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.server_info_recycler_view);
    serverInfoAdapter = new ServerInfoAdapter();
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(serverInfoAdapter);
    progressBar = findViewById(R.id.server_info_progress_bar);
    requestServerInfo();
}
Also used : ServerInfoAdapter(com.xabber.android.ui.adapter.ServerInfoAdapter) AccountJid(com.xabber.android.data.entity.AccountJid) Intent(android.content.Intent) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) Toolbar(androidx.appcompat.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 37 with Toolbar

use of androidx.appcompat.widget.Toolbar in project xabber-android by redsolution.

the class StatusEditActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing()) {
        return;
    }
    actionWithItem = null;
    setContentView(R.layout.activity_status);
    Toolbar toolbar = ToolbarHelper.setUpDefaultToolbar(this, null, R.drawable.ic_clear_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    toolbar.inflateMenu(R.menu.toolbar_set_status);
    toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            return onOptionsItemSelected(item);
        }
    });
    Intent intent = getIntent();
    account = StatusEditActivity.getAccount(intent);
    BarPainter barPainter = new BarPainter(this, toolbar);
    if (account != null) {
        barPainter.updateWithAccountName(account);
    } else {
        barPainter.setDefaultColor();
    }
    ListView listView = getListView();
    listView.setOnItemClickListener(this);
    registerForContextMenu(listView);
    adapter = new StatusEditorAdapter(this);
    View footerView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.status_history_footer, null, false);
    footerView.findViewById(R.id.clear_status_history_button).setOnClickListener(this);
    listView.addFooterView(footerView);
    setListAdapter(adapter);
    statusTextView = (EditText) findViewById(R.id.status_text);
    statusModeView = (Spinner) findViewById(R.id.status_icon);
    statusModeView.setAdapter(new StatusModeAdapter(this));
    savedStatusesTextView = findViewById(R.id.saved_statuses_textview);
    StatusMode statusMode;
    String statusText;
    if (savedInstanceState == null) {
        if (account == null) {
            statusMode = SettingsManager.statusMode();
            statusText = SettingsManager.statusText();
        } else {
            AccountItem accountItem = AccountManager.getInstance().getAccount(account);
            if (accountItem == null) {
                Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
                finish();
                return;
            }
            statusMode = accountItem.getFactualStatusMode();
            statusText = accountItem.getStatusText();
        }
    } else {
        statusMode = StatusMode.valueOf(savedInstanceState.getString(SAVED_MODE));
        statusText = savedInstanceState.getString(SAVED_TEXT);
    }
    showStatus(statusMode, statusText);
}
Also used : StatusMode(com.xabber.android.data.account.StatusMode) AccountItem(com.xabber.android.data.account.AccountItem) StatusEditorAdapter(com.xabber.android.ui.adapter.StatusEditorAdapter) MenuItem(android.view.MenuItem) Intent(android.content.Intent) StatusModeAdapter(com.xabber.android.ui.adapter.StatusModeAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) BarPainter(com.xabber.android.ui.color.BarPainter) ListView(android.widget.ListView) LayoutInflater(android.view.LayoutInflater) Toolbar(androidx.appcompat.widget.Toolbar)

Example 38 with Toolbar

use of androidx.appcompat.widget.Toolbar in project xabber-android by redsolution.

the class OccupantListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing()) {
        return;
    }
    account = getAccount(getIntent());
    room = getUser(getIntent()).getJid().asEntityBareJidIfPossible();
    if (account == null || room == null || !MUCManager.getInstance().hasRoom(account, room)) {
        Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND);
        finish();
        return;
    }
    setContentView(R.layout.list);
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NavUtils.navigateUpFromSameTask(OccupantListActivity.this);
        }
    });
    toolbar.setTitle(room);
    BarPainter barPainter = new BarPainter(this, toolbar);
    barPainter.updateWithAccountName(account);
    listAdapter = new OccupantListAdapter(this, account, room);
    setListAdapter(listAdapter);
    getListView().setOnItemClickListener(this);
}
Also used : OccupantListAdapter(com.xabber.android.ui.adapter.OccupantListAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) Toolbar(androidx.appcompat.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 39 with Toolbar

use of androidx.appcompat.widget.Toolbar in project Signal-Android by WhisperSystems.

the class PaymentsRecoveryPhraseConfirmFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    Toolbar toolbar = view.findViewById(R.id.payments_recovery_phrase_confirm_fragment_toolbar);
    EditText word1 = view.findViewById(R.id.payments_recovery_phrase_confirm_fragment_word_1);
    EditText word2 = view.findViewById(R.id.payments_recovery_phrase_confirm_fragment_word_2);
    View seePhraseAgain = view.findViewById(R.id.payments_recovery_phrase_confirm_fragment_see_again);
    View done = view.findViewById(R.id.payments_recovery_phrase_confirm_fragment_done);
    TextInputLayout wordWrapper1 = view.findViewById(R.id.payments_recovery_phrase_confirm_fragment_word1_wrapper);
    TextInputLayout wordWrapper2 = view.findViewById(R.id.payments_recovery_phrase_confirm_fragment_word2_wrapper);
    PaymentsRecoveryPhraseConfirmFragmentArgs args = PaymentsRecoveryPhraseConfirmFragmentArgs.fromBundle(requireArguments());
    validWordCheckMark = AppCompatResources.getDrawable(requireContext(), R.drawable.ic_check_circle_24);
    invalidWordX = AppCompatResources.getDrawable(requireContext(), R.drawable.ic_circle_x_24);
    DrawableCompat.setTint(validWordCheckMark, ContextCompat.getColor(requireContext(), R.color.signal_accent_green));
    DrawableCompat.setTint(invalidWordX, ContextCompat.getColor(requireContext(), R.color.signal_alert_primary));
    PaymentsRecoveryPhraseConfirmViewModel viewModel = ViewModelProviders.of(requireActivity()).get(PaymentsRecoveryPhraseConfirmViewModel.class);
    toolbar.setNavigationOnClickListener(v -> Navigation.findNavController(requireView()).popBackStack());
    word1.addTextChangedListener(new AfterTextChanged(e -> viewModel.validateWord1(e.toString())));
    word2.addTextChangedListener(new AfterTextChanged(e -> viewModel.validateWord2(e.toString())));
    seePhraseAgain.setOnClickListener(v -> Navigation.findNavController(requireView()).popBackStack());
    done.setOnClickListener(v -> {
        SignalStore.paymentsValues().setUserConfirmedMnemonic(true);
        ViewUtil.hideKeyboard(requireContext(), view);
        Toast.makeText(requireContext(), R.string.PaymentRecoveryPhraseConfirmFragment__recovery_phrase_confirmed, Toast.LENGTH_SHORT).show();
        if (args.getFinishOnConfirm()) {
            requireActivity().setResult(Activity.RESULT_OK);
            requireActivity().finish();
        } else {
            Navigation.findNavController(view).popBackStack(R.id.paymentsHome, false);
        }
    });
    viewModel.getViewState().observe(getViewLifecycleOwner(), viewState -> {
        updateValidity(word1, viewState.isWord1Valid());
        updateValidity(word2, viewState.isWord2Valid());
        done.setEnabled(viewState.areAllWordsValid());
        String hint1 = getString(R.string.PaymentRecoveryPhraseConfirmFragment__word_d, viewState.getWord1Index() + 1);
        String hint2 = getString(R.string.PaymentRecoveryPhraseConfirmFragment__word_d, viewState.getWord2Index() + 1);
        wordWrapper1.setHint(hint1);
        wordWrapper2.setHint(hint2);
    });
    viewModel.updateRandomIndices();
}
Also used : EditText(android.widget.EditText) SignalStore(org.thoughtcrime.securesms.keyvalue.SignalStore) Bundle(android.os.Bundle) NonNull(androidx.annotation.NonNull) AppCompatResources(androidx.appcompat.content.res.AppCompatResources) TextInputLayout(com.google.android.material.textfield.TextInputLayout) AfterTextChanged(org.thoughtcrime.securesms.util.text.AfterTextChanged) ViewUtil(org.thoughtcrime.securesms.util.ViewUtil) DrawableCompat(androidx.core.graphics.drawable.DrawableCompat) Drawable(android.graphics.drawable.Drawable) R(org.thoughtcrime.securesms.R) TextView(android.widget.TextView) Nullable(androidx.annotation.Nullable) Toast(android.widget.Toast) Fragment(androidx.fragment.app.Fragment) View(android.view.View) Toolbar(androidx.appcompat.widget.Toolbar) ViewModelProviders(androidx.lifecycle.ViewModelProviders) Navigation(androidx.navigation.Navigation) Activity(android.app.Activity) ContextCompat(androidx.core.content.ContextCompat) EditText(android.widget.EditText) TextInputLayout(com.google.android.material.textfield.TextInputLayout) TextView(android.widget.TextView) View(android.view.View) AfterTextChanged(org.thoughtcrime.securesms.util.text.AfterTextChanged) Toolbar(androidx.appcompat.widget.Toolbar)

Example 40 with Toolbar

use of androidx.appcompat.widget.Toolbar in project Signal-Android by WhisperSystems.

the class EnterPhoneNumberFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    setDebugLogSubmitMultiTapView(view.findViewById(R.id.verify_header));
    countryCode = view.findViewById(R.id.country_code);
    number = view.findViewById(R.id.number);
    countrySpinner = view.findViewById(R.id.country_spinner);
    cancel = view.findViewById(R.id.cancel_button);
    scrollView = view.findViewById(R.id.scroll_view);
    register = view.findViewById(R.id.registerButton);
    RegistrationNumberInputController controller = new RegistrationNumberInputController(requireContext(), countryCode, number, countrySpinner, true, this);
    register.setOnClickListener(v -> handleRegister(requireContext()));
    disposables.bindTo(getViewLifecycleOwner().getLifecycle());
    viewModel = new ViewModelProvider(requireActivity()).get(RegistrationViewModel.class);
    if (viewModel.isReregister()) {
        cancel.setVisibility(View.VISIBLE);
        cancel.setOnClickListener(v -> Navigation.findNavController(v).navigateUp());
    } else {
        cancel.setVisibility(View.GONE);
    }
    viewModel.getLiveNumber().observe(getViewLifecycleOwner(), controller::updateNumber);
    if (viewModel.hasCaptchaToken()) {
        ThreadUtil.runOnMainDelayed(() -> handleRegister(requireContext()), 250);
    }
    Toolbar toolbar = view.findViewById(R.id.toolbar);
    ((AppCompatActivity) requireActivity()).setSupportActionBar(toolbar);
    ((AppCompatActivity) requireActivity()).getSupportActionBar().setTitle(null);
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) RegistrationNumberInputController(org.thoughtcrime.securesms.registration.util.RegistrationNumberInputController) ViewModelProvider(androidx.lifecycle.ViewModelProvider) RegistrationViewModel(org.thoughtcrime.securesms.registration.viewmodel.RegistrationViewModel) Toolbar(androidx.appcompat.widget.Toolbar)

Aggregations

Toolbar (androidx.appcompat.widget.Toolbar)284 View (android.view.View)116 TextView (android.widget.TextView)58 RecyclerView (androidx.recyclerview.widget.RecyclerView)44 Bundle (android.os.Bundle)43 Intent (android.content.Intent)39 NonNull (androidx.annotation.NonNull)36 Fragment (androidx.fragment.app.Fragment)33 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 Context (android.content.Context)25 ViewGroup (android.view.ViewGroup)25 EditText (android.widget.EditText)23 MenuItem (android.view.MenuItem)21 ImageView (android.widget.ImageView)20 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)20 Navigation (androidx.navigation.Navigation)20