Skip to content

Instantly share code, notes, and snippets.

Avatar

Bitsy Darel bitsydarel

View GitHub Profile
View switching theme without any library.
void main() {
runApp(_SwitchingThemeApp());
}
/// Properties that help me keep track of the example being run.
bool _useMaterial = false;
class _SwitchingThemeApp extends StatefulWidget {
@override
_SwitchingThemeAppState createState() => _SwitchingThemeAppState();
@bitsydarel
bitsydarel / BottomNavigationViewBehavior.kt
Created Feb 15, 2018
Layout behavior for Bottom Navigation View to hide and show on scroll. Root ViewGroup should be CoordinatorLayout.
View BottomNavigationViewBehavior.kt
class BottomNavigationViewBehaviour(context: Context, attrs: AttributeSet) : CoordinatorLayout.Behavior<BottomNavigationView>(context, attrs) {
private var height: Int = 0
override fun onLayoutChild(parent: CoordinatorLayout?, child: BottomNavigationView?, layoutDirection: Int): Boolean {
height = child!!.height
return super.onLayoutChild(parent, child, layoutDirection)
}
override fun onStartNestedScroll(coordinatorLayout: CoordinatorLayout, child: BottomNavigationView, directTargetChild: View, target: View, axes: Int, type: Int): Boolean {
View rsa_encrypt_for_C_sharp
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
View adapter_SourceContract.kt
/*
* Copyright (C) 2017 Darel Bitsy
* 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
* distributed under the License is distributed on an "AS IS" BASIS,
View Temps.java
public void saveCurrentWeatherForCity(final String cityName, final Currently currently) {
final SQLiteDatabase writableDatabase = userCitiesDatabase.getWritableDatabase();
final Cursor query = userCitiesDatabase.getReadableDatabase().rawQuery(String.format("SELECT %s FROM %s WHERE %s=\"%s\"",
CITY_NAME, CURRENT_TABLE_NAME, CITY_NAME, cityName), null);
final ContentValues databaseInsert = new ContentValues();
databaseInsert.put(CITY_NAME, cityName);
databaseInsert.put(CURRENT_TIME, currently.getTime());
databaseInsert.put(CURRENT_SUMMARY, currently.getSummary());
View test.java
public interface IAuthProvider {
public login() {}
public logout() {}
public singup() {}
}
public interface IAuthManager {
IAuthProvider provider;
IAuthManager() {}
View gist:93076e07a1430065f0d784931d5a67d6
/**
* Created by Darel Bitsy on 04/04/17.
* User sqlite Helper to create and configure the user cities database
*/
public class UserCitiesDatabase extends SQLiteOpenHelper {
private static final String DB_NAME = "user_city_list";
private static final int VERSION = 1;
View gist:5c026b159166d23925bde68c59a39145
protected void shareScreenShot() throws IOException {
final Intent shareIntent = new Intent(Intent.ACTION_SEND);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
} else {
shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
shareIntent.setType("image/jpeg");
You can’t perform that action at this time.