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;
}
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;
}
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();
}
Aggregations