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 mSingleton = new Singleton(); //instance will be created at load time | |
private Singleton(){} | |
public static Singleton getInstance() { | |
return mSingleton; | |
} | |
} |
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
class SingletonLazy{ | |
private static SingletonLazy mSingletonLazy; | |
private SingletonLazy(){} | |
public static SingletonLazy getSingletonLazy(){ | |
if (mSingletonLazy == null){ | |
mSingletonLazy = new SingletonLazy();//instance will be created at request time | |
} | |
return mSingletonLazy; | |
} |
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 ThreadSafeSingleton { | |
private static ThreadSafeSingleton mThreadSafeSigleton; | |
private ThreadSafeSingleton(){} | |
public static synchronized ThreadSafeSingleton getThreadSafeSingleton(){ | |
if(mThreadSafeSigleton == null){ | |
mThreadSafeSigleton = new ThreadSafeSingleton(); | |
} |
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 ThreadSafeSingleton getInstanceUsingDoubleLocking(){ | |
if(mThreadSafeSingleton == null){ | |
synchronized (ThreadSafeSingleton.class) { | |
if(mThreadSafeSingleton == null){ | |
mThreadSafeSingleton = new ThreadSafeSingleton(); | |
} | |
} | |
} | |
return mThreadSafeSingleton; | |
} |
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 BillPughSingleton { | |
private BillPughSingleton(){} | |
private static class BillPughSingletonInnerClass{ | |
private static final BillPughSingleton INSTANCE = new BillPughSingleton(); | |
} | |
public static BillPughSingleton getInstance(){ | |
return BillPughSingletonInnerClass.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
<!-- values-v29/themes.xml --> | |
<style name="Theme.MyApp"> | |
<item name="android:navigationBarColor"> | |
@android:color/transparent | |
</item> | |
<!-- Optional, if drawing behind the status bar too --> | |
<item name="android:statusBarColor"> | |
@android:color/transparent | |
</item> |
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
<!-- values/themes.xml --> | |
<style name="Theme.MyApp"> | |
<item name="android:navigationBarColor"> | |
#B3FFFFFF | |
</item> | |
</style> | |
<!-- values-night/themes.xml --> | |
<style name="Theme.MyApp"> | |
<item name="android:navigationBarColor"> |
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
view.systemUiVisibility = | |
// We wish to be laid out as if the | |
// navigation bar was hidden | |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or | |
// We wish to be laid out fullscreen, | |
// behind the status bar | |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or | |
// We wish to be laid out at | |
// the most extreme scenario of any other flags | |
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
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
ViewCompat.setOnApplyWindowInsetsListener(nav_view) { v, insets -> | |
// We'll set the views bottom padding to be the same | |
// value as the system gesture insets bottom value | |
v.updatePadding( | |
bottom = insets.systemWindowInsetBottom | |
) | |
// return the insets | |
insets | |
} |
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
+-----------------------------------------+--------------------------------------------+---------------------------------------+ | |
| Attribute | Description | Default | | |
+-----------------------------------------+--------------------------------------------+---------------------------------------+ | |
| app:isErrorEnable | Whether the EditText error is enabled | false | | |
| app:custom_component_title | Set Outlined border title text | R.string.app_name | | |
| app:custom_component_editText_hint | Set EditText hint | R.string.app_name | | |
| app:custom_component_maxline | Set maximum height of the EditText | 1 | | |
| app:custom_component_minline | Set minimum height of the EditText | 1 |
OlderNewer