mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-01-30 08:25:01 +01:00
show location in status details
This commit is contained in:
parent
b2bd90dc29
commit
4049c9cbeb
@ -110,6 +110,7 @@ public class OpenStreetMapViewerActivity extends BaseActionBarActivity implement
|
||||
setContentView(R.layout.activity_osm_viewer);
|
||||
mMapView.setMultiTouchControls(true);
|
||||
mMapView.setBuiltInZoomControls(true);
|
||||
mMapView.setTilesScaledToDpi(true);
|
||||
final List<Overlay> overlays = mMapView.getOverlays();
|
||||
final GeoPoint gp = new GeoPoint((int) (latitude * 1E6), (int) (longitude * 1E6));
|
||||
final Drawable d = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_map_marker, null);
|
||||
|
@ -74,6 +74,7 @@ import org.mariotaku.twidere.loader.support.StatusRepliesLoader;
|
||||
import org.mariotaku.twidere.model.ListResponse;
|
||||
import org.mariotaku.twidere.model.ParcelableAccount;
|
||||
import org.mariotaku.twidere.model.ParcelableAccount.ParcelableCredentials;
|
||||
import org.mariotaku.twidere.model.ParcelableLocation;
|
||||
import org.mariotaku.twidere.model.ParcelableMedia;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.model.SingleResponse;
|
||||
@ -944,7 +945,7 @@ public class StatusFragment extends BaseSupportFragment
|
||||
private final View mediaPreviewLoad;
|
||||
private final LinearLayout mediaPreviewGrid;
|
||||
|
||||
private final View locationContainer;
|
||||
private final TextView locationView;
|
||||
private final TwitterCardContainer twitterCard;
|
||||
|
||||
public DetailStatusViewHolder(StatusAdapter adapter, View itemView) {
|
||||
@ -969,7 +970,7 @@ public class StatusFragment extends BaseSupportFragment
|
||||
mediaPreviewContainer = itemView.findViewById(R.id.media_preview);
|
||||
mediaPreviewLoad = itemView.findViewById(R.id.media_preview_load);
|
||||
mediaPreviewGrid = (LinearLayout) itemView.findViewById(R.id.media_preview_grid);
|
||||
locationContainer = itemView.findViewById(R.id.location_container);
|
||||
locationView = (TextView) itemView.findViewById(R.id.location_view);
|
||||
profileContainer = itemView.findViewById(R.id.profile_container);
|
||||
twitterCard = (TwitterCardContainer) itemView.findViewById(R.id.twitter_card);
|
||||
|
||||
@ -1010,6 +1011,13 @@ public class StatusFragment extends BaseSupportFragment
|
||||
}
|
||||
break;
|
||||
}
|
||||
case R.id.location_view: {
|
||||
final ParcelableStatus status = adapter.getStatus(getAdapterPosition());
|
||||
final ParcelableLocation location = status.location;
|
||||
if (!ParcelableLocation.isValidLocation(location)) return;
|
||||
Utils.openMap(adapter.getContext(), location.latitude, location.longitude);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1069,6 +1077,7 @@ public class StatusFragment extends BaseSupportFragment
|
||||
}
|
||||
timeSourceView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
locationView.setVisibility(ParcelableLocation.isValidLocation(status.location) ? View.VISIBLE : View.GONE);
|
||||
|
||||
retweetsContainer.setVisibility(!status.user_is_protected ? View.VISIBLE : View.GONE);
|
||||
repliesContainer.setVisibility(status.reply_count < 0 ? View.GONE : View.VISIBLE);
|
||||
@ -1138,11 +1147,13 @@ public class StatusFragment extends BaseSupportFragment
|
||||
profileContainer.setOnClickListener(this);
|
||||
retweetsContainer.setOnClickListener(this);
|
||||
retweetedByContainer.setOnClickListener(this);
|
||||
locationView.setOnClickListener(this);
|
||||
|
||||
final float defaultTextSize = adapter.getTextSize();
|
||||
nameView.setTextSize(defaultTextSize * 1.25f);
|
||||
textView.setTextSize(defaultTextSize * 1.25f);
|
||||
screenNameView.setTextSize(defaultTextSize * 0.85f);
|
||||
locationView.setTextSize(defaultTextSize * 0.85f);
|
||||
timeSourceView.setTextSize(defaultTextSize * 0.85f);
|
||||
}
|
||||
|
||||
|
@ -181,47 +181,21 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/location_container"
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/location_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
|
||||
<org.mariotaku.twidere.view.MapImageView
|
||||
android:id="@+id/map_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_map"
|
||||
android:contentDescription="@string/location"
|
||||
android:duplicateParentState="true"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/location_background_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/location_view"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignTop="@+id/location_view"
|
||||
android:alpha="0.5"
|
||||
android:background="?cardItemBackgroundColor"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/location_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:drawableLeft="@drawable/ic_indicator_location"
|
||||
android:drawablePadding="4dp"
|
||||
android:duplicateParentState="true"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:singleLine="true"
|
||||
android:text="@string/view_map"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</RelativeLayout>
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:drawableLeft="@drawable/ic_indicator_location"
|
||||
android:drawablePadding="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:singleLine="true"
|
||||
android:text="@string/view_map"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
Loading…
x
Reference in New Issue
Block a user