Created
August 28, 2016 21:31
-
-
Save janishar/746657814d1045c112b05cac4362d5b3 to your computer and use it in GitHub Desktop.
This file contains 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 MainActivity extends AppCompatActivity { | |
private SwipePlaceHolderView mSwipeView; | |
private Context mContext; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
mSwipeView = (SwipePlaceHolderView)findViewById(R.id.swipeView); | |
mContext = getApplicationContext(); | |
mSwipeView.getBuilder() | |
.setDisplayViewCount(3) | |
.setSwipeDecor(new SwipeDecor() | |
.setPaddingTop(20) | |
.setRelativeScale(0.01f) | |
.setSwipeInMsgLayoutId(R.layout.tinder_swipe_in_msg_view) | |
.setSwipeOutMsgLayoutId(R.layout.tinder_swipe_out_msg_view)); | |
for(Profile profile : Utils.loadProfiles(this.getApplicationContext())){ | |
mSwipeView.addView(new TinderCard(mContext, profile, mSwipeView)); | |
} | |
findViewById(R.id.rejectBtn).setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
mSwipeView.doSwipe(false); | |
} | |
}); | |
findViewById(R.id.acceptBtn).setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
mSwipeView.doSwipe(true); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment