Skip to content

Commit

Permalink
Merge pull request #509 from pennlabs/dark-mode
Browse files Browse the repository at this point in the history
Dark mode
  • Loading branch information
mgarciaferreiro authored Jan 22, 2020
2 parents 310a6bd + af6ac3f commit 3a4002e
Show file tree
Hide file tree
Showing 45 changed files with 972 additions and 1,110 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
12 changes: 7 additions & 5 deletions PennMobile/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'io.fabric.tools:gradle:1.26.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand All @@ -34,11 +34,11 @@ android {
}
release {}
}
compileSdkVersion 28
buildToolsVersion '28.0.3'
compileSdkVersion 29
buildToolsVersion '29.0.0'
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
targetSdkVersion 29
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
Expand All @@ -61,7 +61,6 @@ dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.maps:google-maps-services:0.10.2'
implementation 'org.jsoup:jsoup:1.12.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.1.0'
Expand Down Expand Up @@ -90,5 +89,8 @@ dependencies {
implementation 'com.github.ahorn:android-rss:master-SNAPSHOT'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// official release is several years old and is not thread-safe

implementation 'com.github.bumptech.glide:glide:4.8.0' // Glide for gif loading
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}

7 changes: 1 addition & 6 deletions PennMobile/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:usesCleartextTraffic="true"
android:theme="@style/AppTheme.Launcher">
<uses-library
android:name="com.google.android.maps"
Expand Down Expand Up @@ -62,12 +63,6 @@
android:name="com.crashlytics.ApiKey"
android:value="18a765536e6539a73a15dd36c369ed29cfb91aa1" />

<activity
android:name=".LaundrySettingsActivity"
android:label="@string/laundry_settings"
android:screenOrientation="portrait"
android:theme="@style/LaundryTheme" />

<!-- receiver for laundry -->
<receiver
android:name=".LaundryBroadcastReceiver"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.pennapps.labs.pennmobile

import android.content.Intent
import android.content.res.Configuration
import android.net.Uri
import android.os.Build
import android.os.Bundle
Expand All @@ -11,40 +12,69 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.webkit.WebView
import androidx.core.view.ViewCompat
import com.pennapps.labs.pennmobile.adapters.AboutAdapter

import kotlinx.android.synthetic.main.fragment_about.view.*
import com.bumptech.glide.Glide
import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.GlideException
import com.bumptech.glide.load.resource.gif.GifDrawable
import com.bumptech.glide.request.RequestListener
import kotlinx.android.synthetic.main.fragment_about.*
import kotlinx.android.synthetic.main.fragment_about.view.logo_gif_iv
import android.graphics.drawable.Animatable
import android.graphics.drawable.Drawable
import android.R.attr.animation
import android.graphics.drawable.AnimatedVectorDrawable

class AboutFragment : Fragment() {

private lateinit var mActivity: MainActivity

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(activity as MainActivity).closeKeyboard()
mActivity = activity as MainActivity
mActivity.closeKeyboard()
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val v = inflater.inflate(R.layout.fragment_about, container, false)

val gif = v.logo_gif_iv?.drawable
if (Build.VERSION.SDK_INT > 20 && gif is AnimatedVectorDrawable) {
gif.start()
} else {
Glide.with(this).asGif().load(R.drawable.logo_gif_transparent).listener(object : RequestListener<GifDrawable> {
override fun onLoadFailed(e: GlideException?, model: Any?, target: com.bumptech.glide.request.target.Target<GifDrawable>?, isFirstResource: Boolean): Boolean {
return false
}
override fun onResourceReady(resource: GifDrawable, model: Any, target: com.bumptech.glide.request.target.Target<GifDrawable>?, dataSource: DataSource, isFirstResource: Boolean): Boolean {
resource.setLoopCount(1)
return false
}
}).into(v.logo_gif_iv)
}

v.our_team_rv?.layoutManager = GridLayoutManager(context, 3)
val members = arrayListOf("Marta García Ferreiro", "Davies Lumumba",
"Sahit Penmatcha", "Varun Ramakrishnan", "Anna Wang", "Sophia Ye")
v.our_team_rv?.adapter = AboutAdapter(members)
ViewCompat.setNestedScrollingEnabled(v.our_team_rv, false)

v.learn_more_btn?.setOnClickListener {
val i = Intent(Intent.ACTION_VIEW, Uri.parse("https://pennlabs.org"))
startActivity(i)
}

v.licenses_btn?.setOnClickListener {
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_licenses, null) as WebView
val view = LayoutInflater.from(mActivity).inflate(R.layout.dialog_licenses, null) as WebView
view.loadUrl("file:///android_asset/open_source_licenses.html")
if (activity != null) {
AlertDialog.Builder(activity!!, R.style.Theme_AppCompat_Light_Dialog_Alert)
.setTitle(getString(R.string.action_licenses))
.setView(view)
.setPositiveButton(android.R.string.ok, null)
.show()
}
AlertDialog.Builder(mActivity, R.style.Theme_AppCompat_Light_Dialog_Alert)
.setTitle(getString(R.string.action_licenses))
.setView(view)
.setPositiveButton(android.R.string.ok, null)
.show()
}

return v
Expand All @@ -55,7 +85,7 @@ class AboutFragment : Fragment() {
(activity as MainActivity).removeTabs()
activity?.setTitle(R.string.about)
if (Build.VERSION.SDK_INT > 17) {
(activity as MainActivity)?.setSelectedTab(12)
(activity as MainActivity).setSelectedTab(12)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.pennapps.labs.pennmobile

import android.os.Build
import android.os.Bundle
import android.preference.PreferenceManager
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import android.view.LayoutInflater
Expand All @@ -11,6 +9,7 @@ import android.view.ViewGroup
import android.widget.Button
import android.widget.EditText
import android.widget.Toast
import androidx.preference.PreferenceManager
import com.pennapps.labs.pennmobile.api.Labs
import com.pennapps.labs.pennmobile.classes.GSRBookingResult
import kotlinx.android.synthetic.main.gsr_details_book.view.*
Expand Down Expand Up @@ -39,10 +38,10 @@ class BookGsrFragment : Fragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {arguments ->
gsrID = arguments.getString("gsrID")
gsrLocationCode = arguments.getString("gsrLocationCode")
startTime = arguments.getString("startTime")
endTime = arguments.getString("endTime")
gsrID = arguments.getString("gsrID") ?: ""
gsrLocationCode = arguments.getString("gsrLocationCode") ?: ""
startTime = arguments.getString("startTime") ?: ""
endTime = arguments.getString("endTime") ?: ""
}
mLabs = MainActivity.getLabsInstance()
activity?.let {activity ->
Expand Down Expand Up @@ -76,25 +75,16 @@ class BookGsrFragment : Fragment() {
lastNameEt.setText(lastName)
emailEt.setText(email)

submit?.let { submit ->
submit.setOnClickListener {
firstNameEt?.let {firstNameEt ->
lastNameEt?.let { lastNameEt ->
emailEt?.let {emailEt ->
if (firstNameEt.text.toString().matches("".toRegex()) || lastNameEt.text.toString().matches("".toRegex())
|| emailEt.text.toString().matches("".toRegex())) {
Toast.makeText(activity, "Please fill in all fields before booking",
Toast.LENGTH_LONG).show()
} else if (!emailEt.text.toString().matches("""[\w]+@(seas\.|sas\.|wharton\.|nursing\.)?upenn\.edu""".toRegex())) {
Toast.makeText(activity, "Please enter a valid Penn email", Toast.LENGTH_LONG).show()
} else {
bookGSR(Integer.parseInt(gsrID), Integer.parseInt(gsrLocationCode), startTime, endTime)
}
}
}
}
submit.setOnClickListener {
if (firstNameEt.text.toString().matches("".toRegex()) || lastNameEt.text.toString().matches("".toRegex())
|| emailEt.text.toString().matches("".toRegex())) {
Toast.makeText(activity, "Please fill in all fields before booking",
Toast.LENGTH_LONG).show()
} else if (!emailEt.text.toString().matches("""[\w]+@(seas\.|sas\.|wharton\.|nursing\.)?upenn\.edu""".toRegex())) {
Toast.makeText(activity, "Please enter a valid Penn email", Toast.LENGTH_LONG).show()
} else {
bookGSR(Integer.parseInt(gsrID), Integer.parseInt(gsrLocationCode), startTime, endTime)
}
return v
}
return v
}
Expand All @@ -104,7 +94,7 @@ class BookGsrFragment : Fragment() {
var sessionID = ""
activity?.let { activity ->
val sp = PreferenceManager.getDefaultSharedPreferences(activity)
sessionID = sp.getString(getString(R.string.huntsmanGSR_SessionID), "")
sessionID = sp.getString(getString(R.string.huntsmanGSR_SessionID), "") ?: ""
}

mLabs?.let { mLabs ->
Expand Down
Loading

0 comments on commit 3a4002e

Please sign in to comment.