Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
vanniktech committed Oct 20, 2015
2 parents 6628dcc + 9bddb21 commit 000099c
Show file tree
Hide file tree
Showing 17 changed files with 214 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public class DebugDrawerApplication extends Application {
}
```

## Creating You Own Module
## Creating Your Own Module
Module must implement `DrawerModule` interface


Expand Down
4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android {

defaultConfig {
applicationId "io.palaima.debugdrawer.app"
minSdkVersion 15
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
Expand All @@ -38,6 +38,7 @@ dependencies {
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'jp.wasabeef:takt:1.0.2'
compile 'com.google.android.gms:play-services-location:8.1.0'
/*compile 'io.palaima.debugdrawer:debugdrawer:0.4.0'
compile 'io.palaima.debugdrawer:debugdrawer-okhttp:0.4.0'
Expand All @@ -51,6 +52,7 @@ dependencies {
compile project(':debugdrawer-scalpel')
compile project(':debugdrawer-location')
compile project(':debugdrawer-log')
compile project(':debugdrawer-fps')

debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
Expand Down
13 changes: 13 additions & 0 deletions app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.palaima.debugdrawer.app">

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

</manifest>
9 changes: 0 additions & 9 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.palaima.debugdrawer.app" >

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.concurrent.TimeUnit;

import io.palaima.debugdrawer.DebugDrawer;
import io.palaima.debugdrawer.fps.FpsModule;
import io.palaima.debugdrawer.location.LocationModule;
import io.palaima.debugdrawer.log.LogModule;
import io.palaima.debugdrawer.module.BuildModule;
Expand All @@ -30,6 +31,7 @@
import io.palaima.debugdrawer.okhttp.OkHttpModule;
import io.palaima.debugdrawer.picasso.PicassoModule;
import io.palaima.debugdrawer.scalpel.ScalpelModule;
import jp.wasabeef.takt.Takt;
import timber.log.Timber;

public class MainActivity extends AppCompatActivity {
Expand Down Expand Up @@ -63,8 +65,10 @@ public void onImageLoadFailed(Picasso picasso, Uri uri, Exception e) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
getWindow().setStatusBarColor(getResources().getColor(R.color.primary_dark_material_light));
}*/

if (BuildConfig.DEBUG) {
mDebugDrawer = new DebugDrawer.Builder(this).modules(
new FpsModule(Takt.stock(getApplication())),
new LocationModule(this),
new ScalpelModule(this),
new LogModule(),
Expand Down
1 change: 1 addition & 0 deletions debugdrawer-fps/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
26 changes: 26 additions & 0 deletions debugdrawer-fps/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile project(':debugdrawer')
compile 'jp.wasabeef:takt:1.0.2'
}

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
22 changes: 22 additions & 0 deletions debugdrawer-fps/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

POM_NAME=Debug Drawer FPS Module
POM_ARTIFACT_ID=debugdrawer-fps
POM_PACKAGING=aar
17 changes: 17 additions & 0 deletions debugdrawer-fps/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/palaima/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.palaima.debugdrawer.fps;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
6 changes: 6 additions & 0 deletions debugdrawer-fps/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<manifest package="io.palaima.debugdrawer.fps"
xmlns:android="http://schemas.android.com/apk/res/android">

<application android:allowBackup="true"/>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package io.palaima.debugdrawer.fps;

import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.Switch;

import io.palaima.debugdrawer.module.DrawerModule;
import jp.wasabeef.takt.Takt;

public class FpsModule implements DrawerModule {

private final Takt.Program program;

private boolean isChecked;

public FpsModule(@NonNull Takt.Program program) {
this.program = program;
}

@Override @NonNull public View onCreateView(LayoutInflater inflater, ViewGroup parent) {
View view = inflater.inflate(R.layout.debug_drawer_item_fps, parent, false);
Switch showSwitch = (Switch) view.findViewById(R.id.debug_fps);
showSwitch.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton button, boolean isChecked) {
FpsModule.this.isChecked = isChecked;
if (isChecked) {
program.play();
} else {
program.stop();
}
}
});
return view;
}

@Override public void onOpened() {

}

@Override public void onClosed() {

}

@Override public void onStart() {
if (isChecked) {
program.play();
}
}

@Override public void onStop() {
if (isChecked) {
program.stop();
}
}
}
30 changes: 30 additions & 0 deletions debugdrawer-fps/src/main/res/layout/debug_drawer_item_fps.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:columnCount="2"
tools:ignore="UselessParent">
<TextView
android:layout_columnSpan="2"
android:layout_width="0dp"
android:layout_gravity="start|fill_horizontal"
android:text="FPS"
style="@style/Widget.DebugDrawer.Header"
/>

<TextView
android:layout_gravity="start|center_vertical"
android:text="Show fps"
style="@style/Widget.DebugDrawer.RowTitle"
/>
<Switch
android:id="@+id/debug_fps"
android:layout_gravity="start|center_vertical"
style="@style/Widget.DebugDrawer.RowWidget"
/>


</GridLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.palaima.debugdrawer.fps;

import org.junit.Test;

import static org.junit.Assert.*;

/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
8 changes: 0 additions & 8 deletions debugdrawer/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
package="io.palaima.debugdrawer"
xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

<application android:allowBackup="true"/>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.palaima.debugdrawer.module;

import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -25,7 +26,7 @@ public interface DrawerModule {
/**
* Creates module view
*/
View onCreateView(LayoutInflater inflater, ViewGroup parent);
@NonNull View onCreateView(LayoutInflater inflater, ViewGroup parent);

/**
* Override this method if you need to refresh
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':app', ':debugdrawer', ':debugdrawer-picasso', ':debugdrawer-okhttp', ':debugdrawer-scalpel', ':debugdrawer-location', ':debugdrawer-log'
include ':app', ':debugdrawer', ':debugdrawer-picasso', ':debugdrawer-okhttp', ':debugdrawer-scalpel', ':debugdrawer-location', ':debugdrawer-log', ':debugdrawer-fps'

0 comments on commit 000099c

Please sign in to comment.