Search in sources :

Example 1 with TopAnchorFillWidthTransformation

use of org.edx.mobile.util.images.TopAnchorFillWidthTransformation in project edx-app-android by openedx.

the class CourseOutlineAdapter method getCardView.

public View getCardView(View view) {
    final MaterialTextView courseTextName = view.findViewById(R.id.course_detail_name);
    final MaterialTextView courseTextDetails = view.findViewById(R.id.course_detail_extras);
    final AppCompatImageView headerImageView = view.findViewById(R.id.header_image_view);
    final View upgradeBtn = view.findViewById(R.id.layout_upgrade_btn);
    final MaterialButton upgradeBtnText = upgradeBtn.findViewById(R.id.btn_upgrade);
    ((ShimmerFrameLayout) upgradeBtn).hideShimmer();
    upgradeBtn.setVisibility(courseData.getMode().equalsIgnoreCase(EnrollmentMode.AUDIT.toString()) ? View.VISIBLE : View.GONE);
    upgradeBtnText.setOnClickListener(view1 -> CourseModalDialogFragment.newInstance(environment.getConfig().getPlatformName(), courseData.getCourseId(), courseData.getCourse().getName(), courseData.getCourse().getPrice(), courseData.getCourse().isSelfPaced()).show(((AppCompatActivity) context).getSupportFragmentManager(), CourseModalDialogFragment.TAG));
    upgradeBtnText.setText(R.string.value_prop_course_card_message);
    // Full course name should appear on the course's dashboard screen.
    courseTextName.setEllipsize(null);
    courseTextName.setSingleLine(false);
    final String headerImageUrl = courseData.getCourse().getCourse_image(environment.getConfig().getApiHostURL());
    Glide.with(context).load(headerImageUrl).placeholder(R.drawable.placeholder_course_card_image).transform(new TopAnchorFillWidthTransformation()).into(headerImageView);
    courseTextName.setText(courseData.getCourse().getName());
    courseTextDetails.setText(CourseCardUtils.getFormattedDate(context, courseData));
    return view;
}
Also used : MaterialTextView(com.google.android.material.textview.MaterialTextView) TopAnchorFillWidthTransformation(org.edx.mobile.util.images.TopAnchorFillWidthTransformation) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) AppCompatImageView(androidx.appcompat.widget.AppCompatImageView) AppCompatImageView(androidx.appcompat.widget.AppCompatImageView) View(android.view.View) MaterialTextView(com.google.android.material.textview.MaterialTextView) TextView(android.widget.TextView) MaterialButton(com.google.android.material.button.MaterialButton) ShimmerFrameLayout(com.facebook.shimmer.ShimmerFrameLayout)

Example 2 with TopAnchorFillWidthTransformation

use of org.edx.mobile.util.images.TopAnchorFillWidthTransformation in project edx-app-android by edx.

the class CourseDashboardFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (courseData == null || !isCoursewareAccessible)
        return;
    final String headerImageUrl = courseData.getCourse().getCourse_image(environment.getConfig().getApiHostURL());
    Glide.with(CourseDashboardFragment.this).load(headerImageUrl).placeholder(R.drawable.placeholder_course_card_image).transform(new TopAnchorFillWidthTransformation(getActivity())).into(headerImageView);
    courseTextName.setText(courseData.getCourse().getName());
    CourseEntry course = courseData.getCourse();
    courseTextDetails.setText(course.getDescriptionWithStartDate(getActivity()));
    if (environment.getConfig().isCourseSharingEnabled()) {
        shareButton.setVisibility(headerImageView.VISIBLE);
        shareButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                openShareMenu();
            }
        });
    }
}
Also used : CourseEntry(org.edx.mobile.model.api.CourseEntry) TopAnchorFillWidthTransformation(org.edx.mobile.util.images.TopAnchorFillWidthTransformation) ImageView(android.widget.ImageView) View(android.view.View) IconImageView(com.joanzapata.iconify.widget.IconImageView) TextView(android.widget.TextView)

Example 3 with TopAnchorFillWidthTransformation

use of org.edx.mobile.util.images.TopAnchorFillWidthTransformation in project edx-app-android by edx.

the class NewCourseOutlineAdapter method getCardView.

public View getCardView(View view) {
    final TextView courseTextName = (TextView) view.findViewById(R.id.course_detail_name);
    final TextView courseTextDetails = (TextView) view.findViewById(R.id.course_detail_extras);
    final ImageView headerImageView = (ImageView) view.findViewById(R.id.header_image_view);
    // Full course name should appear on the course's dashboard screen.
    courseTextName.setEllipsize(null);
    courseTextName.setSingleLine(false);
    final String headerImageUrl = courseData.getCourse().getCourse_image(environment.getConfig().getApiHostURL());
    Glide.with(context).load(headerImageUrl).placeholder(R.drawable.placeholder_course_card_image).transform(new TopAnchorFillWidthTransformation(context)).into(headerImageView);
    courseTextName.setText(courseData.getCourse().getName());
    courseTextDetails.setText(CourseCardUtils.getFormattedDate(context, courseData.getCourse()));
    return view;
}
Also used : TopAnchorFillWidthTransformation(org.edx.mobile.util.images.TopAnchorFillWidthTransformation) TextView(android.widget.TextView) ImageView(android.widget.ImageView) IconImageView(com.joanzapata.iconify.widget.IconImageView)

Example 4 with TopAnchorFillWidthTransformation

use of org.edx.mobile.util.images.TopAnchorFillWidthTransformation in project edx-app-android by edx.

the class CourseOutlineAdapter method getCardView.

public View getCardView(View view) {
    final MaterialTextView courseTextName = view.findViewById(R.id.course_detail_name);
    final MaterialTextView courseTextDetails = view.findViewById(R.id.course_detail_extras);
    final AppCompatImageView headerImageView = view.findViewById(R.id.header_image_view);
    final View upgradeBtn = view.findViewById(R.id.layout_upgrade_btn);
    final MaterialButton upgradeBtnText = upgradeBtn.findViewById(R.id.btn_upgrade);
    ((ShimmerFrameLayout) upgradeBtn).hideShimmer();
    upgradeBtn.setVisibility(courseData.getMode().equalsIgnoreCase(EnrollmentMode.AUDIT.toString()) ? View.VISIBLE : View.GONE);
    upgradeBtnText.setOnClickListener(view1 -> CourseModalDialogFragment.newInstance(environment.getConfig().getPlatformName(), courseData.getCourseId(), courseData.getCourse().getName(), courseData.getCourse().getPrice(), courseData.getCourse().isSelfPaced()).show(((AppCompatActivity) context).getSupportFragmentManager(), CourseModalDialogFragment.TAG));
    upgradeBtnText.setText(R.string.value_prop_course_card_message);
    // Full course name should appear on the course's dashboard screen.
    courseTextName.setEllipsize(null);
    courseTextName.setSingleLine(false);
    final String headerImageUrl = courseData.getCourse().getCourse_image(environment.getConfig().getApiHostURL());
    Glide.with(context).load(headerImageUrl).placeholder(R.drawable.placeholder_course_card_image).transform(new TopAnchorFillWidthTransformation()).into(headerImageView);
    courseTextName.setText(courseData.getCourse().getName());
    courseTextDetails.setText(CourseCardUtils.getFormattedDate(context, courseData));
    return view;
}
Also used : MaterialTextView(com.google.android.material.textview.MaterialTextView) TopAnchorFillWidthTransformation(org.edx.mobile.util.images.TopAnchorFillWidthTransformation) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) AppCompatImageView(androidx.appcompat.widget.AppCompatImageView) AppCompatImageView(androidx.appcompat.widget.AppCompatImageView) View(android.view.View) MaterialTextView(com.google.android.material.textview.MaterialTextView) TextView(android.widget.TextView) MaterialButton(com.google.android.material.button.MaterialButton) ShimmerFrameLayout(com.facebook.shimmer.ShimmerFrameLayout)

Aggregations

TextView (android.widget.TextView)4 TopAnchorFillWidthTransformation (org.edx.mobile.util.images.TopAnchorFillWidthTransformation)4 View (android.view.View)3 ImageView (android.widget.ImageView)2 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)2 AppCompatImageView (androidx.appcompat.widget.AppCompatImageView)2 ShimmerFrameLayout (com.facebook.shimmer.ShimmerFrameLayout)2 MaterialButton (com.google.android.material.button.MaterialButton)2 MaterialTextView (com.google.android.material.textview.MaterialTextView)2 IconImageView (com.joanzapata.iconify.widget.IconImageView)2 CourseEntry (org.edx.mobile.model.api.CourseEntry)1