aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/src
diff options
context:
space:
mode:
authorMarvin Borner2018-08-31 23:07:15 +0200
committerMarvin Borner2018-08-31 23:07:15 +0200
commit02534de25c78ccb01b8fb8752483bca37e72d935 (patch)
tree9f75ad6e10705f5ac49079d493e5ae185baf041a /app/src
parent770081bb0090e8867b1b6e153f8cf65cb700be86 (diff)
Added some documentation
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/me/texx/Texx/Application.kt7
-rw-r--r--app/src/main/java/me/texx/Texx/CameraActivity.kt20
-rw-r--r--app/src/main/java/me/texx/Texx/LoginActivity.kt6
-rw-r--r--app/src/main/java/me/texx/Texx/MediaPreviewActivity.kt8
-rw-r--r--app/src/main/java/me/texx/Texx/RoutingActivity.kt3
-rw-r--r--app/src/main/java/me/texx/Texx/SettingsActivity.kt17
6 files changed, 54 insertions, 7 deletions
diff --git a/app/src/main/java/me/texx/Texx/Application.kt b/app/src/main/java/me/texx/Texx/Application.kt
index a5834f4..a397544 100644
--- a/app/src/main/java/me/texx/Texx/Application.kt
+++ b/app/src/main/java/me/texx/Texx/Application.kt
@@ -4,8 +4,13 @@ import android.app.Application
import daio.io.dresscode.DressCode
import daio.io.dresscode.declareDressCode
+/**
+ * Main Application class mainly for handling themes
+ */
class Application : Application() {
-
+ /**
+ * Set initial configuration
+ */
override fun onCreate() {
super.onCreate()
diff --git a/app/src/main/java/me/texx/Texx/CameraActivity.kt b/app/src/main/java/me/texx/Texx/CameraActivity.kt
index 1cc4800..2cb67c2 100644
--- a/app/src/main/java/me/texx/Texx/CameraActivity.kt
+++ b/app/src/main/java/me/texx/Texx/CameraActivity.kt
@@ -28,9 +28,14 @@ import java.io.IOException
import java.text.SimpleDateFormat
import java.util.*
-
+/**
+ * Activity to either record a video or take a photo
+ * Output will be saved and redirected to corresponding preview activity
+ */
class CameraActivity : AppCompatActivity() {
-
+ /**
+ * Set initial configuration
+ */
override fun onCreate(savedInstanceState: Bundle?) {
matchDressCode()
super.onCreate(savedInstanceState)
@@ -125,18 +130,27 @@ class CameraActivity : AppCompatActivity() {
return "Texx_$timestamp.jpg"
}
+ /**
+ * Start components on activity resume (called at start)
+ */
override fun onResume() {
super.onResume()
camera.start()
}
+ /**
+ * Stop components on activity pause
+ */
override fun onPause() {
super.onPause()
camera.stop()
}
+ /**
+ * Destroy components on activity close
+ */
override fun onDestroy() {
super.onDestroy()
- camera.destroy()
+ camera.destroy() // doesn't really destroys your camera lol
}
}
diff --git a/app/src/main/java/me/texx/Texx/LoginActivity.kt b/app/src/main/java/me/texx/Texx/LoginActivity.kt
index baa91ae..27a4ca2 100644
--- a/app/src/main/java/me/texx/Texx/LoginActivity.kt
+++ b/app/src/main/java/me/texx/Texx/LoginActivity.kt
@@ -230,6 +230,9 @@ class LoginActivity : AppCompatActivity(), LoaderCallbacks<Cursor> {
addEmailsToAutoComplete(emails)
}
+ /**
+ * Listener for loader reset
+ */
override fun onLoaderReset(cursorLoader: Loader<Cursor>) {
}
@@ -242,6 +245,9 @@ class LoginActivity : AppCompatActivity(), LoaderCallbacks<Cursor> {
email.setAdapter(adapter)
}
+ /**
+ * Checks for email to insert
+ */
object ProfileQuery {
val PROJECTION = arrayOf(
ContactsContract.CommonDataKinds.Email.ADDRESS,
diff --git a/app/src/main/java/me/texx/Texx/MediaPreviewActivity.kt b/app/src/main/java/me/texx/Texx/MediaPreviewActivity.kt
index 3e6f25b..b0ebaa7 100644
--- a/app/src/main/java/me/texx/Texx/MediaPreviewActivity.kt
+++ b/app/src/main/java/me/texx/Texx/MediaPreviewActivity.kt
@@ -10,8 +10,14 @@ import daio.io.dresscode.dressCodeName
import daio.io.dresscode.matchDressCode
import me.texx.Texx.util.ThemeUtil.getThemeName
+/**
+ * Activity which will be shown after you've taken a picture
+ * Previews the taken picture and posts it if you want
+ */
class MediaPreviewActivity : AppCompatActivity() {
-
+ /**
+ * Set initial configuration
+ */
override fun onCreate(savedInstanceState: Bundle?) {
matchDressCode()
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/me/texx/Texx/RoutingActivity.kt b/app/src/main/java/me/texx/Texx/RoutingActivity.kt
index 3ef5486..9e1c273 100644
--- a/app/src/main/java/me/texx/Texx/RoutingActivity.kt
+++ b/app/src/main/java/me/texx/Texx/RoutingActivity.kt
@@ -19,6 +19,9 @@ import java.io.IOException
class RoutingActivity : AppCompatActivity() {
private val serverAddress = "192.168.137.1"
+ /**
+ * Set initial configuration
+ */
override fun onCreate(savedInstanceState: Bundle?) {
matchDressCode()
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/me/texx/Texx/SettingsActivity.kt b/app/src/main/java/me/texx/Texx/SettingsActivity.kt
index 663f05a..7737588 100644
--- a/app/src/main/java/me/texx/Texx/SettingsActivity.kt
+++ b/app/src/main/java/me/texx/Texx/SettingsActivity.kt
@@ -24,7 +24,9 @@ import me.texx.Texx.util.ThemeUtil.getThemeName
* for more information on developing a Settings UI.
*/
class SettingsActivity : PreferenceActivity() {
-
+ /**
+ * Set initial configuration
+ */
override fun onCreate(savedInstanceState: Bundle?) {
matchDressCode()
super.onCreate(savedInstanceState)
@@ -39,6 +41,9 @@ class SettingsActivity : PreferenceActivity() {
actionBar?.setDisplayHomeAsUpEnabled(true)
}
+ /**
+ * For calls from fragment classes (non-activity)
+ */
fun updateTheme() {
dressCodeName = getThemeName(this)
}
@@ -88,12 +93,18 @@ class SettingsActivity : PreferenceActivity() {
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
class GeneralPreferenceFragment : PreferenceFragment() {
+ /**
+ * Set initial configuration
+ */
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
addPreferencesFromResource(R.xml.pref_general)
setHasOptionsMenu(true)
}
+ /**
+ * Listener for click onto element of [preference] list (=> tree)
+ */
override fun onPreferenceTreeClick(preferenceScreen: PreferenceScreen?, preference: Preference?): Boolean {
if (preference?.key == "dark_theme_switch") {
(activity as SettingsActivity).updateTheme()
@@ -121,6 +132,9 @@ class SettingsActivity : PreferenceActivity() {
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
class AccountPreferenceFragment : PreferenceFragment() {
+ /**
+ * Set initial configuration
+ */
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
addPreferencesFromResource(R.xml.pref_account)
@@ -147,7 +161,6 @@ class SettingsActivity : PreferenceActivity() {
}
companion object {
-
/**
* A preference value change listener that updates the preference's summary
* to reflect its new value.