Skip to content
Permalink
Browse files

Use dokka to generate some documentation

  • Loading branch information...
ids1024 committed Aug 8, 2018
1 parent e417be4 commit 8ff33cfe28f93b8fb175aa5ae3b87ec7563829e8
@@ -1,17 +1,19 @@
buildscript {
ext.kotlin_version = '1.2.60'
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha18'
classpath "com.android.tools.build:gradle:3.2.0-alpha18"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.17"
}
}
apply plugin: 'android'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'org.jetbrains.dokka-android'

android {
compileSdkVersion 27
@@ -6,6 +6,9 @@ import android.view.View
import android.view.ViewGroup
import android.view.LayoutInflater

/**
* Fragment for the about page.
*/
class AboutFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
@@ -19,6 +19,9 @@ import android.support.v7.preference.PreferenceManager

import kotlinx.android.synthetic.main.search.recycler_view

/**
* Fragment providing the search UI.
*/
class SearchFragment(english_to_latin: Boolean) : Fragment() {
private var search_term: String = ""
private var search_view: SearchView? = null
@@ -3,6 +3,9 @@ package com.ids1024.whitakerswords
import android.os.Bundle
import android.support.v7.preference.PreferenceFragmentCompat

/**
* Fragment for the settings page.
*/
class SettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.preferences, rootKey)
@@ -28,6 +28,9 @@ private fun emptyDirectory(f: File) {
}
}

/**
* Wraps the `words` binary. This handles extraction from the apk and execution.
*/
class WordsWrapper(context: Context) {
// The version number of the APK as specified in the manifest.
private val apkVersion: Int
@@ -107,6 +110,9 @@ class WordsWrapper(context: Context) {
}

// TODO(tcj): Execute this is another thread to prevent UI deadlocking
/**
* Executes `words`.
*/
@Throws(IOException::class)
fun executeWords(text: String, english_to_latin: Boolean): String {
val wordspath = getFile(WORDS_EXECUTABLE).path
@@ -151,6 +157,9 @@ class WordsWrapper(context: Context) {
return output.toString()
}

/**
* Generates `WORDS.MOD` file from the app's preferences.
*/
@Throws(IOException::class)
fun updateConfigFile() {
val file = getFile("WORD.MOD")
@@ -7,6 +7,9 @@ import android.graphics.Typeface
import android.graphics.Color
import android.text.SpannableStringBuilder

/**
* Parses plain text from `words` to add basic formatting (such as italics).
*/
fun parse_words(input: String): ArrayList<SpannableStringBuilder> {
val results = ArrayList<SpannableStringBuilder>()

@@ -27,11 +30,11 @@ fun parse_words(input: String): ArrayList<SpannableStringBuilder> {
handled_line = " $handled_line"
}

if (line.isEmpty() || line == "*") {
if (line.empty || line == "*") {
if (line == "*") {
processed_result.append("*")
}
val finalresult = processed_result.toString().trim { it <= ' ' }
val finalresult = processed_result.toString().trim()
if (!finalresult.isEmpty()) {
results.add(processed_result)
}
@@ -78,7 +81,7 @@ fun parse_words(input: String): ArrayList<SpannableStringBuilder> {
}
processed_result.setSpan(span, startindex, endindex, 0)
}
val finalresult = processed_result.toString().trim { it <= ' ' }
val finalresult = processed_result.toString().trim()
if (!finalresult.isEmpty()) {
results.add(processed_result)
}

0 comments on commit 8ff33cf

Please sign in to comment.
You can’t perform that action at this time.