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
/** | |
* @author Yuana andhikayuana@gmail.com | |
* @since Jun, Sun 10 2018 13.44 | |
**/ | |
public abstract class BaseAdapter<T, V extends BaseViewHolder> extends RecyclerView.Adapter<V> { | |
protected List<T> data = new ArrayList<T>(); | |
protected Context context; | |
protected OnItemClickListener itemClickListener; | |
protected OnLongItemClickListener longItemClickListener; |
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
/** | |
* Created by Ishank Gulati on 14/10/16. | |
* Observer as per Observer design pattern. | |
*/ | |
public interface RVObserver { | |
void update(RecyclerViewItemClickListener listener); | |
} |
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
import android.databinding.DataBindingUtil; | |
import android.databinding.ViewDataBinding; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
/** | |
* Created by Davud. MyApplication project. | |
*/ |
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
/* | |
You need to call the below method once. It register the callback and fire it when there is a change in network state. | |
Here I used a Global Static Variable, So I can use it to access the network state in anyware of the application. | |
*/ | |
// You need to pass the context when creating the class | |
public CheckNetwork(Context context) { | |
this.context = context; | |
} |
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
package com.example.simplenetwork; | |
import android.content.Context; | |
import android.net.ConnectivityManager; | |
import android.net.LinkProperties; | |
import android.net.Network; | |
import android.net.NetworkCapabilities; | |
import android.net.NetworkRequest; | |
import android.util.Log; |
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 PnNetworkMonitor { | |
private static PnNetworkMonitor instance; | |
private ConnectivityManager mConnectivityManager; | |
private Context mContext; | |
private final ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback(){ |
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
<?php | |
#API access key from Google API's Console | |
define( 'API_ACCESS_KEY', 'YOUR-SERVER-API-ACCESS-KEY-GOES-HERE' ); | |
$registrationIds = $_GET['id']; | |
#prep the bundle | |
$msg = array | |
( | |
'body' => 'Body Of Notification', |