Migrate to AndroidX
This commit is contained in:
parent
3a194e14e4
commit
e937c59651
26 changed files with 186 additions and 136 deletions
|
@ -1,4 +1,7 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlin-kapt'
|
||||||
apply plugin: 'io.fabric'
|
apply plugin: 'io.fabric'
|
||||||
|
|
||||||
def keystorePropertiesFile = rootProject.file("keystore.properties")
|
def keystorePropertiesFile = rootProject.file("keystore.properties")
|
||||||
|
@ -29,7 +32,7 @@ android {
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
versionCode 18
|
versionCode 18
|
||||||
versionName "0.6.0"
|
versionName "0.6.0"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
|
@ -57,28 +60,24 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
|
||||||
acraVersion = '5.2.0'
|
|
||||||
support_version = "28.0.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
def lifecycle_version = "2.0.0"
|
||||||
annotationProcessor 'com.google.dagger:dagger-compiler:2.21'
|
annotationProcessor 'com.google.dagger:dagger-compiler:2.21'
|
||||||
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
|
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation 'org.robolectric:robolectric:4.2'
|
testImplementation 'org.robolectric:robolectric:4.2'
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
|
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
|
||||||
exclude group: 'com.android.support', module: 'support-annotations'
|
exclude group: 'com.android.support', module: 'support-annotations'
|
||||||
})
|
})
|
||||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
androidTestImplementation 'androidx.test:runner:1.1.1'
|
||||||
androidTestImplementation 'com.android.support.test:rules:1.0.2'
|
androidTestImplementation 'androidx.test:rules:1.1.1'
|
||||||
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
|
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
|
||||||
implementation "com.android.support:appcompat-v7:$support_version"
|
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
implementation "com.android.support:design:$support_version"
|
implementation 'com.google.android.material:material:1.0.0'
|
||||||
implementation "com.android.support:support-v13:$support_version"
|
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
||||||
implementation 'com.commonsware.cwac:anddown:0.3.0'
|
implementation 'com.commonsware.cwac:anddown:0.3.0'
|
||||||
implementation 'com.google.dagger:dagger:2.21'
|
implementation 'com.google.dagger:dagger:2.21'
|
||||||
implementation 'com.jakewharton:butterknife:8.8.1'
|
implementation 'com.jakewharton:butterknife:8.8.1'
|
||||||
|
@ -89,7 +88,15 @@ dependencies {
|
||||||
implementation 'com.google.firebase:firebase-core:16.0.8'
|
implementation 'com.google.firebase:firebase-core:16.0.8'
|
||||||
implementation 'com.android.billingclient:billing:1.2'
|
implementation 'com.android.billingclient:billing:1.2'
|
||||||
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
|
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
|
||||||
implementation 'com.android.support:multidex:1.0.3'
|
implementation 'androidx.multidex:multidex:2.0.1'
|
||||||
|
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
|
||||||
|
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
|
||||||
|
compile "androidx.core:core-ktx:1.0.1"
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.google.gms.google-services'
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package com.wbrawner.simplemarkdown;
|
package com.wbrawner.simplemarkdown;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.InstrumentationRegistry;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instrumentation test, which will execute on an Android device.
|
* Instrumentation test, which will execute on an Android device.
|
||||||
|
|
|
@ -2,13 +2,14 @@ package com.wbrawner.simplemarkdown;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.support.test.InstrumentationRegistry;
|
|
||||||
import android.support.test.rule.ActivityTestRule;
|
import androidx.test.InstrumentationRegistry;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import androidx.test.rule.ActivityTestRule;
|
||||||
import android.support.test.uiautomator.UiDevice;
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
import android.support.test.uiautomator.UiObject;
|
import androidx.test.uiautomator.UiDevice;
|
||||||
import android.support.test.uiautomator.UiScrollable;
|
import androidx.test.uiautomator.UiObject;
|
||||||
import android.support.test.uiautomator.UiSelector;
|
import androidx.test.uiautomator.UiScrollable;
|
||||||
|
import androidx.test.uiautomator.UiSelector;
|
||||||
|
|
||||||
import com.wbrawner.simplemarkdown.view.activity.MainActivity;
|
import com.wbrawner.simplemarkdown.view.activity.MainActivity;
|
||||||
|
|
||||||
|
@ -17,11 +18,11 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import static android.support.test.InstrumentationRegistry.getInstrumentation;
|
import static androidx.test.InstrumentationRegistry.getInstrumentation;
|
||||||
import static android.support.test.espresso.Espresso.onView;
|
import static androidx.test.espresso.Espresso.onView;
|
||||||
import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
|
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
|
||||||
import static android.support.test.espresso.action.ViewActions.click;
|
import static androidx.test.espresso.action.ViewActions.click;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,15 +2,16 @@ package com.wbrawner.simplemarkdown.view.activity;
|
||||||
|
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.support.test.espresso.ViewInteraction;
|
|
||||||
import android.support.test.filters.LargeTest;
|
|
||||||
import android.support.test.rule.ActivityTestRule;
|
|
||||||
import android.support.test.rule.GrantPermissionRule;
|
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewParent;
|
import android.view.ViewParent;
|
||||||
|
|
||||||
|
import androidx.test.espresso.ViewInteraction;
|
||||||
|
import androidx.test.filters.LargeTest;
|
||||||
|
import androidx.test.rule.ActivityTestRule;
|
||||||
|
import androidx.test.rule.GrantPermissionRule;
|
||||||
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import com.wbrawner.simplemarkdown.R;
|
import com.wbrawner.simplemarkdown.R;
|
||||||
|
|
||||||
import org.hamcrest.Description;
|
import org.hamcrest.Description;
|
||||||
|
@ -20,18 +21,18 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import static android.support.test.InstrumentationRegistry.getInstrumentation;
|
import static androidx.test.InstrumentationRegistry.getInstrumentation;
|
||||||
import static android.support.test.espresso.Espresso.onView;
|
import static androidx.test.espresso.Espresso.onView;
|
||||||
import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
|
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
|
||||||
import static android.support.test.espresso.action.ViewActions.click;
|
import static androidx.test.espresso.action.ViewActions.click;
|
||||||
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
|
import static androidx.test.espresso.action.ViewActions.closeSoftKeyboard;
|
||||||
import static android.support.test.espresso.action.ViewActions.replaceText;
|
import static androidx.test.espresso.action.ViewActions.replaceText;
|
||||||
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
|
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.withClassName;
|
import static androidx.test.espresso.matcher.ViewMatchers.withClassName;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
|
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||||
import static org.hamcrest.Matchers.allOf;
|
import static org.hamcrest.Matchers.allOf;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,11 @@ package com.wbrawner.simplemarkdown.view.activity;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.test.rule.ActivityTestRule;
|
|
||||||
import android.support.test.rule.GrantPermissionRule;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.test.rule.ActivityTestRule;
|
||||||
|
import androidx.test.rule.GrantPermissionRule;
|
||||||
|
|
||||||
import com.wbrawner.simplemarkdown.R;
|
import com.wbrawner.simplemarkdown.R;
|
||||||
import com.wbrawner.simplemarkdown.utility.Constants;
|
import com.wbrawner.simplemarkdown.utility.Constants;
|
||||||
|
|
||||||
|
@ -14,13 +15,13 @@ import org.junit.Test;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import static android.support.test.espresso.Espresso.onData;
|
import static androidx.test.espresso.Espresso.onData;
|
||||||
import static android.support.test.espresso.Espresso.onView;
|
import static androidx.test.espresso.Espresso.onView;
|
||||||
import static android.support.test.espresso.action.ViewActions.click;
|
import static androidx.test.espresso.action.ViewActions.click;
|
||||||
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
|
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
|
||||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||||
import static org.hamcrest.Matchers.allOf;
|
import static org.hamcrest.Matchers.allOf;
|
||||||
import static org.hamcrest.Matchers.instanceOf;
|
import static org.hamcrest.Matchers.instanceOf;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
android:theme="@style/AppTheme" />
|
android:theme="@style/AppTheme" />
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="android.support.v4.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="com.wbrawner.simplemarkdown.fileprovider"
|
android:authorities="com.wbrawner.simplemarkdown.fileprovider"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:grantUriPermissions="true">
|
android:grantUriPermissions="true">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.wbrawner.simplemarkdown;
|
package com.wbrawner.simplemarkdown;
|
||||||
|
|
||||||
import android.support.multidex.MultiDexApplication;
|
import androidx.multidex.MultiDexApplication;
|
||||||
|
|
||||||
public class MarkdownApplication extends MultiDexApplication {
|
public class MarkdownApplication extends MultiDexApplication {
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,13 @@ package com.wbrawner.simplemarkdown.presentation;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
import com.android.billingclient.api.BillingClientStateListener;
|
|
||||||
import com.android.billingclient.api.PurchasesUpdatedListener;
|
|
||||||
import com.wbrawner.simplemarkdown.view.MarkdownEditView;
|
import com.wbrawner.simplemarkdown.view.MarkdownEditView;
|
||||||
import com.wbrawner.simplemarkdown.view.MarkdownPreviewView;
|
import com.wbrawner.simplemarkdown.view.MarkdownPreviewView;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
public interface MarkdownPresenter extends PurchasesUpdatedListener, BillingClientStateListener {
|
public interface MarkdownPresenter {
|
||||||
File getFile();
|
File getFile();
|
||||||
void loadMarkdown();
|
void loadMarkdown();
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,7 @@ import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.provider.OpenableColumns;
|
import android.provider.OpenableColumns;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.android.billingclient.api.BillingClient;
|
|
||||||
import com.android.billingclient.api.BillingClientStateListener;
|
|
||||||
import com.android.billingclient.api.Purchase;
|
|
||||||
import com.android.billingclient.api.PurchasesUpdatedListener;
|
|
||||||
import com.commonsware.cwac.anddown.AndDown;
|
import com.commonsware.cwac.anddown.AndDown;
|
||||||
import com.crashlytics.android.Crashlytics;
|
import com.crashlytics.android.Crashlytics;
|
||||||
import com.wbrawner.simplemarkdown.model.MarkdownFile;
|
import com.wbrawner.simplemarkdown.model.MarkdownFile;
|
||||||
|
@ -22,27 +17,18 @@ import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MarkdownPresenterImpl
|
public class MarkdownPresenterImpl implements MarkdownPresenter {
|
||||||
implements MarkdownPresenter, BillingClientStateListener, PurchasesUpdatedListener {
|
|
||||||
private final Object fileLock = new Object();
|
private final Object fileLock = new Object();
|
||||||
private MarkdownFile file;
|
private MarkdownFile file;
|
||||||
private volatile MarkdownEditView editView;
|
private volatile MarkdownEditView editView;
|
||||||
private volatile MarkdownPreviewView previewView;
|
private volatile MarkdownPreviewView previewView;
|
||||||
private Handler fileHandler = new Handler();
|
private Handler fileHandler = new Handler();
|
||||||
private BillingClient billingClient;
|
|
||||||
|
|
||||||
public MarkdownPresenterImpl(Context context, MarkdownFile file) {
|
public MarkdownPresenterImpl(Context context, MarkdownFile file) {
|
||||||
synchronized (fileLock) {
|
synchronized (fileLock) {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
billingClient = BillingClient.newBuilder(context.getApplicationContext())
|
|
||||||
.setListener(this)
|
|
||||||
.build();
|
|
||||||
billingClient.startConnection(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -255,24 +241,4 @@ public class MarkdownPresenterImpl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBillingSetupFinished(int responseCode) {
|
|
||||||
if (responseCode != BillingClient.BillingResponse.OK) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The billing client is ready. You can query purchases here.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBillingServiceDisconnected() {
|
|
||||||
// TODO: Set a flag and just try again later
|
|
||||||
billingClient.startConnection(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPurchasesUpdated(int responseCode, @Nullable List<Purchase> purchases) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,8 @@ import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.content.ContextCompat;
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.crashlytics.android.Crashlytics;
|
import com.crashlytics.android.Crashlytics;
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,13 @@ package com.wbrawner.simplemarkdown.view;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v4.view.ViewPager;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
public class DisableableViewPager extends ViewPager {
|
public class DisableableViewPager extends ViewPager {
|
||||||
private boolean isSwipeLocked = false;
|
private boolean isSwipeLocked = false;
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -15,6 +13,9 @@ import android.widget.EditText;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.SimpleAdapter;
|
import android.widget.SimpleAdapter;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
import com.crashlytics.android.Crashlytics;
|
import com.crashlytics.android.Crashlytics;
|
||||||
import com.wbrawner.simplemarkdown.R;
|
import com.wbrawner.simplemarkdown.R;
|
||||||
import com.wbrawner.simplemarkdown.utility.Constants;
|
import com.wbrawner.simplemarkdown.utility.Constants;
|
||||||
|
|
|
@ -7,16 +7,18 @@ import android.content.res.AssetManager;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.design.widget.TabLayout;
|
|
||||||
import android.support.v4.app.ActivityCompat;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.lifecycle.ViewModelProviders;
|
||||||
|
|
||||||
import com.crashlytics.android.Crashlytics;
|
import com.crashlytics.android.Crashlytics;
|
||||||
|
import com.google.android.material.tabs.TabLayout;
|
||||||
import com.wbrawner.simplemarkdown.MarkdownApplication;
|
import com.wbrawner.simplemarkdown.MarkdownApplication;
|
||||||
import com.wbrawner.simplemarkdown.R;
|
import com.wbrawner.simplemarkdown.R;
|
||||||
import com.wbrawner.simplemarkdown.presentation.MarkdownPresenter;
|
import com.wbrawner.simplemarkdown.presentation.MarkdownPresenter;
|
||||||
|
|
|
@ -2,11 +2,12 @@ package com.wbrawner.simplemarkdown.view.activity;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.ActionBar;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.ActionBar;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.wbrawner.simplemarkdown.R;
|
import com.wbrawner.simplemarkdown.R;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package com.wbrawner.simplemarkdown.view.activity;
|
package com.wbrawner.simplemarkdown.view.activity;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.wbrawner.simplemarkdown.R;
|
import com.wbrawner.simplemarkdown.R;
|
||||||
|
|
||||||
public class SettingsActivity extends AppCompatActivity {
|
public class SettingsActivity extends AppCompatActivity {
|
||||||
|
|
|
@ -4,8 +4,9 @@ import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.crashlytics.android.Crashlytics;
|
import com.crashlytics.android.Crashlytics;
|
||||||
import com.wbrawner.simplemarkdown.MarkdownApplication;
|
import com.wbrawner.simplemarkdown.MarkdownApplication;
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.wbrawner.simplemarkdown.view.activity
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.android.billingclient.api.*
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class SupportActivity : AppCompatActivity(), BillingClientStateListener, PurchasesUpdatedListener {
|
||||||
|
private lateinit var billingClient: BillingClient
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
billingClient = BillingClient.newBuilder(applicationContext)
|
||||||
|
.setListener(this)
|
||||||
|
.build()
|
||||||
|
billingClient.startConnection(this)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBillingSetupFinished(responseCode: Int) {
|
||||||
|
if (responseCode != BillingClient.BillingResponse.OK) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// The billing client is ready. You can query purchases here.
|
||||||
|
val skuList = ArrayList<String>()
|
||||||
|
skuList.add("support_the_developer")
|
||||||
|
val params = SkuDetailsParams.newBuilder()
|
||||||
|
params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP)
|
||||||
|
billingClient.querySkuDetailsAsync(params.build()) { responseCode1, skuDetailsList ->
|
||||||
|
// Process the result.
|
||||||
|
if (responseCode1 != BillingClient.BillingResponse.OK || skuDetailsList == null) {
|
||||||
|
return@querySkuDetailsAsync
|
||||||
|
}
|
||||||
|
|
||||||
|
val skuDetails = skuDetailsList!!.get(0)
|
||||||
|
val sku = skuDetails.getSku()
|
||||||
|
val price = skuDetails.getPrice()
|
||||||
|
Log.d("SimpleMarkdown",
|
||||||
|
"Got product with sku: " + sku + " and price: " + price + " " + skuDetails.getPriceCurrencyCode())
|
||||||
|
val flowParams = BillingFlowParams.newBuilder()
|
||||||
|
.setSkuDetails(skuDetails)
|
||||||
|
.build()
|
||||||
|
val responseCode2 = billingClient.launchBillingFlow(this, flowParams)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBillingServiceDisconnected() {
|
||||||
|
// TODO: Set a flag and just try again later
|
||||||
|
billingClient.startConnection(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPurchasesUpdated(responseCode: Int, purchases: List<Purchase>?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,9 +6,10 @@ package com.wbrawner.simplemarkdown.view.adapter;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.support.v4.app.FragmentPagerAdapter;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentPagerAdapter;
|
||||||
|
|
||||||
import com.wbrawner.simplemarkdown.R;
|
import com.wbrawner.simplemarkdown.R;
|
||||||
import com.wbrawner.simplemarkdown.view.fragment.EditFragment;
|
import com.wbrawner.simplemarkdown.view.fragment.EditFragment;
|
||||||
|
|
|
@ -4,9 +4,6 @@ import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -16,6 +13,10 @@ import android.widget.EditText;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.jakewharton.rxbinding2.widget.RxTextView;
|
import com.jakewharton.rxbinding2.widget.RxTextView;
|
||||||
import com.wbrawner.simplemarkdown.MarkdownApplication;
|
import com.wbrawner.simplemarkdown.MarkdownApplication;
|
||||||
import com.wbrawner.simplemarkdown.R;
|
import com.wbrawner.simplemarkdown.R;
|
||||||
|
|
|
@ -4,14 +4,15 @@ import android.app.Activity;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.wbrawner.simplemarkdown.BuildConfig;
|
import com.wbrawner.simplemarkdown.BuildConfig;
|
||||||
import com.wbrawner.simplemarkdown.MarkdownApplication;
|
import com.wbrawner.simplemarkdown.MarkdownApplication;
|
||||||
import com.wbrawner.simplemarkdown.R;
|
import com.wbrawner.simplemarkdown.R;
|
||||||
|
|
|
@ -7,12 +7,13 @@ import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.wbrawner.simplemarkdown.R;
|
import com.wbrawner.simplemarkdown.R;
|
||||||
import com.wbrawner.simplemarkdown.utility.Constants;
|
import com.wbrawner.simplemarkdown.utility.Constants;
|
||||||
import com.wbrawner.simplemarkdown.utility.Utils;
|
import com.wbrawner.simplemarkdown.utility.Utils;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="com.wbrawner.simplemarkdown.view.activity.ExplorerActivity">
|
tools:context="com.wbrawner.simplemarkdown.view.activity.ExplorerActivity">
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/toolbarContainer"
|
android:id="@+id/toolbarContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -15,14 +15,14 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/file_list_container"
|
android:id="@+id/file_list_container"
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/toolbarContainer" />
|
app:layout_constraintTop_toBottomOf="@id/toolbarContainer" />
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
android:id="@+id/fab"
|
android:id="@+id/fab"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -72,4 +72,4 @@
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
|
@ -4,22 +4,22 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<android.support.design.widget.TabLayout
|
<com.google.android.material.tabs.TabLayout
|
||||||
android:id="@+id/layout_tab"
|
android:id="@+id/layout_tab"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="top">
|
android:layout_gravity="top">
|
||||||
|
|
||||||
<android.support.design.widget.TabItem
|
<com.google.android.material.tabs.TabItem
|
||||||
android:id="@+id/tab_edit"
|
android:id="@+id/tab_edit"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/action_edit" />
|
android:text="@string/action_edit" />
|
||||||
|
|
||||||
<android.support.design.widget.TabItem
|
<com.google.android.material.tabs.TabItem
|
||||||
android:id="@+id/tab_preview"
|
android:id="@+id/tab_preview"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/action_preview" />
|
android:text="@string/action_preview" />
|
||||||
</android.support.design.widget.TabLayout>
|
</com.google.android.material.tabs.TabLayout>
|
||||||
</com.wbrawner.simplemarkdown.view.DisableableViewPager>
|
</com.wbrawner.simplemarkdown.view.DisableableViewPager>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -17,4 +17,4 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
|
ext.kotlin_version = '1.3.31'
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
google()
|
google()
|
||||||
|
@ -9,9 +10,10 @@ buildscript {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.4.0'
|
classpath 'com.android.tools.build:gradle:3.4.1'
|
||||||
classpath 'com.google.gms:google-services:4.2.0'
|
classpath 'com.google.gms:google-services:4.2.0'
|
||||||
classpath 'io.fabric.tools:gradle:1.26.1'
|
classpath 'io.fabric.tools:gradle:1.26.1'
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +24,7 @@ allprojects {
|
||||||
url "https://s3.amazonaws.com/repo.commonsware.com"
|
url "https://s3.amazonaws.com/repo.commonsware.com"
|
||||||
}
|
}
|
||||||
maven { url 'https://maven.google.com' }
|
maven { url 'https://maven.google.com' }
|
||||||
|
google()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
android.enableJetifier=true
|
||||||
|
android.useAndroidX=true
|
||||||
org.gradle.jvmargs=-Xmx1536m
|
org.gradle.jvmargs=-Xmx1536m
|
||||||
|
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
|
Loading…
Reference in a new issue