1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2024-12-18 19:43:35 +01:00

fixed location validation condition

This commit is contained in:
Mariotaku Lee 2015-04-04 01:30:23 +08:00
parent 07b3ed7998
commit f13ed39058
4 changed files with 10 additions and 4 deletions

View File

@ -153,7 +153,11 @@ public class ParcelableLocation implements Serializable, Parcelable, JSONParcela
}
public boolean isValid() {
return Double.isNaN(latitude) && Double.isNaN(longitude);
return isValidLocation(latitude, longitude);
}
public static boolean isValidLocation(double latitude, double longitude) {
return !Double.isNaN(latitude) && !Double.isNaN(longitude);
}
public GeoLocation toGeoLocation() {

View File

@ -577,7 +577,7 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
final ParcelableAccount account = mSelectedAccount;
if (account != null && option.id == MENU_COMPOSE) {
final Context context = getContext();
return context.getString(R.string.tweet_with_name,
return context.getString(R.string.tweet_from_name,
UserColorNameUtils.getDisplayName(context, -1, account.name, account.screen_name));
}
return super.getTitle(position, option);

View File

@ -3012,7 +3012,7 @@ public final class Utils implements Constants, TwitterConstants {
}
public static void openMap(final Context context, final double latitude, final double longitude) {
if (context == null || !new ParcelableLocation(latitude, longitude).isValid()) return;
if (context == null || !ParcelableLocation.isValidLocation(latitude, longitude)) return;
final Uri.Builder builder = new Uri.Builder();
builder.scheme(SCHEME_TWIDERE);
builder.authority(AUTHORITY_MAP);

View File

@ -733,7 +733,9 @@
<string name="user_type_verified">Verified</string>
<string name="user_type_protected">Protected</string>
<string name="tweet_hashtag">Tweet #<xliff:g id="text">%1$s</xliff:g></string>
<string name="tweet_with_name">Tweet with<xliff:g id="text">%1$s</xliff:g></string>
<!-- 'Tweet' here is a verb -->
<string name="tweet_from_name">Tweet from <xliff:g id="text">%1$s</xliff:g></string>
</resources>