Parcourir la source

fix: title wasn't showing when empty string provided

beautusg il y a 7 ans
Parent
commit
660787301b

+ 1 - 3
app/src/main/java/com/sduduzog/slimlauncher/ui/main/NoteFragment.kt

@@ -36,9 +36,7 @@ class NoteFragment : BaseFragment() {
 
     override fun onActivityCreated(savedInstanceState: Bundle?) {
         super.onActivityCreated(savedInstanceState)
-        note.title?.let {
-            note_fragment_title.text = it
-        }
+        note.title?.let { if (it.isNotBlank()) note_fragment_title.text = it }
         note_fragment_body.text = note.body
         val bundle = Bundle()
         bundle.putSerializable(getString(R.string.nav_key_note), note)

+ 5 - 6
app/src/main/res/layout/notes_fragment.xml

@@ -22,10 +22,8 @@
 
     <TextView
         android:id="@+id/notes_fragment_create_note"
-        android:layout_width="0dp"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginStart="@dimen/_8sdp"
-        android:layout_marginLeft="@dimen/_8sdp"
         android:layout_marginTop="@dimen/_8sdp"
         android:layout_marginEnd="@dimen/_8sdp"
         android:layout_marginRight="@dimen/_8sdp"
@@ -35,15 +33,16 @@
         android:textAppearance="@style/TextAppearance.AppCompat"
         android:textSize="@dimen/_18ssp"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/notes_fragment_title" />
+        app:layout_constraintBottom_toBottomOf="@id/notes_fragment_title"
+        app:layout_constraintTop_toTopOf="@+id/notes_fragment_title" />
 
     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/notes_fragment_list"
         android:layout_width="0dp"
-        android:layout_height="wrap_content"
+        android:layout_height="0dp"
         android:layout_marginTop="@dimen/_8sdp"
         app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+        app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/notes_fragment_create_note"

+ 1 - 49
app/src/main/res/values/strings.xml

@@ -52,61 +52,13 @@
     <string name="menu_remove">Remove</string>
     <string name="choose_theme_dialog_title">Choose Theme</string>
     <string name="home_fragment_tasks">Tasks</string>
-    <string name="notes_fragment_create_new_note">Create new</string>
+    <string name="notes_fragment_create_new_note">Create</string>
     <string name="add_apps_fragment_search_apps">Search apps</string>
     <string name="tasks_fragment_list_item_complete">&lt;strike>%s&lt;/strike></string>
     <string name="tasks_fragment_sort">Sort</string>
     <string name="tasks_fragment_clear_completed_tasks">Clear completed tasks</string>
     <string name="tasks_fragment_enter_a_new_task">Enter a new task</string>
 
-    <string name="test_string">"About Codeo
-Why do we do what we do?
-We love learning and solving challenging problems in an innovative way. We love that technology lets small teams solve big problems.
-We want to leverage what we love and what we are good at to make a positive impact on the way people live and work.
-Our Vision
-Our vision is to create an environment where world class people master their craft while creating remarkable products that change the world.
-Our Values
-To be effective together, we align around a shared set of values:
-Be Excellent We invest care in our work and hone our skills, because how you do anything reflects how you do everything.
-Value Human Experience We care deeply about how people experience our work, whether they are customers, suppliers or coworkers.
-Innovate We constantly push boundaries, moving forward by seeking change and challenging old ideas.
-Be Strategic We think big-picture and long-term so that our work can have the greatest impact.
-Take Ownership We take ownership of challenges. We\'re responsible. We don\'t pass the buck. Be Genuine We are genuine people.
-We are honest, authentic &amp; trustworthy. 
-In pursuing this vision together, adhering to these values, we believe that we will fulfill our purpose and make a significant contribution to the world. 
-More about our Core Values
-Be Excellent - We invest care in our work and hone our skills, because how you do anything reflects how you do everything.
-We care deeply about the work we do, no matter its form. We believe that how one does anything is a reflection of how one does everything.
-We enjoy the process and believe one can be creative in even the most simplest of tasks.
-We care about  detail and believe that this attention reflects the respect we have for others.
-We want to be proud of each deliverable, no matter what it is.
-Value Human Experience We care deeply about how people experience our work, whether they are customers, suppliers or coworkers.
-It\'s not all about the code. We care deeply about the presentation of our work and the human experience.
-We also care about the internals, and value the perspective that other engineers\/designers would have if they reviewed our work.
-We believe in a solid balance of engineering, user experience and the presentation of our work.
-We do not deliver anything that isn\'t underpinned with an investment in these three areas. This is what makes us unique.
-Innovate We constantly push boundaries because we love learning and transforming ideas into reality.
-We evolve through innovation. We value ideation and innovation and the impact it has on the evolution of our work.
-Innovation means a better way of doing something. Innovation means an opportunity to do something differently.
-Innovation means we are learning. We are constantly evolving through innovation. It's not something we do sometimes. 
-Be Strategic We think big-picture and long-term so that our work can have the greatest impact
-We believe in always thinking long term and about solving the right problems.
-We invest in ideas, people, processes and tools that deal with challenges in a sustainable way.
-We ask Why? before What? or How? because we want to invest in things that align with our values and purpose. 
-Take Ownership We take ownership of challenges. We're responsible. We don't pass the buck.
-We demonstrate ownership in everything we do. We take the initiative and don't wait for others to act.
-We care about the outcomes and take the lead, particularly when dealing with the results of our own actions.
-Taking ownership demonstrates to others that they can trust us to do the right thing.
-Because of this, outsiders describe us as responsible or trustworthy.
-Be Genuine We are genuine people. We are honest, authentic &amp; trustworthy. 
-We are genuine. We don't pretend to be something we are not. We demonstrate that we are genuine through our actions.
-We actively listen to others. We are honest. We are sincere. We care. When we express gratitude, it is genuine.
-When we present critiques, we do so in a positive manner.
-Other things we care deeply about:
-Efficacy We hone our skills and optimize our tools to make the best use of the time we have.
-Being effective means more time can be invested in being creative. You cannot scale creativity or be effective at it.
-Because of this, we are ruthless at driving efficiency and automating the rote so we can spend more time on the problems that really challenge us."
-</string>
     <string name="edit_note_fragment_save">SAVE</string>
     <string name="edit_note_fragment_untitled">Untitled</string>
     <string name="note_fragment_edit">EDIT</string>