<commit_before>package com.u.teach.view.register;

import android.content.Context;
import android.content.res.TypedArray;
import android.support.v7.widget.CardView;
import android.util.AttributeSet;
import android.widget.ImageView;
import com.jakewharton.rxbinding.view.RxView;
import com.u.teach.R;
import com.u.teach.contract.register.AccountTypeContract;
import com.u.teach.utils.MetricsUtils;
import rx.Observable;

/**
 * Created by saguilera on 1/20/17.
 */

public class AccountTypeView extends CardView implements AccountTypeContract.View {

    private static final int RADIUS_DP = 2;
    private static final int ELEVATION_DP = 8;
    private static final int PADDING_DP = 8;

    private static final int TYPE_NAN = 0;
    private static final int TYPE_STUDENT = 1;
    private static final int TYPE_PROFESSOR = 2;

    public AccountTypeView(final Context context) {
        this(context, null);
    }

    public AccountTypeView(final Context context, final AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public AccountTypeView(final Context context, final AttributeSet attrs, final int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        inflate(context, R.layout.view_card_pick_user_type, this);

        setRadius(MetricsUtils.convertDpToPixel(RADIUS_DP));
        setCardElevation(MetricsUtils.convertDpToPixel(ELEVATION_DP));

        int contentPadding = (int) MetricsUtils.convertDpToPixel(PADDING_DP);
        setContentPadding(contentPadding,
            contentPadding,
            contentPadding,
            contentPadding);

        TypedArray typedArray = context.getTheme().obtainStyledAttributes(
            attrs,
            R.styleable.AccountTypeView,
            0, 0);

        int userType = typedArray.getInt(R.styleable.AccountTypeView_user_type, TYPE_NAN);

        switch (userType) {
            case TYPE_PROFESSOR:
                //TODO
            case TYPE_STUDENT:
                ((ImageView) findViewById(R.id.view_card_pick_user_type_image)).setImageDrawable(getResources().getDrawable(R.mipmap.ic_launcher));
                break;
            default:
                throw new IllegalStateException("No user_type provided to " + getClass().getSimpleName());
        }

        typedArray.recycle();
    }

    @Override
    public Observable<Void> observeOnCardPickedEvent() {
        return RxView.clicks(this);
    }

}<commit_msg>Fix resource obtained method<commit_after>package com.u.teach.view.register;

import android.content.Context;
import android.content.res.TypedArray;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.widget.CardView;
import android.util.AttributeSet;
import android.widget.ImageView;
import com.jakewharton.rxbinding.view.RxView;
import com.u.teach.R;
import com.u.teach.contract.register.AccountTypeContract;
import com.u.teach.utils.MetricsUtils;
import rx.Observable;

/**
 * Created by saguilera on 1/20/17.
 */
public class AccountTypeView extends CardView implements AccountTypeContract.View {

    private static final int RADIUS_DP = 2;
    private static final int ELEVATION_DP = 8;
    private static final int PADDING_DP = 8;

    private static final int TYPE_NAN = 0;
    private static final int TYPE_STUDENT = 1;
    private static final int TYPE_PROFESSOR = 2;

    public AccountTypeView(final Context context) {
        this(context, null);
    }

    public AccountTypeView(final Context context, final AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public AccountTypeView(final Context context, final AttributeSet attrs, final int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        inflate(context, R.layout.view_card_pick_user_type, this);

        setRadius(MetricsUtils.convertDpToPixel(RADIUS_DP));
        setCardElevation(MetricsUtils.convertDpToPixel(ELEVATION_DP));

        int contentPadding = (int) MetricsUtils.convertDpToPixel(PADDING_DP);
        setContentPadding(contentPadding,
            contentPadding,
            contentPadding,
            contentPadding);

        TypedArray typedArray = context.getTheme().obtainStyledAttributes(
            attrs,
            R.styleable.AccountTypeView,
            0, 0);

        int userType = typedArray.getInt(R.styleable.AccountTypeView_user_type, TYPE_NAN);

        switch (userType) {
            case TYPE_PROFESSOR:
                //TODO
            case TYPE_STUDENT:
                ((ImageView) findViewById(R.id.view_card_pick_user_type_image)).setImageDrawable(ResourcesCompat.getDrawable(getResources(), R.mipmap.ic_launcher, null));
                break;
            default:
                throw new IllegalStateException("No user_type provided to " + getClass().getSimpleName());
        }

        typedArray.recycle();
    }

    @Override
    public Observable<Void> observeOnCardPickedEvent() {
        return RxView.clicks(this);
    }

}
{'fraction_non_alphanumeric': 0.08623481781376519, 'fraction_numerical': 0.006275303643724696, 'mean_word_length': 3.0834710743801654, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '533031', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1414, 'n_words': 303}