forked from upstream-mirrors/OpenTracks
Update marker list and marker detail title
This commit is contained in:
@@ -175,7 +175,9 @@ limitations under the License.
|
|||||||
</activity>
|
</activity>
|
||||||
<activity android:name="com.google.android.apps.mytracks.MarkerEditActivity" />
|
<activity android:name="com.google.android.apps.mytracks.MarkerEditActivity" />
|
||||||
<activity android:name="com.google.android.apps.mytracks.MarkerDetailActivity" />
|
<activity android:name="com.google.android.apps.mytracks.MarkerDetailActivity" />
|
||||||
<activity android:name="com.google.android.apps.mytracks.MarkerListActivity" >
|
<activity
|
||||||
|
android:label="@string/menu_markers"
|
||||||
|
android:name="com.google.android.apps.mytracks.MarkerListActivity" >
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.app.default_searchable"
|
android:name="android.app.default_searchable"
|
||||||
android:value="com.google.android.apps.mytracks.SearchListActivity" />
|
android:value="com.google.android.apps.mytracks.SearchListActivity" />
|
||||||
|
|||||||
@@ -1084,7 +1084,14 @@ limitations under the License.
|
|||||||
%1$d number. E.g., '1'.">
|
%1$d number. E.g., '1'.">
|
||||||
Split %1$d
|
Split %1$d
|
||||||
</string>
|
</string>
|
||||||
|
<string name="marker_title"
|
||||||
|
translation_description="The title of the marker detail page.
|
||||||
|
|
||||||
|
%1$d position. E.g., '1'.
|
||||||
|
%1$d totalt. E.g., '5'.">
|
||||||
|
%1$d of %2$d
|
||||||
|
</string>
|
||||||
|
|
||||||
<!-- Marker Detail -->
|
<!-- Marker Detail -->
|
||||||
<string name="marker_detail_statistics_title"
|
<string name="marker_detail_statistics_title"
|
||||||
translation_description="In the marker detail page, the title for the statistics section
|
translation_description="In the marker detail page, the title for the statistics section
|
||||||
|
|||||||
@@ -130,7 +130,8 @@ public class MarkerDetailActivity extends AbstractMyTracksActivity implements De
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
return MarkerDetailFragment.newInstance(markerIds.get(position));
|
String title = getString(R.string.marker_title, position + 1, getCount());
|
||||||
|
return MarkerDetailFragment.newInstance(markerIds.get(position), title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -61,9 +61,10 @@ import android.widget.TextView;
|
|||||||
*/
|
*/
|
||||||
public class MarkerDetailFragment extends Fragment {
|
public class MarkerDetailFragment extends Fragment {
|
||||||
|
|
||||||
public static MarkerDetailFragment newInstance(long markerId) {
|
public static MarkerDetailFragment newInstance(long markerId, String title) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putLong(KEY_MARKER_ID, markerId);
|
bundle.putLong(KEY_MARKER_ID, markerId);
|
||||||
|
bundle.putString(KEY_TITLE, title);
|
||||||
|
|
||||||
MarkerDetailFragment fragment = new MarkerDetailFragment();
|
MarkerDetailFragment fragment = new MarkerDetailFragment();
|
||||||
fragment.setArguments(bundle);
|
fragment.setArguments(bundle);
|
||||||
@@ -72,6 +73,7 @@ public class MarkerDetailFragment extends Fragment {
|
|||||||
|
|
||||||
private static final String TAG = MarkerDetailFragment.class.getSimpleName();
|
private static final String TAG = MarkerDetailFragment.class.getSimpleName();
|
||||||
private static final String KEY_MARKER_ID = "markerId";
|
private static final String KEY_MARKER_ID = "markerId";
|
||||||
|
private static final String KEY_TITLE = "title";
|
||||||
private static final long HIDE_TEXT_DELAY = 4000L; // 4 seconds
|
private static final long HIDE_TEXT_DELAY = 4000L; // 4 seconds
|
||||||
|
|
||||||
private MyTracksProviderUtils myTracksProviderUtils;
|
private MyTracksProviderUtils myTracksProviderUtils;
|
||||||
@@ -158,6 +160,14 @@ public class MarkerDetailFragment extends Fragment {
|
|||||||
handler.removeCallbacks(hideText);
|
handler.removeCallbacks(hideText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUserVisibleHint(boolean isVisibleToUser) {
|
||||||
|
super.setUserVisibleHint(isVisibleToUser);
|
||||||
|
if (isVisibleToUser) {
|
||||||
|
getActivity().setTitle(getArguments().getString(KEY_TITLE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMenuVisibility(boolean menuVisible) {
|
public void setMenuVisibility(boolean menuVisible) {
|
||||||
super.setMenuVisibility(menuVisible);
|
super.setMenuVisibility(menuVisible);
|
||||||
@@ -190,10 +200,10 @@ public class MarkerDetailFragment extends Fragment {
|
|||||||
String photoUrl = waypoint.getPhotoUrl();
|
String photoUrl = waypoint.getPhotoUrl();
|
||||||
boolean hasPhoto = photoUrl != null && !photoUrl.equals("");
|
boolean hasPhoto = photoUrl != null && !photoUrl.equals("");
|
||||||
menu.findItem(R.id.marker_detail_view_photo).setVisible(hasPhoto);
|
menu.findItem(R.id.marker_detail_view_photo).setVisible(hasPhoto);
|
||||||
|
|
||||||
TrackIconUtils.setMenuIconColor(menu);
|
TrackIconUtils.setMenuIconColor(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
long markerId = getArguments().getLong(KEY_MARKER_ID);
|
long markerId = getArguments().getLong(KEY_MARKER_ID);
|
||||||
|
|||||||
Reference in New Issue
Block a user