Search in sources :

Example 1 with HelveticaTextView

use of com.instructure.speedgrader.views.HelveticaTextView in project instructure-android by instructure.

the class HomeActivity method intAboutPage.

public void intAboutPage() {
    final ImageView helpButtonArrow = (ImageView) findViewById(R.id.helpButtonArrow);
    final ImageView reportProblemButtonArrow = (ImageView) findViewById(R.id.reportProblemButtonArrow);
    final ImageView aboutArrow = (ImageView) findViewById(R.id.aboutButtonArrow);
    final ImageView aboutArrowBack = (ImageView) findViewById(R.id.aboutButtonArrowBack);
    // Set the colors for our arrows
    final Drawable arrow = CanvasContextColor.getColoredDrawable(getContext(), R.drawable.ic_cv_arrow_right, getContext().getResources().getColor(R.color.sg_lightGrayText));
    final Drawable arrowBack = CanvasContextColor.getColoredDrawable(getContext(), R.drawable.ic_cv_arrow_left, getContext().getResources().getColor(R.color.sg_lightGrayText));
    helpButtonArrow.setImageDrawable(arrow);
    reportProblemButtonArrow.setImageDrawable(arrow);
    aboutArrowBack.setImageDrawable(arrowBack);
    aboutArrow.setImageDrawable(arrow);
    final ViewSwitcher aboutViewSwitcher = (ViewSwitcher) findViewById(R.id.aboutViewSwitcher);
    final HelveticaTextView versionNumber = (HelveticaTextView) findViewById(R.id.sg_about_version_text);
    final HelveticaTextView accountName = (HelveticaTextView) findViewById(R.id.sg_about_account_text);
    // Set Version Number
    try {
        versionNumber.setText(getPackageManager().getPackageInfo(getPackageName(), 0).versionName + " (" + getPackageManager().getPackageInfo(getPackageName(), 0).versionCode + ")");
    } catch (Exception e) {
        versionNumber.setText("");
    }
    // Copyright Text
    Calendar calendar = Calendar.getInstance();
    int year = calendar.get(Calendar.YEAR);
    HelveticaTextView copyrightText = (HelveticaTextView) findViewById(R.id.sg_about_copyright_text);
    String yearText = String.format(getString(R.string.copyrightText, String.valueOf(year)));
    copyrightText.setText(yearText);
    accountName.setText(APIHelpers.getCacheUser(getContext()).getEmail());
    aboutButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (!showingAbout) {
                showingAbout = !showingAbout;
                aboutViewSwitcher.setInAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.slide_in_left));
                aboutViewSwitcher.setOutAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.slide_out_right));
                aboutViewSwitcher.setDisplayedChild(1);
                aboutArrowBack.setVisibility(View.VISIBLE);
                aboutArrow.setVisibility(View.INVISIBLE);
            } else {
                showingAbout = !showingAbout;
                // left to right
                aboutViewSwitcher.setInAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.slide_in_right));
                aboutViewSwitcher.setOutAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.slide_out_left));
                aboutViewSwitcher.setDisplayedChild(0);
                aboutArrowBack.setVisibility(View.GONE);
                aboutArrow.setVisibility(View.VISIBLE);
            }
        }
    });
}
Also used : Calendar(java.util.Calendar) Drawable(android.graphics.drawable.Drawable) HelveticaTextView(com.instructure.speedgrader.views.HelveticaTextView) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) HelveticaTextView(com.instructure.speedgrader.views.HelveticaTextView) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) ViewSwitcher(android.widget.ViewSwitcher)

Example 2 with HelveticaTextView

use of com.instructure.speedgrader.views.HelveticaTextView in project instructure-android by instructure.

the class HomeActivity method initNavigationDrawer.

public void initNavigationDrawer() {
    // User Data
    avatar = (CircleImageView) findViewById(R.id.profile_image);
    userName = (HelveticaTextView) findViewById(R.id.userName);
    aboutButton = (RelativeLayout) findViewById(R.id.aboutButton);
    helpButton = (RelativeLayout) findViewById(R.id.helpButton);
    reportProblemButton = (RelativeLayout) findViewById(R.id.reportProblemButton);
    navigationHeader = (LinearLayout) findViewById(R.id.navigationHeader);
    UserAPI.getSelf(userCallback);
    intAboutPage();
    initSettingsListeners();
    initLogoutButton();
    initMasquerading();
    // Help Button
    helpButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            startActivity(InternalWebviewActivity.createIntent(getContext(), com.instructure.pandautils.utils.Const.CANVAS_USER_GUIDES, false));
            overridePendingTransition(R.anim.slide_down, 0);
        }
    });
    reportProblemButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ZendeskDialogStyled dialog = new ZendeskDialogStyled();
            dialog.show(getSupportFragmentManager(), ZendeskDialogStyled.TAG);
        }
    });
}
Also used : ZendeskDialogStyled(com.instructure.loginapi.login.api.zendesk.utilities.ZendeskDialogStyled) HelveticaTextView(com.instructure.speedgrader.views.HelveticaTextView) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView)

Example 3 with HelveticaTextView

use of com.instructure.speedgrader.views.HelveticaTextView 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);
            }
        }
    });
}
Also used : App(com.instructure.speedgrader.util.App) OnSettingsChangedListener(com.instructure.speedgrader.interfaces.OnSettingsChangedListener) HelveticaTextView(com.instructure.speedgrader.views.HelveticaTextView) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) TutorialUtils(com.instructure.pandautils.utils.TutorialUtils) HelveticaTextView(com.instructure.speedgrader.views.HelveticaTextView) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) CompoundButton(android.widget.CompoundButton) SwitchCompat(android.support.v7.widget.SwitchCompat)

Example 4 with HelveticaTextView

use of com.instructure.speedgrader.views.HelveticaTextView in project instructure-android by instructure.

the class SubmissionCommentRowFactory method buildRowView.

// ///////////////////////////////////////////////////////////////
// Row Factories
// ///////////////////////////////////////////////////////////////
public static View buildRowView(View convertView, LayoutInflater inflater, SubmissionComment comment, final Activity context, boolean isUser) {
    final ViewHolder holder;
    if (convertView == null) {
        holder = new ViewHolder();
        if (isUser) {
            convertView = inflater.inflate(R.layout.list_item_user_comment, null);
        } else {
            convertView = inflater.inflate(R.layout.list_item_other_comment, null);
        }
        holder.avatar = (CircleImageView) convertView.findViewById(R.id.avatar);
        holder.comment = (HelveticaTextView) convertView.findViewById(R.id.commentText);
        holder.date = (HelveticaTextView) convertView.findViewById(R.id.date);
        holder.attachmentsHolder = (LinearLayout) convertView.findViewById(R.id.attachmentsHolder);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    String avatarURL = comment.getAuthor().getAvatarImageUrl();
    if (avatarURL != null) {
        Picasso.with(context).load(avatarURL).into(holder.avatar, new Callback() {

            @Override
            public void onSuccess() {
            }

            @Override
            public void onError() {
                holder.avatar.setImageResource(R.drawable.ic_cv_user);
            }
        });
    }
    holder.comment.setText(comment.getComment());
    holder.date.setText(DateHelpers.getShortDate(context, comment.getComparisonDate()) + context.getString(R.string.at) + DateHelpers.getFormattedTime(context, comment.getComparisonDate()) + ", " + comment.getAuthor().getDisplayName());
    holder.attachmentsHolder.removeAllViews();
    List<Attachment> attachments = comment.getAttachments();
    if (attachments != null) {
        for (final Attachment attachment : attachments) {
            if (attachment.getThumbnailUrl() != null && attachment.getUrl() != null) {
                ImageView imageView = getAttachmentImageView(context);
                imageView.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        ((SubmissionListener) context).onMediaOpened(attachment.getMimeType(), attachment.getUrl(), attachment.getFilename());
                    }
                });
                Picasso.with(context).load(attachment.getThumbnailUrl()).into(imageView);
                holder.attachmentsHolder.addView(imageView);
            }
        }
    }
    final MediaComment mediaComment = comment.getMedia_comment();
    if (mediaComment != null) {
        final String url = APIHelpers.getFullDomain(context) + "/media_objects/" + mediaComment.getMediaId() + "/thumbnail?height=140&width=140";
        ImageView imageView = getAttachmentImageView(context);
        imageView.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                ((SubmissionListener) context).onMediaOpened(mediaComment.getMimeType(), mediaComment.getUrl(), mediaComment.getFileName());
            }
        });
        Picasso.with(context).load(url).into(imageView);
        holder.attachmentsHolder.addView(imageView);
    }
    return convertView;
}
Also used : MediaComment(com.instructure.canvasapi.model.MediaComment) Callback(com.squareup.picasso.Callback) Attachment(com.instructure.canvasapi.model.Attachment) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) HelveticaTextView(com.instructure.speedgrader.views.HelveticaTextView) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View)

Example 5 with HelveticaTextView

use of com.instructure.speedgrader.views.HelveticaTextView in project instructure-android by instructure.

the class EmptyViewFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getBundleData(getArguments());
    View rootView = inflateLayout(inflater, container);
    final HelveticaTextView message = (HelveticaTextView) rootView.findViewById(R.id.emptyMessage);
    message.setText(messageToUser);
    return rootView;
}
Also used : HelveticaTextView(com.instructure.speedgrader.views.HelveticaTextView) HelveticaTextView(com.instructure.speedgrader.views.HelveticaTextView) View(android.view.View)

Aggregations

HelveticaTextView (com.instructure.speedgrader.views.HelveticaTextView)10 View (android.view.View)6 ImageView (android.widget.ImageView)5 CircleImageView (de.hdodenhof.circleimageview.CircleImageView)4 ScrollView (android.widget.ScrollView)3 TextView (android.widget.TextView)3 CircularProgressBar (com.instructure.speedgrader.views.CircularProgressBar)2 Drawable (android.graphics.drawable.Drawable)1 SwitchCompat (android.support.v7.widget.SwitchCompat)1 CompoundButton (android.widget.CompoundButton)1 FrameLayout (android.widget.FrameLayout)1 ViewSwitcher (android.widget.ViewSwitcher)1 Attachment (com.instructure.canvasapi.model.Attachment)1 MediaComment (com.instructure.canvasapi.model.MediaComment)1 ZendeskDialogStyled (com.instructure.loginapi.login.api.zendesk.utilities.ZendeskDialogStyled)1 TutorialUtils (com.instructure.pandautils.utils.TutorialUtils)1 OnSettingsChangedListener (com.instructure.speedgrader.interfaces.OnSettingsChangedListener)1 App (com.instructure.speedgrader.util.App)1 Callback (com.squareup.picasso.Callback)1 Calendar (java.util.Calendar)1