Skip to content

Instantly share code, notes, and snippets.

View milon87's full-sized avatar
🎯
Focusing

Din Islam milon87

🎯
Focusing
  • TopUp Limited
  • Dhaka
View GitHub Profile
@milon87
milon87 / MainActivity.java
Last active December 29, 2016 11:22
RecycleView list item click listener
public class MainActivity extends AppCompatActivity implements RecyclerItemClickListener.OnItemClickListener{
private RecyclerView recyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
recyclerView = (RecyclerView) rootView.findViewById(R.id.recycleview);
//set you adapter
@milon87
milon87 / MyToast.java
Created December 30, 2016 17:34
Custom Toast for android
Usage: MyToast.show(context, "MyToast Sample", true);
public class MyToast {
public static void show(Context context, String text, boolean isLong) {
LayoutInflater inflater = LayoutInflater.from(context);
View layout = inflater.inflate(R.layout.toast_layout, null);
ImageView image = (ImageView) layout.findViewById(R.id.toast_image);
image.setImageResource(R.drawable.ic_launcher);
@milon87
milon87 / AppCompatPreferenceActivity.java
Last active December 31, 2016 21:06
Preference Activity with appcompact
public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
private AppCompatDelegate mDelegate;
@Override
protected void onCreate(Bundle savedInstanceState) {
getDelegate().installViewFactory();
getDelegate().onCreate(savedInstanceState);
super.onCreate(savedInstanceState);
}
@milon87
milon87 / AppHelper.java
Created January 3, 2017 14:19 — forked from anggadarkprince/AppHelper.java
Upload file with Multipart Request Volley Android
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayOutputStream;
/**
* Sketch Project Studio
* Created by Angga on 12/04/2016 14.27.
*/
public class AppHelper {
@milon87
milon87 / GPSTracker.java
Last active April 13, 2022 17:40
Show marker and map in fragment android
public class GPSTracker extends Service implements LocationListener {
private final Context mContext;
// flag for GPS status
boolean isGPSEnabled = false;
// flag for network status
boolean isNetworkEnabled = false;
@milon87
milon87 / FragmentHome.java
Created February 5, 2017 12:04
Easy recycleView item/full list item click listener
public class FragmentHome extends Fragment implements ListItemClickListener {
public FragmentHome() {
//Required empty public constructor
}
@Bind(R.id.home_rv_offer)
RecyclerView recyclerView;
@milon87
milon87 / FileDownloadRetrieve.java
Last active March 22, 2017 05:41
Download file android
class FileDownloader{
public static void image_download(Context context, String uRl, String bookNmae) {
File direct = new File(Environment.getExternalStorageDirectory()
+ "/appFolderName/images");
String imageName = uRl.substring(uRl.lastIndexOf('/') + 1, uRl.length());
@milon87
milon87 / Free O'Reilly Books.md
Created June 23, 2017 16:41 — forked from augbog/Free O'Reilly Books.md
Free O'Reilly Books

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the download.sh file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x download.sh should do it)
  3. Run ./download.sh and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.
@milon87
milon87 / login.js
Created August 24, 2017 09:27
x-www-form-urlencoded post in react native
getLoginAPI = () => {
let details = {
'username': 'username',
'password': 'demo'
};
let formBody = [];
for (let property in details) {
let encodedKey = encodeURIComponent(property);
@milon87
milon87 / api.js
Created September 9, 2017 05:37
how to use x-www-form-urlencoded in react native
var details = {
'userName': 'test@gmail.com',
'password': 'Password!',
'grant_type': 'password'
};
var formBody = [];
for (var property in details) {
var encodedKey = encodeURIComponent(property);
var encodedValue = encodeURIComponent(details[property]);