Search in sources :

Example 6 with AppCompatRadioButton

use of android.support.v7.widget.AppCompatRadioButton in project krypton-android by kryptco.

the class OnboardingPolicyFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.fragment_teams_onboarding_approvalwindow, container, false);
    AppCompatRadioButton alwaysAsk = rootView.findViewById(R.id.alwaysAsk);
    AppCompatRadioButton oneHour = rootView.findViewById(R.id.oneHour);
    AppCompatRadioButton threeHours = rootView.findViewById(R.id.threeHours);
    alwaysAsk.setOnClickListener(v -> {
        oneHour.setChecked(false);
        threeHours.setChecked(false);
    });
    oneHour.setOnClickListener(v -> {
        alwaysAsk.setChecked(false);
        threeHours.setChecked(false);
    });
    threeHours.setOnClickListener(v -> {
        alwaysAsk.setChecked(false);
        oneHour.setChecked(false);
    });
    Button nextButton = rootView.findViewById(R.id.nextButton);
    nextButton.setOnClickListener(v -> {
        long temporaryApprovalSeconds = 0;
        if (oneHour.isChecked()) {
            temporaryApprovalSeconds = 3600;
        }
        if (threeHours.isChecked()) {
            temporaryApprovalSeconds = 3600 * 3;
        }
        if (alwaysAsk.isChecked()) {
            temporaryApprovalSeconds = 0;
        }
        final long finalTemporaryApprovalSeconds = temporaryApprovalSeconds;
        CreateTeamProgress progress = new CreateTeamProgress(v.getContext());
        progress.updateTeamData((s, d) -> {
            d.temporaryApprovalSeconds = finalTemporaryApprovalSeconds;
            try {
                if (Silo.shared(getContext()).getKnownHosts().size() > 0) {
                    return CreateStage.PIN_HOSTS;
                }
            } catch (SQLException e) {
                e.printStackTrace();
            }
            d.pinnedHosts = new Sigchain.PinnedHost[] {};
            return CreateStage.VERIFY_EMAIL;
        });
        FragmentManager fragmentManager = getFragmentManager();
        if (fragmentManager != null) {
            fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_right, R.anim.exit_to_left).replace(R.id.fragment_teams, progress.currentStage().getFragment()).commitNowAllowingStateLoss();
        }
    });
    return rootView;
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) AppCompatRadioButton(android.support.v7.widget.AppCompatRadioButton) AppCompatRadioButton(android.support.v7.widget.AppCompatRadioButton) Button(android.widget.Button) SQLException(java.sql.SQLException) Sigchain(co.krypt.krypton.team.Sigchain) View(android.view.View)

Example 7 with AppCompatRadioButton

use of android.support.v7.widget.AppCompatRadioButton in project EssayJoke by qiyei2015.

the class SkinAppCompatViewInflater method createView.

public final View createView(View parent, final String name, @NonNull Context context, @NonNull AttributeSet attrs, boolean inheritContext, boolean readAndroidTheme, boolean readAppTheme) {
    final Context originalContext = context;
    // by using the parent's context
    if (inheritContext && parent != null) {
        context = parent.getContext();
    }
    if (readAndroidTheme || readAppTheme) {
        // We then apply the theme on the context, if specified
        context = themifyContext(context, attrs, readAndroidTheme, readAppTheme);
    }
    View view = null;
    // We need to 'inject' our tint aware Views in place of the standard framework versions
    switch(name) {
        case "TextView":
            view = new AppCompatTextView(context, attrs);
            break;
        case "ImageView":
            view = new AppCompatImageView(context, attrs);
            break;
        case "Button":
            view = new AppCompatButton(context, attrs);
            break;
        case "EditText":
            view = new AppCompatEditText(context, attrs);
            break;
        case "Spinner":
            view = new AppCompatSpinner(context, attrs);
            break;
        case "ImageButton":
            view = new AppCompatImageButton(context, attrs);
            break;
        case "CheckBox":
            view = new AppCompatCheckBox(context, attrs);
            break;
        case "RadioButton":
            view = new AppCompatRadioButton(context, attrs);
            break;
        case "CheckedTextView":
            view = new AppCompatCheckedTextView(context, attrs);
            break;
        case "AutoCompleteTextView":
            view = new AppCompatAutoCompleteTextView(context, attrs);
            break;
        case "MultiAutoCompleteTextView":
            view = new AppCompatMultiAutoCompleteTextView(context, attrs);
            break;
        case "RatingBar":
            view = new AppCompatRatingBar(context, attrs);
            break;
        case "SeekBar":
            view = new AppCompatSeekBar(context, attrs);
            break;
    }
    if (view == null) {
        // If the original context does not equal our themed context, then we need to manually
        // inflate it using the name so that android:theme takes effect.
        view = createViewFromTag(context, name, attrs);
    }
    if (view != null) {
        // If we have created a view, check it's android:onClick
        checkOnClickListener(view, attrs);
    }
    return view;
}
Also used : Context(android.content.Context) AppCompatSeekBar(android.support.v7.widget.AppCompatSeekBar) AppCompatRadioButton(android.support.v7.widget.AppCompatRadioButton) AppCompatRatingBar(android.support.v7.widget.AppCompatRatingBar) AppCompatTextView(android.support.v7.widget.AppCompatTextView) AppCompatImageButton(android.support.v7.widget.AppCompatImageButton) AppCompatCheckedTextView(android.support.v7.widget.AppCompatCheckedTextView) AppCompatAutoCompleteTextView(android.support.v7.widget.AppCompatAutoCompleteTextView) View(android.view.View) AppCompatImageView(android.support.v7.widget.AppCompatImageView) AppCompatMultiAutoCompleteTextView(android.support.v7.widget.AppCompatMultiAutoCompleteTextView) AppCompatTextView(android.support.v7.widget.AppCompatTextView) AppCompatImageView(android.support.v7.widget.AppCompatImageView) AppCompatSpinner(android.support.v7.widget.AppCompatSpinner) AppCompatButton(android.support.v7.widget.AppCompatButton) AppCompatCheckBox(android.support.v7.widget.AppCompatCheckBox) AppCompatEditText(android.support.v7.widget.AppCompatEditText) AppCompatCheckedTextView(android.support.v7.widget.AppCompatCheckedTextView) AppCompatMultiAutoCompleteTextView(android.support.v7.widget.AppCompatMultiAutoCompleteTextView) AppCompatAutoCompleteTextView(android.support.v7.widget.AppCompatAutoCompleteTextView)

Example 8 with AppCompatRadioButton

use of android.support.v7.widget.AppCompatRadioButton in project Roblu by wdavies973.

the class TeamsView method showFilterDialog.

/**
 * Displays the filter dialog and refreshes the team's list when the user selects the
 * desired filter method
 */
private void showFilterDialog() {
    if (eventDrawerManager.getEvent() == null)
        return;
    final Dialog d = new Dialog(this);
    d.setContentView(R.layout.dialog_sort);
    TextView view = d.findViewById(R.id.sort_title);
    view.setTextColor(settings.getRui().getText());
    RadioGroup group = d.findViewById(R.id.filter_group);
    for (int i = 0; i < group.getChildCount(); i++) {
        AppCompatRadioButton rb = (AppCompatRadioButton) group.getChildAt(i);
        if (i == lastFilter)
            rb.setChecked(true);
        rb.setTextColor(settings.getRui().getText());
        final int i2 = i;
        rb.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                if (i2 == 3) {
                    Intent intent = new Intent(TeamsView.this, CustomSort.class);
                    intent.putExtra("eventID", eventDrawerManager.getEvent().getID());
                    startActivityForResult(intent, Constants.GENERAL);
                    d.dismiss();
                    return;
                }
                eventDrawerManager.getEvent().setLastFilter(i2);
                io.saveEvent(eventDrawerManager.getEvent());
                lastFilter = i2;
                executeLoadTeamsTask(lastFilter, false);
                d.dismiss();
                settings.setLastFilter(lastFilter);
                new IO(getApplicationContext()).saveSettings(settings);
            }
        });
    }
    if (d.getWindow() != null) {
        d.getWindow().setBackgroundDrawable(new ColorDrawable(settings.getRui().getBackground()));
        d.getWindow().getAttributes().windowAnimations = settings.getRui().getAnimation();
    }
    d.show();
}
Also used : AppCompatRadioButton(android.support.v7.widget.AppCompatRadioButton) RadioGroup(android.widget.RadioGroup) ColorDrawable(android.graphics.drawable.ColorDrawable) CustomSort(com.cpjd.roblu.ui.teamsSorting.CustomSort) AlertDialog(android.app.AlertDialog) Dialog(android.app.Dialog) IO(com.cpjd.roblu.io.IO) TextView(android.widget.TextView) Intent(android.content.Intent) MaterialSearchView(com.miguelcatalan.materialsearchview.MaterialSearchView) View(android.view.View) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView)

Aggregations

AppCompatRadioButton (android.support.v7.widget.AppCompatRadioButton)8 View (android.view.View)6 RadioGroup (android.widget.RadioGroup)5 Intent (android.content.Intent)4 DialogInterface (android.content.DialogInterface)3 TextView (android.widget.TextView)3 DialogHelper (com.mnnyang.gzuclassschedule.utils.DialogHelper)3 DialogListener (com.mnnyang.gzuclassschedule.utils.DialogListener)3 ColorStateList (android.content.res.ColorStateList)2 ImageView (android.widget.ImageView)2 RadioButton (android.widget.RadioButton)2 ScrollView (android.widget.ScrollView)2 AlertDialog (android.app.AlertDialog)1 Dialog (android.app.Dialog)1 Context (android.content.Context)1 Paint (android.graphics.Paint)1 Point (android.graphics.Point)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 FragmentManager (android.support.v4.app.FragmentManager)1 AppCompatAutoCompleteTextView (android.support.v7.widget.AppCompatAutoCompleteTextView)1