- Open VS Code
- Ctrl + Shift + P
- Type "user"
- Choose "Preferences: Open user Settings"
- Include following settings and restart
- Test Terminal by Ctrl + Shift +
(Command +)
| package br.com.nglauber.jetpackcomposeplayground.screens | |
| import androidx.compose.foundation.background | |
| import androidx.compose.foundation.layout.* | |
| import androidx.compose.foundation.lazy.LazyColumn | |
| import androidx.compose.foundation.lazy.LazyRow | |
| import androidx.compose.foundation.lazy.items | |
| import androidx.compose.foundation.shape.RoundedCornerShape | |
| import androidx.compose.material.MaterialTheme | |
| import androidx.compose.material.Text |
| //app build.gradle | |
| apply plugin: 'kotlin-kapt' | |
| ... | |
| dependencies { | |
| { | |
| //Moshi Core | |
| implementation "com.squareup.moshi:moshi:1.8.0" | |
| //Moshi Codegen |
| import java.io.InputStream | |
| import java.io.OutputStream | |
| fun InputStream.copyTo(out: OutputStream, onCopy: (totalBytesCopied: Long, bytesJustCopied: Int) -> Any): Long { | |
| var bytesCopied: Long = 0 | |
| val buffer = ByteArray(DEFAULT_BUFFER_SIZE) | |
| var bytes = read(buffer) | |
| while (bytes >= 0) { | |
| out.write(buffer, 0, bytes) | |
| bytesCopied += bytes |
| /* | |
| * Handling Errors using async/await | |
| * Has to be used inside an async function | |
| */ | |
| try { | |
| const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
| // Success 🎉 | |
| console.log(response); | |
| } catch (error) { | |
| // Error 😨 |
| @DATABASE@__%Y-%m-%d_%H-%M-%S |
| import android.app.Activity; | |
| import android.content.Context; | |
| import android.content.Intent; | |
| import android.content.pm.ResolveInfo; | |
| import android.content.res.AssetFileDescriptor; | |
| import android.database.Cursor; | |
| import android.graphics.Bitmap; | |
| import android.graphics.BitmapFactory; | |
| import android.graphics.Matrix; | |
| import android.media.ExifInterface; |
You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.
The RecyclerView should use a LinearLayoutManager.
You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)
This is a porting of the class SimpleSectionedListAdapter provided by Google
Example: