Skip to content

Instantly share code, notes, and snippets.

View ShwetaChauhan18's full-sized avatar
🎯
Focusing

Shweta Chauhan ShwetaChauhan18

🎯
Focusing
View GitHub Profile
public class Singleton {
private static Singleton mSingleton = new Singleton(); //instance will be created at load time
private Singleton(){}
public static Singleton getInstance() {
return mSingleton;
}
}
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;
}
public class ThreadSafeSingleton {
private static ThreadSafeSingleton mThreadSafeSigleton;
private ThreadSafeSingleton(){}
public static synchronized ThreadSafeSingleton getThreadSafeSingleton(){
if(mThreadSafeSigleton == null){
mThreadSafeSigleton = new ThreadSafeSingleton();
}
public static ThreadSafeSingleton getInstanceUsingDoubleLocking(){
if(mThreadSafeSingleton == null){
synchronized (ThreadSafeSingleton.class) {
if(mThreadSafeSingleton == null){
mThreadSafeSingleton = new ThreadSafeSingleton();
}
}
}
return mThreadSafeSingleton;
}
public class BillPughSingleton {
private BillPughSingleton(){}
private static class BillPughSingletonInnerClass{
private static final BillPughSingleton INSTANCE = new BillPughSingleton();
}
public static BillPughSingleton getInstance(){
return BillPughSingletonInnerClass.INSTANCE;
<!-- 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>
<!-- 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">
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
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
}
+-----------------------------------------+--------------------------------------------+---------------------------------------+
| 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