Skip to content

Instantly share code, notes, and snippets.

View gabrielbmoro's full-sized avatar
👋
Hii

Gabriel Bronzatti Moro gabrielbmoro

👋
Hii
View GitHub Profile
@gabrielbmoro
gabrielbmoro / show_message.kt
Last active November 25, 2021 00:30
Example - Annotated argument
fun showMessage(context: Context, @StringRes val idRes: Int) {
Toast.makeText(context, idRes, Toast.SHORT_LENGHT).show()
}
@gabrielbmoro
gabrielbmoro / deep_layout.xml
Last active November 25, 2021 00:21
Deep Layout - Example
<LinearLayout>
<FrameLayout>
<RelativeLayout>
<ConstraintLayout>
<View />
<View />
<View />
<View />
</ConstraintLayout>
</RelativeLayout>
@gabrielbmoro
gabrielbmoro / HeaderComponent.kt
Created November 12, 2020 11:57
Custom ViewGroup using a ConstraintLayout
data class HeaderContent(
val headerText: String,
val subHeaderText: String,
val buttonText: String,
val buttonEvent: (()->Unit),
val isButtonVisible: Boolean,
val barEvent: (()->Unit)
)
class HeaderComponent @JvmOverloads constructor(
@gabrielbmoro
gabrielbmoro / FragmentExample.kt
Last active October 4, 2020 14:55
Starting with Dagger Hilt
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.viewModels
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
class InputAlertDialogFragment : DialogFragment() {
private val viewModel by viewModels<ViewModelExample>()
@gabrielbmoro
gabrielbmoro / ContextUtils.kt
Created August 10, 2020 14:38
Change the soft input mode
/**
* Make sure that @param softInputMode is a value from WindowManager.LayoutParams, for example:
* - SOFT_INPUT_ADJUST_PAN
*
* @return the previous softInputMode
*/
fun FragmentActivity.setSoftInputMode(softInputMode: Int): Int? {
val previousSoftInputMode: Int? =
try {
packageManager.getActivityInfo(
fun setProgressBarColor(@ColorRes colorRes: Int) {
val unwrappedDrawable = progressbar.progressDrawable
DrawableCompat.setTint(unwrappedDrawable, ContextCompat.getColor(context, colorRes))
}

[BOARD TICKET ID] - PR title

Description

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

Type

  • Bugfix
@gabrielbmoro
gabrielbmoro / editor_component.dart
Created March 22, 2020 22:27
Learning Flutter - Alura - First course
import 'package:flutter/material.dart';
class Editor extends StatelessWidget {
final TextEditingController controller;
final String labelText;
final String hintText;
final IconData icon;
Editor(this.labelText, {this.controller, this.hintText, this.icon});
@gabrielbmoro
gabrielbmoro / Global.kt
Created October 14, 2019 15:18
It is used to send notification from child views to parents
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
class RxBus {
private val bus : PublishSubject<Any> = PublishSubject.create()
fun send(any : Any) = bus.onNext(any)
@gabrielbmoro
gabrielbmoro / SimpleAnimation.kt
Created September 24, 2019 02:23
Simple animation using translation property
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
super.onCreate(savedInstanceState, persistentState)
var multiplier = 1
val lastMultiplier = 2
val viewToAnimate : View = findViewById(R.id.vwContent)
findViewById<Button>(R.id.btnDispare).apply{
setOnClickListener {
ObjectAnimator.ofFloat(