Transfer SmartLengthInputFilter license to Tusky (#1384)

* Transfer SmartLengthInputFilter in-header license

Transfer license for file "SmartLengthInputFilter.java" from me (Diego Rossi) to Tusky and therefore also change it from the original Apache 2.0 to currently GPLv3. This was a mistake that has been sitting around for way too long.

* Rewrite SmartLengthInputFilter from Java to Kotlin

This has been done by hand, without the custom copy-paste tool.

* Fix bad references in Java files using SmartLengthInputFilter features

* Shorten code in Java classes referencing SmartLengthInputFilter instance

* Refactor SmartLengthInputFilter from class to singleton Kotlin object

* Move hasBadRatio to become a toplevel function

* Patch up all the files affected by SmartLengthInputFilter changes

* Length in SmartLengthInputFilter is const 500, simplify code accordingly

* More meaningful name for toplevel function for checking trimming ability

* Add missing license header
This commit is contained in:
HellPie 2019-07-19 20:47:30 +02:00 committed by Konrad Pozniak
commit 87285ae5bf
7 changed files with 118 additions and 167 deletions

View file

@ -22,7 +22,7 @@ import androidx.room.Entity
import androidx.room.TypeConverters
import com.keylesspalace.tusky.db.Converters
import com.keylesspalace.tusky.entity.*
import com.keylesspalace.tusky.util.SmartLengthInputFilter
import com.keylesspalace.tusky.util.shouldTrimStatus
import java.util.*
@Entity(primaryKeys = ["id","accountId"])
@ -176,7 +176,7 @@ fun Status.toEntity() =
spoilerText, attachments, mentions,
false,
false,
!SmartLengthInputFilter.hasBadRatio(content, SmartLengthInputFilter.LENGTH_DEFAULT),
!shouldTrimStatus(content),
true,
poll
)