Skip to content

Commit

Permalink
Material You Support
Browse files Browse the repository at this point in the history
  • Loading branch information
MahmoudRH committed Aug 2, 2022
1 parent bf06512 commit 7492c5c
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 6 deletions.
17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "com.mahmoudrh.roomxml"
minSdk 22
targetSdk 31
versionCode 1
versionName "1.0"
versionCode 3
versionName "1.0.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Binary file modified app/release/D-Note.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0",
"versionCode": 2,
"versionName": "1.0.1",
"outputFile": "app-release.apk"
}
],
Expand Down
16 changes: 16 additions & 0 deletions app/src/main/java/com/mahmoudrh/roomxml/adapters/NotesAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.cardview.widget.CardView
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.color.DynamicColors
import com.google.android.material.elevation.SurfaceColors
import com.mahmoudrh.roomxml.R
import com.mahmoudrh.roomxml.data.Note
import com.mahmoudrh.roomxml.utils.DateFormatter
Expand All @@ -19,6 +21,7 @@ class NotesAdapter(


class NotesHolder(item: View) : RecyclerView.ViewHolder(item) {
val noteEdge:View
val title: TextView
val content: TextView
val date: TextView
Expand All @@ -28,6 +31,7 @@ class NotesAdapter(
content = item.findViewById(R.id.tv_content)
date = item.findViewById(R.id.tv_date)
card = item.findViewById(R.id.note_card)
noteEdge = item.findViewById(R.id.note_edge)
}
}

Expand All @@ -37,6 +41,18 @@ class NotesAdapter(
}

override fun onBindViewHolder(holder: NotesHolder, position: Int) {

// holder.noteEdge.setBackgroundColor(com.google.android.material.R.color.design_default_color_primary)
/* if (DynamicColors.isDynamicColorAvailable())
holder.noteEdge.setBackgroundResource(com.google.android.material.R.color.material_dynamic_primary50)
else
holder.noteEdge.setBackgroundResource(R.color.purple_500)*/

holder.noteEdge.setBackgroundResource(
if (DynamicColors.isDynamicColorAvailable()) com.google.android.material.R.color.material_dynamic_primary50
else R.color.purple_500
)

holder.title.text = notesList[position].title
holder.content.text = notesList[position].content
holder.date.text = DateFormatter.formatDate(notesList[position].date)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.mahmoudrh.roomxml.application

import android.app.Application
import android.content.Context
import com.google.android.material.color.DynamicColors
import com.mahmoudrh.roomxml.BuildConfig
import com.mahmoudrh.roomxml.R
import com.mahmoudrh.roomxml.data.NotesDB
Expand Down Expand Up @@ -44,4 +45,9 @@ class NotesApplication: Application() {
}
}
}

override fun onCreate() {
super.onCreate()
DynamicColors.applyToActivitiesIfAvailable(this)
}
}
3 changes: 2 additions & 1 deletion app/src/main/res/layout/item_notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@


<View
android:id="@+id/note_edge"
android:layout_width="0dp"
android:layout_weight=".2"
android:background="@color/purple_500"
android:background="@color/design_default_color_primary"
android:layout_height="match_parent"/>

<LinearLayout
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- <item name="android:statusBarColor" >?attr/colorPrimaryVariant</item>-->
<!-- Customize your theme here. -->
<item name="android:windowIsTranslucent"> true</item>
</style>
<style name="Theme.Material3.Light.Dialog" />
</resources>

0 comments on commit 7492c5c

Please sign in to comment.