Skip to content

Instantly share code, notes, and snippets.

View AravinthVelusamy's full-sized avatar
🎯
Focusing

Aravinth Velusamy AravinthVelusamy

🎯
Focusing
View GitHub Profile
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:percent_indicator/circular_percent_indicator.dart';
void main() => runApp(MaterialApp(
title: 'Criar Clock',
home: HomeScreen(),
debugShowCheckedModeBanner: false,
@AravinthVelusamy
AravinthVelusamy / postgres-cheatsheet.md
Created December 10, 2019 08:44 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
val roundRectShape = RoundRectShape(floatArrayOf(16f, 16f, 16f, 16f, 0f, 0f, 0f, 0f), null, null)
val shapeDrawable = ShapeDrawable(roundRectShape)
shapeDrawable.paint.color = ContextCompat.getColor(context,R.color.colorSurface)
yourView.background = shapeDrawable
yourView.elevation = 2f
yourView.outlineProvider = ViewOutlineProvider.BACKGROUND
yourView.clipToOutline = true
@AravinthVelusamy
AravinthVelusamy / build.gradle
Created August 2, 2019 05:52 — forked from albinmathew/build.gradle
An example configuration for proguard-rules.pro
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.abc.example"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
@AravinthVelusamy
AravinthVelusamy / build.gradle
Created August 2, 2019 05:52 — forked from albinmathew/build.gradle
An example configuration for proguard-rules.pro
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.abc.example"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
@AravinthVelusamy
AravinthVelusamy / LoadMoreAdapter.java
Created June 14, 2019 10:16 — forked from talenguyen/LoadMoreAdapter.java
Implementation of Load More feature for RecyclerView
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
public abstract class LoadMoreAdapter<T>
extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
public static final int VIEW_TYPE_LOAD_MORE = 1;
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F0F0F3"
tools:context=".ui.search.SearchActivity">
class SearchNewsFragment : Fragment() {
lateinit var dataBinding: FragmentSearchNewsBinding
private lateinit var searchSharedViewModel: SearchSharedViewModel
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
dataBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_search_news, container, false)
return dataBinding.root
}
@AravinthVelusamy
AravinthVelusamy / SearchClubFragment.kt
Created April 11, 2019 14:39
Search Club Fragment Code
class SearchClubFragment : Fragment() {
private lateinit var dataBinding: FragmentSearchClubBinding
private lateinit var searchSharedViewModel: SearchSharedViewModel
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
dataBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_search_club, container, false)
return dataBinding.root
}
@AravinthVelusamy
AravinthVelusamy / SearchSharedViewModel.kt
Created April 11, 2019 14:37
Shared View Model Between Activity and Fragments
class SearchSharedViewModel : ViewModel() {
val searchQuery = MutableLiveData<String>()
private val clubsRepo = FollowingClubsRepo()
private val newsMyFeedRepo = NewsMyFeedRepo()
var isClubsEmpty = MutableLiveData<Boolean>()
var isNewsEmpty = MutableLiveData<Boolean>()
fun setClubEmpty(value: Boolean) {
isClubsEmpty.value = value