Update application branding

- Logo is now displayed next to the app name
- Remove search bar animation
- New color accent
- Improve visibility of controller binding setting's glyphs
This commit is contained in:
lynxnb 2021-10-11 17:33:48 +02:00
parent 827439d2d1
commit b7b0f07ba8
10 changed files with 37 additions and 144 deletions

View File

@ -145,10 +145,6 @@ class MainActivity : AppCompatActivity() {
addTextChangedListener(afterTextChanged = { editable -> addTextChangedListener(afterTextChanged = { editable ->
editable?.let { text -> adapter.filter.filter(text.toString()) } editable?.let { text -> adapter.filter.filter(text.toString()) }
}) })
if (!viewModel.searchBarAnimated) {
viewModel.searchBarAnimated = true
post { startTitleAnimation() }
}
} }
window.decorView.findViewById<View>(android.R.id.content).viewTreeObserver.addOnTouchModeChangeListener { isInTouchMode -> window.decorView.findViewById<View>(android.R.id.content).viewTreeObserver.addOnTouchModeChangeListener { isInTouchMode ->

View File

@ -36,8 +36,6 @@ class MainViewModel @Inject constructor(@ApplicationContext context : Context, p
private val _stateData = MutableLiveData<MainState>() private val _stateData = MutableLiveData<MainState>()
val stateData : LiveData<MainState> = _stateData val stateData : LiveData<MainState> = _stateData
var searchBarAnimated = false
/** /**
* This refreshes the contents of the adapter by either trying to load cached adapter data or searches for them to recreate a list * This refreshes the contents of the adapter by either trying to load cached adapter data or searches for them to recreate a list
* *

View File

@ -20,20 +20,6 @@ class SearchBarView @JvmOverloads constructor(context : Context, attrs : Attribu
get() = binding.searchField.text get() = binding.searchField.text
set(value) = binding.searchField.setText(value) set(value) = binding.searchField.setText(value)
fun startTitleAnimation() {
binding.motionLayout.progress = 0f
binding.motionLayout.transitionToEnd()
binding.searchField.apply {
setOnFocusChangeListener { v, hasFocus ->
if (hasFocus) {
binding.motionLayout.progress = 1f
context.getSystemService(InputMethodManager::class.java).showSoftInput(v, InputMethodManager.SHOW_IMPLICIT)
onFocusChangeListener = null
}
}
}
}
fun addTextChangedListener( fun addTextChangedListener(
beforeTextChanged : ( beforeTextChanged : (
text : CharSequence?, text : CharSequence?,

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/button_layout" android:id="@+id/button_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -50,11 +51,12 @@
android:layout_alignTop="@id/button_icon" android:layout_alignTop="@id/button_icon"
android:layout_alignEnd="@id/button_icon" android:layout_alignEnd="@id/button_icon"
android:layout_alignBottom="@id/button_icon" android:layout_alignBottom="@id/button_icon"
android:alpha="0.25" android:alpha="0.35"
android:fontFamily="monospace" android:fontFamily="monospace"
android:gravity="center" android:gravity="center"
android:includeFontPadding="false" android:includeFontPadding="false"
android:textSize="27sp" /> android:textSize="26sp"
tools:text="A" />
</RelativeLayout> </RelativeLayout>

View File

@ -77,31 +77,43 @@
app:tint="?android:attr/textColorSecondary" /> app:tint="?android:attr/textColorSecondary" />
<ImageView <ImageView
android:id="@+id/title_text" android:id="@+id/logo"
android:layout_width="match_parent" android:layout_width="36dp"
android:layout_height="30dp" android:layout_height="38dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:paddingBottom="2dp"
android:contentDescription="@string/app_name"
app:layout_constraintBottom_toBottomOf="@+id/sub_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/title_text"
app:srcCompat="@drawable/logo_skyline" />
<ImageView
android:id="@+id/title_text"
android:layout_width="0dp"
android:layout_height="24dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:contentDescription="@string/app_name"
android:scaleType="fitStart" android:scaleType="fitStart"
app:srcCompat="@drawable/skyline_text"
app:layout_constraintEnd_toStartOf="@id/refresh_icon" app:layout_constraintEnd_toStartOf="@id/refresh_icon"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/logo"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:tint="?android:attr/textColorPrimary" app:srcCompat="@drawable/skyline_text"
android:contentDescription="@string/app_name" /> app:tint="?android:attr/textColorPrimary" />
<TextView <TextView
android:id="@+id/sub_text" android:id="@+id/sub_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:fontFamily="sans-serif-medium" android:fontFamily="sans-serif-medium"
android:letterSpacing="0.1" android:letterSpacing="0.1"
android:text="@string/emulator" android:text="@string/emulator"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="12sp" android:textSize="12sp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="@+id/title_text"
app:layout_constraintTop_toBottomOf="@id/title_text" /> app:layout_constraintTop_toBottomOf="@id/title_text" />
<emu.skyline.views.SearchBarView <emu.skyline.views.SearchBarView

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/stick_layout" android:id="@+id/stick_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -48,7 +49,6 @@
android:id="@+id/stick_circle_icon" android:id="@+id/stick_circle_icon"
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="80dp" android:layout_height="80dp"
android:alpha="0.4"
android:contentDescription="@string/buttons" android:contentDescription="@string/buttons"
android:outlineProvider="bounds" android:outlineProvider="bounds"
android:src="@drawable/ic_button" android:src="@drawable/ic_button"
@ -69,7 +69,6 @@
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:layout_margin="15dp" android:layout_margin="15dp"
android:alpha="0.4"
android:contentDescription="@string/buttons" android:contentDescription="@string/buttons"
android:outlineProvider="bounds" android:outlineProvider="bounds"
android:src="@drawable/ic_stick" android:src="@drawable/ic_stick"
@ -83,12 +82,13 @@
android:layout_alignTop="@id/stick_icon" android:layout_alignTop="@id/stick_icon"
android:layout_alignEnd="@id/stick_icon" android:layout_alignEnd="@id/stick_icon"
android:layout_alignBottom="@id/stick_icon" android:layout_alignBottom="@id/stick_icon"
android:alpha="0.55" android:alpha="0.6"
android:fontFamily="monospace" android:fontFamily="monospace"
android:gravity="center" android:gravity="center"
android:includeFontPadding="false" android:includeFontPadding="false"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="27sp" /> android:textSize="26sp"
tools:text="R" />
</RelativeLayout> </RelativeLayout>

View File

@ -6,11 +6,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:parentTag="com.google.android.material.card.MaterialCardView"> tools:parentTag="com.google.android.material.card.MaterialCardView">
<androidx.constraintlayout.motion.widget.MotionLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/motion_layout" android:id="@+id/motion_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layoutDescription="@xml/view_search_bar_xml_constraintlayout_scene"
app:motionProgress="1" app:motionProgress="1"
tools:motionDebug="SHOW_ALL"> tools:motionDebug="SHOW_ALL">
@ -19,13 +18,13 @@
android:layout_width="22dp" android:layout_width="22dp"
android:layout_height="22dp" android:layout_height="22dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:contentDescription="@string/search" android:contentDescription="@string/search"
app:srcCompat="@drawable/ic_search"
app:tint="?android:attr/textColorSecondary"
android:layout_marginStart="16dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"/>
app:srcCompat="@drawable/ic_search"
app:tint="?android:attr/textColorSecondary" />
<EditText <EditText
android:id="@+id/search_field" android:id="@+id/search_field"
@ -47,14 +46,5 @@
app:layout_constraintStart_toEndOf="@id/search_icon" app:layout_constraintStart_toEndOf="@id/search_icon"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:ignore="LabelFor" /> tools:ignore="LabelFor" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/skyline_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:text="@string/app_name"
android:textColor="?android:attr/textColorPrimary"
android:textSize="18sp" />
</androidx.constraintlayout.motion.widget.MotionLayout>
</merge> </merge>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#FF4285F4</color>
<color name="backgroundColor">#FF121212</color> <color name="backgroundColor">#FF121212</color>
<color name="backgroundColorVariant">#323232</color> <color name="backgroundColorVariant">#323232</color>
</resources> </resources>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="logoBackground">#121212</color> <color name="logoBackground">#121212</color>
<color name="colorPrimary">#FFFF0000</color> <color name="colorPrimary">#FF1E58F0</color>
<color name="backgroundColor">@android:color/white</color> <color name="backgroundColor">@android:color/white</color>
<color name="backgroundColorVariant">#F8F8F8</color> <color name="backgroundColorVariant">#F8F8F8</color>
</resources> </resources>

View File

@ -1,92 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:autoTransition="none"
motion:constraintSetEnd="@+id/end"
motion:constraintSetStart="@id/start"
motion:duration="2000">
<KeyFrameSet>
<KeyPosition
motion:motionTarget="@+id/skyline_text"
motion:framePosition="50"
motion:keyPositionType="deltaRelative"
motion:percentX="0" />
<KeyPosition
motion:motionTarget="@+id/skyline_text"
motion:framePosition="90"
motion:keyPositionType="deltaRelative"
motion:percentX="1" />
<KeyAttribute
motion:motionTarget="@+id/search_field"
motion:framePosition="90"
android:alpha="0" />
<KeyAttribute
motion:motionTarget="@+id/skyline_text"
motion:framePosition="55"
android:scaleY="1"
android:scaleX="1" />
<KeyPosition
motion:motionTarget="@+id/skyline_text"
motion:framePosition="70"
motion:keyPositionType="deltaRelative"
motion:percentX="-0.5" />
</KeyFrameSet>
</Transition>
<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@+id/skyline_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
<Constraint
android:id="@+id/search_field"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:visibility="invisible"
motion:layout_constrainedWidth="true"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintHorizontal_bias="0"
motion:layout_constraintStart_toEndOf="@id/search_icon"
motion:layout_constraintTop_toTopOf="parent"
motion:transitionEasing="linear"
android:alpha="0"
motion:layout_constraintEnd_toEndOf="parent" />
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@+id/skyline_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintHorizontal_bias="0.0"
motion:layout_constraintStart_toStartOf="@id/search_field"
motion:layout_constraintTop_toTopOf="parent"
android:scaleX="0.5"
android:scaleY="0.5" />
<Constraint
android:id="@+id/search_field"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:visibility="visible"
motion:layout_constrainedWidth="true"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintHorizontal_bias="0"
motion:layout_constraintStart_toEndOf="@id/search_icon"
motion:layout_constraintTop_toTopOf="parent"
android:alpha="1"
motion:layout_constraintEnd_toEndOf="parent" />
</ConstraintSet>
</MotionScene>