Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add no-op library #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'io.fabric.tools:gradle:1.24.5'
classpath 'com.android.tools.build:gradle:3.3.0-alpha05'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}

Expand All @@ -20,6 +20,7 @@ allprojects {

repositories {
jcenter()
google()
maven {
url 'https://maven.fabric.io/public'
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Nov 20 11:40:43 CET 2017
#Wed Aug 08 15:27:42 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
1 change: 1 addition & 0 deletions library-no-op/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
26 changes: 26 additions & 0 deletions library-no-op/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
buildToolsVersion "28.0.1"

defaultConfig {
minSdkVersion 9
targetSdkVersion 28
versionCode 5
versionName "1.2.2-SNAPSHOT"
}
buildTypes {
release {
minifyEnabled false
}
}
}

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'

dependencies {
implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') {
transitive = true
}
}
3 changes: 3 additions & 0 deletions library-no-op/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POM_NAME=LogcatReporter library
POM_ARTIFACT_ID=logcatreporter
POM_PACKAGING=jar
6 changes: 6 additions & 0 deletions library-no-op/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="cat.ereza.logcatreporter">

<application />

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2016-2017 Eduard Ereza Martínez
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package cat.ereza.logcatreporter;

public class LogcatReporter {

private static final String TAG = "LogcatReporter";

private static final int DEFAULT_WAIT_TIME_IN_MILLIS = 500;
private static final int DEFAULT_LINE_COUNT = 1000;

private static int lineCount;

public static void install() {
}

public static void install(int lineCount) {
}

public static void install(final int lineCount, final int waitTimeInMillis) {
}

public static void reportExceptionWithLogcat(Throwable t) {
}

private static void logLogcat() {
}
}
12 changes: 6 additions & 6 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 27
buildToolsVersion "27.0.1"
compileSdkVersion 28
buildToolsVersion "28.0.1"

defaultConfig {
minSdkVersion 9
targetSdkVersion 27
versionCode 4
versionName "1.2.1-SNAPSHOT"
targetSdkVersion 28
versionCode 5
versionName "1.2.2-SNAPSHOT"
}
buildTypes {
release {
Expand All @@ -20,7 +20,7 @@ android {
apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'

dependencies {
compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') {
transitive = true
}
}
1 change: 1 addition & 0 deletions sample-no-op/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
36 changes: 36 additions & 0 deletions sample-no-op/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.fabric.io/public' }
}

android {
compileSdkVersion 28
buildToolsVersion '28.0.1'

defaultConfig {
applicationId "cat.ereza.logcatreporter.sample"
minSdkVersion 9
targetSdkVersion 28
versionCode 4
versionName "1.2.1-SNAPSHOT"
}
buildTypes {
debug {
minifyEnabled false
proguardFiles 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles 'proguard-rules.pro'
}
}
}

dependencies {
implementation project(":library-no-op")
implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') {
transitive = true;
}
}
1 change: 1 addition & 0 deletions sample-no-op/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# No special config needed for LogcatReporter! :D
30 changes: 30 additions & 0 deletions sample-no-op/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="cat.ereza.logcatreporter.sample">

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

<!-- Use this if you really want to get logs from devices on API <16 -->
<!--<uses-permission android:name="android.permission.READ_LOGS" android:maxSdkVersion="18" />-->

<application
android:name="cat.ereza.logcatreporter.sample.SampleCrashingApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/SampleAppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity
android:name="cat.ereza.logcatreporter.sample.activity.MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="4243bc7bde69a144d20e9aa89b0f3be8d00bfd06" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2016-2017 Eduard Ereza Martínez
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package cat.ereza.logcatreporter.sample;

import android.app.Application;

import com.crashlytics.android.Crashlytics;

import cat.ereza.logcatreporter.LogcatReporter;
import io.fabric.sdk.android.Fabric;

public class SampleCrashingApplication extends Application{
@Override
public void onCreate() {
super.onCreate();

//Initialize Crashlytics as normal
Fabric.with(this, new Crashlytics());

//Install LogcatReporter
LogcatReporter.install();

//You can algo use the following:
// LogcatReporter.install(2000, 500);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright 2016-2017 Eduard Ereza Martínez
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package cat.ereza.logcatreporter.sample.activity;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import java.util.UUID;

import cat.ereza.logcatreporter.sample.R;

public class MainActivity extends Activity {

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

Button logButton = (Button) findViewById(R.id.button_log);
Button crashButton = (Button) findViewById(R.id.button_crash);

logButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String loggedString = "This is a test log! - " + UUID.randomUUID().toString();
Log.e("TEST_TAG", loggedString);
Toast.makeText(MainActivity.this, getString(R.string.logged_toast, loggedString), Toast.LENGTH_SHORT).show();
}
});

crashButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
throw new RuntimeException("Hi! I'm an exception and I made the app crash!");
}
});
}
}
30 changes: 30 additions & 0 deletions sample-no-op/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="20dp"
android:text="@string/hello" />

<Button
android:id="@+id/button_log"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_log" />

<Button
android:id="@+id/button_crash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_crash" />

</LinearLayout>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions sample-no-op/src/main/res/values-v14/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SampleAppTheme" parent="android:Theme.Holo.Light.DarkActionBar" />
</resources>
8 changes: 8 additions & 0 deletions sample-no-op/src/main/res/values-v21/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SampleAppTheme" parent="android:Theme.Material.Light.DarkActionBar">
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<item name="android:colorAccent">@color/accent</item>
</style>
</resources>
6 changes: 6 additions & 0 deletions sample-no-op/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#CC0000</color>
<color name="primary_dark">#880000</color>
<color name="accent">#808000</color>
</resources>
8 changes: 8 additions & 0 deletions sample-no-op/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>

</resources>
8 changes: 8 additions & 0 deletions sample-no-op/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">LogcatReporter sample</string>
<string name="hello">Hello! Press the following buttons to perform the desired actions:</string>
<string name="button_log">Write to log</string>
<string name="button_crash">Crash app</string>
<string name="logged_toast">Logged this string: %s</string>
</resources>
4 changes: 4 additions & 0 deletions sample-no-op/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SampleAppTheme" parent="android:Theme.Light" />
</resources>
Loading