kandi background
Explore Kits

litho | declarative framework for building efficient UIs | User Interface library

 by   facebook Java Version: v0.41.1 License: Apache-2.0

 by   facebook Java Version: v0.41.1 License: Apache-2.0

Download this library from

kandi X-RAY | litho Summary

litho is a Java library typically used in User Interface, React applications. litho has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub, Maven.
Litho is a declarative framework for building efficient UIs on Android.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • litho has a highly active ecosystem.
  • It has 7363 star(s) with 710 fork(s). There are 179 watchers for this library.
  • There were 2 major release(s) in the last 12 months.
  • There are 73 open issues and 301 have been closed. On average issues are closed in 203 days. There are 37 open pull requests and 0 closed requests.
  • It has a positive sentiment in the developer community.
  • The latest version of litho is v0.41.1
litho Support
Best in #User Interface
Average in #User Interface
litho Support
Best in #User Interface
Average in #User Interface

quality kandi Quality

  • litho has no bugs reported.
litho Quality
Best in #User Interface
Average in #User Interface
litho Quality
Best in #User Interface
Average in #User Interface

securitySecurity

  • litho has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
litho Security
Best in #User Interface
Average in #User Interface
litho Security
Best in #User Interface
Average in #User Interface

license License

  • litho is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
litho License
Best in #User Interface
Average in #User Interface
litho License
Best in #User Interface
Average in #User Interface

buildReuse

  • litho releases are available to install and integrate.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
litho Reuse
Best in #User Interface
Average in #User Interface
litho Reuse
Best in #User Interface
Average in #User Interface
Top functions reviewed by kandi - BETA

kandi has reviewed litho and discovered the below as its top functions. This is intended to give you an instant insight into litho implemented functionality, and help decide if they suit your requirements.

  • Collect results from a layout node .
  • Process the visibility outputs of the given state .
  • Compute a layout .
  • Returns a code block representing a delegating method .
  • Applies a new change set .
  • Inits an EditText .
  • Generates a change set from a section tree .
  • Generate a constructor builder .
  • Advances by a given amount .
  • Creates a text layout .

litho Key Features

Declarative: Litho uses a declarative API to define UI components. You simply describe the layout for your UI based on a set of immutable inputs and the framework takes care of the rest.

Asynchronous layout: Litho can measure and layout your UI ahead of time without blocking the UI thread.

View flattening: Litho uses Yoga for layout and automatically reduces the number of ViewGroups that your UI contains.

Fine-grained recycling: Any component such as a text or image can be recycled and reused anywhere in the UI.

Learn how to use Litho in your project.

Get started with our tutorial.

Read more about Litho in our docs.

1. Initialize

copy iconCopydownload iconDownload
public class SampleApplication extends Application {
  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, false);
  }
}

2. Create and display a component in your Activity

copy iconCopydownload iconDownload
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final ComponentContext c = new ComponentContext(this);

    final Component component = Text.create(c)
        .text("Hello World")
        .textSizeDip(50)
        .build();

    setContentView(LithoView.create(c, component));
}

Run sample

copy iconCopydownload iconDownload
$ buck fetch sample
$ buck install -r sample

how to fill pcolor with hatches by mapping it alongwith color fill

copy iconCopydownload iconDownload
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from matplotlib.patches import Patch, PathPatch
import pandas as pd

df = pd.DataFrame({'md litho': [0, 31, 49, 67, 406, 427, 442],
                   'litho': ['NC', 'AT', 'BTT', 'NC', 'ABT', 'BAT', 'NC']})
lithcode = {'ABT': 1, 'AT': 2, 'GD': 3, 'BAT': 4, 'BTT': 5, 'TT': 6, 'NC': 7, 'MV': 8, 'MS': 9, 'GW': 10}
colors = ['darkred', 'crimson', 'red', 'peru', 'lightsalmon', 'lightpink', 'white', 'oldlace', 'thistle', 'lightgray']
cmap = ListedColormap(colors)
hatches = ['', '++', '', '', '', '', 'xx', '', '', '']

fig, ax = plt.subplots(figsize=(12, 1.4))
lithcode_values = df['litho'][:-1].map(lithcode).to_numpy()
polycollection = ax.pcolor(df['md litho'], [0, 1], lithcode_values.reshape(1, -1), cmap=cmap, vmin=1, vmax=len(colors))
ax.set_xticks(df['md litho'])  # optionally set the x-ticks to indicate the column borders
ax.set_yticks([])  # hide ticks on the y-axis

for path, d2_val in zip(polycollection.get_paths(), lithcode_values):
    hatch = hatches[d2_val - 1]
    if hatch != '':
        ax.add_patch(PathPatch(path, hatch=hatch, facecolor='none', edgecolor='black'))

hands = [Patch(facecolor=col, label=k, edgecolor='black', hatch=hatch) for k, col, hatch in
         zip(lithcode.keys(), colors, hatches)]
ax.legend(handles=hands, bbox_to_anchor=(1.03, 1.02), loc='upper left', ncol=2, fontsize=8, facecolor='PaleTurquoise')
plt.tight_layout()  # this fits the legend and the labels nicely into the figure
plt.show()

Create vertical stacked bar chart referenced to y values (lithology/stratigraphic column)

copy iconCopydownload iconDownload
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from matplotlib.patches import Patch
import pandas as pd

df = pd.DataFrame({'md litho': [0, 31, 49, 67, 406, 427, 442],
                   'litho': ['NC', 'AT', 'BTT', 'NC', 'ABT', 'BAT', 'NC']})

d2 = {'ABT': 1, 'AT': 2, 'BAT': 3, 'BTT': 4, 'GT': 5, 'NC': 6, 'TT': 7}
colors = ['firebrick', 'red', 'peru', 'salmon', 'maroon', 'ghostwhite', 'pink']
cmap = ListedColormap(colors)

fig, ax = plt.subplots(figsize=(6, 4))
ax.pcolormesh([0, 1], df['md litho'], df['litho'][:-1].map(d2).to_numpy().reshape(-1, 1),
              cmap=cmap, vmin=1, vmax=len(colors))
ax.set_xticks([])  # hide ticks on the x-axis
ax.set_yticks(df['md litho'])  # optionally set the y-ticks to indicate the row borders
ax.set_aspect(0.01)
hands = [Patch(color=col, label=k) for k, col in zip(d2.keys(), colors)]
ax.legend(handles=hands, bbox_to_anchor=(1.03, 1.02), loc='upper left', fontsize=12, facecolor='lightgrey')
plt.tight_layout()  # this fits the legend and the labels nicely into the figure
plt.show()

Litho Radio Group container

copy iconCopydownload iconDownload
@LayoutSpec
object CrgSpec {
    @OnCreateLayout
    fun onCreateLayout(
        c: ComponentContext,
        @Prop viewModel: ViewModel,
        @State fields: ArrayList<RadioItem>,
        @Prop parentId: String
    ): Component? {
        val row =
            Row.create(c)
                .alignItems(YogaAlign.CENTER)
                .alignContent(YogaAlign.SPACE_AROUND)
                .flexGrow(1F)
                .wrap(YogaWrap.WRAP)
        fields.forEach { item ->
            row.child(
                CRadio.create(c)
                    .value(item.text)
                    .clickHandler(Crg.onClicked(c, item.id, item.text))
                    .isChecked(item.isChecked)
                    .id(item.id)
                    .build()
            )
        }
        val column = Column.create(c)
            .paddingDip(YogaEdge.TOP, 20F)
            .child(row.build())
        return column.child(
            TextInput.create(c)
                //.visibleHandler()
                .backgroundRes(R.drawable.edit_text_bg)
                .build()
        ).build()
    }

    @OnCreateInitialState
    fun onCreateInitialState(
        c: ComponentContext?,
        fields: StateValue<ArrayList<RadioItem>>,
        @Prop initChecked: ArrayList<RadioItem>
    ) {
        fields.set(initChecked)
    }

    @OnUpdateState
    fun updateCheckboxState(
        fields: StateValue<ArrayList<RadioItem>>,
        @Param id: String
    ) {
        fields.get()?.let { radioItem ->
            radioItem.forEach {
                it.isChecked = it.id == id
            }
            fields.set(radioItem)
        }
    }


    @OnUpdateState
    fun updateCheckbox(
        fields: StateValue<ArrayList<RadioItem>>,
        @Param id: String
    ) {
        fields.get()?.let { radioItem ->
            radioItem.forEach {
                it.isChecked = it.id == id
            }
            fields.set(radioItem)
        }
    }

    @OnEvent(ClickEvent::class)
    fun onClicked(
        c: ComponentContext?,
        @Prop viewModel: ViewModel,
        @Param id: String,
        @Prop parentId: String,
        @Param itemValue: String
    ) {
        Timber.d("id is: $id")
        CirclesRadioGroup.updateCheckbox(c, id)
        viewModel.onRadioUpdate(
            id,
            parentId,
            itemValue
        )
    }
}

NaN Issue - Unable to display number in Jquery

copy iconCopydownload iconDownload
var totalNum = $("#total");
totalNum.html();
<div id="total">Total</div>
<div id="total">0</div>
-----------------------
var totalNum = $("#total");
totalNum.html();
<div id="total">Total</div>
<div id="total">0</div>
-----------------------
var totalNum = $("#total");
totalNum.html();
<div id="total">Total</div>
<div id="total">0</div>
-----------------------
$(document).ready(function() {
  $(".ingredient").click(function() {
    var calories = $(this).data("calories");
    var carbs = $(this).data("carbs");
    var fat = $(this).data("fat");
    var proteins = $(this).data("proteins");
    var totalNum = $("#total");
    var totalCarbs = $("#totalCarbs");
    var totalFats = $("#totalFats");
    var totalProteins = $("#totalProteins");
    var currentCalories = +totalNum.html();
    var currentCarbs = +totalCarbs.html();
    var currentFats = +totalFats.html();
    var currentProteins = +totalProteins.html();
    var pressed = $(this).hasClass("clicked");

    if(isNaN(currentCalories)){
      currentCalories = 0;
    }

    if (pressed) {
      $(this).removeClass("clicked");
      totalNum.text(+(currentCalories - calories).toFixed(1));
      totalCarbs.text(+(currentCarbs - carbs).toFixed(1));
      totalFats.text(+(currentFats - fat).toFixed(1));
      totalProteins.text(+(currentProteins - proteins).toFixed(1));
    } else {
      $(this).addClass("clicked");
      totalNum.text(+(currentCalories + calories).toFixed(1));
      totalCarbs.text(+(currentCarbs + carbs).toFixed(1));
      totalFats.text(+(currentFats + fat).toFixed(1));
      totalProteins.text(+(currentProteins + proteins).toFixed(1));
    };

  });

Litho image from remote URL

copy iconCopydownload iconDownload
public static Drawable drawableFromUrl(String url) throws IOException {
    Bitmap b = null;

    HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
    connection.connect();
    InputStream input = connection.getInputStream();

    b = BitmapFactory.decodeStream(input);

    return new BitmapDrawable(b);
}
-----------------------
@LayoutSpec
object MovieComponentSpec {

fun getImageController(imageUrl : String) = Fresco.newDraweeControllerBuilder()
    .setUri(imageUrl)
    .build()


@JvmStatic
@OnCreateLayout
internal fun onCreateLayout(
    c: ComponentContext,
    @Prop title: String,
    @Prop imageUrl: String
): Component {

    return Column.create(c)
        .paddingDip(ALL, 16f)
        .backgroundColor(Color.WHITE)
        .child(
            FrescoImage.create(c).controller(getImageController(imageUrl))
        )
        .child(
            Text.create(c)
                .text(title)
                .textSizeSp(10f)
        )
        .build()
    }

}

Program type already present: android.support.compat.R$attr

copy iconCopydownload iconDownload
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.30'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.facebook.testing.screenshot:plugin:0.8.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


ext {
    //Android
    minSdkVersion = 24
    targetSdkVersion = 28
    compileSdkVersion = targetSdkVersion
    testInstrumentationRunner = "com.appname.runner.SnapshotTestRunner"
    androidSupportLibVersion = "28.0.0"
    androidCompatVersion = "1.0.0-beta01"
    androidCardViewVersion = "1.0.0"
    constraintlayoutVersion = "1.1.3"
    okHttpLibVersion = "3.14.0"

    //Unit testing
    junit = "junit:junit:4.12"
    androidTestRunner = "androidx.test:runner:1.1.0-alpha4"
    espresso = "androidx.test.espresso:espresso-core:3.1.0-alpha4"
    supportTestRules = "com.android.support.test:rules:1.0.2"

    //Support Library & UI
    constraintLayout = "androidx.constraintlayout:constraintlayout:$constraintlayoutVersion"
    supportCompatV7 = "androidx.appcompat:appcompat:$androidCompatVersion"
    supportDesign = "com.android.support:design:$androidSupportLibVersion"
    supportCardView = "androidx.cardview:cardview:$androidCardViewVersion"
    supportCustomTabs = "com.android.support:customtabs:$androidSupportLibVersion"
    glide = "com.github.bumptech.glide:glide:3.7.0"


    mockito = "org.mockito:mockito-all:1.10.19"
    facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.8.0"
    facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.8.0"


    // RxJava lib
    rxAndroid = "io.reactivex.rxjava2:rxandroid:2.0.1"
    rxJava = "io.reactivex.rxjava2:rxjava:2.1.8"
    rxJavaRetrofitAdapter = "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"

    //Retrofit
    retrofit = "com.squareup.retrofit2:retrofit:2.4.0"
    okHttp = "com.squareup.okhttp3:okhttp:$okHttpLibVersion"
    okHttpLoggingInterceptor = "com.squareup.okhttp3:logging-interceptor:$okHttpLibVersion"
    retrofitGsonConverter = "com.squareup.retrofit2:converter-gson:2.3.0"
    retrofitScalarsConverter = "com.squareup.retrofit2:converter-scalars:2.3.0"

    //Others
    parceler = "org.parceler:parceler-api:1.1.9"
    parcelerAnnotationProcessor = "org.parceler:parceler:1.1.9"
    lombok = "org.projectlombok:lombok:1.16.16"
    lombokAnnotationProcessor = "org.projectlombok:lombok:1.16.16"

}
apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    defaultConfig {
        applicationId "com.example.gradletest"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation rootProject.ext.junit
    androidTestImplementation rootProject.ext.androidTestRunner
    androidTestImplementation rootProject.ext.espresso
    androidTestImplementation rootProject.ext.supportTestRules
    testImplementation rootProject.ext.mockito
    testImplementation rootProject.ext.facebookScreenshotTestCommon
    implementation rootProject.ext.facebookScreenshotTestLitho
    implementation rootProject.ext.constraintLayout
    implementation rootProject.ext.supportCompatV7
    implementation rootProject.ext.supportDesign
    implementation rootProject.ext.supportCardView
    implementation rootProject.ext.supportCustomTabs
    implementation rootProject.ext.glide
    // RxJava lib
    implementation rootProject.ext.rxAndroid
    implementation rootProject.ext.rxJava
    implementation rootProject.ext.rxJavaRetrofitAdapter
    //Retrofit
    implementation(rootProject.ext.retrofit) {
        exclude module: 'okhttp'
    }
        implementation rootProject.ext.okHttp
        implementation rootProject.ext.okHttpLoggingInterceptor
        implementation rootProject.ext.retrofitGsonConverter
        implementation rootProject.ext.retrofitScalarsConverter
    implementation rootProject.ext.parceler
//        annotationProcessor rootProject.ext.parcelerAnnotationProcessor
        implementation rootProject.ext.lombok
        annotationProcessor rootProject.ext.lombokAnnotationProcessor
    //Memory leaks
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
    debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.multidots:fingerprint-auth:1.0.1'
    implementation project(':energyswitchcui')
}
apply plugin: 'com.android.library'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    //Unit testing
    testImplementation rootProject.ext.junit
    androidTestImplementation rootProject.ext.androidTestRunner
    androidTestImplementation rootProject.ext.espresso
    testImplementation rootProject.ext.mockito
    testImplementation rootProject.ext.facebookScreenshotTestCommon
    implementation rootProject.ext.facebookScreenshotTestLitho
    androidTestImplementation rootProject.ext.supportTestRules

    //Support Library & UI
    implementation rootProject.ext.constraintLayout
    implementation rootProject.ext.supportCompatV7
    implementation rootProject.ext.supportDesign
    implementation rootProject.ext.supportCardView
    implementation rootProject.ext.supportCustomTabs
    implementation rootProject.ext.glide
    implementation 'com.intuit.sdp:sdp-android:1.0.6'

    // RxJava lib
    implementation rootProject.ext.rxAndroid
    implementation rootProject.ext.rxJava
    implementation rootProject.ext.rxJavaRetrofitAdapter

    //Retrofit
    implementation(rootProject.ext.retrofit) {
        exclude module: 'okhttp'
    }
    implementation rootProject.ext.okHttp
    implementation rootProject.ext.okHttpLoggingInterceptor
    implementation rootProject.ext.retrofitGsonConverter
    implementation rootProject.ext.retrofitScalarsConverter

    //Others
    implementation rootProject.ext.parceler
//    kapt rootProject.ext.parcelerAnnotationProcessor
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

repositories {
    mavenCentral()
}

// need for facebook screenshot test in module
apply plugin: 'com.facebook.testing.screenshot'
screenshots {
    multipleDevices true
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.9.0"

facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.9.0"
-----------------------
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.30'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.facebook.testing.screenshot:plugin:0.8.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


ext {
    //Android
    minSdkVersion = 24
    targetSdkVersion = 28
    compileSdkVersion = targetSdkVersion
    testInstrumentationRunner = "com.appname.runner.SnapshotTestRunner"
    androidSupportLibVersion = "28.0.0"
    androidCompatVersion = "1.0.0-beta01"
    androidCardViewVersion = "1.0.0"
    constraintlayoutVersion = "1.1.3"
    okHttpLibVersion = "3.14.0"

    //Unit testing
    junit = "junit:junit:4.12"
    androidTestRunner = "androidx.test:runner:1.1.0-alpha4"
    espresso = "androidx.test.espresso:espresso-core:3.1.0-alpha4"
    supportTestRules = "com.android.support.test:rules:1.0.2"

    //Support Library & UI
    constraintLayout = "androidx.constraintlayout:constraintlayout:$constraintlayoutVersion"
    supportCompatV7 = "androidx.appcompat:appcompat:$androidCompatVersion"
    supportDesign = "com.android.support:design:$androidSupportLibVersion"
    supportCardView = "androidx.cardview:cardview:$androidCardViewVersion"
    supportCustomTabs = "com.android.support:customtabs:$androidSupportLibVersion"
    glide = "com.github.bumptech.glide:glide:3.7.0"


    mockito = "org.mockito:mockito-all:1.10.19"
    facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.8.0"
    facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.8.0"


    // RxJava lib
    rxAndroid = "io.reactivex.rxjava2:rxandroid:2.0.1"
    rxJava = "io.reactivex.rxjava2:rxjava:2.1.8"
    rxJavaRetrofitAdapter = "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"

    //Retrofit
    retrofit = "com.squareup.retrofit2:retrofit:2.4.0"
    okHttp = "com.squareup.okhttp3:okhttp:$okHttpLibVersion"
    okHttpLoggingInterceptor = "com.squareup.okhttp3:logging-interceptor:$okHttpLibVersion"
    retrofitGsonConverter = "com.squareup.retrofit2:converter-gson:2.3.0"
    retrofitScalarsConverter = "com.squareup.retrofit2:converter-scalars:2.3.0"

    //Others
    parceler = "org.parceler:parceler-api:1.1.9"
    parcelerAnnotationProcessor = "org.parceler:parceler:1.1.9"
    lombok = "org.projectlombok:lombok:1.16.16"
    lombokAnnotationProcessor = "org.projectlombok:lombok:1.16.16"

}
apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    defaultConfig {
        applicationId "com.example.gradletest"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation rootProject.ext.junit
    androidTestImplementation rootProject.ext.androidTestRunner
    androidTestImplementation rootProject.ext.espresso
    androidTestImplementation rootProject.ext.supportTestRules
    testImplementation rootProject.ext.mockito
    testImplementation rootProject.ext.facebookScreenshotTestCommon
    implementation rootProject.ext.facebookScreenshotTestLitho
    implementation rootProject.ext.constraintLayout
    implementation rootProject.ext.supportCompatV7
    implementation rootProject.ext.supportDesign
    implementation rootProject.ext.supportCardView
    implementation rootProject.ext.supportCustomTabs
    implementation rootProject.ext.glide
    // RxJava lib
    implementation rootProject.ext.rxAndroid
    implementation rootProject.ext.rxJava
    implementation rootProject.ext.rxJavaRetrofitAdapter
    //Retrofit
    implementation(rootProject.ext.retrofit) {
        exclude module: 'okhttp'
    }
        implementation rootProject.ext.okHttp
        implementation rootProject.ext.okHttpLoggingInterceptor
        implementation rootProject.ext.retrofitGsonConverter
        implementation rootProject.ext.retrofitScalarsConverter
    implementation rootProject.ext.parceler
//        annotationProcessor rootProject.ext.parcelerAnnotationProcessor
        implementation rootProject.ext.lombok
        annotationProcessor rootProject.ext.lombokAnnotationProcessor
    //Memory leaks
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
    debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.multidots:fingerprint-auth:1.0.1'
    implementation project(':energyswitchcui')
}
apply plugin: 'com.android.library'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    //Unit testing
    testImplementation rootProject.ext.junit
    androidTestImplementation rootProject.ext.androidTestRunner
    androidTestImplementation rootProject.ext.espresso
    testImplementation rootProject.ext.mockito
    testImplementation rootProject.ext.facebookScreenshotTestCommon
    implementation rootProject.ext.facebookScreenshotTestLitho
    androidTestImplementation rootProject.ext.supportTestRules

    //Support Library & UI
    implementation rootProject.ext.constraintLayout
    implementation rootProject.ext.supportCompatV7
    implementation rootProject.ext.supportDesign
    implementation rootProject.ext.supportCardView
    implementation rootProject.ext.supportCustomTabs
    implementation rootProject.ext.glide
    implementation 'com.intuit.sdp:sdp-android:1.0.6'

    // RxJava lib
    implementation rootProject.ext.rxAndroid
    implementation rootProject.ext.rxJava
    implementation rootProject.ext.rxJavaRetrofitAdapter

    //Retrofit
    implementation(rootProject.ext.retrofit) {
        exclude module: 'okhttp'
    }
    implementation rootProject.ext.okHttp
    implementation rootProject.ext.okHttpLoggingInterceptor
    implementation rootProject.ext.retrofitGsonConverter
    implementation rootProject.ext.retrofitScalarsConverter

    //Others
    implementation rootProject.ext.parceler
//    kapt rootProject.ext.parcelerAnnotationProcessor
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

repositories {
    mavenCentral()
}

// need for facebook screenshot test in module
apply plugin: 'com.facebook.testing.screenshot'
screenshots {
    multipleDevices true
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.9.0"

facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.9.0"
-----------------------
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.30'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.facebook.testing.screenshot:plugin:0.8.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


ext {
    //Android
    minSdkVersion = 24
    targetSdkVersion = 28
    compileSdkVersion = targetSdkVersion
    testInstrumentationRunner = "com.appname.runner.SnapshotTestRunner"
    androidSupportLibVersion = "28.0.0"
    androidCompatVersion = "1.0.0-beta01"
    androidCardViewVersion = "1.0.0"
    constraintlayoutVersion = "1.1.3"
    okHttpLibVersion = "3.14.0"

    //Unit testing
    junit = "junit:junit:4.12"
    androidTestRunner = "androidx.test:runner:1.1.0-alpha4"
    espresso = "androidx.test.espresso:espresso-core:3.1.0-alpha4"
    supportTestRules = "com.android.support.test:rules:1.0.2"

    //Support Library & UI
    constraintLayout = "androidx.constraintlayout:constraintlayout:$constraintlayoutVersion"
    supportCompatV7 = "androidx.appcompat:appcompat:$androidCompatVersion"
    supportDesign = "com.android.support:design:$androidSupportLibVersion"
    supportCardView = "androidx.cardview:cardview:$androidCardViewVersion"
    supportCustomTabs = "com.android.support:customtabs:$androidSupportLibVersion"
    glide = "com.github.bumptech.glide:glide:3.7.0"


    mockito = "org.mockito:mockito-all:1.10.19"
    facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.8.0"
    facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.8.0"


    // RxJava lib
    rxAndroid = "io.reactivex.rxjava2:rxandroid:2.0.1"
    rxJava = "io.reactivex.rxjava2:rxjava:2.1.8"
    rxJavaRetrofitAdapter = "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"

    //Retrofit
    retrofit = "com.squareup.retrofit2:retrofit:2.4.0"
    okHttp = "com.squareup.okhttp3:okhttp:$okHttpLibVersion"
    okHttpLoggingInterceptor = "com.squareup.okhttp3:logging-interceptor:$okHttpLibVersion"
    retrofitGsonConverter = "com.squareup.retrofit2:converter-gson:2.3.0"
    retrofitScalarsConverter = "com.squareup.retrofit2:converter-scalars:2.3.0"

    //Others
    parceler = "org.parceler:parceler-api:1.1.9"
    parcelerAnnotationProcessor = "org.parceler:parceler:1.1.9"
    lombok = "org.projectlombok:lombok:1.16.16"
    lombokAnnotationProcessor = "org.projectlombok:lombok:1.16.16"

}
apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    defaultConfig {
        applicationId "com.example.gradletest"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation rootProject.ext.junit
    androidTestImplementation rootProject.ext.androidTestRunner
    androidTestImplementation rootProject.ext.espresso
    androidTestImplementation rootProject.ext.supportTestRules
    testImplementation rootProject.ext.mockito
    testImplementation rootProject.ext.facebookScreenshotTestCommon
    implementation rootProject.ext.facebookScreenshotTestLitho
    implementation rootProject.ext.constraintLayout
    implementation rootProject.ext.supportCompatV7
    implementation rootProject.ext.supportDesign
    implementation rootProject.ext.supportCardView
    implementation rootProject.ext.supportCustomTabs
    implementation rootProject.ext.glide
    // RxJava lib
    implementation rootProject.ext.rxAndroid
    implementation rootProject.ext.rxJava
    implementation rootProject.ext.rxJavaRetrofitAdapter
    //Retrofit
    implementation(rootProject.ext.retrofit) {
        exclude module: 'okhttp'
    }
        implementation rootProject.ext.okHttp
        implementation rootProject.ext.okHttpLoggingInterceptor
        implementation rootProject.ext.retrofitGsonConverter
        implementation rootProject.ext.retrofitScalarsConverter
    implementation rootProject.ext.parceler
//        annotationProcessor rootProject.ext.parcelerAnnotationProcessor
        implementation rootProject.ext.lombok
        annotationProcessor rootProject.ext.lombokAnnotationProcessor
    //Memory leaks
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
    debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.multidots:fingerprint-auth:1.0.1'
    implementation project(':energyswitchcui')
}
apply plugin: 'com.android.library'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    //Unit testing
    testImplementation rootProject.ext.junit
    androidTestImplementation rootProject.ext.androidTestRunner
    androidTestImplementation rootProject.ext.espresso
    testImplementation rootProject.ext.mockito
    testImplementation rootProject.ext.facebookScreenshotTestCommon
    implementation rootProject.ext.facebookScreenshotTestLitho
    androidTestImplementation rootProject.ext.supportTestRules

    //Support Library & UI
    implementation rootProject.ext.constraintLayout
    implementation rootProject.ext.supportCompatV7
    implementation rootProject.ext.supportDesign
    implementation rootProject.ext.supportCardView
    implementation rootProject.ext.supportCustomTabs
    implementation rootProject.ext.glide
    implementation 'com.intuit.sdp:sdp-android:1.0.6'

    // RxJava lib
    implementation rootProject.ext.rxAndroid
    implementation rootProject.ext.rxJava
    implementation rootProject.ext.rxJavaRetrofitAdapter

    //Retrofit
    implementation(rootProject.ext.retrofit) {
        exclude module: 'okhttp'
    }
    implementation rootProject.ext.okHttp
    implementation rootProject.ext.okHttpLoggingInterceptor
    implementation rootProject.ext.retrofitGsonConverter
    implementation rootProject.ext.retrofitScalarsConverter

    //Others
    implementation rootProject.ext.parceler
//    kapt rootProject.ext.parcelerAnnotationProcessor
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

repositories {
    mavenCentral()
}

// need for facebook screenshot test in module
apply plugin: 'com.facebook.testing.screenshot'
screenshots {
    multipleDevices true
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.9.0"

facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.9.0"
-----------------------
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.30'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.facebook.testing.screenshot:plugin:0.8.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


ext {
    //Android
    minSdkVersion = 24
    targetSdkVersion = 28
    compileSdkVersion = targetSdkVersion
    testInstrumentationRunner = "com.appname.runner.SnapshotTestRunner"
    androidSupportLibVersion = "28.0.0"
    androidCompatVersion = "1.0.0-beta01"
    androidCardViewVersion = "1.0.0"
    constraintlayoutVersion = "1.1.3"
    okHttpLibVersion = "3.14.0"

    //Unit testing
    junit = "junit:junit:4.12"
    androidTestRunner = "androidx.test:runner:1.1.0-alpha4"
    espresso = "androidx.test.espresso:espresso-core:3.1.0-alpha4"
    supportTestRules = "com.android.support.test:rules:1.0.2"

    //Support Library & UI
    constraintLayout = "androidx.constraintlayout:constraintlayout:$constraintlayoutVersion"
    supportCompatV7 = "androidx.appcompat:appcompat:$androidCompatVersion"
    supportDesign = "com.android.support:design:$androidSupportLibVersion"
    supportCardView = "androidx.cardview:cardview:$androidCardViewVersion"
    supportCustomTabs = "com.android.support:customtabs:$androidSupportLibVersion"
    glide = "com.github.bumptech.glide:glide:3.7.0"


    mockito = "org.mockito:mockito-all:1.10.19"
    facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.8.0"
    facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.8.0"


    // RxJava lib
    rxAndroid = "io.reactivex.rxjava2:rxandroid:2.0.1"
    rxJava = "io.reactivex.rxjava2:rxjava:2.1.8"
    rxJavaRetrofitAdapter = "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"

    //Retrofit
    retrofit = "com.squareup.retrofit2:retrofit:2.4.0"
    okHttp = "com.squareup.okhttp3:okhttp:$okHttpLibVersion"
    okHttpLoggingInterceptor = "com.squareup.okhttp3:logging-interceptor:$okHttpLibVersion"
    retrofitGsonConverter = "com.squareup.retrofit2:converter-gson:2.3.0"
    retrofitScalarsConverter = "com.squareup.retrofit2:converter-scalars:2.3.0"

    //Others
    parceler = "org.parceler:parceler-api:1.1.9"
    parcelerAnnotationProcessor = "org.parceler:parceler:1.1.9"
    lombok = "org.projectlombok:lombok:1.16.16"
    lombokAnnotationProcessor = "org.projectlombok:lombok:1.16.16"

}
apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    defaultConfig {
        applicationId "com.example.gradletest"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation rootProject.ext.junit
    androidTestImplementation rootProject.ext.androidTestRunner
    androidTestImplementation rootProject.ext.espresso
    androidTestImplementation rootProject.ext.supportTestRules
    testImplementation rootProject.ext.mockito
    testImplementation rootProject.ext.facebookScreenshotTestCommon
    implementation rootProject.ext.facebookScreenshotTestLitho
    implementation rootProject.ext.constraintLayout
    implementation rootProject.ext.supportCompatV7
    implementation rootProject.ext.supportDesign
    implementation rootProject.ext.supportCardView
    implementation rootProject.ext.supportCustomTabs
    implementation rootProject.ext.glide
    // RxJava lib
    implementation rootProject.ext.rxAndroid
    implementation rootProject.ext.rxJava
    implementation rootProject.ext.rxJavaRetrofitAdapter
    //Retrofit
    implementation(rootProject.ext.retrofit) {
        exclude module: 'okhttp'
    }
        implementation rootProject.ext.okHttp
        implementation rootProject.ext.okHttpLoggingInterceptor
        implementation rootProject.ext.retrofitGsonConverter
        implementation rootProject.ext.retrofitScalarsConverter
    implementation rootProject.ext.parceler
//        annotationProcessor rootProject.ext.parcelerAnnotationProcessor
        implementation rootProject.ext.lombok
        annotationProcessor rootProject.ext.lombokAnnotationProcessor
    //Memory leaks
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
    debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.multidots:fingerprint-auth:1.0.1'
    implementation project(':energyswitchcui')
}
apply plugin: 'com.android.library'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    //Unit testing
    testImplementation rootProject.ext.junit
    androidTestImplementation rootProject.ext.androidTestRunner
    androidTestImplementation rootProject.ext.espresso
    testImplementation rootProject.ext.mockito
    testImplementation rootProject.ext.facebookScreenshotTestCommon
    implementation rootProject.ext.facebookScreenshotTestLitho
    androidTestImplementation rootProject.ext.supportTestRules

    //Support Library & UI
    implementation rootProject.ext.constraintLayout
    implementation rootProject.ext.supportCompatV7
    implementation rootProject.ext.supportDesign
    implementation rootProject.ext.supportCardView
    implementation rootProject.ext.supportCustomTabs
    implementation rootProject.ext.glide
    implementation 'com.intuit.sdp:sdp-android:1.0.6'

    // RxJava lib
    implementation rootProject.ext.rxAndroid
    implementation rootProject.ext.rxJava
    implementation rootProject.ext.rxJavaRetrofitAdapter

    //Retrofit
    implementation(rootProject.ext.retrofit) {
        exclude module: 'okhttp'
    }
    implementation rootProject.ext.okHttp
    implementation rootProject.ext.okHttpLoggingInterceptor
    implementation rootProject.ext.retrofitGsonConverter
    implementation rootProject.ext.retrofitScalarsConverter

    //Others
    implementation rootProject.ext.parceler
//    kapt rootProject.ext.parcelerAnnotationProcessor
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

repositories {
    mavenCentral()
}

// need for facebook screenshot test in module
apply plugin: 'com.facebook.testing.screenshot'
screenshots {
    multipleDevices true
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.9.0"

facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.9.0"
-----------------------
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.30'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.facebook.testing.screenshot:plugin:0.8.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


ext {
    //Android
    minSdkVersion = 24
    targetSdkVersion = 28
    compileSdkVersion = targetSdkVersion
    testInstrumentationRunner = "com.appname.runner.SnapshotTestRunner"
    androidSupportLibVersion = "28.0.0"
    androidCompatVersion = "1.0.0-beta01"
    androidCardViewVersion = "1.0.0"
    constraintlayoutVersion = "1.1.3"
    okHttpLibVersion = "3.14.0"

    //Unit testing
    junit = "junit:junit:4.12"
    androidTestRunner = "androidx.test:runner:1.1.0-alpha4"
    espresso = "androidx.test.espresso:espresso-core:3.1.0-alpha4"
    supportTestRules = "com.android.support.test:rules:1.0.2"

    //Support Library & UI
    constraintLayout = "androidx.constraintlayout:constraintlayout:$constraintlayoutVersion"
    supportCompatV7 = "androidx.appcompat:appcompat:$androidCompatVersion"
    supportDesign = "com.android.support:design:$androidSupportLibVersion"
    supportCardView = "androidx.cardview:cardview:$androidCardViewVersion"
    supportCustomTabs = "com.android.support:customtabs:$androidSupportLibVersion"
    glide = "com.github.bumptech.glide:glide:3.7.0"


    mockito = "org.mockito:mockito-all:1.10.19"
    facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.8.0"
    facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.8.0"


    // RxJava lib
    rxAndroid = "io.reactivex.rxjava2:rxandroid:2.0.1"
    rxJava = "io.reactivex.rxjava2:rxjava:2.1.8"
    rxJavaRetrofitAdapter = "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"

    //Retrofit
    retrofit = "com.squareup.retrofit2:retrofit:2.4.0"
    okHttp = "com.squareup.okhttp3:okhttp:$okHttpLibVersion"
    okHttpLoggingInterceptor = "com.squareup.okhttp3:logging-interceptor:$okHttpLibVersion"
    retrofitGsonConverter = "com.squareup.retrofit2:converter-gson:2.3.0"
    retrofitScalarsConverter = "com.squareup.retrofit2:converter-scalars:2.3.0"

    //Others
    parceler = "org.parceler:parceler-api:1.1.9"
    parcelerAnnotationProcessor = "org.parceler:parceler:1.1.9"
    lombok = "org.projectlombok:lombok:1.16.16"
    lombokAnnotationProcessor = "org.projectlombok:lombok:1.16.16"

}
apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    defaultConfig {
        applicationId "com.example.gradletest"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation rootProject.ext.junit
    androidTestImplementation rootProject.ext.androidTestRunner
    androidTestImplementation rootProject.ext.espresso
    androidTestImplementation rootProject.ext.supportTestRules
    testImplementation rootProject.ext.mockito
    testImplementation rootProject.ext.facebookScreenshotTestCommon
    implementation rootProject.ext.facebookScreenshotTestLitho
    implementation rootProject.ext.constraintLayout
    implementation rootProject.ext.supportCompatV7
    implementation rootProject.ext.supportDesign
    implementation rootProject.ext.supportCardView
    implementation rootProject.ext.supportCustomTabs
    implementation rootProject.ext.glide
    // RxJava lib
    implementation rootProject.ext.rxAndroid
    implementation rootProject.ext.rxJava
    implementation rootProject.ext.rxJavaRetrofitAdapter
    //Retrofit
    implementation(rootProject.ext.retrofit) {
        exclude module: 'okhttp'
    }
        implementation rootProject.ext.okHttp
        implementation rootProject.ext.okHttpLoggingInterceptor
        implementation rootProject.ext.retrofitGsonConverter
        implementation rootProject.ext.retrofitScalarsConverter
    implementation rootProject.ext.parceler
//        annotationProcessor rootProject.ext.parcelerAnnotationProcessor
        implementation rootProject.ext.lombok
        annotationProcessor rootProject.ext.lombokAnnotationProcessor
    //Memory leaks
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
    debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.multidots:fingerprint-auth:1.0.1'
    implementation project(':energyswitchcui')
}
apply plugin: 'com.android.library'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    //Unit testing
    testImplementation rootProject.ext.junit
    androidTestImplementation rootProject.ext.androidTestRunner
    androidTestImplementation rootProject.ext.espresso
    testImplementation rootProject.ext.mockito
    testImplementation rootProject.ext.facebookScreenshotTestCommon
    implementation rootProject.ext.facebookScreenshotTestLitho
    androidTestImplementation rootProject.ext.supportTestRules

    //Support Library & UI
    implementation rootProject.ext.constraintLayout
    implementation rootProject.ext.supportCompatV7
    implementation rootProject.ext.supportDesign
    implementation rootProject.ext.supportCardView
    implementation rootProject.ext.supportCustomTabs
    implementation rootProject.ext.glide
    implementation 'com.intuit.sdp:sdp-android:1.0.6'

    // RxJava lib
    implementation rootProject.ext.rxAndroid
    implementation rootProject.ext.rxJava
    implementation rootProject.ext.rxJavaRetrofitAdapter

    //Retrofit
    implementation(rootProject.ext.retrofit) {
        exclude module: 'okhttp'
    }
    implementation rootProject.ext.okHttp
    implementation rootProject.ext.okHttpLoggingInterceptor
    implementation rootProject.ext.retrofitGsonConverter
    implementation rootProject.ext.retrofitScalarsConverter

    //Others
    implementation rootProject.ext.parceler
//    kapt rootProject.ext.parcelerAnnotationProcessor
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

repositories {
    mavenCentral()
}

// need for facebook screenshot test in module
apply plugin: 'com.facebook.testing.screenshot'
screenshots {
    multipleDevices true
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.9.0"

facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.9.0"

Litho ListRecyclerConfiguration Kotlin with linearLayoutInfoFactory

copy iconCopydownload iconDownload
RecyclerCollectionComponent.create(c)
        .recyclerConfiguration(
            ListRecyclerConfiguration.create()
                .orientation(LinearLayoutManager.HORIZONTAL)
                .snapMode(0)
                .build()
        )
        .section(
            DataDiffSection.create<DiscoverListDataModel>(SectionContext(c))
                .data(dataModels)
                .renderEventHandler(DiscoverListComponent.onRender(c))
                .onCheckIsSameItemEventHandler(DiscoverListComponent.isSameItem(c))
                .onCheckIsSameContentEventHandler(DiscoverListComponent.isSameContent(c))
                .build()
        )
        .canMeasureRecycler(true)
        .disablePTR(true)
        .build()

pandas replace null values for a subset of rows and columns

copy iconCopydownload iconDownload
m = df['Litho'].notnull()
df.loc[m,'Mu_alt'] = df.loc[m,'Mu_alt'].fillna(0)

How to implement part of sections with LinearLayoutManager and part with GridLayoutManager?

copy iconCopydownload iconDownload
RecyclerCollectionComponent.create(c)
                .recyclerConfiguration(
                        StaggeredGridRecyclerConfiguration<SectionBinderTarget>(3)
                )
                .section(...)
                .build()
 @OnEvent(RenderEvent::class)
    fun onRender(c: SectionContext,
    ): RenderInfo {
        return when (model) {
            is ImagesItem -> ComponentRenderInfo.create()
                        .isFullSpan(true)
                        .component(...)
                        .build()
    }
-----------------------
RecyclerCollectionComponent.create(c)
                .recyclerConfiguration(
                        StaggeredGridRecyclerConfiguration<SectionBinderTarget>(3)
                )
                .section(...)
                .build()
 @OnEvent(RenderEvent::class)
    fun onRender(c: SectionContext,
    ): RenderInfo {
        return when (model) {
            is ImagesItem -> ComponentRenderInfo.create()
                        .isFullSpan(true)
                        .component(...)
                        .build()
    }

Litho, ViewPager and Tabs. How to load several Tab's layouts using Litho?

copy iconCopydownload iconDownload
public static boolean incrementalMountUsesLocalVisibleBounds = false;
// ViewPager does not give its child views any callbacks when it moves content onto the screen,
// so we need to attach a listener to give us the information that we require.
ViewParent viewParent = lithoView.getParent();
while (viewParent != null) {
  if (ComponentsConfiguration.incrementalMountUsesLocalVisibleBounds
      && viewParent instanceof ViewPager) {
    final ViewPager viewPager = (ViewPager) viewParent;
    final IncrementalMountHelper.ViewPagerListener viewPagerListener =
        new ViewPagerListener(mComponentTree, viewPager);
    ViewCompat.postOnAnimation(
        viewPager,
        new Runnable() {
          @Override
          public void run() {
            viewPager.addOnPageChangeListener(viewPagerListener);
          }
        });
    mViewPagerListeners.add(viewPagerListener);
  }

  if (viewParent instanceof LithoView && ((LithoView) viewParent).doesOwnIncrementalMount()) {
    lithoView.setDoesOwnIncrementalMount(true);
  }

  viewParent = viewParent.getParent();
}
-----------------------
public static boolean incrementalMountUsesLocalVisibleBounds = false;
// ViewPager does not give its child views any callbacks when it moves content onto the screen,
// so we need to attach a listener to give us the information that we require.
ViewParent viewParent = lithoView.getParent();
while (viewParent != null) {
  if (ComponentsConfiguration.incrementalMountUsesLocalVisibleBounds
      && viewParent instanceof ViewPager) {
    final ViewPager viewPager = (ViewPager) viewParent;
    final IncrementalMountHelper.ViewPagerListener viewPagerListener =
        new ViewPagerListener(mComponentTree, viewPager);
    ViewCompat.postOnAnimation(
        viewPager,
        new Runnable() {
          @Override
          public void run() {
            viewPager.addOnPageChangeListener(viewPagerListener);
          }
        });
    mViewPagerListeners.add(viewPagerListener);
  }

  if (viewParent instanceof LithoView && ((LithoView) viewParent).doesOwnIncrementalMount()) {
    lithoView.setDoesOwnIncrementalMount(true);
  }

  viewParent = viewParent.getParent();
}

Community Discussions

Trending Discussions on litho
  • how to fill pcolor with hatches by mapping it alongwith color fill
  • Create vertical stacked bar chart referenced to y values (lithology/stratigraphic column)
  • Litho Radio Group container
  • Building UI using Litho and JSON
  • App crashing on start when using facebooks litho library
  • Does Litho Support Data Binding?
  • NaN Issue - Unable to display number in Jquery
  • Is there a way to easily propagate a Litho event from a child to the root parent?
  • Litho image from remote URL
  • How to add exoplayer in facebook litho for android
Trending Discussions on litho

QUESTION

how to fill pcolor with hatches by mapping it alongwith color fill

Asked 2020-Dec-03 at 07:49

Hi I want to continue from what I already ask in here Create vertical stacked bar chart referenced to y values (lithology/stratigraphic column)

The question is how to make multiple hatches on my pcolor, here is the picture

enter image description here

I want to make that white colored pcolor with 'x' pattern, and the red one with '+'.

Any ways to do it? thank you in advance

lithcode = {'ABT': 1, 'AT': 2, 'GD': 3, 'BAT': 4, 'BTT': 5, 'TT': 6, 'NC': 7, 'MV':8, 'MS':9, 'GW':10}
colors = ['darkred', 'crimson', 'red', 'peru', 'lightsalmon', 'lightpink', 'white', 'oldlace', 
          'thistle', 'lightgray']
hatch=['','+','','','','','x','','','']
cmap = ListedColormap(colors)


Zb=litho['litho'].map(lithcode).to_numpy().reshape(1, -1)
nonan=np.count_nonzero(Zb[np.logical_not(np.isnan(Zb))])
Za=litho['litho'][:nonan].map(lithcode).to_numpy().reshape(1, -1)
X=litho['elev litho'][:nonan]
cl.pcolor(X, [0, 1], Za, cmap=cmap, vmin=1, vmax=len(colors))

# ax.set_yticks(data['md litho']) optionally set the y-ticks to indicate the row borders
hands = [Patch(color=col, label=k) for k, col in zip(lithcode.keys(), colors)]
cl.legend(handles=hands, loc=(1.01, 0), ncol=2, fontsize=8)
        

ANSWER

Answered 2020-Dec-03 at 07:49

Based on the linked example data, and on How to hatch PolyCollection instance? for a method to hatch the PolyCollection created by pcolor:

import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from matplotlib.patches import Patch, PathPatch
import pandas as pd

df = pd.DataFrame({'md litho': [0, 31, 49, 67, 406, 427, 442],
                   'litho': ['NC', 'AT', 'BTT', 'NC', 'ABT', 'BAT', 'NC']})
lithcode = {'ABT': 1, 'AT': 2, 'GD': 3, 'BAT': 4, 'BTT': 5, 'TT': 6, 'NC': 7, 'MV': 8, 'MS': 9, 'GW': 10}
colors = ['darkred', 'crimson', 'red', 'peru', 'lightsalmon', 'lightpink', 'white', 'oldlace', 'thistle', 'lightgray']
cmap = ListedColormap(colors)
hatches = ['', '++', '', '', '', '', 'xx', '', '', '']

fig, ax = plt.subplots(figsize=(12, 1.4))
lithcode_values = df['litho'][:-1].map(lithcode).to_numpy()
polycollection = ax.pcolor(df['md litho'], [0, 1], lithcode_values.reshape(1, -1), cmap=cmap, vmin=1, vmax=len(colors))
ax.set_xticks(df['md litho'])  # optionally set the x-ticks to indicate the column borders
ax.set_yticks([])  # hide ticks on the y-axis

for path, d2_val in zip(polycollection.get_paths(), lithcode_values):
    hatch = hatches[d2_val - 1]
    if hatch != '':
        ax.add_patch(PathPatch(path, hatch=hatch, facecolor='none', edgecolor='black'))

hands = [Patch(facecolor=col, label=k, edgecolor='black', hatch=hatch) for k, col, hatch in
         zip(lithcode.keys(), colors, hatches)]
ax.legend(handles=hands, bbox_to_anchor=(1.03, 1.02), loc='upper left', ncol=2, fontsize=8, facecolor='PaleTurquoise')
plt.tight_layout()  # this fits the legend and the labels nicely into the figure
plt.show()

example plot

PS: Importing matplotlib.pyplot as cl is extremely confusing.

Source https://stackoverflow.com/questions/65119142

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install litho

Litho can be integrated either in Gradle or Buck projects. Read our Getting Started guide for installation instructions.

Support

Before contributing to Litho, please first read the Code of Conduct that we expect project participants to adhere to. For pull requests, please see our CONTRIBUTING guide. See our issues page for ideas on how to contribute or to let us know of any problems. Please also read our Coding Style and Code of Conduct before you contribute.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Compare User Interface Libraries with Highest Quality
Compare User Interface Libraries with Highest Security
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.