This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.squareup.widgets; | |
| import android.content.Context; | |
| import android.util.AttributeSet; | |
| import android.view.View; | |
| import android.widget.ViewAnimator; | |
| /** ViewAnimator helper which allows setting the selected child by ID rather than index. */ | |
| public class SquareViewAnimator extends ViewAnimator { | |
| public SquareViewAnimator(Context context) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright 2012 Square, Inc. | |
| package com.squareup.widgets; | |
| import android.content.Context; | |
| import android.content.res.TypedArray; | |
| import android.util.AttributeSet; | |
| import android.widget.ImageView; | |
| /** Maintains an aspect ratio based on either width or height. Disabled by default. */ | |
| public class AspectRatioImageView extends ImageView { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CheckableFrameLayout extends FrameLayout implements Checkable { | |
| private static final int[] CHECKED_STATE_SET = { | |
| android.R.attr.state_activated, | |
| android.R.attr.state_checked, | |
| }; | |
| private boolean mChecked; | |
| public CheckableFrameLayout(Context context) { | |
| super(context); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Base fragment to ensure the parent activity implements a contract interface. */ | |
| public abstract class ContractFragment<T> extends Fragment { | |
| private T mContract; | |
| @Override | |
| public void onAttach(Activity activity) { | |
| try { | |
| mContract = (T)activity; | |
| } catch (ClassCastException e) { | |
| throw new IllegalStateException(activity.getClass().getSimpleName() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class TweetAdapter extends BaseAdapter { | |
| // ... | |
| public View getView(int position, View convertView, ViewGroup parent) { | |
| TweetViewHolder vh = TweetViewHolder.get(convertView, parent); | |
| Tweet item = getItem(position); | |
| vh.user.setText(item.user); | |
| vh.tweet.setText(item.tweet); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.jakewharton.utilities; | |
| import android.content.Context; | |
| import android.graphics.drawable.Drawable; | |
| import android.preference.CheckBoxPreference; | |
| import android.util.AttributeSet; | |
| import android.view.View; | |
| import android.widget.ImageView; | |
| import com.jakewharton.wakkawallpaper.R; |
NewerOlder