Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed May 20, 2018
2 parents fe80adf + a25eacf commit 00e5912
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ![ShowsRage](app/src/main/res/mipmap-mdpi/ic_launcher.png) ShowsRage

[![Build Status](https://travis-ci.org/MGaetan89/ShowsRage.svg?branch=master)](https://travis-ci.org/MGaetan89/ShowsRage) [![Coverage Status](https://coveralls.io/repos/MGaetan89/ShowsRage/badge.svg?branch=master&service=github)](https://coveralls.io/github/MGaetan89/ShowsRage?branch=master) [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/MGaetan89/ShowsRage/master/LICENSE) [![Minimum API](https://img.shields.io/badge/API-15%2B-green.svg)](https://android-arsenal.com/api?level=15) [![Support on Paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/MGaetan89)
[![Build Status](https://travis-ci.org/MGaetan89/ShowsRage.svg?branch=master)](https://travis-ci.org/MGaetan89/ShowsRage) [![Coverage Status](https://coveralls.io/repos/MGaetan89/ShowsRage/badge.svg?branch=master&service=github)](https://coveralls.io/github/MGaetan89/ShowsRage?branch=master) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/showsrage/localized.svg)](https://crowdin.com/project/showsrage) [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/MGaetan89/ShowsRage/master/LICENSE) [![Minimum API](https://img.shields.io/badge/API-15%2B-green.svg)](https://android-arsenal.com/api?level=15) [![Support on Paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/MGaetan89)

**ShowsRage** is an Android application that allows you to manage your *[SickRage](https://www.sickrage.tv/)* installation.

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {
applicationId 'com.mgaetan89.showsrage'
minSdkVersion 15
targetSdkVersion 27
versionCode 34
versionName '1.6'
versionCode 35
versionName '1.6.1'
resConfigs 'en', 'fr'
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class ScheduleAdapter(schedules: RealmResults<Schedule>) : RealmRecyclerViewAdap
private fun showPlot() {
val context = this.itemView.context
val schedule = getItem(this.adapterPosition).takeIf { it != null && it.isValid } ?: return
val plot = schedule.episodePlot
val plot = schedule.episodePlot.orEmpty()

if (!plot.isEmpty()) {
var message = context.getString(R.string.season_episode_name, schedule.season, schedule.episode, schedule.episodeName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LogsFilterFragment : DialogFragment(), DialogInterface.OnClickListener, Di
val data = Intent()
data.putExtra(Constants.Bundle.LOGS_GROUPS, selectedItems)

this.targetFragment?.onActivityResult(this.targetRequestCode, Activity.RESULT_OK, data)
this.parentFragment?.onActivityResult(LogsFragment.REQUEST_CODE_FILTER, Activity.RESULT_OK, data)

dialog?.dismiss()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,8 @@ class LogsFragment : Fragment(), Callback<Logs>, RealmChangeListener<RealmResult
}

private fun handleLogsGroupFilter() {
val fragment = LogsFilterFragment.newInstance(this.groups)
fragment.setTargetFragment(this, REQUEST_CODE_FILTER)
fragment.show(this.childFragmentManager, "logs_filter")
LogsFilterFragment.newInstance(this.groups)
.show(this.childFragmentManager, "logs_filter")
}

private fun handleLogsLevelSelection(item: MenuItem?): Boolean {
Expand Down Expand Up @@ -256,8 +255,9 @@ class LogsFragment : Fragment(), Callback<Logs>, RealmChangeListener<RealmResult
}

companion object {
const val REQUEST_CODE_FILTER = 1

private const val AUTO_UPDATE_JOB_TAG = "logs-auto-update-tag"
private const val REQUEST_CODE_FILTER = 1
private const val TOLERANCE_RATIO = 0.1

internal fun getLogLevelForMenuId(menuId: Int?) = when (menuId) {
Expand Down
33 changes: 26 additions & 7 deletions app/src/main/kotlin/com/mgaetan89/showsrage/helper/Migration.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package com.mgaetan89.showsrage.helper

import com.mgaetan89.showsrage.model.Episode
import com.mgaetan89.showsrage.model.History
import com.mgaetan89.showsrage.model.LogEntry
import com.mgaetan89.showsrage.model.RealmString
import com.mgaetan89.showsrage.model.RootDir
import com.mgaetan89.showsrage.model.Schedule
import com.mgaetan89.showsrage.model.Show
import io.realm.DynamicRealm
import io.realm.RealmMigration
import io.realm.RealmSchema
Expand Down Expand Up @@ -54,6 +59,12 @@ class Migration : RealmMigration {

localOldVersion++
}

if (localOldVersion == 7L) {
this.updateToV8(schema)

localOldVersion++
}
}

override fun equals(other: Any?) = other is Migration
Expand Down Expand Up @@ -91,24 +102,27 @@ class Migration : RealmMigration {
}

private fun updateToV7(schema: RealmSchema) {
schema.get("Episode")
schema.get(Episode::class.java.simpleName)
?.setRequired("airDate", true)
?.setRequired("id", true)
?.setRequired("name", true)
?.setRequired("quality", true)
?.setRequired("subtitles", true)

schema.get("History")?.setRequired("id", true)
schema.get(History::class.java.simpleName)
?.setRequired("id", true)

schema.get("LogEntry")
schema.get(LogEntry::class.java.simpleName)
?.setRequired("dateTime", true)
?.setRequired("message", true)

schema.get("RealmString")?.setRequired("value", true)
schema.get(RealmString::class.java.simpleName)
?.setRequired("value", true)

schema.get("RootDir")?.setRequired("location", true)
schema.get(RootDir::class.java.simpleName)
?.setRequired("location", true)

schema.get("Schedule")
schema.get(Schedule::class.java.simpleName)
?.setRequired("airDate", true)
?.setRequired("airs", true)
?.setRequired("episodeName", true)
Expand All @@ -120,10 +134,15 @@ class Migration : RealmMigration {
?.setRequired("showName", true)
?.setRequired("showStatus", true)

schema.get("Show")
schema.get(Show::class.java.simpleName)
?.setRequired("network", true)
?.setRequired("nextEpisodeAirDate", true)
?.setRequired("quality", true)
?.setRequired("tvRageName", true)
}

private fun updateToV8(schema: RealmSchema) {
schema.get(Schedule::class.java.simpleName)
?.setRequired("episodePlot", false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import io.realm.Realm
import io.realm.RealmConfiguration

object Utils {
private const val DATABASE_VERSION = 7L
private const val DATABASE_VERSION = 8L

fun createRealmConfiguration(assetFile: String?): RealmConfiguration {
return RealmConfiguration.Builder().let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ open class Schedule : RealmObject() {
@SerializedName("ep_name")
open var episodeName: String = ""
@SerializedName("ep_plot")
open var episodePlot: String = ""
open var episodePlot: String? = ""
@PrimaryKey
open var id: String = ""
@SerializedName("indexerid")
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<resources xmlns:tools="http://schemas.android.com/tools" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2" tools:locale="en">
<string name="about">About</string>
<string name="actions">Actions</string>
<string name="active">Active</string>
Expand Down

0 comments on commit 00e5912

Please sign in to comment.