Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
3d5b4e6
Ignore vim files
pmwhite Sep 28, 2019
5e7bd91
Make phone request local laptop server
pmwhite Sep 28, 2019
418d709
Make environment for building android without android-studio
pmwhite Oct 1, 2019
08d490c
Finish branch
pmwhite Oct 3, 2019
e169dc1
Merge branch 'make-rocc-url-configurable' into 'develop'
pmwhite Oct 3, 2019
c7d7489
Convert files to unix line endings
pmwhite Oct 11, 2019
a85e06b
Fixup fomatting of PhaseType enum
pmwhite Oct 22, 2019
fd4bfc9
Add whole story back translation activity and clean up some random im…
pmwhite Nov 3, 2019
f65e1fd
Restructure recording data and do formatting
pmwhite Nov 3, 2019
83f4ed2
Remove some unnecessary function indirection
pmwhite Nov 3, 2019
9c9dcdc
Added backtranslation activity with upload button
pmwhite Nov 4, 2019
18d0e14
Reformat layout file
pmwhite Nov 12, 2019
10f2310
Add some texting functionality
pmwhite Nov 12, 2019
4afecc2
Restructure registration activity and JSON handling
pmwhite Nov 14, 2019
6e9bb30
Add support for sending transcripts
pmwhite Nov 18, 2019
401933c
Abstract slide specific server requests
pmwhite Nov 19, 2019
893eb68
Store story id upon sending audio
pmwhite Nov 19, 2019
69250d4
Cleanup formatting, warnings, and some miner bugs
pmwhite Nov 22, 2019
ab19e2d
Add support for backtranslation transcripts
pmwhite Nov 18, 2019
cabcaa9
Add approval status button and improve some abstractions
pmwhite Nov 28, 2019
f4247f5
Stop using activeSlideNum in SlidePhaseFrag fragments
pmwhite Dec 6, 2019
fe34f5f
Add approval and upload indicator to remote check fragment
pmwhite Dec 6, 2019
d1939e1
Update story.json
pmwhite Jan 23, 2020
cafe0e8
Add whole story property when sending audio
pmwhite Jan 22, 2020
122ff39
Restructure phases from activities to fragments
pmwhite Jan 25, 2020
3a3b698
Cleanup, deduplicate, and format code
pmwhite Jan 26, 2020
eb574c6
Add ROCC_URL_PREFIX editor to global drawer
pmwhite Jan 26, 2020
aba0b08
Toggle visibility of rocc setting based on build variant
pmwhite Jan 27, 2020
859fede
Fix phase pager bugs and use websockets for messages
pmwhite Feb 5, 2020
17321db
Add message queueing (including UI)
pmwhite Feb 6, 2020
0e433bb
Add projectId to websocket url
pmwhite Feb 12, 2020
eeb75d0
Only display messages relevant to the correct slide number
pmwhite Feb 12, 2020
c520820
Only show story-relevant messages
pmwhite Feb 13, 2020
c3f105a
Make slide uploading more robust to user and programmer errors
pmwhite Feb 20, 2020
bfb064c
Add catchup message on websocket reconnect
pmwhite Feb 21, 2020
54b282a
Add approval status live-update
pmwhite Feb 27, 2020
8f5df72
Switch transcript sending box to using websockets
pmwhite Mar 16, 2020
d8d884e
Fix SlidePhaseFrag inheritance-related initialization bug
pmwhite Mar 19, 2020
47133b3
Correct behavior for MultiRecordingToolbar selectedIndex when adding …
pmwhite Mar 19, 2020
3bfde36
Add alternative icons
pmwhite Mar 30, 2020
52137e3
Add vector asset to repo
pmwhite Apr 7, 2020
849c7ce
Update remote check icon
pmwhite Apr 7, 2020
a429d3c
Update remote check icon
pmwhite Apr 7, 2020
8f069ed
Update and fix some logo issues
pmwhite Apr 7, 2020
f9d3074
Make upload button behavior consistent and abstracted across all remo…
pmwhite Apr 7, 2020
cc0c21e
Make new story recording reset story upload state
pmwhite Apr 7, 2020
a35dac6
Make story tell back phase color unique
pmwhite Apr 7, 2020
76fe891
Make recording toolbar warn on overwriting in story tell-back
pmwhite Apr 7, 2020
3864422
Disallow double-send with transcripts and give helpful visual indicat…
pmwhite Apr 8, 2020
e1fcf4c
Update slide and story tell-back icons
pmwhite Apr 8, 2020
5481a39
Merge branch 'add-whole-story-backtranslation-phase' of gitlab:cedarv…
pmwhite Apr 8, 2020
73143e2
Make approval indicator work on both remote and slide tell-back by ab…
pmwhite Apr 8, 2020
04b037f
Update tell-back icon colors and transparency
pmwhite Apr 8, 2020
d09ed24
Approved story when all slides get approved remotely
pmwhite Apr 8, 2020
4943f92
Use DramatizationRecordingToolbar in the Backtranslation phase
pmwhite Apr 9, 2020
8cf5dbf
Fix null reference exceptions when navigating away from playing audio
pmwhite Apr 13, 2020
e5768fc
Fix crash when no registration is present
pmwhite Apr 13, 2020
562d8ce
Reset upload state for BackTranslationFrag when new recording is fini…
pmwhite Apr 15, 2020
d5cc4ba
Change all instances of slideNum to slideNumber (for consistency)
pmwhite Apr 15, 2020
c6a7309
Synchronize slideNumber when a new phase becomes visible.
pmwhite Apr 15, 2020
bb015bf
Add scrub bar and slide thumbnail to remote check phase
pmwhite Apr 17, 2020
76531c1
Fix bug with slide seek bar not updating
pmwhite Apr 17, 2020
c762a38
Add messages not yet sent divider
pmwhite Apr 17, 2020
ab58148
Cosmetic improvement and bug fix.
pmwhite Apr 17, 2020
4060ea8
Fix some minor bugs
pmwhite Apr 29, 2020
0b4d5e1
Make dramatization phase automatically remove lock icon
pmwhite May 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
/captures
*debug*
*release*
*.swp
*.swo
*~
17 changes: 16 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,26 @@ android {
}
buildTypes {
release {
versionNameSuffix ".release"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "String", "ROCC_URL_PREFIX", ROCC_URL_PREFIX
buildConfigField "String", "ROCC_WEBSOCKETS_PREFIX", ROCC_WEBSOCKETS_PREFIX
buildConfigField "Boolean", "ENABLE_IN_APP_ROCC_URL_SETTING", "false"
resValue "bool", "enable_in_app_rocc_url_setting", "false"
}
debug {
versionNameSuffix ".debug"
buildConfigField "String", "ROCC_URL_PREFIX", ROCC_URL_PREFIX
buildConfigField "String", "ROCC_WEBSOCKETS_PREFIX", ROCC_WEBSOCKETS_PREFIX
buildConfigField "Boolean", "ENABLE_IN_APP_ROCC_URL_SETTING", "true"
resValue "bool", "enable_in_app_rocc_url_setting", "true"
}
clientDebug {
initWith debug
buildConfigField "Boolean", "ENABLE_IN_APP_ROCC_URL_SETTING", "false"
resValue "bool", "enable_in_app_rocc_url_setting", "false"

}
}
defaultConfig {
Expand Down Expand Up @@ -80,12 +95,12 @@ dependencies {
implementation 'com.github.codekidX:storage-chooser:2.0.3'
implementation 'com.squareup.moshi:moshi:1.8.0'
implementation 'com.opencsv:opencsv:4.3.2'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'org.java-websocket:Java-WebSocket:1.4.1'
kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.6.0'
testImplementation 'junit:junit:4.12'
testImplementation 'androidx.test:core:1.2.0'
Expand Down
29 changes: 5 additions & 24 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
android:theme="@style/AppTheme"
android:largeHeap="true"
android:fullBackupContent="false"
android:usesCleartextTraffic="true"
tools:replace="android:icon,android:roundIcon"
>

Expand All @@ -32,12 +33,6 @@
android:resource="@xml/file_paths"/>
</provider>

<!-- Pager Base -->
<activity
android:name=".controller.pager.PagerBaseActivity"
android:label="Pager Base"
android:screenOrientation="portrait" />

<!-- Splash Screen -->
<activity
android:name=".controller.SplashScreenActivity"
Expand All @@ -60,28 +55,14 @@
android:name=".controller.RegistrationActivity"
android:screenOrientation="portrait" />
<activity
android:name=".controller.WorkspaceUpdateActivity"
android:name=".controller.phase.PhaseBaseActivity"
android:screenOrientation="portrait" />
<activity
android:name=".controller.WorkspaceDialogUpdateActivity"
android:screenOrientation="portrait" />
<!-- Learn -->
<activity
android:name=".controller.learn.LearnActivity"
android:name=".controller.WorkspaceUpdateActivity"
android:screenOrientation="portrait" />
<activity
android:name=".controller.remote.WholeStoryBackTranslationActivity"
android:name=".controller.WorkspaceDialogUpdateActivity"
android:screenOrientation="portrait" />
<!-- Create -->
<activity
android:name=".controller.export.CreateActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<!-- Share -->
<activity
android:name=".controller.export.ShareActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
</application>

</manifest>
</manifest>
147 changes: 88 additions & 59 deletions app/src/main/java/org/sil/storyproducer/controller/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package org.sil.storyproducer.controller

import android.app.Activity
import android.app.AlertDialog
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.net.ConnectivityManager
import android.os.Bundle
import android.os.SystemClock
import android.preference.PreferenceManager
import android.support.design.widget.NavigationView
import android.support.v4.view.GravityCompat
import android.support.v4.widget.DrawerLayout
Expand All @@ -19,21 +20,91 @@ import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.webkit.WebView
import android.widget.EditText
import android.widget.LinearLayout
import android.widget.ProgressBar
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.async
import org.sil.storyproducer.R
import org.sil.storyproducer.model.Phase
import org.sil.storyproducer.model.PhaseType
import org.sil.storyproducer.model.Story
import org.sil.storyproducer.model.Workspace
import org.sil.storyproducer.tools.Network.ConnectivityStatus
import org.sil.storyproducer.tools.Network.VolleySingleton
import java.io.Serializable

fun handleDrawerItemSelection(activity: Activity, menuItem: MenuItem, drawerLayout: DrawerLayout, currentItemId: Int?): Boolean {
menuItem.isChecked = true
drawerLayout.closeDrawers()

if (currentItemId == menuItem.itemId) {
return true
}

when (menuItem.itemId) {
R.id.nav_workspace -> {
val intent = Intent(activity, WorkspaceUpdateActivity::class.java)
activity.startActivity(intent)
activity.finish()
}
R.id.nav_stories -> {
val intent = Intent(activity, MainActivity::class.java)
activity.startActivity(intent)
activity.finish()
}
R.id.nav_registration -> {
val intent = Intent(activity, RegistrationActivity::class.java)
activity.startActivity(intent)
activity.finish()
}
R.id.nav_license -> {
val dialog = AlertDialog.Builder(activity)
.setTitle(activity.getString(R.string.license_title))
.setMessage(activity.getString(R.string.license_body))
.setPositiveButton(activity.getString(R.string.ok)) { _, _ -> }.create()
dialog.show()
}
R.id.nav_set_rocc_url_prefix -> {
val container = LinearLayout(activity)
container.orientation = LinearLayout.VERTICAL
container.layoutParams = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT)
val roccPrefixInput = EditText(activity)
roccPrefixInput.setText(PreferenceManager.getDefaultSharedPreferences(activity).getString("ROCC_URL_PREFIX", "")
?: "")
container.addView(roccPrefixInput,
LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT))
val webSocketsInput = EditText(activity)
container.addView(webSocketsInput,
LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT))
webSocketsInput.setText(PreferenceManager.getDefaultSharedPreferences(activity).getString("WEBSOCKETS_URL", "")
?: "")
val dialog = AlertDialog.Builder(activity)
.setTitle("ROCC URL Prefix")
.setMessage("Enter a string to prefix all requests to the remote consultant site")
.setView(container)
.setPositiveButton(activity.getString(R.string.ok)) { _, _ ->
PreferenceManager.getDefaultSharedPreferences(activity).edit()
.putString("ROCC_URL_PREFIX", roccPrefixInput.text.toString())
.putString("WEBSOCKETS_URL", webSocketsInput.text.toString()).apply()
}.create()
dialog.show()
}
R.id.nav_clear_all_messages -> {
}
R.id.nav_forget_remote_story_id -> {
Workspace.activeStory.remoteId = null
}
}

return true
}

class MainActivity : AppCompatActivity(), Serializable {
private var mDrawerLayout: DrawerLayout? = null
private lateinit var mDrawerLayout: DrawerLayout

private val receiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
Expand All @@ -60,7 +131,7 @@ class MainActivity : AppCompatActivity(), Serializable {
pb.visibility = View.VISIBLE

GlobalScope.async {
if(!Workspace.isInitialized) Workspace.initializeWorskpace([email protected])
if (!Workspace.isInitialized) Workspace.initializeWorkspace([email protected])
runOnUiThread {
pb.visibility = View.GONE
supportFragmentManager.beginTransaction().add(R.id.fragment_container, StoryListFrag()).commit()
Expand All @@ -74,31 +145,23 @@ class MainActivity : AppCompatActivity(), Serializable {
return true
}

/**
* move to the chosen story
*/
fun switchToStory(story: Story) {
Workspace.activeStory = story
val intent = Intent(this.applicationContext, Workspace.activePhase.getTheClass())
startActivity(intent)
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
android.R.id.home -> {
mDrawerLayout!!.openDrawer(GravityCompat.START)
mDrawerLayout.openDrawer(GravityCompat.START)
true
}
R.id.helpButton -> {
val alert = AlertDialog.Builder(this)
alert.setTitle("Story List Help")

val wv = WebView(this)
val iStream = assets.open(Phase.getHelpName(PhaseType.STORY_LIST))
val iStream = assets.open("story_list.html")
val text = iStream.reader().use {
it.readText() }
it.readText()
}

wv.loadData(text,"text/html",null)
wv.loadData(text, "text/html", null)
alert.setView(wv)
alert.setNegativeButton("Close") { dialog, _ ->
dialog!!.dismiss()
Expand All @@ -116,52 +179,18 @@ class MainActivity : AppCompatActivity(), Serializable {
private fun setupDrawer() {
val toolbar = findViewById<Toolbar>(R.id.toolbar)
setSupportActionBar(toolbar)
val actionbar: ActionBar? = supportActionBar
actionbar?.apply {
val actionbar: ActionBar = supportActionBar!!
actionbar.apply {
setDisplayHomeAsUpEnabled(true)
setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp)
}

supportActionBar!!.setDisplayHomeAsUpEnabled(true)
supportActionBar!!.setHomeButtonEnabled(true)

mDrawerLayout = findViewById(R.id.drawer_layout)
//Lock from opening with left swipe
mDrawerLayout!!.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
val navigationView: NavigationView = findViewById(R.id.nav_view)
val drawerLayout = mDrawerLayout
navigationView.setNavigationItemSelectedListener { menuItem ->
// set item as selected to persist highlight
menuItem.isChecked = true
// close drawer when item is tapped
mDrawerLayout!!.closeDrawers()

// Add code here to update the UI based on the item selected
// For example, swap UI fragments here
val intent: Intent
when (menuItem.itemId) {
R.id.nav_workspace -> {
intent = Intent(this, WorkspaceUpdateActivity::class.java)
this.startActivity(intent)
this.finish()
}
R.id.nav_stories -> {
// Current fragment
}
R.id.nav_registration -> {
intent = Intent(this, RegistrationActivity::class.java)
this.startActivity(intent)
this.finish()
}
R.id.nav_license -> {
val dialog = AlertDialog.Builder(this)
.setTitle(this.getString(R.string.license_title))
.setMessage(this.getString(R.string.license_body))
.setPositiveButton(this.getString(R.string.ok)) { _, _ -> }.create()
dialog.show()
}
}

true
handleDrawerItemSelection(this, menuItem, drawerLayout, R.id.nav_stories)
}
}

Expand Down
Loading