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 java.text.ParseException; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
public class DateTimeUtils { | |
public static String getCurrentDateToFormat(SimpleDateFormat dateFormat) { | |
return dateToFormat(new Date(), dateFormat); | |
} |
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 App extends Application { | |
private static LifecycleManager manager = new LifecycleManager(); | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
registerActivityLifecycleCallbacks(manager); | |
} | |
public static boolean isAppForeground() { |
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
# built application files | |
*.apk | |
*.ap_ | |
# files for the dex VM | |
*.dex | |
# Java class files | |
*.class |
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.content.Context; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.ArrayAdapter; | |
import android.widget.TextView; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; |
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
private boolean isEmailValid(String email){ | |
return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches(); | |
} |
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 static void showKeyboard(Context context, View view) { | |
InputMethodManager inputMethodManager =(InputMethodManager)context.getSystemService(Activity | |
.INPUT_METHOD_SERVICE); | |
inputMethodManager.showSoftInputFromInputMethod(view.getWindowToken(), 0); | |
} | |
public static void hideKeyboard(Context context, View view) { | |
InputMethodManager inputMethodManager =(InputMethodManager)context.getSystemService(Activity | |
.INPUT_METHOD_SERVICE); | |
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); |
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 DayView extends LinearLayout implements View.OnClickListener { | |
private boolean isChecked = false; | |
private OnCheckedChangeListener changeListener; | |
private TextView textView; | |
private Enums.WeekDays day; | |
public DayView(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
init(); | |
initAttrs(attrs); |
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 Singleton{ | |
private static Singleton instance; | |
private Singleton(){} | |
public static synchronized Singleton getInstance(){ | |
if (instance == null){ | |
instance = new Singleton(); | |
} | |
return instance; |
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
static long getMaxPairwiseProduct(int[] numbers) { | |
long result = 0; | |
int n = numbers.length; | |
int max_position1 = -1; | |
for (int i = 0; i < numbers.length; i++) { | |
if ((max_position1 == -1) || (numbers[i] > numbers[max_position1])) { | |
max_position1 = i; | |
} | |
} |
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
int number = 101; | |
int lastDigit = number % 10; |
OlderNewer