use of com.instructure.pandautils.utils.TutorialUtils in project instructure-android by instructure.
the class StudentListView method initSectionsRadioGroup.
private void initSectionsRadioGroup(RadioGroup radioGroup, final TextView sectionTitle, ViewGroup header) {
sectionTitle.setText(getCurrentSection().getName());
// Create our radio buttons
for (int i = 0; i < mSections.size(); i++) {
// create our new radiobutton
RadioButton newRadioButton = new RadioButton(mApplicationContext);
newRadioButton.setId(i);
newRadioButton.setText(mSections.get(i).getName());
newRadioButton.setTextColor(mActivity.getResources().getColor(R.color.canvasTextDark));
newRadioButton.setTypeface(Typeface.createFromAsset(mApplicationContext.getAssets(), "HelveticaNeueLTCom-MdCn.ttf"));
RadioGroup.LayoutParams params = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.MATCH_PARENT, RadioGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(0, 4, 0, 4);
// add the new radio button to the buttongroup
radioGroup.addView(newRadioButton, params);
// set the default selection for this radiobutton group
if (mSections.get(i) != null && getCurrentSection() != null && mSections.get(i).getId() == mCurrentSectionId) {
radioGroup.check(newRadioButton.getId());
}
}
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
mSubmissionsAdapter.filterBySection(mSections.get(checkedId));
// get the nearest student submission by section
goToClosestSubmissionBySection(mSections.get(checkedId));
sectionTitle.setText(mSections.get(checkedId).getName());
}
});
// tutorial
ImageView pulse = (ImageView) header.findViewById(R.id.pulse);
new TutorialUtils(mActivity, App.getPrefs(), pulse, TutorialUtils.TYPE.FILTER_SECTIONS).setContent(mActivity.getApplicationContext().getString(R.string.tutorial_tipFilterSections), mApplicationContext.getString(R.string.tutorial_tipFilterSectionsMessage)).build();
mSubmissionsAdapter.filterBySection(getCurrentSection());
goToClosestSubmissionBySection(getCurrentSection());
mListView.invalidateViews();
}
use of com.instructure.pandautils.utils.TutorialUtils in project instructure-android by instructure.
the class HomeActivity method initSettingsListeners.
public void initSettingsListeners() {
final SwitchCompat hideNamesSwitch = (SwitchCompat) findViewById(R.id.sg_options_hideNames_switch);
final SwitchCompat showUngradedFirstSwitch = (SwitchCompat) findViewById(R.id.sg_options_showUngradedFirst_switch);
final SwitchCompat showUngradedCountSwitch = (SwitchCompat) findViewById(R.id.sg_options_viewUngradedCount_switch);
final HelveticaTextView hideNamesLabel = (HelveticaTextView) findViewById(R.id.sg_options_hideNames);
final HelveticaTextView showUngradedFirstLabel = (HelveticaTextView) findViewById(R.id.sg_options_showUngradedFirst);
final HelveticaTextView viewUngradedCountLabel = (HelveticaTextView) findViewById(R.id.sg_options_viewUngradedCount);
final ImageView pulse = (ImageView) findViewById(R.id.pulse);
new TutorialUtils(HomeActivity.this, App.getPrefs(), pulse, TutorialUtils.TYPE.COLOR_CHANGING_DIALOG).setContent(getString(R.string.tutorial_tipHideStudentNames), getString(R.string.tutorial_tipHideStudentNamesMessage)).build();
hideNamesLabel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
hideNamesSwitch.toggle();
}
});
showUngradedFirstLabel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showUngradedFirstSwitch.toggle();
}
});
viewUngradedCountLabel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showUngradedCountSwitch.toggle();
}
});
// Set Switch defaults
final App applicationManager = (App) getApplication();
// Set Default values for our switches
hideNamesSwitch.setChecked(applicationManager.showStudentNames());
showUngradedFirstSwitch.setChecked(applicationManager.showUngradedStudentsFirst());
showUngradedCountSwitch.setChecked(applicationManager.showUngradedCount());
// set On check changed listeners
hideNamesSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
applicationManager.setShowStudentNames(isChecked);
}
});
showUngradedFirstSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
applicationManager.setShowUngradedStudentsFirst(isChecked);
}
});
showUngradedCountSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
applicationManager.setShowUngradedCount(isChecked);
if (getSupportFragmentManager().findFragmentById(R.id.content_frame) instanceof OnSettingsChangedListener) {
((OnSettingsChangedListener) getSupportFragmentManager().findFragmentById(R.id.content_frame)).onShowUngradedCountChanged(isChecked);
}
}
});
}
use of com.instructure.pandautils.utils.TutorialUtils in project instructure-android by instructure.
the class CourseGridFragment method onPrepareOptionsMenu.
// /////////////////////////////////////////////////////////////////////////
// Favorite / All Courses Switcher
// /////////////////////////////////////////////////////////////////////////
@Override
public void onPrepareOptionsMenu(Menu menu) {
menu.clear();
getActivity().getMenuInflater().inflate(R.menu.home, menu);
// Setup favorite courses switch
coursesSwitch = (SwitchCompat) menu.findItem(R.id.favoriteSwitch).getActionView().findViewById(R.id.courseSwitcher);
ImageView pulse = (ImageView) menu.findItem(R.id.favoriteSwitch).getActionView().findViewById(R.id.pulse);
new TutorialUtils(getActivity(), App.getPrefs(), pulse, TutorialUtils.TYPE.SORTING_FAVORITES).setContent(getString(R.string.tutorial_tipMyCoursesTitle), getString(R.string.tutorial_tipMyCoursesMessage)).build();
if (course_view == COURSE_VIEW.ALL_COURSES) {
coursesSwitch.setChecked(true);
} else {
coursesSwitch.setChecked(false);
}
coursesSwitch.setOnCheckedChangeListener(this);
}
use of com.instructure.pandautils.utils.TutorialUtils in project instructure-android by instructure.
the class StudentListView method initSortSelector.
private void initSortSelector(View popupView) {
final CheckedLinearLayout sortSwitch = (CheckedLinearLayout) popupView.findViewById(R.id.sortSelector);
sortSwitch.setLeftAsChecked(isSortByName);
sortSwitch.setLeftIndicatorText(mApplicationContext.getResources().getString(R.string.name));
sortSwitch.setRightIndicatorText(mApplicationContext.getResources().getString(R.string.grade));
sortSwitch.setCallbacks(new CheckedLinearLayout.OnSwitchListener() {
@Override
public void onSwitch(boolean isLeftChecked) {
if (!isLeftChecked) {
// !isLeftChecked == sort by Grade
isSortByName = false;
mSubmissionsAdapter.sortSubmissionsByGrade();
mSubmissionsAdapter.notifyDataSetChanged();
mListener.onSubmissionListUpdated();
} else {
// isLeftChecked == sort by Name
isSortByName = true;
mSubmissionsAdapter.sortSubmissionsByName(((App) mActivity.getApplication()).showUngradedStudentsFirst());
mSubmissionsAdapter.notifyDataSetChanged();
mListener.onSubmissionListUpdated();
}
}
});
// set tutorial
ImageView pulse = (ImageView) popupView.findViewById(R.id.pulse);
new TutorialUtils(mActivity, App.getPrefs(), pulse, TutorialUtils.TYPE.FILTER_BY_GRADE).setContent(mApplicationContext.getString(R.string.tutorial_tipSortStudentList), mApplicationContext.getString(R.string.tutorial_tipSortStudentListMessage)).build();
}
Aggregations