From 9559ad90e9e5542518602f2f5cffd64cb6a96974 Mon Sep 17 00:00:00 2001
From: Marvin Borner
Date: Thu, 30 Aug 2018 00:12:53 +0200
Subject: Renamed project to Texx

---
 .../main/java/com/no_name/no_name/Application.kt   |  16 --
 .../main/java/com/no_name/no_name/LoginActivity.kt | 319 ---------------------
 .../main/java/com/no_name/no_name/MainActivity.kt  |  67 -----
 .../java/com/no_name/no_name/RoutingActivity.kt    |  62 ----
 .../main/java/com/no_name/no_name/SecureStorage.kt |  71 -----
 .../java/com/no_name/no_name/SettingsActivity.kt   | 208 --------------
 .../java/com/no_name/no_name/util/ThemeUtil.kt     |  34 ---
 7 files changed, 777 deletions(-)
 delete mode 100644 app/src/main/java/com/no_name/no_name/Application.kt
 delete mode 100644 app/src/main/java/com/no_name/no_name/LoginActivity.kt
 delete mode 100644 app/src/main/java/com/no_name/no_name/MainActivity.kt
 delete mode 100644 app/src/main/java/com/no_name/no_name/RoutingActivity.kt
 delete mode 100644 app/src/main/java/com/no_name/no_name/SecureStorage.kt
 delete mode 100644 app/src/main/java/com/no_name/no_name/SettingsActivity.kt
 delete mode 100644 app/src/main/java/com/no_name/no_name/util/ThemeUtil.kt

(limited to 'app/src/main/java/com')

diff --git a/app/src/main/java/com/no_name/no_name/Application.kt b/app/src/main/java/com/no_name/no_name/Application.kt
deleted file mode 100644
index 441a728..0000000
--- a/app/src/main/java/com/no_name/no_name/Application.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.no_name.no_name
-
-import android.app.Application
-import daio.io.dresscode.DressCode
-import daio.io.dresscode.declareDressCode
-
-class Application : Application() {
-
-    override fun onCreate() {
-        super.onCreate()
-
-        declareDressCode(this,
-                DressCode("dark", R.style.AppTheme_Dark),
-                DressCode("light", R.style.AppTheme))
-    }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/no_name/no_name/LoginActivity.kt b/app/src/main/java/com/no_name/no_name/LoginActivity.kt
deleted file mode 100644
index 861e425..0000000
--- a/app/src/main/java/com/no_name/no_name/LoginActivity.kt
+++ /dev/null
@@ -1,319 +0,0 @@
-package com.no_name.no_name
-
-import android.Manifest.permission.READ_CONTACTS
-import android.animation.Animator
-import android.animation.AnimatorListenerAdapter
-import android.annotation.TargetApi
-import android.app.LoaderManager.LoaderCallbacks
-import android.content.CursorLoader
-import android.content.Loader
-import android.content.pm.PackageManager
-import android.database.Cursor
-import android.net.Uri
-import android.os.AsyncTask
-import android.os.Build
-import android.os.Bundle
-import android.provider.ContactsContract
-import android.support.design.widget.Snackbar
-import android.support.v7.app.AppCompatActivity
-import android.text.TextUtils
-import android.view.View
-import android.view.inputmethod.EditorInfo
-import android.widget.ArrayAdapter
-import android.widget.TextView
-import com.github.kittinunf.fuel.android.extension.responseJson
-import com.github.kittinunf.fuel.httpPost
-import com.madapps.prefrences.EasyPrefrences
-import com.no_name.no_name.util.ThemeUtil.getThemeName
-import daio.io.dresscode.dressCodeName
-import daio.io.dresscode.matchDressCode
-import kotlinx.android.synthetic.main.activity_login.*
-import org.jetbrains.anko.longToast
-import org.jetbrains.anko.startActivity
-import org.json.JSONObject
-import java.util.*
-
-/**
- * A login screen that offers login via email/password.
- */
-class LoginActivity : AppCompatActivity(), LoaderCallbacks<Cursor> {
-    /**
-     * Keep track of the login task to ensure we can cancel it if requested.
-     */
-    private var mAuthTask: UserLoginTask? = null
-
-    /**
-     * Set up the login form and initial configuration
-     */
-    override fun onCreate(savedInstanceState: Bundle?) {
-        matchDressCode()
-        super.onCreate(savedInstanceState)
-        dressCodeName = getThemeName(this)
-        setContentView(R.layout.activity_login)
-
-        populateAutoComplete()
-        password.setOnEditorActionListener(TextView.OnEditorActionListener { _, id, _ ->
-            if (id == EditorInfo.IME_ACTION_DONE || id == EditorInfo.IME_NULL) {
-                attemptLogin()
-                return@OnEditorActionListener true
-            }
-            false
-        })
-
-        email_sign_in_button.setOnClickListener { attemptLogin() }
-    }
-
-    private fun populateAutoComplete() {
-        if (!mayRequestContacts()) {
-            return
-        }
-
-        loaderManager.initLoader(0, null, this)
-    }
-
-    private fun mayRequestContacts(): Boolean {
-        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
-            return true
-        }
-        if (checkSelfPermission(READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) {
-            return true
-        }
-        if (shouldShowRequestPermissionRationale(READ_CONTACTS)) {
-            Snackbar.make(email, R.string.permission_rationale, Snackbar.LENGTH_INDEFINITE)
-                    .setAction(android.R.string.ok,
-                            { requestPermissions(arrayOf(READ_CONTACTS), REQUEST_READ_CONTACTS) })
-        } else {
-            requestPermissions(arrayOf(READ_CONTACTS), REQUEST_READ_CONTACTS)
-        }
-        return false
-    }
-
-    /**
-     * Callback received when a permissions request has been completed.
-     */
-    override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>,
-                                            grantResults: IntArray) {
-        if (requestCode == REQUEST_READ_CONTACTS) {
-            if (grantResults.size == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
-                populateAutoComplete()
-            }
-        }
-    }
-
-    /**
-     * Attempts to sign in or register the account specified by the login form.
-     * If there are form errors (invalid email, missing fields, etc.), the
-     * errors are presented and no actual login attempt is made.
-     */
-    private fun attemptLogin() {
-        if (mAuthTask != null) {
-            return
-        }
-
-        // Reset errors.
-        email.error = null
-        password.error = null
-
-        // Store values at the time of the login attempt.
-        val emailStr = email.text.toString()
-        val passwordStr = password.text.toString()
-
-        var cancel = false
-        var focusView: View? = null
-
-        // Check for a valid password, if the user entered one.
-        if (!TextUtils.isEmpty(passwordStr) && !isPasswordValid(passwordStr)) {
-            password.error = getString(R.string.error_invalid_password)
-            focusView = password
-            cancel = true
-        }
-
-        // Check for a valid email address.
-        if (TextUtils.isEmpty(emailStr)) {
-            email.error = getString(R.string.error_field_required)
-            focusView = email
-            cancel = true
-        } else if (!isEmailValid(emailStr)) {
-            email.error = getString(R.string.error_invalid_email)
-            focusView = email
-            cancel = true
-        }
-
-        if (cancel) {
-            // There was an error; don't attempt login and focus the first
-            // form field with an error.
-            focusView?.requestFocus()
-        } else {
-            // Show a progress spinner, and kick off a background task to
-            // perform the user login attempt.
-            showProgress(true)
-            mAuthTask = UserLoginTask(emailStr, passwordStr)
-            mAuthTask!!.execute(null as Void?)
-        }
-    }
-
-    private fun isEmailValid(email: String): Boolean {
-        return email.contains("@") && email.length >= 4
-    }
-
-    private fun isPasswordValid(password: String): Boolean {
-        return password.length >= 8
-    }
-
-    /**
-     * Shows the progress UI and hides the login form.
-     */
-    @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
-    private fun showProgress(show: Boolean) {
-        // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
-        // for very easy animations. If available, use these APIs to fade-in
-        // the progress spinner.
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
-            val shortAnimTime = resources.getInteger(android.R.integer.config_shortAnimTime).toLong()
-
-            login_form.visibility = if (show) View.GONE else View.VISIBLE
-            login_form.animate()
-                    .setDuration(shortAnimTime)
-                    .alpha((if (show) 0 else 1).toFloat())
-                    .setListener(object : AnimatorListenerAdapter() {
-                        override fun onAnimationEnd(animation: Animator) {
-                            login_form.visibility = if (show) View.GONE else View.VISIBLE
-                        }
-                    })
-
-            login_progress.visibility = if (show) View.VISIBLE else View.GONE
-            login_progress.animate()
-                    .setDuration(shortAnimTime)
-                    .alpha((if (show) 1 else 0).toFloat())
-                    .setListener(object : AnimatorListenerAdapter() {
-                        override fun onAnimationEnd(animation: Animator) {
-                            login_progress.visibility = if (show) View.VISIBLE else View.GONE
-                        }
-                    })
-        } else {
-            // The ViewPropertyAnimator APIs are not available, so simply show
-            // and hide the relevant UI components.
-            login_progress.visibility = if (show) View.VISIBLE else View.GONE
-            login_form.visibility = if (show) View.GONE else View.VISIBLE
-        }
-    }
-
-    /**
-     * Things executed while creation of the loader
-     */
-    override fun onCreateLoader(i: Int, bundle: Bundle?): Loader<Cursor> {
-        return CursorLoader(this,
-                // Retrieve data rows for the device user's 'profile' contact.
-                Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
-                        ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
-
-                // Select only email addresses.
-                ContactsContract.Contacts.Data.MIMETYPE + " = ?", arrayOf(ContactsContract.CommonDataKinds.Email
-                .CONTENT_ITEM_TYPE),
-
-                // Show primary email addresses first. Note that there won't be
-                // a primary email address if the user hasn't specified one.
-                ContactsContract.Contacts.Data.IS_PRIMARY + " DESC")
-    }
-
-    /**
-     * Things executed when loading is finished -> shown if login wasn't successful
-     */
-    override fun onLoadFinished(cursorLoader: Loader<Cursor>, cursor: Cursor) {
-        val emails = ArrayList<String>()
-        cursor.moveToFirst()
-        while (!cursor.isAfterLast) {
-            emails.add(cursor.getString(ProfileQuery.ADDRESS))
-            cursor.moveToNext()
-        }
-
-        addEmailsToAutoComplete(emails)
-    }
-
-    override fun onLoaderReset(cursorLoader: Loader<Cursor>) {
-
-    }
-
-    private fun addEmailsToAutoComplete(emailAddressCollection: List<String>) {
-        //Create adapter to tell the AutoCompleteTextView what to show in its dropdown list.
-        val adapter = ArrayAdapter(this@LoginActivity,
-                android.R.layout.simple_dropdown_item_1line, emailAddressCollection)
-
-        email.setAdapter(adapter)
-    }
-
-    object ProfileQuery {
-        val PROJECTION = arrayOf(
-                ContactsContract.CommonDataKinds.Email.ADDRESS,
-                ContactsContract.CommonDataKinds.Email.IS_PRIMARY)
-        val ADDRESS = 0
-        val IS_PRIMARY = 1
-    }
-
-    /**
-     * Represents an asynchronous login/registration task used to authenticate
-     * the user.
-     */
-    inner class UserLoginTask internal constructor(private val mEmail: String, private val mPassword: String) : AsyncTask<Void, Void, Boolean>() {
-        /**
-         * Login processing and verifying
-         */
-        override fun doInBackground(vararg params: Void): Boolean? {
-            val credentialJson = JSONObject()
-            credentialJson.put("email", mEmail)
-            credentialJson.put("password", mPassword)
-
-            val (_, _, result) = "/login".httpPost()
-                    .header("Content-Type" to "application/json")
-                    .body(credentialJson.toString())
-                    .responseJson()
-
-            result.fold(success = {
-                val accessToken = result.get().obj().getString("access_token")
-                val userID = result.get().obj().getString("user_id")
-
-                val sharedPrefs = EasyPrefrences(this@LoginActivity)
-                sharedPrefs.putString("user_id", userID)
-
-                val secureStorage = SecureStorage(this@LoginActivity)
-                secureStorage.set("access_token", accessToken)
-
-                val verifyToken = secureStorage.get("access_token")
-                return verifyToken == accessToken
-            }, failure = {
-                return false
-            })
-        }
-
-        /**
-         * Runs after [doInBackground], starts actions depending on [success]
-         */
-        override fun onPostExecute(success: Boolean?) {
-            mAuthTask = null
-            showProgress(false)
-
-            if (success!!) {
-                startActivity<MainActivity>()
-                longToast("Successfully logged in.")
-            } else {
-                password.error = getString(R.string.error_incorrect_password)
-                password.requestFocus()
-            }
-        }
-
-        /**
-         * Executed if login process was cancelled
-         */
-        override fun onCancelled() {
-            mAuthTask = null
-            showProgress(false)
-        }
-    }
-
-    companion object {
-        /**
-         * Id to identity READ_CONTACTS permission request.
-         */
-        private val REQUEST_READ_CONTACTS = 0
-    }
-}
diff --git a/app/src/main/java/com/no_name/no_name/MainActivity.kt b/app/src/main/java/com/no_name/no_name/MainActivity.kt
deleted file mode 100644
index 2417181..0000000
--- a/app/src/main/java/com/no_name/no_name/MainActivity.kt
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.no_name.no_name
-
-import android.os.Bundle
-import android.support.v7.app.AppCompatActivity
-import android.view.Menu
-import android.view.MenuItem
-import com.no_name.no_name.util.ThemeUtil.getThemeName
-import daio.io.dresscode.dressCodeName
-import daio.io.dresscode.matchDressCode
-import kotlinx.android.synthetic.main.activity_main.*
-import org.jetbrains.anko.alert
-import org.jetbrains.anko.longToast
-import org.jetbrains.anko.startActivity
-
-/**
- * Main activity aka home screen of app
- */
-class MainActivity : AppCompatActivity() {
-    /**
-     * Set initial configuration
-     */
-    override fun onCreate(savedInstanceState: Bundle?) {
-        matchDressCode()
-        super.onCreate(savedInstanceState)
-        dressCodeName = getThemeName(this)
-        setContentView(R.layout.activity_main)
-        setSupportActionBar(toolbar)
-
-        if (intent.getBooleanExtra("serverDown", false)) {
-            alert("We are sorry, but our servers do not seem to be working at the moment. Please wait a few minutes before you try again.", "Sorry") {
-                positiveButton("Okay") {
-                    finishAffinity() // TODO: Loading activity will somehow still be opened after close
-                    System.exit(0)
-                }
-            }.show()
-        }
-
-        if (intent.getBooleanExtra("notConnected", false))
-            longToast("No internet connection!")
-
-        fab.setOnClickListener { view ->
-            // TODO: Add camera support
-        }
-    }
-
-
-    /**
-     * Inflate the [menu]; this adds items to the action bar if it is present
-     */
-    override fun onCreateOptionsMenu(menu: Menu): Boolean {
-        menuInflater.inflate(R.menu.menu_main, menu)
-        return true
-    }
-
-    /**
-     * Handling action bar [item] clicks
-     */
-    override fun onOptionsItemSelected(item: MenuItem): Boolean {
-        return when (item.itemId) {
-            R.id.action_settings -> {
-                startActivity<SettingsActivity>()
-                true
-            }
-            else -> super.onOptionsItemSelected(item)
-        }
-    }
-}
diff --git a/app/src/main/java/com/no_name/no_name/RoutingActivity.kt b/app/src/main/java/com/no_name/no_name/RoutingActivity.kt
deleted file mode 100644
index 22c2813..0000000
--- a/app/src/main/java/com/no_name/no_name/RoutingActivity.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.no_name.no_name
-
-import android.os.Bundle
-import android.support.v7.app.AppCompatActivity
-import com.github.kittinunf.fuel.android.extension.responseJson
-import com.github.kittinunf.fuel.core.FuelManager
-import com.github.kittinunf.fuel.httpGet
-import com.madapps.prefrences.EasyPrefrences
-import com.no_name.no_name.util.ThemeUtil.getThemeName
-import daio.io.dresscode.dressCodeName
-import daio.io.dresscode.matchDressCode
-import org.jetbrains.anko.alert
-import org.jetbrains.anko.startActivity
-import java.io.IOException
-
-/**
- * Activity which will be run before any other to verify user and choose which activity
- * should be started next
- */
-class RoutingActivity : AppCompatActivity() {
-    private val serverAddress = "192.168.0.102"
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        matchDressCode()
-        super.onCreate(savedInstanceState)
-        dressCodeName = getThemeName(this)
-
-        FuelManager.instance.basePath = "http://$serverAddress"
-        alert("Logging you in.", "Loading...") {
-            isCancelable = false
-        }.show()
-        verifyLogin()
-    }
-
-    @Throws(InterruptedException::class, IOException::class)
-    fun isConnected(): Boolean {
-        val command = "ping -c 1 google.com"
-        return Runtime.getRuntime().exec(command).waitFor() == 0
-    }
-
-    private fun verifyLogin() {
-        val accessToken: String? = SecureStorage(this@RoutingActivity).get("access_token")
-        // synced function of fuel doesn't work here (#331) -> ugly workaround
-        if (accessToken != null) {
-            val userID = EasyPrefrences(this@RoutingActivity).getString("user_id")
-            "/users/$userID".httpGet() // verify by making request to user api
-                    .header("Authorization" to "Bearer $accessToken")
-                    .responseJson { _, response, result ->
-                        val (_, serverError) = result
-                        when {
-                            response.httpStatusCode == 200 -> startActivity<MainActivity>()
-                            response.httpStatusCode == 401 -> startActivity<LoginActivity>()
-                            !isConnected() -> startActivity<MainActivity>("notConnected" to true)
-                            serverError != null -> startActivity<MainActivity>("serverDown" to true)
-                            else -> startActivity<LoginActivity>()
-                        }
-                    }
-        } else {
-            startActivity<LoginActivity>()
-        }
-    }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/no_name/no_name/SecureStorage.kt b/app/src/main/java/com/no_name/no_name/SecureStorage.kt
deleted file mode 100644
index ff14167..0000000
--- a/app/src/main/java/com/no_name/no_name/SecureStorage.kt
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.no_name.no_name
-
-import android.content.Context
-import android.preference.PreferenceManager
-import android.util.Base64
-import com.kazakago.cryptore.CipherAlgorithm
-import com.kazakago.cryptore.Cryptore
-import com.madapps.prefrences.EasyPrefrences
-
-/**
- * Class for saving data securely in SharedPreferences
- */
-class SecureStorage(private val context: Context) {
-    /**
-     * Encrypts and saves the [value] with [key] as index
-     */
-    fun set(key: String, value: String) {
-        sharedPrefs.putString(key, encryptAES(value))
-    }
-
-    /**
-     * Finds the encrypted value by [key], decrypts it and returns the value as string
-     */
-    fun get(key: String): String? {
-        return try {
-            decryptAES(sharedPrefs.getString(key))
-        } catch (e: Exception) {
-            null
-        }
-    }
-
-    private val sharedPrefs = EasyPrefrences(context)
-
-    private enum class Alias(val value: String) {
-        RSA("CIPHER_RSA"),
-        AES("CIPHER_AES")
-    }
-
-    private val cryptoreAES: Cryptore by lazy {
-        val builder = Cryptore.Builder(alias = Alias.AES.value, type = CipherAlgorithm.AES)
-        builder.build()
-    }
-
-    private fun encryptAES(plainStr: String): String {
-        val plainByte = plainStr.toByteArray()
-        val result = cryptoreAES.encrypt(plainByte = plainByte)
-        cipherIV = result.cipherIV
-        return Base64.encodeToString(result.bytes, Base64.DEFAULT)
-    }
-
-    private fun decryptAES(encryptedStr: String): String {
-        val encryptedByte = Base64.decode(encryptedStr, Base64.DEFAULT)
-        val result = cryptoreAES.decrypt(encryptedByte = encryptedByte, cipherIV = cipherIV)
-        return String(result.bytes)
-    }
-
-    private var cipherIV: ByteArray?
-        get() {
-            val preferences = PreferenceManager.getDefaultSharedPreferences(this.context)
-            preferences.getString("cipher_iv", null)?.let {
-                return Base64.decode(it, Base64.DEFAULT)
-            }
-            return null
-        }
-        set(value) {
-            val preferences = PreferenceManager.getDefaultSharedPreferences(this.context)
-            val editor = preferences.edit()
-            editor.putString("cipher_iv", Base64.encodeToString(value, Base64.DEFAULT))
-            editor.apply()
-        }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/no_name/no_name/SettingsActivity.kt b/app/src/main/java/com/no_name/no_name/SettingsActivity.kt
deleted file mode 100644
index e4a9f74..0000000
--- a/app/src/main/java/com/no_name/no_name/SettingsActivity.kt
+++ /dev/null
@@ -1,208 +0,0 @@
-package com.no_name.no_name
-
-import android.annotation.TargetApi
-import android.content.Context
-import android.content.Intent
-import android.content.res.Configuration
-import android.os.Build
-import android.os.Bundle
-import android.preference.*
-import android.support.v4.app.NavUtils
-import android.view.MenuItem
-import com.no_name.no_name.util.ThemeUtil.getThemeName
-import daio.io.dresscode.dressCodeName
-import daio.io.dresscode.matchDressCode
-
-/**
- * A [PreferenceActivity] that presents a set of application settings. On
- * handset devices, settings are presented as a single list. On tablets,
- * settings are split by category, with category headers shown to the left of
- * the list of settings.
- *
- * See [Android Design: Settings](http://developer.android.com/design/patterns/settings.html)
- * for design guidelines and the [Settings API Guide](http://developer.android.com/guide/topics/ui/settings.html)
- * for more information on developing a Settings UI.
- */
-class SettingsActivity : PreferenceActivity() {
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        matchDressCode()
-        super.onCreate(savedInstanceState)
-        dressCodeName = getThemeName(this)
-        setupActionBar()
-    }
-
-    /**
-     * Set up the [android.app.ActionBar], if the API is available.
-     */
-    private fun setupActionBar() {
-        actionBar?.setDisplayHomeAsUpEnabled(true)
-    }
-
-    fun updateTheme() {
-        dressCodeName = getThemeName(this)
-    }
-
-    /**
-     * Listener for menu item selector
-     */
-    override fun onMenuItemSelected(featureId: Int, item: MenuItem): Boolean {
-        val id = item.itemId
-        if (id == android.R.id.home) {
-            if (!super.onMenuItemSelected(featureId, item)) {
-                NavUtils.navigateUpFromSameTask(this)
-            }
-            return true
-        }
-        return super.onMenuItemSelected(featureId, item)
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    override fun onIsMultiPane(): Boolean {
-        return isXLargeTablet(this)
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
-    override fun onBuildHeaders(target: List<PreferenceActivity.Header>) {
-        loadHeadersFromResource(R.xml.pref_headers, target)
-    }
-
-    /**
-     * This method stops fragment injection in malicious applications.
-     * Make sure to deny any unknown fragments here.
-     */
-    override fun isValidFragment(fragmentName: String): Boolean {
-        return PreferenceFragment::class.java.name == fragmentName
-                || GeneralPreferenceFragment::class.java.name == fragmentName
-                || AccountPreferenceFragment::class.java.name == fragmentName
-    }
-
-    /**
-     * This fragment shows general preferences only. It is used when the
-     * activity is showing a two-pane settings UI.
-     */
-    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
-    class GeneralPreferenceFragment : PreferenceFragment() {
-        override fun onCreate(savedInstanceState: Bundle?) {
-            super.onCreate(savedInstanceState)
-            addPreferencesFromResource(R.xml.pref_general)
-            setHasOptionsMenu(true)
-        }
-
-        override fun onPreferenceTreeClick(preferenceScreen: PreferenceScreen?, preference: Preference?): Boolean {
-            if (preference?.key == "dark_theme_switch") {
-                (activity as SettingsActivity).updateTheme()
-                return true
-            }
-            return true
-        }
-
-        /**
-         * Listener for action bar option selector
-         */
-        override fun onOptionsItemSelected(item: MenuItem): Boolean {
-            val id = item.itemId
-            if (id == android.R.id.home) {
-                startActivity(Intent(activity, SettingsActivity::class.java))
-                return true
-            }
-            return super.onOptionsItemSelected(item)
-        }
-    }
-
-    /**
-     * This fragment shows general preferences only. It is used when the
-     * activity is showing a two-pane settings UI.
-     */
-    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
-    class AccountPreferenceFragment : PreferenceFragment() {
-        override fun onCreate(savedInstanceState: Bundle?) {
-            super.onCreate(savedInstanceState)
-            addPreferencesFromResource(R.xml.pref_account)
-            setHasOptionsMenu(true)
-
-            // Bind the summaries of EditText/List/Dialog/Ringtone preferences
-            // to their values. When their values change, their summaries are
-            // updated to reflect the new value, per the Android Design
-            // guidelines.
-            //bindPreferenceSummaryToValue(findPreference("example_list"))
-        }
-
-        /**
-         * Listener for action bar option selector
-         */
-        override fun onOptionsItemSelected(item: MenuItem): Boolean {
-            val id = item.itemId
-            if (id == android.R.id.home) {
-                startActivity(Intent(activity, SettingsActivity::class.java))
-                return true
-            }
-            return super.onOptionsItemSelected(item)
-        }
-    }
-
-    companion object {
-
-        /**
-         * A preference value change listener that updates the preference's summary
-         * to reflect its new value.
-         */
-        private val sBindPreferenceSummaryToValueListener = Preference.OnPreferenceChangeListener { preference, value ->
-            val stringValue = value.toString()
-
-            if (preference is ListPreference) {
-                // For list preferences, look up the correct display value in
-                // the preference's 'entries' list.
-                val listPreference = preference
-                val index = listPreference.findIndexOfValue(stringValue)
-
-                // Set the summary to reflect the new value.
-                preference.setSummary(
-                        if (index >= 0)
-                            listPreference.entries[index]
-                        else
-                            null)
-
-            } else {
-                // For all other preferences, set the summary to the value's
-                // simple string representation.
-                preference.summary = stringValue
-            }
-            true
-        }
-
-        /**
-         * Helper method to determine if the device has an extra-large screen. For
-         * example, 10" tablets are extra-large.
-         */
-        private fun isXLargeTablet(context: Context): Boolean {
-            return context.resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK >= Configuration.SCREENLAYOUT_SIZE_XLARGE
-        }
-
-        /**
-         * Binds a preference's summary to its value. More specifically, when the
-         * preference's value is changed, its summary (line of text below the
-         * preference title) is updated to reflect the value. The summary is also
-         * immediately updated upon calling this method. The exact display format is
-         * dependent on the type of preference.
-
-         * @see .sBindPreferenceSummaryToValueListener
-         */
-        private fun bindPreferenceSummaryToValue(preference: Preference) {
-            // Set the listener to watch for value changes.
-            preference.onPreferenceChangeListener = sBindPreferenceSummaryToValueListener
-
-            // Trigger the listener immediately with the preference's
-            // current value.
-            sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
-                    PreferenceManager
-                            .getDefaultSharedPreferences(preference.context)
-                            .getString(preference.key, ""))
-        }
-    }
-}
diff --git a/app/src/main/java/com/no_name/no_name/util/ThemeUtil.kt b/app/src/main/java/com/no_name/no_name/util/ThemeUtil.kt
deleted file mode 100644
index 5125f12..0000000
--- a/app/src/main/java/com/no_name/no_name/util/ThemeUtil.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.no_name.no_name.util
-
-import android.content.Context
-import com.madapps.prefrences.EasyPrefrences
-import com.no_name.no_name.util.ThemeUtil.isDarkTheme
-
-/**
- * Get the name of the theme depending on [actionBar] and [isDarkTheme]
- */
-object ThemeUtil {
-    /**
-     * Checks if the theme saved in sharedPreferences is dark/light
-     */
-    private fun isDarkTheme(context: Context): Boolean {
-        val sharedPrefs = EasyPrefrences(context)
-        val darkTheme: Boolean? = sharedPrefs.getBoolean("dark_theme_switch")
-        darkTheme?.let {
-            return darkTheme
-        } ?: run {
-            return false
-        }
-    }
-
-    /**
-     * Get the name of the theme depending on [actionBar] and [isDarkTheme]
-     */
-    fun getThemeName(context: Context): String {
-        return if (isDarkTheme(context)) {
-            "dark"
-        } else {
-            "light"
-        }
-    }
-}
\ No newline at end of file
-- 
cgit v1.2.3