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
@Override | |
public void hideKeyboard() { | |
Activity activity = getActivity(); | |
if (activity == null) return; | |
View view = activity.getCurrentFocus(); | |
if (view != null) { | |
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); | |
if (imm != null) imm.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 DrawingView extends View implements IDrawingView { | |
private static final int TOUCH_TOLERANCE = 4; | |
private static final int PAINT_COLOR = 0xff1565C0; | |
private static final int PAINT_BRUSH_SIZE = 20; | |
// To hold the path that will be drawn. | |
private Path mDrawPath; | |
// Paint object to draw drawPath and drawCanvas. | |
private Paint mDrawPaint, mCanvasPaint; |
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 static byte[] readBytes(@NonNull File file) throws IOException { | |
byte[] byteArray = null; | |
InputStream inputStream = null; | |
ByteArrayOutputStream outputStream = null; | |
try { | |
inputStream = new FileInputStream(file); | |
outputStream = new ByteArrayOutputStream(); | |
byte[] b = new byte[1024 * 4]; | |
int bytesRead = 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
/** | |
* Divider for RecyclerView list items | |
* <p> | |
* Created by Dmitriy V. Chernysh on 24.09.16. | |
* [email protected] | |
* <p> | |
* www.mobile-dev.pro | |
*/ | |
public class DividerItemDecoration extends RecyclerView.ItemDecoration { |
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
.gradle | |
.DS_Store | |
/build | |
/captures | |
.idea | |
*.txt | |
*.apk | |
*.iml | |
*.properties | |
wiki |
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
# Need to paste this into the file [HOME]/[username]/.gradle/gradle.properties | |
# The Gradle daemon aims to improve the startup and execution time of Gradle. | |
# When set to true the Gradle daemon is to run the build. | |
org.gradle.daemon=true | |
# Specifies the JVM arguments used for the daemon process. | |
# The setting is particularly useful for tweaking memory settings. | |
# Default value: -Xmx10248m -XX:MaxPermSize=256m | |
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 |
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
# This is a configuration file for ProGuard. | |
# http://proguard.sourceforge.net/index.html#manual/usage.html | |
-dontusemixedcaseclassnames | |
-dontskipnonpubliclibraryclasses | |
-verbose | |
# Optimization is turned off by default. Dex does not like code run | |
# through the ProGuard optimize and preverify steps (and performs some | |
# of these optimizations on its own). |
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 FragmentsHelper { | |
private static Fragment sCurrentVisibleFragment; | |
/** | |
* Method for creating new fragment | |
* @param fm FragmentManager | |
*/ | |
public static void createFragment(FragmentManager fm, Fragment newFragment, boolean addToBackStack) { |
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
...... | |
@Override | |
public void onBackPressed() { | |
OnBackPressedListener listener = null; | |
boolean backInFragment = false; | |
//back pressed listener in fragment |
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 isGooglePlayServicesAvailable() { | |
// Check that Google Play services is available | |
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); | |
// If Google Play services is available | |
if (ConnectionResult.SUCCESS == resultCode) { | |
// In debug mode, log the status | |
Log.d("Location Updates", "Google Play services is available."); | |
return true; | |
} else { | |
// Get the error dialog from Google Play services |