Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Fix minor problems (#1082)
Browse files Browse the repository at this point in the history
- Crash in MainActivity when pressing the back button
- Rainbow logo was not shown even if logo was enabled
  • Loading branch information
thellmund authored and kordianbruck committed Sep 17, 2018
1 parent 215718a commit 84462ef
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ object NavigationManager {
fun onBackPressed(current: Activity): Boolean {
val isTopLevel = current::class.java in topLevelActivities
val showDrawer = current.intent.extras?.getBoolean(Const.SHOW_DRAWER) ?: false
val parentName = current.parentActivityIntent.component.className
val parentName = current.parentActivityIntent?.component?.className

if (isTopLevel && showDrawer && parentName == MainActivity::class.java.name) {
val intent = Intent(current, MainActivity::class.java).apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,16 @@ private void initEasterEgg() {

// use the other logo and invert the setting
boolean rainbowEnabled = Utils.getSettingBool(this, Const.RAINBOW_MODE, false);
rainbowEnabled = !rainbowEnabled;
ImageView tumLogo = findViewById(R.id.startupTumLogo);

if (rainbowEnabled) {
tumLogo.setImageResource(R.drawable.tum_logo);
} else {
tumLogo.setImageResource(R.drawable.tum_logo_rainbow);
} else {
tumLogo.setImageResource(R.drawable.tum_logo_blue);
}

Utils.setSetting(this, Const.RAINBOW_MODE, !rainbowEnabled);
Utils.setSetting(this, Const.RAINBOW_MODE, rainbowEnabled);
}
});
background.setSoundEffectsEnabled(false);
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/tum_logo_blue.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="125dp"
android:height="66dp"
android:viewportHeight="66.561005"
android:viewportWidth="125.95499">
<path
android:fillColor="@color/tum_blue"
android:pathData="M87.48,66.55l12.44,0l0,-54.03l13.59,0l0,54.03l12.44,0l0,-66.55l-63.84,0l0,54.45l-13.67,0l0,-54.37l-48.44,0l0,11.78l11.29,0l0,54.7l11.86,0l0,-54.62l13.17,0l0,54.62l37.73,0l0,-54.04l13.42,0z"/>
</vector>
7 changes: 4 additions & 3 deletions app/src/main/res/layout/activity_startup.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand All @@ -10,8 +11,8 @@
android:layout_height="120dp"
android:layout_centerInParent="true"
android:layout_marginStart="@dimen/material_default_padding"
android:src="@drawable/tum_logo"
android:tint="@color/tum_blue"
android:layout_marginEnd="@dimen/material_default_padding"
android:src="@drawable/tum_logo_blue"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -34,7 +35,7 @@
<TextView
android:id="@+id/startupLoading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="19dp"
android:layout_below="@id/startupTumMotto"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/material_default_padding"
Expand Down

0 comments on commit 84462ef

Please sign in to comment.