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

Use AndroidX #665

Open
wants to merge 20 commits into
base: main
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
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.android.tools.build:gradle:3.2.1'
}
}

Expand All @@ -16,6 +16,6 @@ allprojects {
}

ext {
compileSdkVersion = 28
targetSdkVersion = 28
compileSdkVersion = 29
targetSdkVersion = 29
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
2 changes: 1 addition & 1 deletion stetho-js-rhino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This [Stetho](https://facebook.github.io/stetho) plugin adds a JavaScript consol
### Download
Download [the latest JARs](https://github.com/facebook/stetho/releases/latest) or grab via Gradle:
```groovy
compile 'com.facebook.stetho:stetho-js-rhino:1.4.2'
implementation 'com.facebook.stetho:stetho-js-rhino:1.4.2'
```
or Maven:
```xml
Expand Down
6 changes: 3 additions & 3 deletions stetho-js-rhino/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ android {
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
minSdkVersion 9
minSdkVersion 14
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
Expand All @@ -19,9 +19,9 @@ android {

dependencies {
implementation project(':stetho')
implementation 'com.google.code.findbugs:jsr305:2.0.1'
implementation 'com.google.code.findbugs:jsr305:2.0.3'
implementation 'org.mozilla:rhino:1.7.6'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'androidx.annotation:annotation:1.1.0'

testImplementation 'junit:junit:4.12'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

package com.facebook.stetho.rhino;

import android.support.annotation.NonNull;

import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import androidx.annotation.NonNull;

/**
* <p>Formatter that tries to mimic <pre>console.log()</pre>'s format as close as possible.</p>
*
Expand Down Expand Up @@ -64,6 +64,7 @@ public char charAt(int index) {
return array[start + index];
}

@NonNull
@Override
public CharSequence subSequence(int start, int end) {
return new ArrayCharSequence(array, this.start + start, this.start + end);
Expand Down Expand Up @@ -124,7 +125,7 @@ public CharSequence subSequence(int start, int end) {
}

// Analyze the format. We don't have named captures in android yet so we will inspect
// the groups. They are each optional but we can find out which one is whic easily.
// the groups. They are each optional but we can find out which one is which easily.
// Remember that we want to parse: %[argument_index$][flags][width][.precision]conversion
//
// - `index` ends with '$'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@

package com.facebook.stetho.rhino;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.facebook.stetho.inspector.console.RuntimeRepl;

import org.mozilla.javascript.Context;
import org.mozilla.javascript.ScriptableObject;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

class JsRuntimeRepl implements RuntimeRepl {

private final @NonNull ScriptableObject mJsScope;
Expand All @@ -22,7 +25,8 @@ class JsRuntimeRepl implements RuntimeRepl {
}

@Override
public @Nullable Object evaluate(@NonNull String expression) throws Throwable {
public @Nullable
Object evaluate(@NonNull String expression) throws Throwable {
Object result;
final Context jsContext = enterJsContext();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

package com.facebook.stetho.rhino;

import android.support.annotation.NonNull;
import android.util.Log;

import com.facebook.stetho.common.LogUtil;
import com.facebook.stetho.inspector.console.CLog;
import com.facebook.stetho.inspector.console.RuntimeRepl;
import com.facebook.stetho.inspector.console.RuntimeReplFactory;
import com.facebook.stetho.inspector.protocol.module.Console;

import org.mozilla.javascript.Context;
import org.mozilla.javascript.Function;
import org.mozilla.javascript.ImporterTopLevel;
Expand All @@ -26,6 +27,8 @@
import java.util.Map;
import java.util.Set;

import androidx.annotation.NonNull;

/**
* <p>Builder used to setup the javascript runtime to be used by stetho.</p>
*
Expand Down
12 changes: 6 additions & 6 deletions stetho-okhttp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ android {
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
minSdkVersion 9
minSdkVersion 14
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
Expand All @@ -21,20 +21,20 @@ android {

dependencies {
implementation project(':stetho')
implementation 'com.google.code.findbugs:jsr305:2.0.1'
implementation 'com.google.code.findbugs:jsr305:2.0.3'
implementation 'com.squareup.okhttp:okhttp:2.7.2'

testImplementation 'junit:junit:4.12'
testImplementation('org.robolectric:robolectric:2.4') {
exclude module: 'commons-logging'
exclude module: 'httpclient'
}
testImplementation 'org.powermock:powermock-api-mockito:1.6.1'
testImplementation 'org.powermock:powermock-module-junit4:1.6.1'
testImplementation 'org.powermock:powermock-api-mockito:1.6.6'
testImplementation 'org.powermock:powermock-module-junit4:1.6.6'

// Needed for Robolectric and PowerMock to be combined in a single test.
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.1'
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.1'
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.6'
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.6'

testImplementation 'com.squareup.okhttp:mockwebserver:2.7.2'
}
Expand Down
12 changes: 6 additions & 6 deletions stetho-okhttp3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ android {
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
minSdkVersion 9
minSdkVersion 14
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
Expand All @@ -21,20 +21,20 @@ android {

dependencies {
implementation project(':stetho')
implementation 'com.google.code.findbugs:jsr305:2.0.1'
implementation 'com.google.code.findbugs:jsr305:2.0.3'
implementation 'com.squareup.okhttp3:okhttp:3.4.2'

testImplementation 'junit:junit:4.12'
testImplementation('org.robolectric:robolectric:2.4') {
exclude module: 'commons-logging'
exclude module: 'httpclient'
}
testImplementation 'org.powermock:powermock-api-mockito:1.6.1'
testImplementation 'org.powermock:powermock-module-junit4:1.6.1'
testImplementation 'org.powermock:powermock-api-mockito:1.6.6'
testImplementation 'org.powermock:powermock-module-junit4:1.6.6'

// Needed for Robolectric and PowerMock to be combined in a single test.
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.1'
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.1'
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.6'
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.6'

testImplementation 'com.squareup.okhttp3:mockwebserver:3.4.2'
}
Expand Down
10 changes: 5 additions & 5 deletions stetho-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {

defaultConfig {
applicationId "com.facebook.stetho.sample"
minSdkVersion 11
minSdkVersion 14
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
Expand Down Expand Up @@ -43,8 +43,8 @@ dependencies {
// way to express this is:
//
// dependencies {
// debugCompile 'com.facebook.stetho:stetho:<VERSION>'
// compile 'com.facebook.stetho:stetho-urlconnection:<VERSION>'
// debugImplementation 'com.facebook.stetho:stetho:<VERSION>'
// implementation 'com.facebook.stetho:stetho-urlconnection:<VERSION>'
// }
//
// For Stetho developers, to verify locally that things are working
Expand All @@ -54,8 +54,8 @@ dependencies {
// ./gradlew installArchives
//
// Then uncomment the Maven style dependency and comment the project one:
//releaseCompile "com.facebook.stetho:stetho-urlconnection:${VERSION_NAME}"
//releaseImplementation "com.facebook.stetho:stetho-urlconnection:${VERSION_NAME}"
releaseImplementation project(':stetho-urlconnection')

implementation 'com.google.code.findbugs:jsr305:2.0.1'
implementation 'com.google.code.findbugs:jsr305:2.0.3'
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@

package com.facebook.stetho.sample;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.SystemClock;
import android.provider.CalendarContract;
import android.util.Log;

import com.facebook.stetho.DumperPluginsProvider;
import com.facebook.stetho.InspectorModulesProvider;
import com.facebook.stetho.Stetho;
Expand Down Expand Up @@ -66,7 +65,6 @@ public Iterable<ChromeDevtoolsDomain> get() {
.finish();
}

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private ContentProviderDatabaseDriver createContentProviderDatabaseDriver(Context context) {
ContentProviderSchema calendarsSchema = new ContentProviderSchema.Builder()
.table(new Table.Builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

package com.facebook.stetho.sample;

import java.io.IOException;

import android.app.ListActivity;
import android.app.LoaderManager;
import android.content.Context;
Expand All @@ -29,6 +27,8 @@
import android.widget.ImageView;
import android.widget.TextView;

import java.io.IOException;

/**
* Simple demonstration of fetching and caching a specific RSS feed showing the
* "Astronomy Picture of the Day" feed from NASA. This demonstrates both the database access
Expand Down Expand Up @@ -164,9 +164,9 @@ private static class ViewHolder {
int position;

public ViewHolder(View v) {
image = (ImageView)v.findViewById(R.id.image);
title = (TextView)v.findViewById(R.id.title);
description = (TextView)v.findViewById(R.id.description);
image = v.findViewById(R.id.image);
title = v.findViewById(R.id.title);
description = v.findViewById(R.id.description);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

package com.facebook.stetho.sample;

import java.util.ArrayList;

import android.content.ContentProvider;
import android.content.ContentProviderOperation;
import android.content.ContentProviderResult;
Expand All @@ -20,6 +18,10 @@
import android.database.sqlite.SQLiteOpenHelper;
import android.net.Uri;

import java.util.ArrayList;

import javax.annotation.Nonnull;

public class APODContentProvider extends ContentProvider {
private APODSQLiteOpenHelper mOpenHelper;

Expand All @@ -31,7 +33,7 @@ public boolean onCreate() {

@Override
public Cursor query(
Uri uri,
@Nonnull Uri uri,
String[] projection,
String selection,
String[] selectionArgs,
Expand All @@ -51,7 +53,7 @@ public Cursor query(
}

@Override
public String getType(Uri uri) {
public String getType(@Nonnull Uri uri) {
return null;
}

Expand All @@ -64,23 +66,24 @@ public Uri insert(Uri uri, ContentValues values) {
}

@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
public int delete(@Nonnull Uri uri, String selection, String[] selectionArgs) {
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
int count = db.delete(APODContract.TABLE_NAME, selection, selectionArgs);
notifyChange();
return count;
}

@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
public int update(@Nonnull Uri uri, ContentValues values, String selection, String[] selectionArgs) {
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
int count = db.update(APODContract.TABLE_NAME, values, selection, selectionArgs);
notifyChange();
return count;
}

@Nonnull
@Override
public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations)
public ContentProviderResult[] applyBatch(@Nonnull ArrayList<ContentProviderOperation> operations)
throws OperationApplicationException {
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
db.beginTransaction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.irc_chat_activity);

mConsoleDisplay = (ListView) findViewById(R.id.console_display);
mConsoleDisplay = findViewById(R.id.console_display);
mConsoleRowAdapter = new IRCConsoleRowAdapter(this);
mConsoleDisplay.setAdapter(mConsoleRowAdapter);

mConsoleInput = (TextView) findViewById(R.id.console_input);
mConsoleInput = findViewById(R.id.console_input);
mConsoleInput.setOnEditorActionListener(mOnConsoleInputEditorAction);
findViewById(R.id.console_send).setOnClickListener(mConsoleSendClicked);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.irc_connect_activity);

mIRCPriorError = (TextView) findViewById(R.id.irc_prior_error);
mIRCServer = (EditText) findViewById(R.id.irc_server);
mIRCPriorError = findViewById(R.id.irc_prior_error);
mIRCServer = findViewById(R.id.irc_server);
if (TextUtils.isEmpty(mIRCServer.getText())) {
mIRCServer.setText(DEFAULT_HOST);
}
mIRCNickname = (EditText) findViewById(R.id.irc_nickname);
mIRCNickname = findViewById(R.id.irc_nickname);
if (TextUtils.isEmpty(mIRCNickname.getText())) {
mIRCNickname.setText("stetho" + (new Random().nextInt(9999) + 1));
}
Expand Down
2 changes: 1 addition & 1 deletion stetho-timber/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ android {
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
minSdkVersion 11
minSdkVersion 14
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
Expand Down
Loading