Fix 51 (#52)
* Some more bug fixes. * Cleaning travis file. * Fixes #51
This commit is contained in:
parent
4924ddd172
commit
69a2418afc
@ -28,15 +28,6 @@ android:
|
|||||||
- 'android-sdk-license-.+'
|
- 'android-sdk-license-.+'
|
||||||
- 'google-gdk-license-.+'
|
- 'google-gdk-license-.+'
|
||||||
|
|
||||||
#install:
|
|
||||||
# - echo y | android update sdk --no-ui --filter "android-26,build-tools-26.0.0"
|
|
||||||
# - echo y | android update sdk --no-ui --all --filter "platform-tools, tools"
|
|
||||||
# - echo y | android update sdk --no-ui --all --filter "android-26, build-tools-26.0.0"
|
|
||||||
# - echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"
|
|
||||||
# - echo y | android update sdk --no-ui --all --filter "extra-android-support"
|
|
||||||
# - echo y | android update sdk --no-ui --all --filter "extra-google-m2repository"
|
|
||||||
# - echo y | android update sdk --no-ui --all --filter "extra-google-google_play_services"
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- mkdir app/src/main/res/mipmap-hdpi
|
- mkdir app/src/main/res/mipmap-hdpi
|
||||||
- convert -size 72x72 xc:white app/src/main/res/mipmap-hdpi/ic_launcher.png
|
- convert -size 72x72 xc:white app/src/main/res/mipmap-hdpi/ic_launcher.png
|
||||||
|
@ -16,7 +16,7 @@ import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
|||||||
import apps.amine.bou.readerforselfoss.api.selfoss.Spout
|
import apps.amine.bou.readerforselfoss.api.selfoss.Spout
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
||||||
import apps.amine.bou.readerforselfoss.utils.Config
|
import apps.amine.bou.readerforselfoss.utils.Config
|
||||||
import apps.amine.bou.readerforselfoss.utils.isUrlValid
|
import apps.amine.bou.readerforselfoss.utils.isBaseUrlValid
|
||||||
import com.ftinc.scoop.Scoop
|
import com.ftinc.scoop.Scoop
|
||||||
|
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ class AddSourceActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
val config = Config(this)
|
val config = Config(this)
|
||||||
|
|
||||||
if (config.baseUrl.isEmpty() || !config.baseUrl.isUrlValid()) {
|
if (config.baseUrl.isEmpty() || !config.baseUrl.isBaseUrlValid()) {
|
||||||
mustLoginToAddSource()
|
mustLoginToAddSource()
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -185,9 +185,10 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
} else {
|
} else {
|
||||||
(recyclerView.adapter as ItemListAdapter).removeItemAtIndex(position)
|
(recyclerView.adapter as ItemListAdapter).removeItemAtIndex(position)
|
||||||
}
|
}
|
||||||
|
if (items.size > 0)
|
||||||
tabNewBadge.setText("${items.size}").maybeShow()
|
tabNewBadge.setText("${items.size}").maybeShow()
|
||||||
|
else
|
||||||
mayBeEmpty()
|
tabNewBadge.hide()
|
||||||
|
|
||||||
} catch (e: IndexOutOfBoundsException) {}
|
} catch (e: IndexOutOfBoundsException) {}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
|||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
||||||
import apps.amine.bou.readerforselfoss.utils.Config
|
import apps.amine.bou.readerforselfoss.utils.Config
|
||||||
import apps.amine.bou.readerforselfoss.utils.checkAndDisplayStoreApk
|
import apps.amine.bou.readerforselfoss.utils.checkAndDisplayStoreApk
|
||||||
import apps.amine.bou.readerforselfoss.utils.isUrlValid
|
import apps.amine.bou.readerforselfoss.utils.isBaseUrlValid
|
||||||
import com.ftinc.scoop.Scoop
|
import com.ftinc.scoop.Scoop
|
||||||
|
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
var cancel = false
|
var cancel = false
|
||||||
var focusView: View? = null
|
var focusView: View? = null
|
||||||
|
|
||||||
if (!url.isUrlValid()) {
|
if (!url.isBaseUrlValid()) {
|
||||||
mUrlView.error = getString(R.string.login_url_problem)
|
mUrlView.error = getString(R.string.login_url_problem)
|
||||||
focusView = mUrlView
|
focusView = mUrlView
|
||||||
cancel = true
|
cancel = true
|
||||||
|
@ -23,17 +23,31 @@ class MyApp : MultiDexApplication() {
|
|||||||
if (!BuildConfig.DEBUG)
|
if (!BuildConfig.DEBUG)
|
||||||
Fabric.with(this, Crashlytics())
|
Fabric.with(this, Crashlytics())
|
||||||
|
|
||||||
|
initAmplify()
|
||||||
|
|
||||||
|
initCache()
|
||||||
|
|
||||||
|
initDrawerImageLoader()
|
||||||
|
|
||||||
|
initTheme()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initAmplify() {
|
||||||
Amplify.initSharedInstance(this)
|
Amplify.initSharedInstance(this)
|
||||||
.setFeedbackEmailAddress(getString(R.string.feedback_email))
|
.setFeedbackEmailAddress(getString(R.string.feedback_email))
|
||||||
.setAlwaysShow(BuildConfig.DEBUG)
|
|
||||||
.applyAllDefaultRules()
|
.applyAllDefaultRules()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initCache() {
|
||||||
try {
|
try {
|
||||||
Reservoir.init(this, 8192) //in bytes
|
Reservoir.init(this, 8192) //in bytes
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
//failure
|
//failure
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initDrawerImageLoader() {
|
||||||
DrawerImageLoader.init(object : AbstractDrawerImageLoader() {
|
DrawerImageLoader.init(object : AbstractDrawerImageLoader() {
|
||||||
override fun set(imageView: ImageView?, uri: Uri?, placeholder: Drawable?, tag: String?) {
|
override fun set(imageView: ImageView?, uri: Uri?, placeholder: Drawable?, tag: String?) {
|
||||||
Glide.with(imageView?.context).load(uri).placeholder(placeholder).into(imageView)
|
Glide.with(imageView?.context).load(uri).placeholder(placeholder).into(imageView)
|
||||||
@ -47,6 +61,9 @@ class MyApp : MultiDexApplication() {
|
|||||||
return baseContext.resources.getDrawable(R.mipmap.ic_launcher)
|
return baseContext.resources.getDrawable(R.mipmap.ic_launcher)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initTheme() {
|
||||||
Scoop.waffleCone()
|
Scoop.waffleCone()
|
||||||
.addFlavor(getString(R.string.default_theme), R.style.NoBar, true)
|
.addFlavor(getString(R.string.default_theme), R.style.NoBar, true)
|
||||||
.addFlavor(getString(R.string.default_dark_theme), R.style.NoBarDark)
|
.addFlavor(getString(R.string.default_dark_theme), R.style.NoBarDark)
|
||||||
@ -64,6 +81,5 @@ class MyApp : MultiDexApplication() {
|
|||||||
.addFlavor(getString(R.string.red_teal_dark_theme), R.style.NoBarRedTealDark)
|
.addFlavor(getString(R.string.red_teal_dark_theme), R.style.NoBarRedTealDark)
|
||||||
.setSharedPreferences(PreferenceManager.getDefaultSharedPreferences(this))
|
.setSharedPreferences(PreferenceManager.getDefaultSharedPreferences(this))
|
||||||
.initialize()
|
.initialize()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -100,12 +100,13 @@ class ReaderActivity : DragDismissActivity() {
|
|||||||
override fun onFailure(call: Call<ParsedContent>, t: Throwable) = openInBrowserAfterFailing()
|
override fun onFailure(call: Call<ParsedContent>, t: Throwable) = openInBrowserAfterFailing()
|
||||||
|
|
||||||
private fun openInBrowserAfterFailing() {
|
private fun openInBrowserAfterFailing() {
|
||||||
CustomTabActivityHelper.openCustomTab(this@ReaderActivity, customTabsIntent, Uri.parse(url)
|
this@ReaderActivity.openItemUrl(
|
||||||
) { _, uri ->
|
url,
|
||||||
val intent = Intent(Intent.ACTION_VIEW, uri)
|
customTabsIntent,
|
||||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
true,
|
||||||
startActivity(intent)
|
false,
|
||||||
}
|
this@ReaderActivity
|
||||||
|
)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -206,7 +206,9 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||||||
public void onHeaderClick(Header header, int position) {
|
public void onHeaderClick(Header header, int position) {
|
||||||
super.onHeaderClick(header, position);
|
super.onHeaderClick(header, position);
|
||||||
if (header.id == R.id.theme_change) {
|
if (header.id == R.id.theme_change) {
|
||||||
getApplicationContext().startActivity(ScoopSettingsActivity.createIntent(getApplicationContext()));
|
Intent intent = ScoopSettingsActivity.createIntent(getApplicationContext());
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
getApplicationContext().startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,10 @@ fun Context.checkAndDisplayStoreApk() = {
|
|||||||
} else Unit
|
} else Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
fun String.isUrlValid(): Boolean {
|
fun String.isUrlValid(): Boolean =
|
||||||
|
HttpUrl.parse(this) != null && Patterns.WEB_URL.matcher(this).matches()
|
||||||
|
|
||||||
|
fun String.isBaseUrlValid(): Boolean {
|
||||||
val baseUrl = HttpUrl.parse(this)
|
val baseUrl = HttpUrl.parse(this)
|
||||||
var existsAndEndsWithSlash = false
|
var existsAndEndsWithSlash = false
|
||||||
if (baseUrl != null) {
|
if (baseUrl != null) {
|
||||||
|
@ -55,7 +55,7 @@ fun Context.openItemUrl(linkDecoded: String,
|
|||||||
internalBrowser: Boolean,
|
internalBrowser: Boolean,
|
||||||
articleViewer: Boolean,
|
articleViewer: Boolean,
|
||||||
app: Activity) {
|
app: Activity) {
|
||||||
if (!internalBrowser) {
|
if (!internalBrowser || !linkDecoded.isUrlValid()) {
|
||||||
openInBrowser(linkDecoded, app)
|
openInBrowser(linkDecoded, app)
|
||||||
} else {
|
} else {
|
||||||
if (articleViewer) {
|
if (articleViewer) {
|
||||||
|
Loading…
Reference in New Issue
Block a user