https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png

| import android.os.SystemClock; | |
| import android.view.View; | |
| import java.util.Map; | |
| import java.util.WeakHashMap; | |
| /** | |
| * A Debounced OnClickListener | |
| * Rejects clicks that are too close together in time. | |
| * This class is safe to use as an OnClickListener for multiple views, and will debounce each one separately. |
| // No Security | |
| { | |
| "rules": { | |
| ".read": true, | |
| ".write": true | |
| } | |
| } |
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| // This widget is the root of your application. | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Flutter Demo', |
| 1. To enable TLS 1.2 in Android 4.4 | |
| Copy TLSSocketFactory.java | |
| If using HttpsURLConnection: | |
| => conn.setSSLSocketFactory(new TLSSocketFactory()); | |
| Else if using OkHttp: | |
| => new OkHttpClient.Builder().setSocketFactory(new TLSSocketFactory()). ... .build(); | |
| Else if using HttpClient: | |
| sample for legacy apache http library: https://github.com/Kane-Shih/TestApacheHttpClient | |
| => see: https://stackoverflow.com/questions/2603691/android-httpclient-and-https |
| /* | |
| * Copyright 2016 Alireza Eskandarpour Shoferi | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| .... | |
| public void startFacebook(String facebookUrl) { | |
| try { | |
| Uri uri = null; | |
| int versionCode = getPackageManager() | |
| .getPackageInfo("com.facebook.katana", 0) | |
| .versionCode; |
| public class ToolbarAlphaScrollBehavior extends CoordinatorLayout.Behavior<android.support.v7.widget.Toolbar> { | |
| private ColorDrawable mStatusBarColorDrawable; | |
| private int mStatusBarColor; | |
| private TextView mTitleView; | |
| private boolean searchedForTitleView = false; | |
| public ToolbarAlphaScrollBehavior(Context context, AttributeSet attrs) { | |
| super(context, attrs); | |
| mStatusBarColor = ContextCompat.getColor(context, R.color.primary_dark); | |
| mStatusBarColor = getColorWithAlpha(0, mStatusBarColor); |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |