Commit 1de63587 authored by Niklas Fix's avatar Niklas Fix 🎓

implement #14

parent c70fc6b0
Pipeline #1972 failed with stages
in 76 minutes and 34 seconds
......@@ -24,7 +24,7 @@
<option name="values">
<map>
<entry key="color" value="000000" />
<entry key="imagePath" value="C:\Users\Niklas\AppData\Local\Temp\baseline_code_24.xml" />
<entry key="imagePath" value="C:\Users\Niklas\AppData\Local\Temp\baseline_chevron_right_24.xml" />
<entry key="opacityPercent" value="80" />
</map>
</option>
......@@ -36,7 +36,7 @@
<PersistentState>
<option name="values">
<map>
<entry key="url" value="jar:file:/C:/Android/Android%20Studio/plugins/android/lib/android.jar!/images/material/icons/materialicons/code/baseline_code_24.xml" />
<entry key="url" value="jar:file:/C:/Android/Android%20Studio/plugins/android/lib/android.jar!/images/material/icons/materialicons/chevron_right/baseline_chevron_right_24.xml" />
</map>
</option>
</PersistentState>
......@@ -68,7 +68,7 @@
</option>
<option name="values">
<map>
<entry key="outputName" value="ic_code" />
<entry key="outputName" value="ic_chewron_right" />
<entry key="theme" value="CUSTOM" />
<entry key="themeColor" value="000000" />
</map>
......
......@@ -62,7 +62,7 @@
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".features.dashboard.settings.SettingsActivity"
android:name="de.akamu.tudarmstadt.features.settings.SettingsActivity"
android:label="@string/title_activity_settings"
android:parentActivityName=".features.dashboard.MainActivity"
android:screenOrientation="portrait" />
......
......@@ -2,6 +2,7 @@ package de.akamu.tudarmstadt.data.duel
import android.os.AsyncTask
import de.akamu.tudarmstadt.api.V2APIDuel
import de.akamu.tudarmstadt.exceptions.AkamuAPIException
import de.akamu.tudarmstadt.model.Duel
import de.akamu.tudarmstadt.model.Pool
import de.akamu.tudarmstadt.model.Round
......@@ -153,6 +154,9 @@ class DuelDataSourceImpl : DuelDataSource {
return try {
V2APIDuel.submitOptionAnswer(roundID, questionID, selected)
true
} catch (ae: AkamuAPIException) {
errorMessage = ae.message!!
ae.code == 403
} catch (e: Exception) {
errorMessage = e.message!!
false
......
......@@ -2,16 +2,10 @@ package de.akamu.tudarmstadt.features.dashboard
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.util.Log
import android.view.View
import android.widget.Toast
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentTransaction
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.google.android.gms.tasks.OnCompleteListener
import com.google.firebase.iid.FirebaseInstanceId
import de.akamu.tudarmstadt.BaseActivity
import de.akamu.tudarmstadt.R
import de.akamu.tudarmstadt.custom.NextLevelReachedAnimation
......@@ -19,7 +13,7 @@ import de.akamu.tudarmstadt.custom.ProgressBarAddNewPointsAnimation
import de.akamu.tudarmstadt.data.user.UserDataSourceImpl
import de.akamu.tudarmstadt.features.dashboard.duels.DuelListFragment
import de.akamu.tudarmstadt.features.dashboard.memorystore.MemoryStoreFragment
import de.akamu.tudarmstadt.features.dashboard.settings.SettingsActivity
import de.akamu.tudarmstadt.features.settings.SettingsActivity
import de.akamu.tudarmstadt.features.dashboard.training.TrainingFragment
import de.akamu.tudarmstadt.features.login.LoginActivity
import de.akamu.tudarmstadt.features.profile.ProfileActivity
......
......@@ -12,6 +12,7 @@ import com.google.android.material.snackbar.Snackbar
import de.akamu.tudarmstadt.BaseActivity
import de.akamu.tudarmstadt.R
import de.akamu.tudarmstadt.data.user.UserDataSourceImpl
import de.akamu.tudarmstadt.features.settings.SettingsActivity
import de.akamu.tudarmstadt.features.login.LoginActivity
import de.akamu.tudarmstadt.features.password.ChangePasswordActivity
import de.akamu.tudarmstadt.features.questionpools.QuestionPoolsActivity
......@@ -51,6 +52,8 @@ class ProfileActivity : BaseActivity(), ProfileContract.View, AvatarBottomSheetF
change_title_edit.setOnClickListener { presenter.startChangeTitle() }
change_subjects_btn.setOnClickListener { presenter.startQuestionPoolsActivity() }
change_password_btn.setOnClickListener { presenter.startChangePassword() }
app_settings_btn.setOnClickListener { presenter.startAppSettings() }
app_settings_edit.setOnClickListener { presenter.startAppSettings() }
useravatar_profile.setOnClickListener { showBottomSheet() }
useravatar_edit_profile.setOnClickListener{ showBottomSheet() }
}
......@@ -79,6 +82,10 @@ class ProfileActivity : BaseActivity(), ProfileContract.View, AvatarBottomSheetF
startActivity(Intent(this, ChangePasswordActivity::class.java))
}
override fun navigateToAppSettings() {
startActivity(Intent(this, SettingsActivity::class.java))
}
/**
* Fill the profile screen with the user's information
*/
......
......@@ -34,6 +34,11 @@ interface ProfileContract {
*/
fun navigateToLogin()
/**
* Start the AkamuPreferencesActivity
*/
fun navigateToAppSettings()
/**
* Let the user know that loading all avatars failed due to [reason]
*
......@@ -92,6 +97,12 @@ interface ProfileContract {
*/
fun startChangePassword()
/**
* Start the AkamuPreferencesActivity
*
*/
fun startAppSettings()
/**
* Updates the user in the server
*
......
......@@ -33,6 +33,10 @@ class ProfilePresenter(private var view: ProfileContract.View?, private val inte
view?.navigateToChangePassword()
}
override fun startAppSettings() {
view?.navigateToAppSettings()
}
override fun updateUserInServer(user: User) {
interactor.updateUserInServer(user, object : UserDataSource.UpdateUserCallback{
override fun onUpdateUserSuccess() {
......
package de.akamu.tudarmstadt.features.dashboard.settings
package de.akamu.tudarmstadt.features.settings
import android.os.Bundle
import android.view.MenuItem
......
package de.akamu.tudarmstadt.features.dashboard.settings
package de.akamu.tudarmstadt.features.settings
import android.content.Intent
import android.os.Bundle
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#000000"
android:alpha="0.8">
<path
android:fillColor="@android:color/white"
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
</vector>
......@@ -301,6 +301,63 @@
android:id="@+id/sep6"
style="@style/Divider"/>
<TextView
android:id="@+id/title_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin_top"
android:layout_marginTop="32dp"
android:layout_marginBottom="@dimen/profile_section_title"
android:text="@string/more"
android:textColor="#aaaaaa"
android:textStyle="bold"/>
<View
android:id="@+id/sep7"
style="@style/Divider"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/app_settings_btn"
style="@style/TextButtonRipple"
android:layout_width="match_parent"
android:layout_height="51dp"
android:background="@android:color/transparent"
android:paddingStart="@dimen/activity_margin_top"
android:paddingEnd="@dimen/activity_margin_top"
android:text="@string/app_settings"
android:textAlignment="textStart"
android:textAllCaps="false"
android:textColor="@color/darkText"
android:textSize="18sp"
android:textStyle="normal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="@+id/app_settings_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:contentDescription="@string/change_your_password"
android:src="@drawable/ms_ic_chevron_right"
android:text="@string/app_settings"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/app_settings_btn"
app:layout_constraintHorizontal_bias="0.954"
app:layout_constraintStart_toStartOf="@+id/app_settings_btn"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id="@+id/sep8"
style="@style/Divider"/>
<Button
android:id="@+id/button_sign_out"
style="@style/AppButtonBorders"
......
......@@ -245,4 +245,5 @@
<string name="password_ok">Password OK!</string>
<string name="passwords_match">Passwords match.</string>
<string name="email_valid">Email is valid</string>
<string name="more">More</string>
</resources>
......@@ -301,4 +301,6 @@
<string name="password_ok">Password OK!</string>
<string name="passwords_match">Passwords match.</string>
<string name="email_valid">Email is valid</string>
<string name="more">More</string>
<string name="app_settings">App Settings</string>
</resources>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment