Skip to content

Instantly share code, notes, and snippets.

View fredgrott's full-sized avatar
👾
focusing on flutter cross platform mobile dev

Fred Grott fredgrott

👾
focusing on flutter cross platform mobile dev
View GitHub Profile
@fredgrott
fredgrott / renameapk
Created December 4, 2014 19:35
rename android app apk
// in your android.applicationVariants.all { variant ->
// or in your android.libraryVariants.all { variant ->
// code block put this:
if (variant.productFlavors[0] == null){
variant.outputs[0].outputFile = new File(variant.outputs[0].outputFile.parent,
project.ext.ourProjectName + "_"
+ variant.buildType.name + "_"
+ android.defaultConfig.versionCode + "_"
+ android.defaultConfig.versionName + ".apk")
}else{
@fredgrott
fredgrott / BaseSavable.java
Created September 22, 2015 18:28
a savable interface for integrating with android lifecycles
package com.grottworkshop.gwsbase;
import android.os.Bundle;
/**
* BaseSaveable interface
* Created by fgrott on 9/21/2015.
*/
@SuppressWarnings("unused")
public interface BaseSaveable {
@fredgrott
fredgrott / BaseSavingState.java
Created September 22, 2015 18:32
BaseSavingState
package com.grottworkshop.gwsbase;
import android.os.Bundle;
import java.util.List;
@SuppressWarnings("unused")
public abstract class BaseSavingState implements BaseSaveable {
@fredgrott
fredgrott / MyExtendedSavingStateProvider.java
Created September 22, 2015 18:35
Proxy to load the SavingState as a Singleton in the app class
public final class MyExtendedSavingStateProvider extends BaseSavingStateProvider{
private static final MyExtendedBaseSavingSate mySavingState = new MyExtendedBaseSavingState(objectGlobalOne, objectGlobalTwo);
public static MyExtendedBaseSavingState getInstance(){
return mySavingState;
}
private MyExtendedSavingStateProvider(){
}
@fredgrott
fredgrott / deps.gradle
Created February 2, 2016 19:22
Githashses cross platform with gradle, the ext block..require grgit lib
ext{
repo = Grgit.open(rootProject.file('.'))
gitSha = '${repo.head().abbreviatedId}'
}
@fredgrott
fredgrott / buildConfig.gradle
Created February 2, 2016 19:24
in buildTypes release, def GIT_HASH = "GIT_HASH" at head of file is assumed
buildConfigField STRING, GIT_HASH, rootProject.ext.gitSha
public class DroidUuidFactory {
protected static final String PREFS_FILE = "device_uuid.xml";
protected static final String PREFS_DEVICE_UUID = "device_uuid";
protected volatile static UUID uuid;
public DroidUuidFactory(Context context){
if( uuid ==null ) {
synchronized (DroidUuidFactory.class) {
ASL2.0 Copyright(C) 2016 Fred Grott
public class MyApplication extends Application {
public void onCreate ()
{
ASL2.0 Copyright(C) 2016 Fred Grott
public class NoReflectionLayoutInflaterFactory implements LayoutInflaterFactory {
private AppCompatActivity appCompatActivity;
public NoReflectionLayoutInflaterFactory(AppCompatActivity appCompatActivity) {
this.appCompatActivity = appCompatActivity;
}
@Override

ASL2.0 Copyright(C) 2016 Fred Grott first part is the clove

public class Clove {

    private static String myClove = null;

    public String setClove(String ourClove){
       return ourClove = myClove;
 }