Added more bugs

This commit is contained in:
kubasz 2019-08-11 15:58:02 +02:00
parent e1ad455f67
commit cf7976481f
13 changed files with 242 additions and 101 deletions

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RenderSettings">
<option name="showDecorations" value="true" />
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -8,7 +8,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme.Light">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@ -1,7 +1,8 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<pl.szczodrzynski.navlib.NavView
android:layout_width="match_parent"
@ -10,7 +11,7 @@
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:text="booton" />
<Switch
@ -19,9 +20,45 @@
android:layout_height="wrap_content"
android:text="Switch" />
<ProgressBar
android:id="@+id/progressBar2"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.google.android.material.card.MaterialCardView
style="@style/Widget.MaterialComponents.CardView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iconImageView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:contentDescription="Card Icon"
app:tint="?attr/colorOnSurface" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/titleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textAppearance="?attr/textAppearanceHeadline6"
android:textColor="?attr/colorOnSurface"
tools:text="Title" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</pl.szczodrzynski.navlib.NavView>
</FrameLayout>

View File

@ -5,4 +5,7 @@
<color name="colorPrimaryLight">#6EC6FF</color>
<color name="colorAccent">#4caf50</color>
<color name="colorSection">#4CAF50</color>
<color name="white">#ffffff</color>
<color name="black">#121212</color>
</resources>

View File

@ -1,18 +1,55 @@
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="AppTheme" parent="NavView">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimaryLight</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorPrimary">#64b5f6</item>
<item name="colorPrimaryDark">#1976d2</item>
<item name="colorPrimaryVariant">#1976d2</item>
<item name="colorAccent">#ba68c8</item>
<item name="colorSecondary">#ba68c8</item>
<item name="colorSecondaryVariant">#9c27b0</item>
<item name="android:colorBackground">@color/black</item>
<item name="colorSurface">#1f1f1f</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">?android:colorBackground</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">?colorPrimaryDark</item>
<item name="colorOnPrimary">#000000</item>
<item name="colorOnSecondary">#000000</item>
<item name="colorOnBackground">#ffffff</item>
<item name="colorOnSurface">#ffffff</item>
<item name="nv_actionBarBackground">?colorSurface</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.Light" parent="NavView.Light">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorPrimary">#2196f3</item>
<item name="colorPrimaryDark">#1976d2</item>
<item name="colorPrimaryVariant">#90caf9</item>
<item name="colorAccent">#ba68c8</item>
<item name="colorSecondary">#ba68c8</item>
<item name="colorSecondaryVariant">#9c27b0</item>
<item name="android:colorBackground">@color/white</item>
<item name="android:windowBackground">?android:colorBackground</item>
<item name="colorSurface">#ffffff</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">?android:colorBackground</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">?colorPrimaryDark</item>
<item name="colorOnPrimary">#000000</item>
<item name="colorOnSecondary">#000000</item>
<item name="colorOnBackground">#000000</item>
<item name="colorOnSurface">#000000</item>
<item name="nv_actionBarBackground">?colorSurface</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>

View File

@ -12,6 +12,8 @@ android {
versionName "1.0"
consumerProguardFiles 'consumer-rules.pro'
vectorDrawables.useSupportLibrary = true
}
buildTypes {
@ -28,6 +30,6 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha09'
implementation "androidx.legacy:legacy-support-v4:1.0.0"
}

View File

@ -4,23 +4,28 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.MotionEvent.INVALID_POINTER_ID
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.view.MotionEventCompat
import androidx.core.widget.NestedScrollView
import androidx.customview.widget.ViewDragHelper
import com.google.android.material.bottomappbar.BottomAppBar
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_COLLAPSED
import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_HIDDEN
import com.google.android.material.floatingactionbutton.FloatingActionButton
class NavView : LinearLayout {
class NavView : FrameLayout {
private var contentView: LinearLayout? = null
private lateinit var bottomAppBar: BottomAppBar
private lateinit var floatingActionButton: FloatingActionButton
private lateinit var scrimView: View
private lateinit var bottomSheet: View
private lateinit var bottomSheet: NestedScrollView
private lateinit var bottomSheetBehavior: BottomSheetBehavior<View>
private var bottomSheetVisible = false
@ -56,7 +61,7 @@ class NavView : LinearLayout {
contentView = findViewById<LinearLayout>(R.id.nv_content)
findViewById<TextView>(R.id.textView).text = "${displayWidth}dp x ${displayHeight}dp"
//findViewById<TextView>(R.id.textView).text = "${displayWidth}dp x ${displayHeight}dp"
bottomAppBar = findViewById(R.id.nv_bottomAppBar)
floatingActionButton = findViewById(R.id.nv_floatingActionButton)
@ -64,16 +69,18 @@ class NavView : LinearLayout {
bottomSheet = findViewById(R.id.nv_bottomSheet)
bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet)
bottomSheetBehavior.state = STATE_HIDDEN
bottomAppBar.setOnTouchListener { v, event ->
bottomSheet.dispatchTouchEvent(event)
false
}
scrimView.setOnTouchListener { v, event ->
if (event.action == MotionEvent.ACTION_UP && bottomSheetVisible) {
if (event.action == MotionEvent.ACTION_UP && bottomSheetBehavior.state != STATE_HIDDEN) {
bottomSheetBehavior.state = STATE_HIDDEN
}
false
true
}
bottomSheetBehavior.setBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
@ -90,7 +97,6 @@ class NavView : LinearLayout {
}
})
floatingActionButton.setOnClickListener {
if (bottomSheetBehavior.state == STATE_HIDDEN) {
bottomSheetBehavior.state = STATE_COLLAPSED
@ -100,8 +106,15 @@ class NavView : LinearLayout {
}
}
}
override fun addView(child: View?, index: Int, params: ViewGroup.LayoutParams?) {
if (contentView == null) {
super.addView(child, index, params)

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topLeftRadius="16dp"
android:topRightRadius="16dp" />
<solid android:color="?colorBackgroundFloating" />
</shape>

View File

@ -12,41 +12,79 @@
android:layout_marginTop="8dp"
android:background="@drawable/bottom_sheet_controll_bar" />
<androidx.core.widget.NestedScrollView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
android:orientation="vertical">
<LinearLayout
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:text="Button" />
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<CalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="48dp"
app:srcCompat="@android:drawable/checkbox_on_background" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<SearchView
android:layout_width="match_parent"
android:layout_height="match_parent">
</SearchView>
<Switch
android:id="@+id/switch1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Switch" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
app:srcCompat="@drawable/ic_android" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</LinearLayout>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout 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:layout_width="match_parent"
@ -7,19 +7,20 @@
android:orientation="vertical"
tools:parentTag="FrameLayout">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
android:visibility="gone" />
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?nv_actionBarBackground"
app:title="@string/app_name" /><!--style="@style/Widget.MaterialComponents.Toolbar.Surface"-->
</com.google.android.material.appbar.AppBarLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom">
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/nv_content"
@ -28,27 +29,7 @@
android:layout_gravity="center"
android:layout_marginTop="?actionBarSize"
android:layout_marginBottom="?actionBarSize"
android:orientation="vertical"
android:visibility="gone">
<Button
android:id="@+id/button5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
android:orientation="vertical" />
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/nv_bottomAppBar"
@ -70,35 +51,42 @@
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<View
android:id="@+id/nv_scrim"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/scrimBackground"
android:visibility="invisible"
tools:visibility="invisible" />
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minWidth="300dp">
<!--style="@style/width_max_600dp"-->
android:layout_height="match_parent">
<View
android:id="@+id/nv_scrim"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99000000"
android:visibility="invisible"
tools:visibility="visible" />
<androidx.core.widget.NestedScrollView
android:id="@+id/nv_bottomSheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minWidth="300dp"
android:background="?colorBackgroundFloating"
style="@style/width_max_600dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
app:behavior_hideable="true"
app:behavior_peekHeight="200dp"
app:behavior_peekHeight="500dp"
app:layout_behavior="@string/bottom_sheet_behavior">
<include
layout="@layout/bottom_sheet_fragment_theme_info"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:background="@drawable/bottom_sheet_background"
android:paddingStart="8dp"
android:paddingEnd="8dp">
<include
layout="@layout/bottom_sheet_fragment_theme_info"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</merge>
</FrameLayout>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="nv_actionBarBackground" format="color" />
</resources>

View File

@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="NavView" parent="Theme.MaterialComponents">
<style name="NavView" parent="Theme.MaterialComponents.NoActionBar">
</style>
<style name="NavView.Light" parent="Theme.MaterialComponents.Light">
<style name="NavView.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
</style>
<style name="width_max_600dp">
<item name="android:layout_width">match_parent</item>
</style>