Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI updates and app reorganization #3

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 3 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/render.experimental.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/build
/google-services.json
/google-services.json
app/src/main/java/com/spartahack/spartahack_android/Secrets.java
27 changes: 21 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,43 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

// Design
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

// Async stuff
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0-RC'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.0.1'

// Notifications
implementation 'com.google.firebase:firebase-analytics:17.2.3'
implementation 'com.google.firebase:firebase-messaging:20.1.2'

// QR Scanner
implementation 'com.google.firebase:firebase-ml-vision:24.0.1'
implementation 'com.google.firebase:firebase-ml-vision-barcode-model:16.0.2'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61'

implementation 'com.google.android.gms:play-services-vision:19.0.0'

// Auth0
implementation 'com.auth0.android:auth0:1.+'
implementation 'com.android.support:support-annotations:28.0.0'


}

Expand Down
32 changes: 5 additions & 27 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,40 @@

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme" >

android:theme="@style/Theme.AppCompat.Light.NoActionBar" >

<!--
<activity android:name="com.auth0.samples.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</activity>-->

<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MapsActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAPS" />

<category android:name="android.intent.category.MAPS" />
</intent-filter>
</activity>
<activity
android:name=".ScheduleActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.SCHEDULE" />

<category android:name="android.intent.category.SCHEDULE" />
</intent-filter>
</activity>
Expand All @@ -57,27 +47,15 @@
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.FAQ" />

<category android:name="android.intent.category.FAQ" />
</intent-filter>
</activity>
<activity
android:name=".ProfileActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.PROFILE" />

<category android:name="android.intent.category.PROFILE" />
</intent-filter>
</activity>
<activity
android:name=".QRScannerActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.QRSCANNER" />

<category android:name="android.intent.category.QRSCANNER" />
</intent-filter>
</activity>
Expand Down
40 changes: 5 additions & 35 deletions app/src/main/java/com/spartahack/spartahack_android/FAQActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,24 @@ import android.view.Menu
import androidx.core.text.HtmlCompat
import kotlinx.coroutines.*
import kotlinx.android.synthetic.main.faq_view.*
import com.spartahack.spartahack_android.scripts.faqMain
import com.spartahack.spartahack_android.scripts.faqMainSuspend


class FAQActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_faq)
val toolbar: Toolbar = findViewById(R.id.toolbar)
setSupportActionBar(toolbar)

val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout)
val navView: NavigationView = findViewById(R.id.nav_view)
val toggle = ActionBarDrawerToggle(
this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close)
drawerLayout.addDrawerListener(toggle)
toggle.syncState()

navView.setNavigationItemSelectedListener(this)
setContentView(R.layout.faq_view)

// Makes the API call and sends the data to the activity.
val displayString = GlobalScope.async { faqMain() }
val displayString = GlobalScope.async { faqMainSuspend() }

runBlocking { faqTextView.text = HtmlCompat.fromHtml(displayString.await(), 0) }
}

override fun onBackPressed() {
val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout)
if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
drawerLayout.closeDrawer(GravityCompat.START)
} else {
super.onBackPressed()

}
super.onBackPressed()
}

override fun onCreateOptionsMenu(menu: Menu): Boolean {
Expand All @@ -73,24 +56,11 @@ class FAQActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelected
var intent = Intent(this, MainActivity::class.java)
startActivity(intent)
}
R.id.nav_maps -> {
// set activity to maps

var intent = Intent(this, MapsActivity::class.java)
startActivity(intent)
}
R.id.nav_faq -> {
// already here
}
R.id.nav_schedule -> {
// set activity to schedule
var intent = Intent(this, ScheduleActivity::class.java)
startActivity(intent)
}

}
val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout)
drawerLayout.closeDrawer(GravityCompat.START)

return true
}
}
45 changes: 45 additions & 0 deletions app/src/main/java/com/spartahack/spartahack_android/FAQFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.spartahack.spartahack_android

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.text.HtmlCompat
import androidx.fragment.app.Fragment
import com.spartahack.spartahack_android.scripts.faqMainSuspend
import kotlinx.android.synthetic.main.faq_view.*
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import kotlinx.coroutines.runBlocking


class FAQFragment(private val fragment_id:Int) : Fragment(fragment_id) {
private lateinit var faqDisplay: String

override fun onCreate(savedInstanceState: Bundle?) {
// Makes the API call and sends the data to the activity.
val displayString = GlobalScope.async { faqMainSuspend() }

// Store the string so that the API call will not have to be made again.
runBlocking { faqDisplay = displayString.await() }
super.onCreate(savedInstanceState)
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(fragment_id, container, false)
}

override fun onStart() {
faqTextView.text = HtmlCompat.fromHtml(faqDisplay, 0)
super.onStart()
}

override fun onResume() {
faqTextView.text = HtmlCompat.fromHtml(faqDisplay, 0)
super.onResume()
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.spartahack.spartahack_android

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.spartahack.spartahack_android.tools.Timer
import kotlinx.android.synthetic.main.home_view.*
import java.lang.System.currentTimeMillis

/**
* The home fragment is the default page for the app. It displays a timer which counts down to the
* start of the event, and displays the schedule beneath it.
*
* fragment_id: [Int] must be the LAYOUT id (R.layout.home_view) for the XML file which contains the
* layout for the home fragment.
*/
class HomeFragment(private val fragment_id:Int) : Fragment(fragment_id) {

private lateinit var timer: Timer
// 3/27/20 @ 6:00 PM, the start of the event.
private val END_DATE_MILLS = 1585346400000

// Inflates the view for the fragment.
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(fragment_id, container, false)
}

override fun onStart() {
// Initialize the timer.
val currentDate = currentTimeMillis()
val endTimeMills = END_DATE_MILLS - currentDate
val timer = Timer(endTimeMills, 1000, timer_text)
timer.start()

super.onStart()
}

override fun onResume() {
// Initialize the timer.
val currentDate = currentTimeMillis()
val endTimeMills = END_DATE_MILLS - currentDate
val timer = Timer(endTimeMills, 1000, timer_text)
timer.start()

super.onResume()
}

}
Loading