Skip to content

Instantly share code, notes, and snippets.

View tank777's full-sized avatar
🎯
Focusing

Bhavesh Tank tank777

🎯
Focusing
  • Surat, Gujarat, India
View GitHub Profile
import 'package:http/http.dart' as http;
Future<String> getIdToken({bool? force}) async {
// fetch update token
return "abc*******";
}
Future<void> main() async {
final client = http.Client();
final token = await getIdToken();
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
class CountController extends StateNotifier<AsyncValue<int>> {
CountController() : super(const AsyncData<int>(0));
Future<void> up() async {
state = const AsyncLoading<int>();
@tank777
tank777 / CustomLinearLayoutManager.java
Created June 15, 2017 16:58
stop recyclerview scroll
package com.bgt.stopscrollrecycleview;
import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.util.AttributeSet;
/**
* Created by Bhavesh on 15-06-2017.
*/
@tank777
tank777 / infinite_scroll.dart
Created August 22, 2019 11:41 — forked from putraxor/infinite_scroll.dart
Flutter infinite scrolling
import 'dart:async';
import 'package:flutter/material.dart';
class InfiniteScroll extends StatefulWidget {
@override
_InfiniteScrollState createState() => new _InfiniteScrollState();
}
class _InfiniteScrollState extends State<InfiniteScroll> {
@tank777
tank777 / ffmpeg-watermark.md
Created June 11, 2018 15:29 — forked from bennylope/ffmpeg-watermark.md
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.

private class FetchContacts extends AsyncTask<Void, Void, ArrayList<Contact>> {
private final String DISPLAY_NAME = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ?
ContactsContract.Contacts.DISPLAY_NAME_PRIMARY : ContactsContract.Contacts.DISPLAY_NAME;
private final String FILTER = DISPLAY_NAME + " NOT LIKE '%@%'";
private final String ORDER = String.format("%1$s COLLATE NOCASE", DISPLAY_NAME);
@SuppressLint("InlinedApi")
private Bitmap addWaterMark(Bitmap src, Bitmap waterMark) {
if (src == null || waterMark == null) {
return null;
}
try {
int w = src.getWidth();
int h = src.getHeight();
@tank777
tank777 / README.md
Created September 11, 2017 17:40 — forked from gabrielemariotti/README.md
A SectionedGridRecyclerViewAdapter: use this class to realize a simple sectioned grid `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned grid RecyclerView.Adapter without changing your code.

Screen

The RecyclerView has to use a GridLayoutManager.

This is a porting of the class SimpleSectionedListAdapter provided by Google

If you are looking for a sectioned list RecyclerView.Adapter you can take a look here

@tank777
tank777 / countries.json
Created August 4, 2017 16:09 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},

Make your multiple type view adapter with annotations!

Gist for Making a Multiple View Types Adapter With Annotations

Pretty easy to use.

  1. Create your delegate adapters, implementing DelegateAdapter, and with the annotation DelegateAdapterType. e.g:
@DelegateAdapterType(itemType = 0)