Search in sources :

Example 1 with CircleButton

use of at.markushi.ui.CircleButton in project ETSMobile-Android2 by ApplETS.

the class EvenementCommunauteAdapter method getRealChildView.

@Override
public View getRealChildView(final int listPosition, final int expandedListPosition, boolean isLastChild, View convertView, ViewGroup parent) {
    final EvenementCommunaute item = (EvenementCommunaute) getChild(listPosition, expandedListPosition);
    if (convertView == null) {
        LayoutInflater layoutInflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = layoutInflater.inflate(R.layout.row_applets_events, null);
    }
    TextView textViewDescription = (TextView) convertView.findViewById(R.id.tv_description);
    ImageView imageViewLogoOrganisateur = (ImageView) convertView.findViewById(R.id.iv_logo_organisateur);
    TextView textViewNomOrganisateur = (TextView) convertView.findViewById(R.id.tv_nom_organisateur);
    CircleButton buttonDetails = (CircleButton) convertView.findViewById(R.id.btn_details);
    textViewDescription.setText(item.getDescription());
    textViewNomOrganisateur.setText(item.getSourceEvenement().getName());
    String urlImageOrganisateur = item.getSourceEvenement().getUrlImage();
    if (!urlImageOrganisateur.isEmpty()) {
        Picasso.with(convertView.getContext()).load(urlImageOrganisateur).into(imageViewLogoOrganisateur);
    }
    buttonDetails.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String url = getFacebookEventURL(item.getId());
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            // Verify if the link is one to use Facebook first. If not, open a webpage.
            if (URLUtil.isHttpUrl(url) || URLUtil.isHttpsUrl(url)) {
                Utility.openChromeCustomTabs(v.getContext(), url);
            } else {
                v.getContext().startActivity(intent);
            }
        }
    });
    convertView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (!(view instanceof Button)) {
                expandableListView.collapseGroupWithAnimation(listPosition);
            }
        }
    });
    return convertView;
}
Also used : CircleButton(at.markushi.ui.CircleButton) EvenementCommunaute(ca.etsmtl.applets.etsmobile.model.applets_events.EvenementCommunaute) CircleButton(at.markushi.ui.CircleButton) Button(android.widget.Button) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) Intent(android.content.Intent) ImageView(android.widget.ImageView) AnimatedExpandableListView(ca.etsmtl.applets.etsmobile.views.AnimatedExpandableListView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Aggregations

Intent (android.content.Intent)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 Button (android.widget.Button)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 CircleButton (at.markushi.ui.CircleButton)1 EvenementCommunaute (ca.etsmtl.applets.etsmobile.model.applets_events.EvenementCommunaute)1 AnimatedExpandableListView (ca.etsmtl.applets.etsmobile.views.AnimatedExpandableListView)1