Commit 12b60d35 authored by Niklas Fix's avatar Niklas Fix 🎓

fix #7 and #11

parent 32e75ea0
Pipeline #1925 failed with stages
in 1 minute and 46 seconds
......@@ -5,7 +5,7 @@
"entities": [
{
"id": "1:4720043437448546018",
"lastPropertyId": "13:7210474573444229449",
"lastPropertyId": "14:1703234935781492023",
"name": "User",
"properties": [
{
......@@ -78,6 +78,12 @@
"id": "13:7210474573444229449",
"name": "password",
"type": 9
},
{
"id": "14:1703234935781492023",
"name": "level",
"type": 5,
"flags": 4
}
],
"relations": []
......
......@@ -12,11 +12,19 @@ import okhttp3.Response;
public class UnauthorizedInterceptor implements Interceptor {
private volatile boolean isLoggedOut = false;
@Override
public Response intercept(@NonNull Chain chain) throws IOException {
Response response = chain.proceed(chain.request());
if (response.code() == 401) {
EventBus.getDefault().post(UnauthorizedEvent.instance());
isLoggedOut = false;
synchronized (this) {
if (!isLoggedOut) {
EventBus.getDefault().post(UnauthorizedEvent.instance());
isLoggedOut = true;
}
}
}
return response;
}
......
......@@ -175,8 +175,11 @@ class MainActivity : BaseActivity(), DashboardContract.View, NextLevelEventHandl
override fun onLoadUserSuccess(user: User) {
this.user = user
AppUserUtil.updateLocalAppUser(user, this)
ProgressBarAddNewPointsAnimation.animate(progressbar_mainactivity_lvl, AppUserUtil.getUserProgress(user).toInt(), this)
fillProfile()
ProgressBarAddNewPointsAnimation.animate(progressbar_mainactivity_lvl, AppUserUtil.getUserProgress(user), this)
user.let {
textview_mainactivity_username.text = it.username
textview_mainactivity_title.text = it.title.name
}
}
override fun onLoadUserFail(reason: String) {
......@@ -196,6 +199,8 @@ class MainActivity : BaseActivity(), DashboardContract.View, NextLevelEventHandl
imageview_mainactivity_next_lvl.setImageResource(R.drawable.oval_white)
textview_mainactivity_next_lvl.setTextColor(ContextCompat.getColor(this, R.color.akamu_blue))
progressbar_mainactivity_lvl.progress = 0
ProgressBarAddNewPointsAnimation.animate(progressbar_mainactivity_lvl, AppUserUtil.getUserProgress(user!!).toInt(), this)
textView_dashboard_level.text = user?.level.toString()
textview_mainactivity_next_lvl.text = user?.level?.plus(1).toString()
ProgressBarAddNewPointsAnimation.animate(progressbar_mainactivity_lvl, AppUserUtil.getUserProgress(user!!), this)
}
}
......@@ -9,25 +9,25 @@
android:layout_marginTop="@dimen/fab_margin"
android:orientation="vertical">
<TextView
<Button
android:id="@+id/button_questionlongansfragment_answer1"
style="@style/QuestionLongAnswer"
android:text="Answer 1"
tools:ignore="HardcodedText" />
<TextView
<Button
android:id="@+id/button_questionlongansfragment_answer2"
style="@style/QuestionLongAnswer"
android:text="Answer 2"
tools:ignore="HardcodedText" />
<TextView
<Button
android:id="@+id/button_questionlongansfragment_answer3"
style="@style/QuestionLongAnswer"
android:text="Answer 3"
tools:ignore="HardcodedText" />
<TextView
<Button
android:id="@+id/button_questionlongansfragment_answer4"
style="@style/QuestionLongAnswer"
android:text="Answer 4"
......
......@@ -94,6 +94,7 @@
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_weight">1.0</item>
<item name="android:textAllCaps">false</item>
<item name="android:background">@drawable/button_answer_ripple</item>
<item name="android:padding">8dp</item>
<item name="android:textColor">@android:color/white</item>
......
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