Skip to content

Commit

Permalink
Suppress warning on parameter changed on override
Browse files Browse the repository at this point in the history
  • Loading branch information
dodyg committed Feb 8, 2014
1 parent 0109c15 commit 2877b4b
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 57 deletions.
6 changes: 5 additions & 1 deletion .idea/androidDexCompiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package com.silverkeytech.news_engine.outlines

import java.util.ArrayList
import android.util.Log

public class OpmlBuilder{
class object {
Expand All @@ -41,17 +42,25 @@ public class OpmlBuilder{
}

public class BodyBuilder (val opml : Opml){
class object {
public val TAG: String = javaClass<BodyBuilder>().getSimpleName()
}

var currentLevel = 0
var currentOutline = Outline()
var parentOutline : Outline? = null
var parents : ArrayList<Outline> = ArrayList<Outline>()
var counterLevelUp = 0
var counterLevelDown = 0
var rootOutlines : ArrayList<Outline>? = null
{
opml.body = Body()
rootOutlines = opml.body!!.outline
}

public fun startLevel(level : Int){
counterLevelUp++
Log.d(TAG, "Counter Level Up $counterLevelUp")
if (level == 0){
currentLevel = 0
currentOutline = Outline()
Expand Down Expand Up @@ -80,14 +89,20 @@ public class OpmlBuilder{
}

public fun endLevel(level : Int){
counterLevelDown++
if (level < currentLevel && level > 0){
parentOutline = parents.get(level - 1)
currentLevel = level
}
else if (level == 0){
currentLevel = 0
}
else {
val isEqual = level == currentLevel
Log.d(TAG, "Level $level is equal to $currentLevel $isEqual")
}

Log.d(TAG, "Counter Level Down $counterLevelDown")
}

public fun setText(text : String) { currentOutline.text = text }
Expand Down
Expand Up @@ -25,10 +25,10 @@ import com.thebuzzmedia.sjxp.rule.DefaultRule
import com.silverkeytech.news_engine.xml.attributeRule
import com.silverkeytech.news_engine.xml.tagRule

public class OpmlParser{
public class OpmlParser {
public fun parse(input: InputStream, rss: OpmlBuilder) {
var items = arrayListOf<DefaultRule<OpmlBuilder>>(headTitle, headDateCreated, headDateModified, headOwnerName, headOwnerEmail)
for (i in 0..15){
for (i in 0..15) {
items.add(outlineTag(i))
items.add(outlineAttributes(i))
}
Expand All @@ -39,7 +39,7 @@ public class OpmlParser{

val headTitle = textRule<OpmlBuilder>("/opml/head/title", {(text, opml) ->
opml.head.setTitle(text)
})
})

val headDateCreated = textRule<OpmlBuilder>("/opml/head/dateCreated", {(text, opml) ->
opml.head.setDateCreated(text)
Expand All @@ -57,9 +57,9 @@ val headOwnerEmail = textRule<OpmlBuilder>("/opml/head/ownerEmail", {(text, opml
opml.head.setOwnerEmail(text)
})

fun outlineTag(level : Int) : DefaultRule<OpmlBuilder>{
fun outlineTag(level: Int): DefaultRule<OpmlBuilder> {
if (level < 0)
throw IllegalArgumentException()
throw IllegalArgumentException()

var path = "/opml/body"
for (i in 0..level)
Expand All @@ -74,7 +74,7 @@ fun outlineTag(level : Int) : DefaultRule<OpmlBuilder>{
}

//(path: String, action: (attrName: String, attrValue: String, rss: T) -> Unit, vararg attrNames: String?): DefaultRule<T>
fun outlineAttributes(level : Int) : DefaultRule<OpmlBuilder>{
fun outlineAttributes(level: Int): DefaultRule<OpmlBuilder> {
if (level < 0)
throw IllegalArgumentException()

Expand All @@ -83,7 +83,7 @@ fun outlineAttributes(level : Int) : DefaultRule<OpmlBuilder>{
path += "/outline"

return attributeRule<OpmlBuilder>(path, { attrName, attrValue, opml ->
when(attrName){
when(attrName) {
"text" -> opml.body.setText(attrValue)
"url" -> opml.body.setUrl(attrValue)
"xmlUrl" -> opml.body.setXmlUrl(attrValue)
Expand All @@ -92,7 +92,8 @@ fun outlineAttributes(level : Int) : DefaultRule<OpmlBuilder>{
"name" -> opml.body.setName(attrValue)
"language" -> opml.body.setLanguage(attrValue)
"opmlUrl" -> opml.body.setOpmlUrl(attrValue)
else -> { } //empty
else -> {
} //empty
}
}, "text", "url", "xmlUrl", "htmlUrl", "type", "name", "language", "opmlUrl")
}
Expand Up @@ -29,6 +29,7 @@ public trait WithVisualModificationPanel{
open fun getActivity(): Activity
}

[suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")]
public class ResizeTextActionMode (private val parent: WithVisualModificationPanel, private var mode: ActionMode?): ActionMode.Callback{
val INCREASE_SIZE = 1
val DECREASE_SIZE = 2
Expand Down
4 changes: 2 additions & 2 deletions src/com/silverkeytech/android_rivers/Texts.kt
Expand Up @@ -40,8 +40,8 @@ fun scrubHtml(text: String?): String {
if (text.isNullOrEmpty())
return ""
else {
val text = text!!.trim().replaceAll("(<br>|<br/>)", "\n")
val spanned = android.text.Html.fromHtml(text) as SpannableStringBuilder
val txt = text!!.trim().replaceAll("(<br>|<br/>)", "\n")
val spanned = android.text.Html.fromHtml(txt) as SpannableStringBuilder
val spannedObjects = spanned.getSpans(0, spanned.length(), javaClass<Any>())!!

for(i in 0..(spannedObjects.size - 1)){
Expand Down
Expand Up @@ -30,6 +30,7 @@ import com.silverkeytech.android_rivers.Result
import com.silverkeytech.android_rivers.InfinityProgressDialog
import com.silverkeytech.android_rivers.R

[suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")]
public class DeleteAllPodcastsAsync(it: Context?): AsyncTask<String, Int, Result<Int>>(){
class object {
public val TAG: String = javaClass<DeleteAllPodcastsAsync>().getSimpleName()
Expand Down
Expand Up @@ -35,6 +35,7 @@ import com.silverkeytech.android_rivers.Result
import com.silverkeytech.android_rivers.R
import com.silverkeytech.android_rivers.httpGet

[suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")]
public class DownloadBookmarksAsync(it: Context, ignoreCache: Boolean): AsyncTask<String, Int, Result<Opml>>(){
class object {
public val TAG: String = javaClass<DownloadBookmarksAsync>().getSimpleName()
Expand Down
Expand Up @@ -40,6 +40,7 @@ import com.silverkeytech.android_rivers.PreferenceDefaults
import com.silverkeytech.android_rivers.makeLocalUrl
import com.silverkeytech.android_rivers.toHoursInMinutes

[suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")]
public class DownloadCollectionAsRiverAsync(it: Context?, private val collectionId: Int): AsyncTask<String, Int, Result<List<RiverItemMeta>>>(){
class object {
public val TAG: String = javaClass<DownloadCollectionAsRiverAsync>().getSimpleName()
Expand Down
Expand Up @@ -35,6 +35,7 @@ import com.silverkeytech.android_rivers.InfinityProgressDialog
import com.silverkeytech.android_rivers.daysBeforeNow
import com.silverkeytech.android_rivers.PreferenceDefaults

[suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")]
public class DownloadFeedAsync(it: Context?, ignoreCache: Boolean): AsyncTask<String, Int, Result<SyndicationFeed>>(){
class object {
public val TAG: String = javaClass<DownloadFeedAsync>().getSimpleName()
Expand Down
Expand Up @@ -43,6 +43,7 @@ import com.silverkeytech.android_rivers.findView

public data class DownloadedFile(val contentType: String, val filePath: String)

[suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")]
public class DownloadImageAsync(it: Context?): AsyncTask<String, Int, Result<DownloadedFile>>(){
class object {
public val TAG: String = javaClass<DownloadImageAsync>().getSimpleName()
Expand Down
Expand Up @@ -38,6 +38,7 @@ import com.silverkeytech.android_rivers.PreferenceDefaults
import com.silverkeytech.android_rivers.startOutlinerActivity
import com.silverkeytech.android_rivers.traverse

[suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")]
public class DownloadOpmlAsync(it: Context?): AsyncTask<String, Int, Pair<String, Result<Opml>>>(){
class object {
public val TAG: String = javaClass<DownloadOpmlAsync>().getSimpleName()
Expand Down
Expand Up @@ -32,6 +32,7 @@ import com.silverkeytech.android_rivers.InfinityProgressDialog
import com.silverkeytech.android_rivers.R
import com.silverkeytech.android_rivers.downloadSingleRiver

[suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")]
//Responsible for handling a river js downloading and display in asynchronous way
public class DownloadRiverContentAsync(it: Context?, val language: String): AsyncTask<String, Int, Result<River>>(){
class object {
Expand Down

0 comments on commit 2877b4b

Please sign in to comment.