Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Collection of examples on how to improve preview of your layout

License

NotificationsYou must be signed in to change notification settings

VladimirWrites/tools-sample

Repository files navigation

header

This repo is a collection of sample data that you can use in your project.It also contains examples on how to improve preview of your layout.

Usage

Add following code into yourbuild.gradle.

clean.doFirst {    println "cleanSamples"    def samplesDir = new File(projectDir.absolutePath, "sampledata")    if (samplesDir.exists()) {        samplesDir.deleteDir()    }}    preBuild.doFirst {    println "fetchSamplesStarted"    def samplesDir = new File(projectDir.absolutePath, "sampledata")    if (samplesDir.exists()) {        println "samples dir already exists"        return    }    samplesDir.mkdir()    def files = ["lotr.json", "starwars.json", "hitchhikers.json", "developers.json"]    for(fileName in files) {        def names = new File(samplesDir, fileName)        new URL("https://raw.githubusercontent.com/VladimirWrites/tools-sample/master/sampledata/$fileName").withInputStream { i ->            names.withOutputStream {               it << i            }        }        println "fetchSample: $fileName"    }    println "fetchSamplesEnded"}

After you rebuild your project, you will have files defined infiles array in yoursampledata folder.Now you can use the sample data in your layout like this:

<TextView    android:layout_width="wrap_content"    android:layout_height="wrap_content"    tools:text="@sample/lotr.json/characters/name" />

Credits

License

Copyright 2018 Vladimir JovanovicLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at     http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.

About

Collection of examples on how to improve preview of your layout

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp