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

make star icon clickable #1478

Merged
merged 5 commits into from
Jul 13, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions app/src/main/java/de/westnordost/streetcomplete/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

Expand Down Expand Up @@ -247,6 +248,9 @@ public void onServiceDisconnected(ComponentName className)
downloadProgressBar = findViewById(R.id.download_progress);
downloadProgressBar.setMax(1000);

RelativeLayout starMenu = findViewById(R.id.uploadedAnswersContainer);
starMenu.setOnClickListener(this::starInfoMenu);

mapFragment = (QuestsMapFragment) getSupportFragmentManager().findFragmentById(R.id.map_fragment);
mapFragment.getMapAsync(BuildConfig.MAPZEN_API_KEY);
updateMapQuestOffsets();
Expand Down Expand Up @@ -1120,6 +1124,20 @@ private void onLocationRequestFinished(LocationState withLocationState)
}
}

// ---------------------------------------------------------------------------------------------

/** Menu raised by clicking on the star icon */
public void starInfoMenu(View view) {
String message = getString(R.string.about_contributing) + "\n\n" + getString(R.string.about_missing_stars);
if(answersCounter.waitingForUpload() + answersCounter.uploaded() == 0){
message = getString(R.string.how_to_get_stars) + "\n\n" + getString(R.string.about_contributing);
}
new AlertDialog.Builder(MainActivity.this)
.setMessage(message)
.show();
}


// ---------------------------------------------------------------------------------------------

/** Does not necessarily mean that the user has internet. But if he is not connected, he will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ public Integer waitingForUpload(){
return unsynced;
}

public Integer uploaded(){
return unsynced;
}

@SuppressLint("StaticFieldLeak") public void update()
{
new AsyncTask<Void, Void, Void>()
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
android:paddingEnd="12dp"
android:clipChildren="false"
android:minWidth="84dp"
android:gravity="center_vertical">
android:gravity="center_vertical"
android:clickable="true">

<ProgressBar
android:id="@+id/uploadedAnswersProgress"
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -661,4 +661,7 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards
<string name="quest_ferry_motor_vehicle_name_title">Does %s transport motor vehicles?</string>
<string name="quest_ferry_motor_vehicle_title">Does this ferry route transport motor vehicles?</string>
<string name="create_new_note_hint">Best write the note in the locally spoken language or otherwise in English.</string>
<string name="about_contributing">Your answers are directly improving OpenStreetMap. Contributed data is open, everyone can use it. Many great projects are already using it.</string>
<string name="about_missing_stars">Currently star count is not shared across devices, but answers are added directly to the OpenStreetMap database.</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    <string name="about_missing_stars">Currently, the star count is not shared across devices, but answers are added directly to the OpenStreetMap database.</string>
    <string name="how_to_get_stars">Choose one of the markers on the map and answer the question. This way you will improve OpenStreetMap data and get stars. If you see no markers you may need to zoom in or out the map.</string>

(I have no idea if my adapted syntax is functional.)

<string name="how_to_get_stars">Select one of markers on the map and answer the question. This way you will improve OpenStreetMap data and get stars. If you see no markers you may need to zoom out map.</string>
</resources>