Skip to content

Instantly share code, notes, and snippets.

View Lzyct's full-sized avatar
:shipit:
Code Geek

Mudassir Lzyct

:shipit:
Code Geek
View GitHub Profile
@Lzyct
Lzyct / TimeAgoUtils.java
Last active February 5, 2017 11:44
Create time ago in android
public class TimeAgoUtils{
public static String getValue(String yourPostingTime){
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", new Locale("id", "ID")); //set your locale
Date postDate;
Date currentDate;
try {
AppController.inputDate2.setTimeZone(TimeZone.getTimeZone("GMT+7")); //set your GMT server current time
postDate = sdf1.parse(yourPostingTime);
long postDateTime = postDate.getTime();
@Lzyct
Lzyct / CustomDialog.java
Created January 5, 2017 11:27
Sample floating
View dialogView = getLayoutInflater().inflate(R.layout.custom_dialog, null);
Dialog customDialog = new Dialog(this, R.style.CustomDialog);
customDialog.setContentView(dialogView);
customDialog.setCancelable(true);
customDialog.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
customDialog.show();
@Lzyct
Lzyct / GetResponse.java
Last active August 13, 2016 06:29
Get return value from Retrofit 2
StatusResponse statusResponse = new StatusResponse(param1,param2,new StatusInterface(){
@Override
public void returnResponse(int status){
switch(status){
case 1: //do your stuff
break;
case 2: //do your stuff
break;
default:
break;