Skip to content

Instantly share code, notes, and snippets.

View pbhoraskar911's full-sized avatar
πŸ‘¨β€πŸ’»
Keep Coding

Pranav Bhoraskar pbhoraskar911

πŸ‘¨β€πŸ’»
Keep Coding
  • India
View GitHub Profile
@pbhoraskar911
pbhoraskar911 / .zshrc
Created February 1, 2023 10:19 — forked from chrisnolet/.zshrc
Color-coded git branch for zsh prompt
autoload -Uz compinit && compinit
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
add-zsh-hook precmd vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' formats " %F{cyan}%c%u(%b)%f"
zstyle ':vcs_info:*' actionformats " %F{cyan}%c%u(%b)%f %a"
zstyle ':vcs_info:*' stagedstr "%F{green}"
@pbhoraskar911
pbhoraskar911 / compose_dependencies
Created January 6, 2023 09:06
Compose Project Dependencies
build.gradle (app)
android {
...
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.3.2"
@pbhoraskar911
pbhoraskar911 / activity_ui_demo.xml
Last active February 1, 2021 11:09
Constraint Layout - Basic UI elements and attributes example
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
<com.google.android.material.button.MaterialButton
android:id="@+id/button1"
android:layout_width="0dp"
@pbhoraskar911
pbhoraskar911 / SearchActivity.kt
Last active February 1, 2021 10:50
SearchActivity.kt - TextChanges
override fun onCreate(savedInstance: bundle?) {
super.onCreate(savedInstance)
with(search_edittext) {
viewModel.processSearchTextChanges(this.textChanges())
}
}
// observing the auto suggestion search results
viewModel.searchAutoSuggestionLiveData.observe(this, Observer {
autoSuggestionResponse ->
@pbhoraskar911
pbhoraskar911 / SearchActivityViewModel.kt
Created April 27, 2020 06:21
SearchActivityViewModel
var searchResponseLiveData : MutableLiveData<SearchResponse> = MutableLiveData()
var searchProgressBarLiveData : MutableLiveData<Boolean> = MutableLiveData()
/**
* Method to observe the text changes and filter out the appropriate stream to make the api call.
*/
fun processSearchTextChanges(changedText: InitialValueObservable<CharSequence>) {
compositeDisposable.add(
changedText
.skipInitialValue()
@pbhoraskar911
pbhoraskar911 / namespace_migration.txt
Last active February 1, 2021 11:02
Namespace Migration - AndroidX Migration
android.support.v7.widget.CardView -> androidx.cardview.widget.CardView
android.support.constraint.Group -> androidx.constraintlayout.widget.Group
androidx.appcompat.widget.GridLayout -> androidx.gridlayout.widget.GridLayout
@pbhoraskar911
pbhoraskar911 / gradle.properties
Last active February 1, 2021 11:01
Script properties in gradle.properties - For AndroidX Migration
android.useAndroidX=true
android.enableJetifier=true