Skip to content

Commit

Permalink
Improves dark mode stylings.
Browse files Browse the repository at this point in the history
  • Loading branch information
coderPaddyS committed Nov 4, 2023
1 parent d56d613 commit 8f12714
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
package org.secuso.privacyfriendlynotes.ui.adapter

import android.opengl.Visibility
import android.preference.PreferenceManager
import android.text.Html
import android.util.Log
Expand All @@ -35,8 +34,7 @@ import org.secuso.privacyfriendlynotes.ui.main.MainActivityViewModel
* @see org.secuso.privacyfriendlynotes.ui.RecycleActivity
*/
class NoteAdapter(private val mainActivityViewModel: MainActivityViewModel) : RecyclerView.Adapter<NoteAdapter.NoteHolder>() {
private var notes: List<Note> = ArrayList()
private val notesFilteredList: List<Note> = ArrayList()
private var notes: MutableList<Note> = ArrayList()
private var listener: ((Note) -> Unit)? = null
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NoteHolder {
val itemView = LayoutInflater.from(parent.context)
Expand All @@ -57,6 +55,10 @@ class NoteAdapter(private val mainActivityViewModel: MainActivityViewModel) : Re
holder.textViewDescription.text = ""
val pref = PreferenceManager.getDefaultSharedPreferences(holder.itemView.context)
holder.textViewDescription.visibility = if (pref.getBoolean("settings_show_preview", true)) View.VISIBLE else View.GONE
holder.textViewExtraText.visibility = View.GONE
holder.textViewExtraText.text = null
holder.imageViewcategory.visibility = View.GONE
holder.imageViewcategory.setImageResource(0)
when (currentNote.type) {
DbContract.NoteEntry.TYPE_TEXT -> {
holder.textViewDescription.text = Html.fromHtml(currentNote.content)
Expand Down Expand Up @@ -100,7 +102,8 @@ class NoteAdapter(private val mainActivityViewModel: MainActivityViewModel) : Re
}

fun setNotes(notes: List<Note>) {
this.notes = notes
this.notes.clear()
this.notes.addAll(notes)
notifyDataSetChanged()
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_sketch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
android:layout_height="0dp"
android:layout_weight="1"
android:id="@+id/draw_view"
android:background="@drawable/border"
android:background="?attr/colorSurface"
android:padding="3dp"/>

</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_category.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black"
android:textColor="?attr/colorOnBackground"
android:textSize="20sp"
android:layout_margin="10dp"/>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/menu/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
android:id="@+id/action_sort_alphabetical"
android:orderInCategory="100"
android:title="@string/action_sort_alphabetical"
android:icon="@drawable/ic_sort_by_alpha_white_24dp"
android:icon="@drawable/ic_sort_by_alpha_icon_24dp"
app:showAsAction="ifRoom" />
</menu>

0 comments on commit 8f12714

Please sign in to comment.