@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_voting);
final View heartIcon = findViewById(R.id.heart_icon);
final View brokenHeartIcon = findViewById(R.id.broken_hear_icon);
loading = findViewById(R.id.loading);
mSwipeList = (SwipeFlingAdapterView) findViewById(R.id.swipe_list);
mSwipeList.setFlingListener(new SwipeListener());
OnVoteButtonsClicked onVoteButtonsClicked = new OnVoteButtonsClicked();
heartIcon.setOnClickListener(onVoteButtonsClicked);
brokenHeartIcon.setOnClickListener(onVoteButtonsClicked);
}
private void initView() {
DisplayMetrics dm = getResources().getDisplayMetrics();
float density = dm.density;
cardWidth = (int) (dm.widthPixels - (2 * 18 * density));
cardHeight = (int) (dm.heightPixels - (338 * density));
swipeView = (SwipeFlingAdapterView) findViewById(R.id.swipe_view);
if (swipeView != null) {
swipeView.setIsNeedSwipe(true);
swipeView.setFlingListener(this);
swipeView.setOnItemClickListener(this);
adapter = new InnerAdapter();
swipeView.setAdapter(adapter);
}
View v = findViewById(R.id.swipeLeft);
if (v != null) {
v.setOnClickListener(this);
}
v = findViewById(R.id.swipeRight);
if (v != null) {
v.setOnClickListener(this);
}
}