Skip to content

Commit

Permalink
Merge pull request #9 from orhanobut/refactoring
Browse files Browse the repository at this point in the history
refactoring
  • Loading branch information
orhanobut committed Oct 9, 2015
2 parents 462d23c + a934d98 commit a15c64b
Show file tree
Hide file tree
Showing 42 changed files with 1,392 additions and 1,033 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: java

script:
- ./gradlew clean build
47 changes: 21 additions & 26 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
compileSdkVersion 21
buildToolsVersion "21.1.1"

defaultConfig {
applicationId "com.orhanobut.android.beesample"
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
defaultConfig {
applicationId "com.orhanobut.android.beesample"
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionName "1.0"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

buildTypes {
debug {
build
}
}
lintOptions {
abortOnError false
buildTypes {
debug {
build
}
}

repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
lintOptions {
abortOnError false
}
}

dependencies {
compile project(':bee')
compile 'com.orhanobut:wasp:1.2-SNAPSHOT'
compile project(':bee')
}
17 changes: 0 additions & 17 deletions app/proguard-rules.pro

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
</activity>
</application>

</manifest>
</manifest>
152 changes: 73 additions & 79 deletions app/src/main/java/com/orhanobut/android/beesample/AppBeeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,86 +10,80 @@

import java.util.Map;

/**
* @author Orhan Obut
*/
public class AppBeeConfig extends BeeConfig {

private static final String TAG = AppBeeConfig.class.getSimpleName();


/**
* Add extra information by using content object.
*/
@Override
public void onInfoContentCreated(Map<String, String> content) {
content.put("Current End Point", "http://www.google.com");
}

/**
* It is called when the close button is pressed
*/
@Override
public void onClose() {
super.onClose();
}

/**
* Use Button annotation to add button to the settings menu.
* Title is used for button text.
* Method should have no parameter.
*/
@Title("Reset")
@Button
public void onResetClicked() {
Log.d(TAG, "onResetClicked");
}

@Title("Restart")
@Button
public void onRestartClicked() {
Log.d(TAG, "onRestartClicked");
}

/**
* Use CheckBox annotation to add checkbox to the settings menu.
* Title is used for the label.
* Method should have a boolean parameter
*/
@Title("Show splash screen")
@CheckBox
public void onShowSplashChecked(boolean isChecked) {
Log.d(TAG, "onShowSplashChecked");
}

@Title("Show ads")
@CheckBox
public void onShowAdsChecked(boolean isChecked) {
Log.d(TAG, "onShowAdsChecked");
}

/**
* Use Spinner annotation to add spinner to the settings menu.
* Spinner annotation gets the content of spinner, either String[] or just String
* Title is used for the label.
* Method should have String parameter
*/
@Title("End Point")
@Spinner({"Staging", "Live", "Mock"})
public void onEndPointSelected(String selectedValue) {
Log.d(TAG, "onEndPointSelected");
}

@Title("Select user")
@Spinner({"John Doe", "Foo Bar"})
public void onUserSelected(String selectedValue) {
Log.d(TAG, "onUserSelected");
}

@Title("Select store option")
@Spinner({"SQLite", "In-Memory"})
public void onStoreOptionSelected(String selectedValue) {
Log.d(TAG, "onStoreOptionSelected");
}
private static final String TAG = AppBeeConfig.class.getSimpleName();

/**
* Add extra information by using content object.
*/
@Override public void onInfoContentCreated(Map<String, String> content) {
content.put("Current End Point", "http://www.google.com");
}

/**
* It is called when the close button is pressed
*/
@Override public void onClose() {
super.onClose();
}

/**
* Use Button annotation to add button to the settings menu.
* Title is used for button text.
* Method should have no parameter.
*/
@Title("Reset")
@Button
public void onResetClicked() {
Log.d(TAG, "onResetClicked");
}

@Title("Restart")
@Button
public void onRestartClicked() {
Log.d(TAG, "onRestartClicked");
}

/**
* Use CheckBox annotation to add checkbox to the settings menu.
* Title is used for the label.
* Method should have a boolean parameter
*/
@Title("Show splash screen")
@CheckBox
public void onShowSplashChecked(boolean isChecked) {
Log.d(TAG, "onShowSplashChecked");
}

@Title("Show ads")
@CheckBox
public void onShowAdsChecked(boolean isChecked) {
Log.d(TAG, "onShowAdsChecked");
}

/**
* Use Spinner annotation to add spinner to the settings menu.
* Spinner annotation gets the content of spinner, either String[] or just String
* Title is used for the label.
* Method should have String parameter
*/
@Title("End Point")
@Spinner({"Staging", "Live", "Mock"})
public void onEndPointSelected(String selectedValue) {
Log.d(TAG, "onEndPointSelected");
}

@Title("Select user")
@Spinner({"John Doe", "Foo Bar"})
public void onUserSelected(String selectedValue) {
Log.d(TAG, "onUserSelected");
}

@Title("Select store option")
@Spinner({"SQLite", "In-Memory"})
public void onStoreOptionSelected(String selectedValue) {
Log.d(TAG, "onStoreOptionSelected");
}

}
29 changes: 13 additions & 16 deletions app/src/main/java/com/orhanobut/android/beesample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,23 @@
import com.orhanobut.bee.Bee;
import com.orhanobut.bee.BeeLog;


public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Bee.init(this)
.setBeeSize(100)
.setBeePosition(Gravity.CENTER)
.setBeeMargin(0, 0, 0, 400)
.inject(AppBeeConfig.class);

BeeLog.d("MainActivity", "onCreate");
BeeLog.d("MainActivity", "user logged in");
BeeLog.d("MainActivity", "user logged out");
BeeLog.d("MainActivity", "onDestroyed");
Bee.init(this)
.setBeeSize(100)
.setBeePosition(Gravity.CENTER)
.setBeeMargin(0, 0, 0, 400)
.inject(AppBeeConfig.class);

}
BeeLog.d("MainActivity", "onCreate");
BeeLog.d("MainActivity", "user logged in");
BeeLog.d("MainActivity", "user logged out");
BeeLog.d("MainActivity", "onDestroyed");
}

}
64 changes: 48 additions & 16 deletions bee/build.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,56 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'checkstyle'

check.dependsOn('checkstyle')

checkstyle {
toolVersion = "6.0"
}

android {
compileSdkVersion 21
buildToolsVersion "21.1.1"

defaultConfig {
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionName "1.0"
}

lintOptions {
abortOnError false
}
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
minSdkVersion 10
targetSdkVersion 22
}

lintOptions {
abortOnError false
}
}

dependencies {
androidTestCompile 'org.assertj:assertj-core:1.7.0'
task checkstyle(type: Checkstyle) {
configFile = rootProject.file('checkstyle.xml')
source 'src'
include '**/*.java'
exclude '**/gen/**'

classpath = files()
}

apply from: '../maven_push.gradle'
// build a jar with source files
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

// build a jar with javadoc
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

dependencies {
testCompile 'junit:junit:4.12'
testCompile "org.robolectric:robolectric:3.0"
testCompile 'org.assertj:assertj-core:1.7.0'
}
Loading

0 comments on commit a15c64b

Please sign in to comment.