├── .gitignore ├── README.md ├── annotations ├── .gitignore ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── thefinestartist │ └── annotations │ └── Extra.java ├── art ├── 144.png ├── 192.png ├── 2056.png ├── 256_1.png ├── 256_2.png ├── 48.png ├── 512.png ├── 72.png ├── 96.png ├── APILevel Lint Option.png ├── LogHelper.png └── LogUtil.png ├── build.gradle ├── compilers ├── .gitignore ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ └── thefinestartist │ │ └── compilers │ │ ├── Constants.java │ │ ├── ExtraCompiler.java │ │ └── TypeElementUtil.java │ └── resources │ └── META-INF │ └── services │ └── javax.annotation.processing.Processor ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── sample ├── .gitignore ├── build.gradle ├── keystore │ └── keystore.jks ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── thefinestartist │ │ └── utils │ │ └── sample │ │ ├── App.java │ │ ├── Fragment1.java │ │ ├── MainActivity.java │ │ └── fragments │ │ ├── Fragment2.java │ │ ├── Fragment3.java │ │ └── SubActivity.java │ └── res │ ├── color │ └── black.xml │ ├── layout │ ├── fragment1_layout.xml │ └── main_layout.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── settings.gradle └── utils ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src ├── androidTest └── java │ └── com │ └── thefinestartist │ └── utils │ ├── ApplicationTest.java │ └── etc │ └── PreferencesUtilTest.java ├── main ├── AndroidManifest.xml ├── java │ └── com │ │ └── thefinestartist │ │ ├── Base.java │ │ ├── binders │ │ └── ExtrasBinder.java │ │ ├── builders │ │ ├── ActivityBuilder.java │ │ └── BundleBuilder.java │ │ ├── converters │ │ ├── Unit.java │ │ └── UnitConverter.java │ │ ├── enums │ │ ├── LogLevel.java │ │ └── Rotation.java │ │ ├── listeners │ │ └── KeyboardStateListener.java │ │ ├── utils │ │ ├── content │ │ │ ├── ContextUtil.java │ │ │ ├── Ctx.java │ │ │ ├── Res.java │ │ │ ├── ResourcesUtil.java │ │ │ ├── ThemeUtil.java │ │ │ └── TypedValueUtil.java │ │ ├── etc │ │ │ ├── APILevel.java │ │ │ ├── IntArrayUtil.java │ │ │ ├── PackageUtil.java │ │ │ ├── SparseArrayUtil.java │ │ │ ├── ThreadUtil.java │ │ │ └── TypefaceUtil.java │ │ ├── log │ │ │ ├── AndroidLogPrinter.java │ │ │ ├── FileLogPrinter.java │ │ │ ├── L.java │ │ │ ├── LogHelper.java │ │ │ ├── LogPrinter.java │ │ │ ├── LogUtil.java │ │ │ └── Settings.java │ │ ├── preferences │ │ │ ├── Pref.java │ │ │ └── PreferencesUtil.java │ │ ├── service │ │ │ ├── ClipboardManagerUtil.java │ │ │ ├── ServiceUtil.java │ │ │ ├── VibratorUtil.java │ │ │ └── WindowManagerUtil.java │ │ └── ui │ │ │ ├── DisplayUtil.java │ │ │ ├── Keyboard.java │ │ │ ├── KeyboardUtil.java │ │ │ └── ViewUtil.java │ │ └── wip │ │ ├── AgeUtil.java │ │ ├── AudioManagerUtil.java │ │ ├── AwakeUtil.java │ │ ├── BitmapUtil.java │ │ ├── DateUtil.java │ │ ├── EmailUtil.java │ │ ├── FileUtil.java │ │ ├── LanguageDetector.java │ │ ├── NetworkUtil.java │ │ ├── PhotoUtil.java │ │ ├── RippleUtil.java │ │ └── Validator.java └── res │ ├── anim │ ├── accelerate_cubic.xml │ ├── accelerate_quart.xml │ ├── accelerate_quint.xml │ ├── activity_close_enter.xml │ ├── activity_close_exit.xml │ ├── activity_open_enter.xml │ ├── activity_open_exit.xml │ ├── decelerate_cubic.xml │ ├── decelerate_quart.xml │ ├── decelerate_quint.xml │ ├── fade_in.xml │ ├── fade_in_fast.xml │ ├── fade_out.xml │ ├── fade_out_fast.xml │ ├── fade_out_slow.xml │ ├── fragment_close_exit.xml │ ├── fragment_close_exit_reverse.xml │ ├── fragment_open_enter.xml │ ├── fragment_open_enter_reverse.xml │ ├── modal_activity_close_enter.xml │ ├── modal_activity_close_exit.xml │ ├── modal_activity_open_enter.xml │ ├── modal_activity_open_exit.xml │ ├── no_anim.xml │ ├── splash_out.xml │ ├── view_blink.xml │ ├── view_bounce.xml │ ├── view_fade_in.xml │ ├── view_fade_out.xml │ ├── view_move.xml │ ├── view_rotate.xml │ ├── view_slide_down.xml │ ├── view_slide_up.xml │ ├── view_zoom_in.xml │ └── view_zoom_out.xml │ ├── animator │ ├── card_flip_left_in.xml │ ├── card_flip_left_out.xml │ ├── card_flip_right_in.xml │ └── card_flip_right_out.xml │ └── values │ ├── colors_basic.xml │ ├── colors_grey.xml │ └── colors_transparent.xml └── test └── java └── com └── thefinestartist └── helpers └── ExampleUnitTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/osx,windows,linux,android,intellij 3 | 4 | ### OSX ### 5 | .DS_Store 6 | .AppleDouble 7 | .LSOverride 8 | 9 | # Icon must end with two \r 10 | Icon 11 | 12 | 13 | # Thumbnails 14 | ._* 15 | 16 | # Files that might appear in the root of a volume 17 | .DocumentRevisions-V100 18 | .fseventsd 19 | .Spotlight-V100 20 | .TemporaryItems 21 | .Trashes 22 | .VolumeIcon.icns 23 | 24 | # Directories potentially created on remote AFP share 25 | .AppleDB 26 | .AppleDesktop 27 | Network Trash Folder 28 | Temporary Items 29 | .apdisk 30 | 31 | 32 | ### Windows ### 33 | # Windows image file caches 34 | Thumbs.db 35 | ehthumbs.db 36 | 37 | # Folder config file 38 | Desktop.ini 39 | 40 | # Recycle Bin used on file shares 41 | $RECYCLE.BIN/ 42 | 43 | # Windows Installer files 44 | *.cab 45 | *.msi 46 | *.msm 47 | *.msp 48 | 49 | # Windows shortcuts 50 | *.lnk 51 | 52 | 53 | ### Linux ### 54 | *~ 55 | 56 | # temporary files which can be created if a process still has a handle open of a deleted file 57 | .fuse_hidden* 58 | 59 | # KDE directory preferences 60 | .directory 61 | 62 | # Linux trash folder which might appear on any partition or disk 63 | .Trash-* 64 | 65 | 66 | ### Android ### 67 | # Built application files 68 | *.apk 69 | *.ap_ 70 | 71 | # Files for the Dalvik VM 72 | *.dex 73 | 74 | # Java class files 75 | *.class 76 | 77 | # Generated files 78 | bin/ 79 | gen/ 80 | 81 | # Gradle files 82 | .gradle/ 83 | build/ 84 | 85 | # Local configuration file (sdk path, etc) 86 | local.properties 87 | 88 | # Proguard folder generated by Eclipse 89 | proguard/ 90 | 91 | # Log Files 92 | *.log 93 | 94 | # Android Studio Navigation editor temp files 95 | .navigation/ 96 | 97 | # Android Studio captures folder 98 | captures/ 99 | 100 | ### Android Patch ### 101 | gen-external-apklibs 102 | 103 | 104 | ### Intellij ### 105 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 106 | 107 | *.iml 108 | 109 | ## Directory-based project format: 110 | .idea/ 111 | # if you remove the above rule, at least ignore the following: 112 | 113 | # User-specific stuff: 114 | # .idea/workspace.xml 115 | # .idea/tasks.xml 116 | # .idea/dictionaries 117 | # .idea/shelf 118 | 119 | # Sensitive or high-churn files: 120 | # .idea/dataSources.ids 121 | # .idea/dataSources.xml 122 | # .idea/sqlDataSources.xml 123 | # .idea/dynamic.xml 124 | # .idea/uiDesigner.xml 125 | 126 | # Gradle: 127 | # .idea/gradle.xml 128 | # .idea/libraries 129 | 130 | # Mongo Explorer plugin: 131 | # .idea/mongoSettings.xml 132 | 133 | ## File-based project format: 134 | *.ipr 135 | *.iws 136 | 137 | ## Plugin-specific files: 138 | 139 | # IntelliJ 140 | /out/ 141 | 142 | # mpeltonen/sbt-idea plugin 143 | .idea_modules/ 144 | 145 | # JIRA plugin 146 | atlassian-ide-plugin.xml 147 | 148 | # Crashlytics plugin (for Android Studio and IntelliJ) 149 | com_crashlytics_export_strings.xml 150 | crashlytics.properties 151 | crashlytics-build.properties 152 | fabric.properties -------------------------------------------------------------------------------- /annotations/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /annotations/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | //apply plugin: 'com.novoda.bintray-release' 3 | 4 | //publish { 5 | // userOrg = 'thefinestartist' 6 | // groupId = 'com.thefinestartist' 7 | // artifactId = 'annotations' 8 | // publishVersion = rootProject.ext.versionName 9 | // desc = 'Context free and basic utils to build Android project conveniently.' 10 | // website = 'https://github.com/TheFinestArtist/AndroidBaseUtils' 11 | //} -------------------------------------------------------------------------------- /annotations/src/main/java/com/thefinestartist/annotations/Extra.java: -------------------------------------------------------------------------------- 1 | package com.thefinestartist.annotations; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.FIELD; 7 | import static java.lang.annotation.RetentionPolicy.CLASS; 8 | 9 | /** 10 | * Bind a field to the bundle data for the specific key. 11 | *

12 |  * {@literal @}Extra(EXTRA_TITLE) String title;
13 |  * 
14 | */ 15 | @Retention(CLASS) 16 | @Target(FIELD) 17 | public @interface Extra { 18 | String value() default ""; 19 | } -------------------------------------------------------------------------------- /art/144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/art/144.png -------------------------------------------------------------------------------- /art/192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/art/192.png -------------------------------------------------------------------------------- /art/2056.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/art/2056.png -------------------------------------------------------------------------------- /art/256_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/art/256_1.png -------------------------------------------------------------------------------- /art/256_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/art/256_2.png -------------------------------------------------------------------------------- /art/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/art/48.png -------------------------------------------------------------------------------- /art/512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/art/512.png -------------------------------------------------------------------------------- /art/72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/art/72.png -------------------------------------------------------------------------------- /art/96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/art/96.png -------------------------------------------------------------------------------- /art/APILevel Lint Option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/art/APILevel Lint Option.png -------------------------------------------------------------------------------- /art/LogHelper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/art/LogHelper.png -------------------------------------------------------------------------------- /art/LogUtil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/art/LogUtil.png -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' 9 | classpath 'com.android.tools.build:gradle:2.1.0' 10 | classpath 'com.novoda:bintray-release:0.3.4' 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | jcenter() 20 | } 21 | 22 | /** 23 | * Prevents sporadic compilation error: 'Bad service configuration file, or exception thrown while constructing 24 | * Processor object: javax.annotation.processing.Processor: Error reading configuration file' 25 | * 26 | * See https://discuss.gradle.org/t/gradle-not-compiles-with-solder-tooling-jar/7583/20 27 | */ 28 | tasks.withType(JavaCompile) { options.fork = true } 29 | } 30 | 31 | task clean(type: Delete) { 32 | delete rootProject.buildDir 33 | } 34 | 35 | ext { 36 | minSdkVersion = 7 37 | targetSdkVersion = 23 38 | compileSdkVersion = 23 39 | buildToolsVersion = '23.0.2' 40 | 41 | sourceCompatibility = JavaVersion.VERSION_1_7 42 | targetCompatibility = JavaVersion.VERSION_1_7 43 | 44 | versionCode = 1 45 | versionName = '0.9.5' 46 | 47 | supportLibVersion = '23.3.0' 48 | playLibVersion = '8.4.0' 49 | } 50 | 51 | //$ ./gradlew clean build bintrayUpload -PbintrayUser=thefinestartist -PbintrayKey=BINTRAY_KEY -PdryRun=false -------------------------------------------------------------------------------- /compilers/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /compilers/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | //apply plugin: 'com.novoda.bintray-release' 3 | 4 | dependencies { 5 | compile project(':annotations') 6 | // compile "com.thefinestartist:annotations:${rootProject.ext.versionName}" 7 | compile 'com.google.auto.service:auto-service:1.0-rc2' 8 | compile 'com.google.android:android:2.1.2' 9 | compile 'com.squareup:javapoet:1.5.1' 10 | } 11 | 12 | //publish { 13 | // userOrg = 'thefinestartist' 14 | // groupId = 'com.thefinestartist' 15 | // artifactId = 'compilers' 16 | // publishVersion = rootProject.ext.versionName 17 | // desc = 'Context free and basic utils to build Android project conveniently.' 18 | // website = 'https://github.com/TheFinestArtist/AndroidBaseUtils' 19 | //} -------------------------------------------------------------------------------- /compilers/src/main/java/com/thefinestartist/compilers/Constants.java: -------------------------------------------------------------------------------- 1 | package com.thefinestartist.compilers; 2 | 3 | /** 4 | * Created by TheFinestArtist on 2/9/16. 5 | */ 6 | public class Constants { 7 | 8 | public static final String SUFFIX = "$$ExtraBinder"; 9 | 10 | public static final String BINDING_ACTIVITY = " activity.%s = (%s) bundle.get(\"%s\");"; 11 | public static final String BINDER_ACTIVITY = "" 12 | + "package %s;\n\n" 13 | + "import android.os.Bundle;\n\n" 14 | + "public class %s {\n" 15 | + " public static void bind(%s activity) {\n" 16 | + " Bundle bundle = activity.getIntent().getExtras();\n" 17 | + "%s" 18 | + " }\n" 19 | + "}\n"; 20 | 21 | public static final String BINDING_FRAGMENT = " fragment.%s = (%s) bundle.get(\"%s\");"; 22 | public static final String BINDER_FRAGMENT = "" 23 | + "package %s;\n\n" 24 | + "import android.os.Bundle;\n\n" 25 | + "public class %s {\n" 26 | + " public static void bind(%s fragment) {\n" 27 | + " Bundle bundle = fragment.getArguments();\n" 28 | + "%s" 29 | + " }\n" 30 | + "}\n"; 31 | } 32 | -------------------------------------------------------------------------------- /compilers/src/main/java/com/thefinestartist/compilers/ExtraCompiler.java: -------------------------------------------------------------------------------- 1 | package com.thefinestartist.compilers; 2 | 3 | import android.app.Activity; 4 | 5 | import com.thefinestartist.annotations.Extra; 6 | 7 | import java.io.IOException; 8 | import java.io.Writer; 9 | import java.util.HashSet; 10 | import java.util.LinkedHashMap; 11 | import java.util.Map; 12 | import java.util.Set; 13 | 14 | import javax.annotation.processing.AbstractProcessor; 15 | import javax.annotation.processing.Filer; 16 | import javax.annotation.processing.Messager; 17 | import javax.annotation.processing.ProcessingEnvironment; 18 | import javax.annotation.processing.RoundEnvironment; 19 | import javax.annotation.processing.SupportedAnnotationTypes; 20 | import javax.lang.model.SourceVersion; 21 | import javax.lang.model.element.Element; 22 | import javax.lang.model.element.ElementKind; 23 | import javax.lang.model.element.Modifier; 24 | import javax.lang.model.element.TypeElement; 25 | import javax.lang.model.type.DeclaredType; 26 | import javax.lang.model.type.TypeKind; 27 | import javax.lang.model.type.TypeMirror; 28 | import javax.lang.model.util.Types; 29 | import javax.tools.Diagnostic; 30 | import javax.tools.JavaFileObject; 31 | 32 | /** 33 | * Created by TheFinestArtist on 2/7/16. 34 | */ 35 | @SupportedAnnotationTypes("com.thefinestartist.annotations.Extra") 36 | public class ExtraCompiler extends AbstractProcessor { 37 | 38 | 39 | Filer filer; 40 | Messager messager; 41 | Types types; 42 | 43 | @Override 44 | public SourceVersion getSupportedSourceVersion() { 45 | return SourceVersion.latestSupported(); 46 | } 47 | 48 | @Override 49 | public synchronized void init(ProcessingEnvironment processingEnv) { 50 | super.init(processingEnv); 51 | filer = processingEnv.getFiler(); 52 | messager = processingEnv.getMessager(); 53 | types = processingEnv.getTypeUtils(); 54 | } 55 | 56 | private void note(String message, Object... args) { 57 | messager.printMessage(Diagnostic.Kind.NOTE, String.format(message, args)); 58 | } 59 | 60 | private void error(String message, Object... args) { 61 | messager.printMessage(Diagnostic.Kind.ERROR, String.format(message, args)); 62 | } 63 | 64 | @Override 65 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 66 | Map> bindingsByClass = new LinkedHashMap<>(); 67 | Set bindingTargets = new HashSet<>(); 68 | 69 | for (Element element : roundEnv.getElementsAnnotatedWith(Extra.class)) { 70 | 71 | // Verify containing type. 72 | TypeElement enclosingElement = (TypeElement) element.getEnclosingElement(); 73 | if (enclosingElement.getKind() != ElementKind.CLASS) { 74 | error("Unexpected @Extra on field in " + element); 75 | continue; 76 | } 77 | 78 | // Verify field properties. 79 | Set modifiers = element.getModifiers(); 80 | if (modifiers.contains(Modifier.PRIVATE)) { 81 | error("@Extra fields must not be private: " 82 | + enclosingElement.getQualifiedName() 83 | + "." 84 | + element); 85 | continue; 86 | } 87 | 88 | // Get and optionally create a set of all binding points for a type. 89 | Set bindings = bindingsByClass.get(enclosingElement); 90 | if (bindings == null) { 91 | bindings = new HashSet<>(); 92 | bindingsByClass.put(enclosingElement, bindings); 93 | } 94 | 95 | // Assemble information on the binding point. 96 | String variableName = element.getSimpleName().toString(); 97 | String type = element.asType().toString(); 98 | String value = element.getAnnotation(Extra.class).value(); 99 | 100 | if (TypeElementUtil.instanceOf(enclosingElement, Activity.class)) { 101 | bindings.add(new BindingPoint(ClassType.ACTIVITY, variableName, type, value)); 102 | } else { 103 | bindings.add(new BindingPoint(ClassType.FRAGMENT, variableName, type, value)); 104 | } 105 | 106 | // Add to the valid binding targets set. 107 | bindingTargets.add(enclosingElement.asType()); 108 | } 109 | 110 | for (Map.Entry> binding : bindingsByClass.entrySet()) { 111 | TypeElement type = binding.getKey(); 112 | String targetClass = type.getQualifiedName().toString(); 113 | int lastDot = targetClass.lastIndexOf("."); 114 | String classType = targetClass.substring(lastDot + 1); 115 | String className = classType + Constants.SUFFIX; 116 | String packageName = targetClass.substring(0, lastDot); 117 | StringBuilder bindings = new StringBuilder(); 118 | for (BindingPoint bindingPoint : binding.getValue()) { 119 | bindings.append(bindingPoint).append("\n"); 120 | } 121 | 122 | // Write the view binder class. 123 | try { 124 | JavaFileObject jfo = filer.createSourceFile(packageName + "." + className, type); 125 | Writer writer = jfo.openWriter(); 126 | if (TypeElementUtil.instanceOf(type, Activity.class)) { 127 | writer.write(String.format(Constants.BINDER_ACTIVITY, packageName, className, classType, bindings.toString())); 128 | } else { 129 | writer.write(String.format(Constants.BINDER_FRAGMENT, packageName, className, classType, bindings.toString())); 130 | } 131 | writer.flush(); 132 | writer.close(); 133 | } catch (IOException e) { 134 | error(e.getMessage()); 135 | } 136 | } 137 | 138 | return true; 139 | } 140 | 141 | 142 | private String resolveParentType(TypeElement typeElement, Set parents) { 143 | TypeMirror type; 144 | while (true) { 145 | type = typeElement.getSuperclass(); 146 | if (type.getKind() == TypeKind.NONE) { 147 | return null; 148 | } 149 | if (parents.contains(type)) { 150 | return type.toString(); 151 | } 152 | typeElement = (TypeElement) ((DeclaredType) type).asElement(); 153 | } 154 | } 155 | 156 | private enum ClassType { 157 | ACTIVITY, FRAGMENT 158 | } 159 | 160 | private static class BindingPoint { 161 | private final ClassType classType; 162 | private final String variableName; 163 | private final String type; 164 | private final String value; 165 | 166 | BindingPoint(ClassType classType, String variableName, String type, String value) { 167 | this.classType = classType; 168 | this.variableName = variableName; 169 | this.type = type; 170 | this.value = value.length() == 0 ? variableName : value; 171 | } 172 | 173 | @Override 174 | public String toString() { 175 | switch (classType) { 176 | case ACTIVITY: 177 | return String.format(Constants.BINDING_ACTIVITY, variableName, type, value); 178 | case FRAGMENT: 179 | default: 180 | return String.format(Constants.BINDING_FRAGMENT, variableName, type, value); 181 | } 182 | } 183 | } 184 | 185 | 186 | } 187 | -------------------------------------------------------------------------------- /compilers/src/main/java/com/thefinestartist/compilers/TypeElementUtil.java: -------------------------------------------------------------------------------- 1 | package com.thefinestartist.compilers; 2 | 3 | import javax.lang.model.element.TypeElement; 4 | import javax.lang.model.type.DeclaredType; 5 | import javax.lang.model.type.NoType; 6 | 7 | /** 8 | * Created by TheFinestArtist on 2/9/16. 9 | */ 10 | public class TypeElementUtil { 11 | 12 | public static boolean instanceOf(TypeElement typeElement, Class clazz) { 13 | if (typeElement == null || typeElement instanceof NoType) { 14 | return false; 15 | } else if (typeElement.getQualifiedName().toString().equals(clazz.getCanonicalName())) { 16 | return true; 17 | } else if (typeElement.getSuperclass() instanceof DeclaredType) { 18 | return instanceOf((TypeElement) ((DeclaredType) typeElement.getSuperclass()).asElement(), clazz); 19 | } else { 20 | return false; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /compilers/src/main/resources/META-INF/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | com.thefinestartist.compilers.ExtraCompiler -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Oct 21 11:34:03 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.neenbedankt.android-apt' 3 | 4 | android { 5 | compileSdkVersion rootProject.ext.compileSdkVersion 6 | buildToolsVersion rootProject.ext.buildToolsVersion 7 | 8 | lintOptions { 9 | abortOnError false 10 | } 11 | 12 | defaultConfig { 13 | applicationId "com.thefinestartist.helpers.sample" 14 | minSdkVersion 8 15 | targetSdkVersion rootProject.ext.targetSdkVersion 16 | versionCode rootProject.ext.versionCode 17 | versionName rootProject.ext.versionName 18 | } 19 | 20 | signingConfigs { 21 | release { 22 | storeFile file("../sample/keystore/keystore.jks") 23 | storePassword "baseutils" 24 | keyAlias "thefinestartist" 25 | keyPassword "baseutils" 26 | } 27 | } 28 | 29 | buildTypes { 30 | release { 31 | minifyEnabled true 32 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 33 | signingConfig signingConfigs.release 34 | } 35 | debug { 36 | minifyEnabled false 37 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 38 | } 39 | } 40 | } 41 | 42 | repositories { 43 | maven { url "https://oss.sonatype.org/content/repositories/snapshots" } 44 | maven { url "https://jitpack.io" } 45 | } 46 | 47 | dependencies { 48 | // compile project(':annotations') 49 | compile project(':utils') 50 | apt project(':compilers') 51 | // compile 'com.thefinestartist:annotations:0.8.6' 52 | // compile 'com.thefinestartist:utils:0.8.4' 53 | // apt 'com.thefinestartist:compilers:0.8.4' 54 | compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" 55 | compile 'com.jakewharton:butterknife:7.0.1' 56 | // compile 'com.github.orhanobut:logger:1.12' 57 | // compile 'com.jakewharton:butterknife:8.0.0-SNAPSHOT' 58 | // apt 'com.jakewharton:butterknife-compiler:8.0.0-SNAPSHOT' 59 | } 60 | -------------------------------------------------------------------------------- /sample/keystore/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheFinestArtist/AndroidBaseUtils/c69de3234afbce1ea0f042f6b2300d9c1ac236f9/sample/keystore/keystore.jks -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/TheFinestArtist/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | -keep class com.thefinestartist.annotations.** { *; } 20 | -keep class **$$ExtraBinder { *; } 21 | -keepclasseswithmembernames class * { 22 | @com.thefinestartist.annotations.Extra ; 23 | } 24 | 25 | -keep class butterknife.** { *; } 26 | -dontwarn butterknife.internal.** 27 | -keep class **$$ViewBinder { *; } 28 | 29 | -keepclasseswithmembernames class * { 30 | @butterknife.* ; 31 | } 32 | 33 | -keepclasseswithmembernames class * { 34 | @butterknife.* ; 35 | } -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /sample/src/main/java/com/thefinestartist/utils/sample/App.java: -------------------------------------------------------------------------------- 1 | package com.thefinestartist.utils.sample; 2 | 3 | import android.app.Application; 4 | 5 | import com.thefinestartist.Base; 6 | 7 | /** 8 | * Created by TheFinestArtist on 2/10/16. 9 | */ 10 | public class App extends Application { 11 | 12 | @Override 13 | public void onCreate() { 14 | super.onCreate(); 15 | Base.initialize(this); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /sample/src/main/java/com/thefinestartist/utils/sample/Fragment1.java: -------------------------------------------------------------------------------- 1 | package com.thefinestartist.utils.sample; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | import com.thefinestartist.annotations.Extra; 11 | import com.thefinestartist.binders.ExtrasBinder; 12 | 13 | import butterknife.Bind; 14 | import butterknife.ButterKnife; 15 | 16 | /** 17 | * Created by TheFinestArtist on 2/8/16. 18 | */ 19 | public class Fragment1 extends Fragment { 20 | 21 | public static final String NAME = "NAME"; 22 | 23 | @Extra(NAME) String name; 24 | @Bind(R.id.view) View view; 25 | 26 | @Nullable 27 | @Override 28 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 29 | View rootView = inflater.inflate(R.layout.fragment1_layout, container, false); 30 | ButterKnife.bind(this, rootView); 31 | ExtrasBinder.bind(this); 32 | return rootView; 33 | } 34 | 35 | public static String getCallerClassName() { 36 | StackTraceElement[] stElements = Thread.currentThread().getStackTrace(); 37 | for (int i = 1; i < stElements.length; i++) { 38 | StackTraceElement ste = stElements[i]; 39 | if (!ste.getClassName().equals(Fragment1.class.getName()) && ste.getClassName().indexOf("java.lang.Thread") != 0) { 40 | return ste.getClassName(); 41 | } 42 | } 43 | return null; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /sample/src/main/java/com/thefinestartist/utils/sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.thefinestartist.utils.sample; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentTransaction; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.view.View; 8 | import android.widget.Button; 9 | import android.widget.EditText; 10 | 11 | import com.thefinestartist.utils.log.L; 12 | import com.thefinestartist.utils.log.LogHelper; 13 | 14 | import org.json.JSONException; 15 | import org.json.JSONObject; 16 | 17 | /** 18 | * Created by TheFinestArtist on 1/30/16. 19 | */ 20 | public class MainActivity extends AppCompatActivity { 21 | 22 | LogHelper logHelper = new LogHelper(MainActivity.class).showThreadInfo(true); 23 | 24 | EditText editText; 25 | Button button; 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | setContentView(R.layout.main_layout); 31 | editText = (EditText) findViewById(R.id.edit_text); 32 | button = (Button) findViewById(R.id.button); 33 | button.setOnClickListener(new View.OnClickListener() { 34 | @Override 35 | public void onClick(View v) { 36 | // KeyboardUtil.showImmediately(editText); 37 | // new ActivityBuilder(SubActivity.class) 38 | // .set(SubActivity.TITLE, "Hey") 39 | // .start(); 40 | 41 | // ArrayList list = new ArrayList<>(); 42 | // list.add(1); 43 | // new ActivityBuilder(SubActivity.class) 44 | // .set(SubActivity.TITLE, "Hey") 45 | // .set(SubActivity.CONTENT, 1) 46 | // .set("values", new int[]{1, 2, 3}) 47 | // .set(SubActivity.ARRAY_LIST, list) 48 | // .start(); 49 | 50 | Fragment1 fragment1 = new Fragment1(); 51 | Bundle bundle = new Bundle(); 52 | bundle.putString(Fragment1.NAME, "Name"); 53 | fragment1.setArguments(bundle); 54 | // 55 | // fragment1.setArguments(new BundleBuilder() 56 | // .set(Fragment1.NAME, "Hoy") 57 | // .build()); 58 | // 59 | FragmentManager fragmentManager = getSupportFragmentManager(); 60 | FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); 61 | fragmentTransaction.add(android.R.id.content, fragment1); 62 | fragmentTransaction.commitAllowingStateLoss(); 63 | 64 | // Log.e("DisplayUtil","DisplayUtil: " + DisplayUtil.getWidth()); 65 | } 66 | }); 67 | 68 | // VibratorUtil.eee(); 69 | // KeyboardUtil.showImmediately(editText); 70 | 71 | // logHelper.v("Hey"); 72 | // logHelper.v("Hello"); 73 | // try { 74 | // JSONObject jsonObject = new JSONObject("caller\":\"getPoiById\",\"results\":{\"indexForPhone\":0,\"indexForEmail\":\"NULL\",\"indexForHomePage\":\"NULL\",\"indexForComment\":\"NULL\",\"phone\":\"05137-930 68\",\"cleanPhone\":\"0513793068\",\"internetAccess\":\"2\",\"overnightStay\":\"2\",\"wasteDisposal\":\"2\",\"toilet\":\"2\",\"electricity\":\"2\",\"cran\":\"2\",\"slipway\":\"2\",\"camping\":\"2\",\"freshWater\":\"2\",\"fieldNamesWithValue\":[\"phone\"],\"fieldNameTranslations\":[\"Telefon\"],\"id\":\"1470\",\"name\":\"Marina Rasche Werft GmbH & Co. KG\",\"latitude\":\"52.3956107286487\",\"longitude\":\"9.56583023071289\"}}"); 75 | // logHelper.e(jsonObject); 76 | // } catch (JSONException e) { 77 | // L.e(e); 78 | // logHelper.e(e); 79 | // } 80 | // 81 | // logHelper.json("{\"caller\":\"getPoiById\",\"results\":{\"indexForPhone\":0,\"indexForEmail\":\"NULL\",\"indexForHomePage\":\"NULL\",\"indexForComment\":\"NULL\",\"phone\":\"05137-930 68\",\"cleanPhone\":\"0513793068\",\"internetAccess\":\"2\",\"overnightStay\":\"2\",\"wasteDisposal\":\"2\",\"toilet\":\"2\",\"electricity\":\"2\",\"cran\":\"2\",\"slipway\":\"2\",\"camping\":\"2\",\"freshWater\":\"2\",\"fieldNamesWithValue\":[\"phone\"],\"fieldNameTranslations\":[\"Telefon\"],\"id\":\"1470\",\"name\":\"Marina Rasche Werft GmbH & Co. KG\",\"latitude\":\"52.3956107286487\",\"longitude\":\"9.56583023071289\"}}"); 82 | // 83 | // logHelper.xml("\n" + 84 | // " \n" + 85 | // " \n" + 90 | // "\n" + 91 | // " \n" + 92 | // " \n" + 98 | // "\n" + 99 | // " \n" + 100 | // " \n" + 106 | // ""); 107 | // Thread thread = new Thread(new Runnable() { 108 | // @Override 109 | // public void run() { 110 | // logHelper.e("Hey"); 111 | // } 112 | // }); 113 | // thread.start(); 114 | // 115 | // L.stackTraceCount(3).json("{\"name\":\"Leonardo Taehwan Kim\",\"email\":\"leonardo@thefinestartist.com\"}"); 116 | // L.e("Hello World"); 117 | // 118 | // L.showThreadInfo(true).v("Hello World"); 119 | // L.tag("MainActivity").e(12.0f); 120 | // L.stackTraceCount(3).showDivider(true).json("{\"name\":\"Leonardo Taehwan Kim\",\"email\":\"leonardo@thefinestartist.com\"}"); 121 | 122 | L.v("Hello World"); 123 | L.tag("Tag").e(12.0f); 124 | L.showThreadInfo(true).i(new int[]{1, 2, 3}); 125 | L.stackTraceCount(3).showDivider(true).json("{\"name\":\"Leonardo Taehwan Kim\",\"email\":\"leonardo@thefinestartist.com\"}"); 126 | 127 | logHelper.v("Hello World"); 128 | logHelper.e(12.0f); 129 | logHelper.json("{\"name\":\"Leonardo Taehwan Kim\",\"email\":\"leonardo@thefinestartist.com\"}"); 130 | } 131 | 132 | @Override 133 | protected void onStart() { 134 | super.onStart(); 135 | // KeyboardUtil.showImmediately(editText); 136 | } 137 | 138 | @Override 139 | protected void onResume() { 140 | super.onResume(); 141 | // KeyboardUtil.showImmediately(editText); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /sample/src/main/java/com/thefinestartist/utils/sample/fragments/Fragment2.java: -------------------------------------------------------------------------------- 1 | package com.thefinestartist.utils.sample.fragments; 2 | 3 | 4 | import android.app.Fragment; 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import com.thefinestartist.annotations.Extra; 12 | import com.thefinestartist.binders.ExtrasBinder; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * Created by TheFinestArtist on 2/15/16. 18 | */ 19 | public class Fragment2 extends Fragment { 20 | 21 | @Extra String[] titles; 22 | @Extra List contents; 23 | 24 | @Nullable 25 | @Override 26 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 27 | ExtrasBinder.bind(this); 28 | return super.onCreateView(inflater, container, savedInstanceState); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /sample/src/main/java/com/thefinestartist/utils/sample/fragments/Fragment3.java: -------------------------------------------------------------------------------- 1 | package com.thefinestartist.utils.sample.fragments; 2 | 3 | 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import com.thefinestartist.annotations.Extra; 12 | import com.thefinestartist.binders.ExtrasBinder; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * Created by TheFinestArtist on 2/15/16. 18 | */ 19 | public class Fragment3 extends Fragment { 20 | 21 | @Extra String[] titles; 22 | @Extra List contents; 23 | 24 | @Nullable 25 | @Override 26 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 27 | ExtrasBinder.bind(this); 28 | return super.onCreateView(inflater, container, savedInstanceState); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /sample/src/main/java/com/thefinestartist/utils/sample/fragments/SubActivity.java: -------------------------------------------------------------------------------- 1 | package com.thefinestartist.utils.sample.fragments; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.util.Log; 6 | 7 | import com.thefinestartist.annotations.Extra; 8 | import com.thefinestartist.binders.ExtrasBinder; 9 | 10 | import java.util.ArrayList; 11 | 12 | /** 13 | * Created by TheFinestArtist on 2/7/16. 14 | */ 15 | public class SubActivity extends AppCompatActivity { 16 | 17 | public static final String TITLE = "TITLE"; 18 | public static final String CONTENT = "CONTENT"; 19 | public static final String ARRAY_LIST = "ARRAY_LIST"; 20 | 21 | protected @Extra(TITLE) String title; 22 | static @Extra(CONTENT) int content; 23 | @Extra int[] values; 24 | @Extra(ARRAY_LIST) ArrayList list; 25 | 26 | @Override 27 | protected void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | ExtrasBinder.bind(this); 30 | Log.e("SubActivity", "title: " + title); 31 | Log.e("SubActivity", "content: " + content); 32 | Log.e("SubActivity", "values: " + values); 33 | Log.e("SubActivity", "list: " + list); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /sample/src/main/res/color/black.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/fragment1_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/main_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 |