Skip to content

refactored to work on Android N #418

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

Closed
wants to merge 3 commits into from
Closed
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
26 changes: 18 additions & 8 deletions Parse/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@ version = '1.13.1-SNAPSHOT'
buildscript {
repositories {
mavenCentral()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can kill this line, maven is redundant

jcenter()
}

dependencies {
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1x'
classpath 'com.android.tools.build:gradle:2.1.0-alpha1'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1x'
}
}

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.getProperties().get('compileSdkVersion')
buildToolsVersion rootProject.getProperties().get('buildToolsVersion')

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
minSdkVersion rootProject.getProperties().get('minSdkVersion')
targetSdkVersion rootProject.getProperties().get('targetSdkVersion')
versionCode 1
versionName project.version
}
Expand All @@ -36,14 +38,22 @@ android {
testCoverageEnabled = true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}



useLibrary 'org.apache.http.legacy'
}

dependencies {
compile 'com.android.tools.build:gradle:2.0.0-beta6'
compile 'com.parse.bolts:bolts-tasks:1.4.0'

compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary since you already have useLibrary 'org.apache.http.legacy'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete line

provided 'com.squareup.okhttp:okhttp:2.4.0'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these need to go to okhttp3

provided 'com.facebook.stetho:stetho:1.1.1'

testCompile 'org.robolectric:robolectric:3.0'
testCompile 'org.skyscreamer:jsonassert:1.2.3'
testCompile 'org.mockito:mockito-core:1.10.19'
Expand Down Expand Up @@ -204,6 +214,6 @@ task jacocoTestReport(type:JacocoReport, dependsOn: "testDebugUnitTest") {

//region Coveralls

coveralls.jacocoReportPath = "${buildDir}/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"
//coveralls.jacocoReportPath = "${buildDir}/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"

//endregion
25 changes: 14 additions & 11 deletions Parse/src/main/java/com/parse/NotificationCompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ static class NotificationCompatImplBase implements NotificationCompatImpl {
@Override
public Notification build(Builder b) {
Notification result = (Notification) b.mNotification;
result.setLatestEventInfo(b.mContext, b.mContentTitle, b.mContentText, b.mContentIntent);
Notification.Builder builder = new Notification.Builder(b.mContext);
builder.setContentTitle(b.mContentTitle);
builder.setContentText(b.mContentText);
builder.setContentIntent(b.mContentIntent);
// translate high priority requests into legacy flag
if (b.mPriority > PRIORITY_DEFAULT) {
result.flags |= FLAG_HIGH_PRIORITY;
Expand All @@ -73,20 +76,20 @@ static class NotificationCompatPostJellyBean implements NotificationCompatImpl {
public Notification build(Builder b) {
postJellyBeanBuilder = new Notification.Builder(b.mContext);
postJellyBeanBuilder.setContentTitle(b.mContentTitle)
.setContentText(b.mContentText)
.setTicker(b.mNotification.tickerText)
.setSmallIcon(b.mNotification.icon, b.mNotification.iconLevel)
.setContentIntent(b.mContentIntent)
.setDeleteIntent(b.mNotification.deleteIntent)
.setAutoCancel((b.mNotification.flags & Notification.FLAG_AUTO_CANCEL) != 0)
.setLargeIcon(b.mLargeIcon)
.setDefaults(b.mNotification.defaults);
.setContentText(b.mContentText)
.setTicker(b.mNotification.tickerText)
.setSmallIcon(b.mNotification.icon, b.mNotification.iconLevel)
.setContentIntent(b.mContentIntent)
.setDeleteIntent(b.mNotification.deleteIntent)
.setAutoCancel((b.mNotification.flags & Notification.FLAG_AUTO_CANCEL) != 0)
.setLargeIcon(b.mLargeIcon)
.setDefaults(b.mNotification.defaults);
if (b.mStyle != null) {
if (b.mStyle instanceof Builder.BigTextStyle) {
Builder.BigTextStyle staticStyle = (Builder.BigTextStyle) b.mStyle;
Notification.BigTextStyle style = new Notification.BigTextStyle(postJellyBeanBuilder)
.setBigContentTitle(staticStyle.mBigContentTitle)
.bigText(staticStyle.mBigText);
.setBigContentTitle(staticStyle.mBigContentTitle)
.bigText(staticStyle.mBigText);
if (staticStyle.mSummaryTextSet) {
style.setSummaryText(staticStyle.mSummaryText);
}
Expand Down
5 changes: 3 additions & 2 deletions Parse/src/main/java/com/parse/ParseApacheHttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.scheme.SocketFactory;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
Expand Down Expand Up @@ -76,8 +77,8 @@ public ParseApacheHttpClient(int socketOperationTimeout, SSLSessionCache sslSess
// Register standard protocols.
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
schemeRegistry.register(new Scheme("https", SSLCertificateSocketFactory.getHttpSocketFactory(
socketOperationTimeout, sslSessionCache), 443));
schemeRegistry.register(new Scheme("https", (SocketFactory) SSLCertificateSocketFactory.getDefault(
socketOperationTimeout, sslSessionCache), 443));

// [1] AndroidHttpClient defaults to 2 connections per route. Not fun. AND you can't set these
// properties after AndroidHttpClient#newInstance(context)
Expand Down
6 changes: 6 additions & 0 deletions Parse/src/main/java/com/parse/ParseSQLiteCursor.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ public boolean getWantsAllOnMoveCalls() {
return cursor.getWantsAllOnMoveCalls();
}

@Override
public void setExtras(Bundle bundle) {
cursor.setExtras(bundle);
}


@Override
public Bundle getExtras() {
return cursor.getExtras();
Expand Down
16 changes: 11 additions & 5 deletions ParseStarterProject/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

compileSdkVersion rootProject.getProperties().get('compileSdkVersion')
buildToolsVersion rootProject.getProperties().get('buildToolsVersion')

defaultConfig {
applicationId "com.parse.starter"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
minSdkVersion rootProject.getProperties().get('minSdkVersion')
targetSdkVersion rootProject.getProperties().get('targetSdkVersion')
versionCode 1
versionName "1.0"
}
Expand All @@ -17,11 +18,16 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}

dependencies {
compile 'com.android.support:appcompat-v7:22.2.0'

compile 'com.android.tools.build:gradle:2.0.0-beta6'
compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
compile 'com.parse.bolts:bolts-tasks:1.3.0'
compile project(':Parse')
}
17 changes: 10 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'com.android.tools.build:gradle:2.1.0-alpha1'
}
}


allprojects {
repositories {
mavenCentral()
jcenter()
}
}

ext {
compileSdkVersion = 22
buildToolsVersion = "23.0.1"

minSdkVersion = 9
targetSdkVersion = 23
setProperty('compileSdkVersion', 'android-N')
setProperty('buildToolsVersion', '24.0.0 rc1')
setProperty('minSdkVersion', 'N')
setProperty('targetSdkVersion', 'N')
}


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-2.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip