Skip to content

Commit

Permalink
design improvements (#1)
Browse files Browse the repository at this point in the history
* design improvements
  • Loading branch information
borut123 authored Jan 12, 2018
1 parent 5656c20 commit 998bb16
Show file tree
Hide file tree
Showing 28 changed files with 381 additions and 381 deletions.
27 changes: 15 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "io.stanwood.framework.dialog"
minSdkVersion 21
targetSdkVersion 26
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -20,16 +20,19 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'

implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibVersion"
implementation project(':library')
implementation "com.github.bumptech.glide:glide:$rootProject.ext.glideVersion"
annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.ext.glideVersion"

implementation "com.github.bumptech.glide:glide:4.3.1"
//implementation "com.github.bumptech.glide:okhttp3-integration:$glide_version"
annotationProcessor "com.github.bumptech.glide:compiler:4.3.1"
implementation "com.google.dagger:dagger:$rootProject.ext.dagger_version"
implementation "com.google.dagger:dagger-android:$rootProject.ext.dagger_version"
implementation "com.google.dagger:dagger-android-support:$rootProject.ext.dagger_version"
annotationProcessor "com.google.dagger:dagger-android-processor:$rootProject.ext.dagger_version"
annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.ext.dagger_version"

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//stanwood framework
//implementation 'com.github.stanwood:Dialog_Framework_android:feature~design_improvements-SNAPSHOT'
implementation 'com.github.stanwood.Core_Framework_android:framework-base:develop-SNAPSHOT'
implementation 'com.github.stanwood.Core_Framework_android:framework-ui:develop-SNAPSHOT'
}

This file was deleted.

7 changes: 4 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.stanwood.framework.dialog">
package="io.stanwood.framework.demo">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".MyApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name="io.stanwood.framework.demo.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
44 changes: 44 additions & 0 deletions app/src/main/java/io/stanwood/framework/demo/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package io.stanwood.framework.demo;


import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import javax.inject.Inject;

import dagger.android.AndroidInjection;
import io.stanwood.framework.dialog.RatingDialog;
import io.stanwood.framework.dialog.RatingService;

public class MainActivity extends AppCompatActivity {

@Inject
RatingService ratingService;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidInjection.inject(this);

setContentView(R.layout.activity_main);
if (ratingService.shouldBeDisplayed()) {
RatingDialog.builder()
.setParagraph1("Hi,\nI'm the developer of this app.")
.setParagraph2("Developers like me live on good ratings in Google Play.")
.setParagraph3("If you like the app, please rate it.")
.setParagraph4("It takes only 1 minute.")
.setCancelText("Cancel")
.setOkText("Ok")
.setBannerUrl("https://media.istockphoto.com/photos/plitvice-lakes-picture-id500463760?s=2048x2048")
.setBannerUrl("https://www.istockphoto.com/photo/mountain-landscape-gm517188688-89380423")
.setFaceUrl("https://lh5.googleusercontent.com/-_w2wo1s6SkI/AAAAAAAAAAI/AAAAAAAAhMU/s78iSxXwVZk/photo.jpg")
.build()
.show(getSupportFragmentManager(), "dialog");
}
}

@Override
public void onResume() {
super.onResume();
}
}
31 changes: 31 additions & 0 deletions app/src/main/java/io/stanwood/framework/demo/MyApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.stanwood.framework.demo;

import android.app.Activity;
import android.app.Application;

import javax.inject.Inject;

import dagger.android.DispatchingAndroidInjector;
import dagger.android.HasActivityInjector;
import io.stanwood.framework.demo.di.DaggerAppComponent;
import io.stanwood.framework.dialog.RatingService;

public class MyApp extends Application implements HasActivityInjector {
@Inject
DispatchingAndroidInjector<Activity> dispatchingAndroidInjector;

@Inject
RatingService ratingService;

@Override
public void onCreate() {
super.onCreate();
DaggerAppComponent.builder().application(this).build().inject(this);
ratingService.setLaunchTimes(2);
}

@Override
public DispatchingAndroidInjector<Activity> activityInjector() {
return dispatchingAndroidInjector;
}
}
28 changes: 28 additions & 0 deletions app/src/main/java/io/stanwood/framework/demo/di/AppComponent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.stanwood.framework.demo.di;

import android.app.Application;

import javax.inject.Singleton;

import dagger.BindsInstance;
import dagger.Component;
import dagger.android.AndroidInjectionModule;
import io.stanwood.framework.demo.MyApp;

@Singleton
@Component(modules = {
AndroidInjectionModule.class,
AppModule.class,
MainActivityModule.class
})
public interface AppComponent {
void inject(MyApp application);

@Component.Builder
interface Builder {
@BindsInstance
Builder application(Application application);

AppComponent build();
}
}
20 changes: 20 additions & 0 deletions app/src/main/java/io/stanwood/framework/demo/di/AppModule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.stanwood.framework.demo.di;

import android.app.Application;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import io.stanwood.framework.dialog.RatingService;

@Module
class AppModule {

@Singleton
@Provides
RatingService provideRatingService(Application context) {
return new RatingService(context);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.stanwood.framework.demo.di;

import dagger.Module;
import dagger.android.ContributesAndroidInjector;
import io.stanwood.framework.demo.MainActivity;

@Module
public abstract class MainActivityModule {

@ContributesAndroidInjector
abstract MainActivity contributeMainActivity();
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.stanwood.framework.dialog.glide;
package io.stanwood.framework.demo.glide;

import android.content.Context;

Expand Down
32 changes: 0 additions & 32 deletions app/src/main/java/io/stanwood/framework/dialog/MainActivity.java

This file was deleted.

20 changes: 9 additions & 11 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="io.stanwood.framework.dialog.MainActivity">
android:layout_height="match_parent">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:text="Hello World!" />

</android.support.constraint.ConstraintLayout>
<ImageView
android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

</RelativeLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="colorAccent">#1865fb</color>
</resources>

This file was deleted.

16 changes: 13 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'


classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -19,9 +18,20 @@ allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

ext {
minSdkVersion = 21
targetSdkVersion = 26
compileSdkVersion = 26
buildToolsVersion = '26.0.2'
supportLibVersion = '26.1.0'
glideVersion = "4.3.1"
dagger_version = '2.11'
}
Loading

0 comments on commit 998bb16

Please sign in to comment.