update dependencies, added fasthub debug firebase project.

- fixed image getter size
This commit is contained in:
k0shk0sh 2019-12-27 20:22:42 +01:00
parent a6b06c3e14
commit 463e19c4bf
12 changed files with 67 additions and 94 deletions

View File

@ -8,10 +8,10 @@ apply plugin: 'io.fabric'
buildProperties {
notThere {
file rootProject.file('debug_gradle.properties')
using rootProject.file('debug_gradle.properties')
}
secrets {
file rootProject.file('release_gradle.properties')
using rootProject.file('release_gradle.properties')
}
}
@ -29,8 +29,8 @@ android {
applicationId "com.fastaccess.github"
minSdkVersion 21
targetSdkVersion 29
versionCode 469
versionName "4.6.9"
versionCode 470
versionName "4.7.0"
buildConfigString "GITHUB_CLIENT_ID", (buildProperties.secrets['github_client_id'] | buildProperties.notThere['github_client_id']).string
buildConfigString "GITHUB_SECRET", (buildProperties.secrets['github_secret'] | buildProperties.notThere['github_secret']).string
buildConfigString "IMGUR_CLIENT_ID", (buildProperties.secrets['imgur_client_id'] | buildProperties.notThere['imgur_client_id']).string
@ -38,7 +38,6 @@ android {
buildConfigField "String", "REST_URL", '"https://api.github.com/"'
buildConfigField "String", "IMGUR_URL", '"https://api.imgur.com/3/"'
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
@ -54,14 +53,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
if (!rootProject.file('gradle.properties').exists()) {
signingConfig signingConfigs.signing
}
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
ext.alwaysUpdateBuildId = false
}
}
sourceSets {
@ -99,14 +94,6 @@ android {
jumboMode true
javaMaxHeapSize "4g"
}
testOptions {
unitTests.returnDefaultValues = true
}
}
kapt {
generateStubs = true
}
repositories {
@ -139,7 +126,7 @@ dependencies {
implementation 'it.sephiroth.android.library.bottomnavigation:bottom-navigation:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.2.15'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2'
implementation 'com.annimon:stream:1.1.9'
implementation 'com.github.GrenderG:Toasty:1.1.3'
implementation 'com.github.k0shk0sh:RetainedDateTimePickers:1.0.2'
@ -156,7 +143,8 @@ dependencies {
implementation "com.atlassian.commonmark:commonmark-ext-gfm-tables:${commonmark}"
implementation "com.atlassian.commonmark:commonmark-ext-ins:${commonmark}"
implementation "com.atlassian.commonmark:commonmark-ext-yaml-front-matter:${commonmark}"
implementation "com.google.firebase:firebase-core:17.2.1"
implementation "com.google.firebase:firebase-analytics:17.2.1"
implementation "com.google.firebase:firebase-inappmessaging:19.0.2"
implementation "com.google.firebase:firebase-messaging:20.1.0"
implementation "com.google.firebase:firebase-database:19.2.0"
implementation "com.google.android.gms:play-services-base:17.1.0"
@ -170,10 +158,11 @@ dependencies {
implementation "petrov.kristiyan:colorpicker-library:1.1.4"
implementation 'com.apollographql.apollo:apollo-rx2-support:1.2.2'
implementation("com.apollographql.apollo:apollo-runtime:1.2.2")
implementation 'com.jaredrummler:android-device-names:1.1.5'
implementation 'com.jaredrummler:android-device-names:1.1.9'
implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
implementation 'com.airbnb.android:lottie:3.0.7'
implementation 'com.airbnb.android:lottie:3.3.1'
implementation 'com.firebase:firebase-jobdispatcher:0.8.2'
implementation 'com.google.guava:guava:27.0.1-android' /*to be removed*/
debugImplementation 'com.github.whataa:pandora:2.0.6'
releaseImplementation 'com.github.whataa:pandora-no-op:2.0.3'
@ -185,7 +174,6 @@ dependencies {
kapt 'com.github.matthiasrobbers:shortbread-compiler:1.0.1'
kapt "io.requery:requery-processor:${requery}"
kapt "com.github.bumptech.glide:compiler:$glideVersion"
}
apply plugin: 'com.google.gms.google-services'

View File

@ -1,61 +1,53 @@
{
"project_info": {
"project_id": "this-is-a-sample",
"project_number": "999999999999",
"name": "FastHub Sample",
"firebase_url": "https://this-is-a-sample-do-not-use.firebaseio.com",
"storage_bucket": "this-is-a-sample-do-not-use.storage.firebase.com"
"project_number": "535903042804",
"firebase_url": "https://fasthub-dev-a1309.firebaseio.com",
"project_id": "fasthub-dev-a1309",
"storage_bucket": "fasthub-dev-a1309.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:999999999999:android:0000000000000000",
"mobilesdk_app_id": "1:535903042804:android:516309017e0298c938b2a1",
"android_client_info": {
"package_name": "com.fastaccess.github.debug"
}
},
"oauth_client": [
{
"client_id": "this-is-a-sample-do-not-use.apps.googleusercontent.com",
"client_id": "535903042804-ubkic52fte5tpoe62q6k1m4h0pbcjp9c.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.fastaccess.github.debug",
"certificate_hash": "0000000000000000000000000000000000000000"
"certificate_hash": "42b1ddc5872bd156a90e2aebc94ee149a30f0ef3"
}
},
{
"client_id": "this-is-a-sample-do-not-use.apps.googleusercontent.com",
"client_id": "535903042804-asaj9vcag2pbb0c170p5ll53ovpab02q.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.fastaccess.github.debug",
"certificate_hash": "0000000000000000000000000000000000000000"
"certificate_hash": "c12fc4581dd11d64717548d8480ba537fc835893"
}
},
{
"client_id": "this-is-a-sample-do-not-use.apps.googleusercontent.com",
"client_id": "535903042804-14481m7poceb7ojv5roddqm28pg4ch5n.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "000000000000000000000000000000000000000"
"current_key": "AIzaSyBbRQtQN1UxFRgeSSfjZwQ5TRulc2lZUzI"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "this-is-a-sample-do-not-use.apps.googleusercontent.com",
"client_id": "535903042804-14481m7poceb7ojv5roddqm28pg4ch5n.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
}

View File

@ -120,7 +120,6 @@ public class RestProvider {
public static int getErrorCode(Throwable throwable) {
if (throwable instanceof HttpException) {
return ((HttpException) throwable).code();
}
return -1;
}

View File

@ -41,7 +41,6 @@ import static android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
builder.append("\n");
DrawableGetter imageGetter = new DrawableGetter(textView, width);
builder.setSpan(new ImageSpan(imageGetter.getDrawable(src)), start, builder.length(), SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setSpan(new CenterSpan(), start, builder.length(), SPAN_EXCLUSIVE_EXCLUSIVE);
builder.append("\n");
} else {
builder.append(SpannableBuilder.builder().clickable("Image", v -> SchemeParser.launchUri(v.getContext(), src)));

View File

@ -71,7 +71,7 @@ import static android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
this.appendNewLine(builder);
this.appendNewLine(builder);
} else {
StringBuffer text = node.getText();
CharSequence text = node.getText();
builder.append(" ");
builder.append(replace(text.toString()));
builder.append(" ");

View File

@ -40,8 +40,8 @@ public class DrawableGetter implements Html.ImageGetter, Drawable.Callback {
final RequestBuilder load = Glide.with(context)
.load(url)
.placeholder(ContextCompat.getDrawable(context, R.drawable.ic_image))
.dontAnimate()
.override(width, width / 2);
.dontAnimate();
final GlideDrawableTarget target = new GlideDrawableTarget(urlDrawable, container, width);
load.into(target);
cachedTargets.add(target);

View File

@ -37,9 +37,8 @@ class GlideDrawableTarget extends SimpleTarget<Drawable> {
width = (float) (resource.getIntrinsicWidth() / downScale / 1.3);
height = (float) (resource.getIntrinsicHeight() / downScale / 1.3);
} else {
float multiplier = (float) this.width / resource.getIntrinsicWidth();
width = (float) resource.getIntrinsicWidth() * multiplier;
height = (float) resource.getIntrinsicHeight() * multiplier;
width = (float) resource.getIntrinsicWidth();
height = (float) resource.getIntrinsicHeight();
}
Rect rect = new Rect(0, 0, Math.round(width), Math.round(height));
resource.setBounds(rect);

View File

@ -1,11 +1,14 @@
package com.fastaccess.provider.timeline.handler.drawable;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.crashlytics.android.Crashlytics;
class UrlDrawable extends BitmapDrawable implements Drawable.Callback {
private Drawable drawable;
@ -14,7 +17,12 @@ class UrlDrawable extends BitmapDrawable implements Drawable.Callback {
@Override public void draw(Canvas canvas) {
if (drawable != null) {
drawable.draw(canvas);
try {
drawable.draw(canvas);
} catch (Exception e) {
Crashlytics.logException(e);
e.printStackTrace();
}
if (drawable instanceof GifDrawable) {
if (!((GifDrawable) drawable).isRunning()) {
((GifDrawable) drawable).start();

View File

@ -15,8 +15,6 @@ import com.fastaccess.helper.InputHelper;
import com.fastaccess.provider.scheme.SchemeParser;
import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity;
import org.apache.tools.ant.ExitException;
/**
* Created by Kosh on 09 Dec 2016, 12:31 PM
*/
@ -51,7 +49,7 @@ public class LinksParserActivity extends Activity {
Uri uri = Uri.parse(sharedText);
onUriReceived(uri);
}
} catch (ExitException ignored) {}
} catch (Exception ignored) {}
} else if (intent.getAction().equals(Intent.ACTION_VIEW)) {
if (intent.getData() != null) {
onUriReceived(intent.getData());

View File

@ -43,26 +43,21 @@ class WikiPresenter : BasePresenter<WikiMvp.View>(), WikiMvp.Presenter {
}
override fun onSidebarClicked(sidebar: WikiSideBarModel) {
if (BuildConfig.DEBUG) {
firebaseWikiConfigModel = FirebaseWikiConfigModel()
callApi(sidebar)
if (firebaseWikiConfigModel == null) {
manageDisposable(
RxHelper.getSingle(RxFirebaseDatabase.data(FirebaseDatabase.getInstance().reference.child("github_wiki")))
.doOnSubscribe { sendToView { it.showProgress(0) } }
.map {
firebaseWikiConfigModel = FirebaseWikiConfigModel.map(it.value as? HashMap<String, String>)
return@map firebaseWikiConfigModel
}
.subscribe(
{ callApi(sidebar) },
{ callApi(sidebar) }
)
)
} else {
if (firebaseWikiConfigModel == null) {
manageDisposable(
RxHelper.getSingle(RxFirebaseDatabase.data(FirebaseDatabase.getInstance().reference.child("github_wiki")))
.doOnSubscribe { sendToView { it.showProgress(0) } }
.map {
firebaseWikiConfigModel = FirebaseWikiConfigModel.map(it.value as? HashMap<String, String>)
return@map firebaseWikiConfigModel
}
.subscribe(
{ callApi(sidebar) },
{ callApi(sidebar) }
)
)
} else {
callApi(sidebar)
}
callApi(sidebar)
}
}

View File

@ -42,25 +42,21 @@ class TrendingFragmentPresenter : BasePresenter<TrendingFragmentMvp.View>(), Tre
disposel?.let { if (!it.isDisposed) it.dispose() }
val config = firebaseTrendingConfigModel
if (com.fastaccess.BuildConfig.DEBUG) {
callApi(lang, since)
} else {
if (config == null) {
manageDisposable(RxHelper.getSingle(RxFirebaseDatabase.data(FirebaseDatabase.getInstance().reference.child("github_trending")))
.doOnSubscribe { sendToView { it.showProgress(0) } }
.map {
firebaseTrendingConfigModel = FirebaseTrendingConfigModel
.map(it.value as? HashMap<String, String>)
return@map firebaseTrendingConfigModel
}
.subscribe(
{ callApi(lang, since) },
{ callApi(lang, since) }
)
if (config == null) {
manageDisposable(RxHelper.getSingle(RxFirebaseDatabase.data(FirebaseDatabase.getInstance().reference.child("github_trending")))
.doOnSubscribe { sendToView { it.showProgress(0) } }
.map {
firebaseTrendingConfigModel = FirebaseTrendingConfigModel
.map(it.value as? HashMap<String, String>)
return@map firebaseTrendingConfigModel
}
.subscribe(
{ callApi(lang, since) },
{ callApi(lang, since) }
)
} else {
callApi(lang, since)
}
)
} else {
callApi(lang, since)
}
}

View File

@ -3,11 +3,10 @@ buildscript {
ext {
butterKnifeVersion = '10.2.1'
state_version = '1.4.1'
lombokVersion = '1.16.20'
lombokVersion = '1.18.10'
supportVersion = "27.1.0"
gms = "12.0.0"
thirtyinchVersion = '0.9.6'
retrofit = '2.3.0'
retrofit = '2.7.0'
junitVersion = '4.12'
mockitoVersion = '1.10.19'
assertjVersion = '2.5.0'