Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explain that photos are useful [ready for review] #1452

Merged
merged 10 commits into from
Jul 7, 2019
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast

import java.io.File
import java.io.FileOutputStream
Expand All @@ -26,14 +25,20 @@ import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osmnotes.AttachPhotoUtils

import android.app.Activity.RESULT_OK
import android.database.DataSetObserver
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import de.westnordost.streetcomplete.ApplicationConstants.ATTACH_PHOTO_MAXWIDTH
import de.westnordost.streetcomplete.ApplicationConstants.ATTACH_PHOTO_QUALITY
import de.westnordost.streetcomplete.ktx.toast
import de.westnordost.streetcomplete.util.AdapterDataChangedWatcher
import kotlinx.android.synthetic.main.fragment_attach_photo.*

class AttachPhotoFragment : Fragment() {

val imagePaths: List<String> get() = noteImageAdapter.list
val imagePaths: List<String> get() = noteImageAdapter.list;
private var photosListView : RecyclerView? = null;
private var hintView : TextView? = null;

private var currentImagePath: String? = null

Expand All @@ -45,10 +50,21 @@ class AttachPhotoFragment : Fragment() {
if (!activity!!.packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
view.visibility = View.GONE
}

photosListView = view.findViewById(R.id.gridView)
hintView = view.findViewById(R.id.photosAreUsefulExplanation)
return view
}

private fun updateHintVisibility(){
if (imagePaths.isEmpty()) {
photosListView?.visibility = View.GONE;
hintView?.visibility = View.VISIBLE;
} else {
photosListView?.visibility = View.VISIBLE;
hintView?.visibility = View.GONE;
}
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

Expand All @@ -70,6 +86,8 @@ class AttachPhotoFragment : Fragment() {
false
)
gridView.adapter = noteImageAdapter
noteImageAdapter.registerAdapterDataObserver(AdapterDataChangedWatcher { updateHintVisibility() })
updateHintVisibility()
}

override fun onSaveInstanceState(outState: Bundle) {
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/layout/fragment_attach_photo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
android:contentDescription="@string/quest_leave_new_note_photo"
android:layout_centerVertical="true"/>

<TextView
android:id="@+id/photosAreUsefulExplanation"
android:layout_toEndOf="@id/takePhotoButton"
android:text="@string/quest_leave_new_note_photos_are_useful"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/gridView"
android:layout_toEndOf="@id/takePhotoButton"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<string name="quest_leave_new_note_no">"No, just hide"</string>
<string name="quest_leave_new_note_photo">Attach photo</string>
<string name="quest_leave_new_note_photo_delete_title">Do you want to delete this picture?</string>
<string name="quest_leave_new_note_photos_are_useful">Adding a photo will make the note much more useful.</string>
<string name="quest_streetName_title">"What is the name of this road?"</string>
<string name="quest_streetName_description">"as written on the street sign, abbreviations are expanded:"</string>
<string name="quest_streetName_answer_noName_confirmation_description">"Sometimes the street sign is only at one end of the street. Also, note that there may not be extra street signs for side streets that belong to a bigger street. Usually, any street with houses has a name."</string>
Expand Down