Skip to content

Commit

Permalink
Updated Dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
TutorialsAndroid committed Jun 10, 2019
1 parent 182a3b0 commit 2b40b59
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 64 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ restartActivity(Class<? extends Activity>);
```
> This method sets the activity that must be launched by the error activity when the user presses the button to restart the app.
> If you don't set it (or set it to null), the library will use the first activity on your manifest that has an intent-filter with action
> `com.kinda.crash.RESTART`, and if there is none, the default launchable activity on your app.
> `com.developer.kinda.RESTART`, and if there is none, the default launchable activity on your app.
> If no launchable activity can be found and you didn't specify any, the "restart app" button will become a "close app" button,
> even if `showRestartButton` is set to `true`.
>
> As noted, you can also use the following intent-filter to specify the restart activity:
> ```xml
> <intent-filter>
> <!-- ... -->
> <action android:name="com.kinda.crash.RESTART" />
> <action android:name="com.developer.kinda.RESTART" />
> </intent-filter>
> ```
Expand All @@ -162,13 +162,13 @@ errorActivity(Class<? extends Activity>);
> This method allows you to set a custom error activity to be launched, instead of the default one.
> Use it if you need further customization that is not just strings, colors or themes (see below).
> If you don't set it (or set it to null), the library will use the first activity on your manifest that has an intent-filter with action
> `com.kinda.crash.ERROR`, and if there is none, a default error activity from the library.
> `com.developer.kinda.ERROR`, and if there is none, a default error activity from the library.
> If you use this, the activity **must** be declared in your `AndroidManifest.xml`, with `process` set to `:error_activity`.
>
> Example:
> ```xml
> <activity
> android:name="com.kinda.crash.sample.CustomErrorActivity"
> android:name="com.developer.kinda.sample.CustomErrorActivity"
> android:label="@string/error_title"
> android:process=":error_activity" />
> ```
Expand All @@ -177,7 +177,7 @@ errorActivity(Class<? extends Activity>);
> ```xml
> <intent-filter>
> <!-- ... -->
> <action android:name="com.kinda.crash.ERROR" />
> <action android:name="com.developer.kinda.ERROR" />
> </intent-filter>
> ```
Expand All @@ -200,7 +200,7 @@ If you want to specify a specific theme only for the error activity, you can do

```xml
<activity
android:name="com.kinda.crash.activity.DefaultErrorActivity"
android:name="com.developer.kinda.activity.DefaultErrorActivity"
android:theme="@style/YourThemeHere"
android:process=":error_activity" />
```
Expand Down
8 changes: 4 additions & 4 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ android {
resourcePrefix 'crash_'

defaultConfig {
minSdkVersion 15
minSdkVersion 21
targetSdkVersion 29
versionCode 5
versionName "2.0.19" //renamed library version properly.
versionCode 6
versionName "3.0.19"
}
buildTypes {
release {
Expand All @@ -25,7 +25,7 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

//ANDROID SUPPORT LIBRARIES
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
Expand Down
6 changes: 3 additions & 3 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kinda.crash">
package="com.developer.kinda">

<application>
<activity
android:name="com.kinda.crash.activity.DefaultErrorActivity"
android:name="com.developer.kinda.activity.DefaultErrorActivity"
android:process=":error_activity" />
<provider
android:name="com.kinda.crash.provider.CrashInitProvider"
android:name="com.developer.kinda.provider.CrashInitProvider"
android:authorities="${applicationId}.crashinitprovider"
android:exported="false"
android:initOrder="101" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kinda.crash;
package com.developer.kinda;

import android.annotation.SuppressLint;
import android.app.Activity;
Expand All @@ -15,7 +15,6 @@
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import android.util.Log;

import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
Expand All @@ -27,25 +26,25 @@
import java.util.Deque;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import com.kinda.crash.activity.DefaultErrorActivity;
import com.kinda.crash.config.CrashConfig;
import com.developer.kinda.activity.DefaultErrorActivity;
import com.developer.kinda.config.CrashConfig;

public final class CrashActivity {

private final static String TAG = "CrashActivity";

//Extras passed to the error activity
private static final String EXTRA_CONFIG = "com.kinda.crash.EXTRA_CONFIG";
private static final String EXTRA_STACK_TRACE = "com.kinda.crash.EXTRA_STACK_TRACE";
private static final String EXTRA_ACTIVITY_LOG = "com.kinda.crash.EXTRA_ACTIVITY_LOG";
private static final String EXTRA_CONFIG = "com.developer.kinda.EXTRA_CONFIG";
private static final String EXTRA_STACK_TRACE = "com.developer.kinda.EXTRA_STACK_TRACE";
private static final String EXTRA_ACTIVITY_LOG = "com.developer.kinda.EXTRA_ACTIVITY_LOG";

//General constants
private static final String INTENT_ACTION_ERROR_ACTIVITY = "com.kinda.crash.ERROR";
private static final String INTENT_ACTION_RESTART_ACTIVITY = "com.kinda.crash.RESTART";
private static final String CRASH_HANDLER_PACKAGE_NAME = "com.kinda.crash.";
private static final String INTENT_ACTION_ERROR_ACTIVITY = "com.developer.kinda.ERROR";
private static final String INTENT_ACTION_RESTART_ACTIVITY = "com.developer.kinda.RESTART";
private static final String CRASH_HANDLER_PACKAGE_NAME = "com.developer.kinda.";
private static final String DEFAULT_HANDLER_PACKAGE_NAME = "com.android.internal.os";
private static final int MAX_STACK_TRACE_SIZE = 131071; //128 KB - 1
private static final int MAX_ACTIVITIES_IN_LOG = 50;
Expand Down Expand Up @@ -259,7 +258,7 @@ public static String getStackTraceFromIntent(@NonNull Intent intent) {
*/
public static CrashConfig getConfigFromIntent(@NonNull Intent intent) {
CrashConfig config = (CrashConfig) intent.getSerializableExtra(CrashActivity.EXTRA_CONFIG);
if (config.isLogErrorOnRestart()) {
if (Objects.requireNonNull(config).isLogErrorOnRestart()) {
String stackTrace = getStackTraceFromIntent(intent);
if (stackTrace != null) {
Log.e(TAG, "The previous app process crashed. This is the stack trace of the crash:\n" + getStackTraceFromIntent(intent));
Expand Down Expand Up @@ -505,7 +504,7 @@ private static String capitalize(@Nullable String s) {

/**
* INTERNAL method used to guess which activity must be called from the error activity to restart the app.
* It will first get activities from the AndroidManifest with intent filter <action android:name="com.kinda.crash.RESTART" />,
* It will first get activities from the AndroidManifest with intent filter <action android:name="com.developer.kinda.RESTART" />,
* if it cannot find them, then it will get the default launcher.
* If there is no default launcher, this returns null.
*
Expand All @@ -528,13 +527,12 @@ private static Class<? extends Activity> guessRestartActivityClass(@NonNull Cont
}

/**
* INTERNAL method used to get the first activity with an intent-filter <action android:name="com.kinda.crash.RESTART" />,
* INTERNAL method used to get the first activity with an intent-filter <action android:name="com.developer.kinda.RESTART" />,
* If there is no activity with that intent filter, this returns null.
*
* @param context A valid context. Must not be null.
* @return A valid activity class, or null if no suitable one is found
*/
@SuppressWarnings("unchecked")
@Nullable
private static Class<? extends Activity> getRestartActivityClassWithIntentFilter(@NonNull Context context) {
Intent searchedIntent = new Intent().setAction(INTENT_ACTION_RESTART_ACTIVITY).setPackage(context.getPackageName());
Expand Down Expand Up @@ -579,7 +577,7 @@ private static Class<? extends Activity> getLauncherActivity(@NonNull Context co

/**
* INTERNAL method used to guess which error activity must be called when the app crashes.
* It will first get activities from the AndroidManifest with intent filter <action android:name="com.kinda.crash.ERROR" />,
* It will first get activities from the AndroidManifest with intent filter <action android:name="com.developer.kinda.ERROR" />,
* if it cannot find them, then it will use the default error activity.
*
* @param context A valid context. Must not be null.
Expand All @@ -601,7 +599,7 @@ private static Class<? extends Activity> guessErrorActivityClass(@NonNull Contex
}

/**
* INTERNAL method used to get the first activity with an intent-filter <action android:name="com.kinda.crash.ERROR" />,
* INTERNAL method used to get the first activity with an intent-filter <action android:name="com.developer.kinda.ERROR" />,
* If there is no activity with that intent filter, this returns null.
*
* @param context A valid context. Must not be null.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kinda.crash.activity;
package com.developer.kinda.activity;

import android.annotation.SuppressLint;
import android.content.ClipData;
Expand All @@ -20,9 +20,9 @@
import android.widget.TextView;
import android.widget.Toast;

import com.kinda.crash.CrashActivity;
import com.kinda.crash.R;
import com.kinda.crash.config.CrashConfig;
import com.developer.kinda.CrashActivity;
import com.developer.kinda.R;
import com.developer.kinda.config.CrashConfig;

public final class DefaultErrorActivity extends AppCompatActivity {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kinda.crash.config;
package com.developer.kinda.config;

import android.app.Activity;
import androidx.annotation.DrawableRes;
Expand All @@ -11,7 +11,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Modifier;

import com.kinda.crash.CrashActivity;
import com.developer.kinda.CrashActivity;

public class CrashConfig implements Serializable {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kinda.crash.provider;
package com.developer.kinda.provider;

import android.content.ContentProvider;
import android.content.ContentValues;
Expand All @@ -7,7 +7,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.kinda.crash.CrashActivity;
import com.developer.kinda.CrashActivity;

public class CrashInitProvider extends ContentProvider {

Expand Down
10 changes: 5 additions & 5 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ android {
compileSdkVersion 29

defaultConfig {
applicationId "com.kinda.crash.sample"
minSdkVersion 15
applicationId "com.developer.kinda.crashx"
minSdkVersion 21
targetSdkVersion 29
versionCode 5
versionName "2.0.19" //renamed library version properly.
versionCode 6
versionName "3.0.19"
}
buildTypes {
debug {
Expand All @@ -26,7 +26,7 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

//ANDROID SUPPORT LIBRARIES
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
Expand Down
14 changes: 4 additions & 10 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
<?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="com.kinda.crash.sample">
package="com.developer.kinda.crashx">

<application
android:name="com.kinda.crash.sample.CrashingApplication"
android:name="com.developer.kinda.crashx.CrashingApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/SampleAppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity
android:name="com.kinda.crash.sample.activity.MainActivity"
android:name="com.developer.kinda.crashx.activity.MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!-- You can also use this instead of using CrashActivity.setRestartActivityClass(MainActivity.class); -->
<!--<action android:name="com.kinda.crash.RESTART" />-->
</intent-filter>
</activity>

<activity
android:name="com.kinda.crash.sample.activity.ErrorActivity"
android:name="com.developer.kinda.crashx.activity.ErrorActivity"
android:label="@string/error_title"
android:process=":error_activity">
<!-- You can also use this instead of using CrashActivity.setErrorActivityClass(ErrorActivity.class); -->
<!--<intent-filter>-->
<!--<action android:name="com.kinda.crash.ERROR" />-->
<!--</intent-filter>-->
</activity>
</application>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.kinda.crash.sample;
package com.developer.kinda.crashx;

import android.app.Application;
import android.util.Log;

import com.kinda.crash.CrashActivity;
import com.kinda.crash.config.CrashConfig;
import com.developer.kinda.CrashActivity;
import com.developer.kinda.config.CrashConfig;

public class CrashingApplication extends Application {

Expand Down Expand Up @@ -45,12 +45,12 @@ public void onCreate() {
// .errorDrawable(R.mipmap.ic_launcher)
//This sets the restart activity.
//If you set this, this will be used. However, you can also set it with an intent-filter:
// <action android:name="com.kinda.crash.RESTART" />
// <action android:name="com.developer.kinda.RESTART" />
//If none are set, the default launch activity will be used.
// .restartActivity(MainActivity.class)
//This sets a custom error activity class instead of the default one.
//If you set this, this will be used. However, you can also set it with an intent-filter:
// <action android:name="com.kinda.crash.ERROR" />
// <action android:name="com.developer.kinda.ERROR" />
//If none are set, the default launch activity will be used.
//Comment it (and disable the intent filter) to see the customization effects on the default error activity.
//Uncomment to use the custom error activity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kinda.crash.sample.activity;
package com.developer.kinda.crashx.activity;

import android.os.Bundle;
import androidx.annotation.Nullable;
Expand All @@ -7,9 +7,9 @@
import android.widget.Button;
import android.widget.TextView;

import com.kinda.crash.CrashActivity;
import com.kinda.crash.config.CrashConfig;
import com.kinda.crash.sample.R;
import com.developer.kinda.CrashActivity;
import com.developer.kinda.config.CrashConfig;
import com.developer.kinda.crashx.R;

public class ErrorActivity extends AppCompatActivity {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.kinda.crash.sample.activity;
package com.developer.kinda.crashx.activity;

import android.annotation.SuppressLint;
import android.os.AsyncTask;
Expand All @@ -8,7 +8,7 @@
import android.view.View;
import android.widget.Button;

import com.kinda.crash.sample.R;
import com.developer.kinda.crashx.R;

public class MainActivity extends AppCompatActivity {

Expand Down

0 comments on commit 2b40b59

Please sign in to comment.