Skip to content

Instantly share code, notes, and snippets.

View AL4AL's full-sized avatar
💭
Studying

ALPHA AL4AL

💭
Studying
View GitHub Profile
@AL4AL
AL4AL / VenueListAdapter.java
Created November 9, 2019 14:18
RecyclerView with two ViewHolders
public class VenueListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final int VENUE_ITEM_VIEW_TYPE = 1;
private static final int EMPTY_LIST_VIEW_TYPE = 2;
private List<Venue> mListData = new ArrayList<>();
public VenueListAdapter(List<Venue> listData) {
if (listData != null){
this.mListData.addAll(listData);
Architectures:
MVVM, MVP, MVC
OOP:
Inheritance
Polymorphism
Encapsulation
Android:
Activity
private static CurrentLocationProvider.OnLocationSuccessReceiveListener getLocationSuccessListener(Context context){
if (locationSuccessReceiveListener == null)
locationSuccessReceiveListener = location -> {
if (!shouldStopSending) {
if (isNotSoClose(location)){
IntentFilter batteryIntentFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
Intent batteryStatus = context.registerReceiver(null, batteryIntentFilter);
int level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);