Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

+ click location icon to pan the map to center.

  • Loading branch information...
commit 54bbaf2e74bfe726f7029ef392b56c8d3ec17775 1 parent b2f92a5
@mariotaku authored
View
10 assets/mapview.html
@@ -48,6 +48,16 @@
map.panTo(getLatLng(latitude, longitude));
}
+ function center() {
+ var latitude = 0;
+ var longitude = 0;
+ if (window.android) {
+ latitude = window.android.getLatitude();
+ longitude = window.android.getLongitude();
+ }
+ setCenter(latitude, longitude);
+ }
+
function setMark(latitude, longitude) {
var latlng = getLatLng(latitude, longitude);
var marker = new google.maps.Marker({
View
2  res/values-hi/strings.xml
@@ -92,7 +92,7 @@
<string name="reply_to">को उत्तर दें <xliff:g id="user_name">%s</xliff:g></string>
<string name="quote_user">उद्धरण <xliff:g id="user_name">%s</xliff:g></string>
<string name="time_source"><xliff:g id="time">%1$s</xliff:g>, द्वारा <xliff:g id="source">%2$s</xliff:g></string>
- <string name="source"><xliff:g id="source"> %s </xliff:g> के द्वारा</string>
+ <string name="source"><xliff:g id="source">%s</xliff:g> के द्वारा</string>
<string name="filter">फ़िल्टर</string>
<string name="users">उपयोगकर्ता</string>
<string name="keywords">खोजशब्दों</string>
View
2  res/values-hu/strings.xml
@@ -91,7 +91,7 @@
<string name="retweeted_by"><xliff:g id="user_name">%s</xliff:g> retweetelte ezt</string>
<string name="retweeted_by_with_count"><xliff:g id="user_name">%1$s</xliff:g> és másik <xliff:g id="retweet_count">%2$d</xliff:g> felhasználó retweetelte ezt</string>
<string name="reply_to">Válasz neki: <xliff:g id="user_name">%s</xliff:g></string>
- <string name="quote_user">Idézet <xliff:g id="user_name">: %s </xliff:g></string>
+ <string name="quote_user">Idézet: <xliff:g id="user_name">%s</xliff:g></string>
<string name="time_source"><xliff:g id="time">%1$s</xliff:g>, via <xliff:g id="source">%2$s</xliff:g></string>
<string name="source">via <xliff:g id="source">%s</xliff:g></string>
<string name="filter">Szűrő</string>
View
2  res/values-id/strings.xml
@@ -96,7 +96,7 @@
<string name="reply_to">Balasan untuk <xliff:g id="user_name">%s</xliff:g></string>
<string name="quote_user">Mengutip <xliff:g id="user_name">%s</xliff:g></string>
<string name="time_source"><xliff:g id="time">%1$s</xliff:g>, via <xliff:g id="source">%2$s</xliff:g></string>
- <string name="source">melalui <xliff:g id="source"> %s </xliff:g></string>
+ <string name="source">melalui <xliff:g id="source">%s</xliff:g></string>
<string name="filter">Filter</string>
<string name="users">Pengguna</string>
<string name="keywords">Kata kunci</string>
View
10 res/values-it/strings.xml
@@ -35,7 +35,7 @@
<string name="error_already_logged_in">Hai già effettuato il login.</string>
<string name="no_account_selected">È necessario selezionare almeno un account.</string>
<string name="error_unknown_error">Errore: Errore sconosciuto, questo è probabilmente un bug.</string>
- <string name="error_message">Errore: <xliff:g id="message"> %s </xliff:g></string>
+ <string name="error_message">Errore: <xliff:g id="message">%s</xliff:g></string>
<string name="error_message_with_action">Errore durante <xliff:g id="action">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g></string>
<string name="error_message_rate_limit">Superato limite di Twitter durante <xliff:g id="action">%1$s</xliff:g>, riprovare tra <xliff:g id="time">%2$s</xliff:g></string>
<string name="select_account">Seleziona account</string>
@@ -95,10 +95,10 @@
<string name="dark_theme_summary">Usa il tema scuro per Twidere.</string>
<string name="display_profile_image">Mostra immagine profilo</string>
<string name="image_load_summary">Disabilitando questo sarà aumentata la velocità di scorrimento della lista e ridotto l\'uso di traffico.</string>
- <string name="in_reply_to">Risposta a <xliff:g id="username"> %s </xliff:g></string>
+ <string name="in_reply_to">Risposta a <xliff:g id="username">%s</xliff:g></string>
<string name="retweeted_by">Retwittato da <xliff:g id="user_name">%s</xliff:g></string>
<string name="retweeted_by_with_count">Retwittato da <xliff:g id="user_name">%1$s</xliff:g> e da altri<xliff:g id="retweet_count">%2$d</xliff:g></string>
- <string name="reply_to">Risposta a <xliff:g id="user_name"> %s </xliff:g></string>
+ <string name="reply_to">Risposta a <xliff:g id="user_name">%s</xliff:g></string>
<string name="quote_user">Citazione di <xliff:g id="user_name">%s</xliff:g></string>
<string name="time_source"><xliff:g id="time">%1$s</xliff:g>, via <xliff:g id="source">%2$s</xliff:g></string>
<string name="source">via <xliff:g id="source">%s</xliff:g></string>
@@ -167,7 +167,7 @@
<string name="overwrite_confirm">File esistente, sovrascrivere?</string>
<string name="save_as">Salva come</string>
<string name="please_wait">Attendere prego.</string>
- <string name="file_saved_to">File salvato in <xliff:g id="filename"> %s </xliff:g>.</string>
+ <string name="file_saved_to">File salvato in <xliff:g id="filename">%s</xliff:g>.</string>
<string name="proxy">Proxy</string>
<string name="http_proxy">HTTP Proxy</string>
<string name="http_proxy_summary">Utilizza il HTTP Proxy per tutte le richieste di rete.</string>
@@ -282,7 +282,7 @@
<string name="show_absolute_time">Visualizza il tempo assoluto</string>
<string name="show_absolute_time_summary">Visualizza il tempo assoluto nei tweets</string>
<string name="mute_source">Muta sorgente</string>
- <string name="source_muted">Aggiunto \"<xliff:g id="source"> %s </xliff:g>\" all\'elenco dei filtri. Non vedrete i tweets da questa fonte nella timeline o tra le menzioni.</string>
+ <string name="source_muted">Aggiunto \"<xliff:g id="source">%s</xliff:g>\" all\'elenco dei filtri. Non vedrete i tweets da questa fonte nella timeline o tra le menzioni.</string>
<string name="user_mentions">Menzioni utente</string>
<string name="dual_pane_layout">Layout a doppio riquadro</string>
<string name="landscape">Landscape</string>
View
4 res/values-ko/strings.xml
@@ -152,7 +152,7 @@
<string name="overwrite_confirm">파일이 이미 존재합니다. 덮어쓰시겠습니까?</string>
<string name="save_as">다른 이름으로 저장</string>
<string name="please_wait">기다려 주세요.</string>
- <string name="file_saved_to"><xliff:g id="filename"> %s </xliff:g>로 저장 합니다.</string>
+ <string name="file_saved_to"><xliff:g id="filename">%s</xliff:g>로 저장 합니다.</string>
<string name="proxy">Proxy</string>
<string name="http_proxy">HTTP Proxy</string>
<string name="http_proxy_summary">모든 네트워크 요청에 HTTP 프록시를 사용.</string>
@@ -239,4 +239,4 @@
<string name="api_upgrade_notice_title">매우 중요합니다!</string>
<string name="api_upgrade_notice_message">트위터가 API 1.1버젼을 공개하였습니다.\n\n Twidere는 이번 버젼부터 API 1.1버젼을 사용합니다.\n\n 지금 그대로 사용하시면 많은 오류가 발생할 수 있으므로, *반드시*다시 로그인하시길 바랍니다.\n\n&lt;API 1.1에서의 변경점&gt;\n*사용 제한 기준이 강화되었습니다. 대표적으로,이제는 15분동안 단 15번만 타임라인 새로고침이 가능합니다.\n누가 당신의 트윗을 리트윗했는지 볼 수 없으며,당신에게 리트윗된 트윗 역시 볼 수 없습니다.\n*Twidere를 StatusNet 클라이언트로 사용중이시라면, API 변경으로 많은 기능들이 없어질 것입니다. \m\n불편을 드려 죄송합니다. 하지만 트위터가 서드파티 앱을 죽이려 하고 있어서, 저는 아무것도 할 수 없습니다.</string>
-</resources>
+</resources>
View
2  res/values-nl/strings.xml
@@ -92,7 +92,7 @@
<string name="reply_to">Antwoord aan <xliff:g id="user_name">%s</xliff:g>;</string>
<string name="quote_user">Quote <xliff:g id="user_name">%s</xliff:g>;</string>
<string name="time_source"><xliff:g id="time">%1$s</xliff:g>, via <xliff:g id="source">%2$s</xliff:g>;</string>
- <string name="source">via <xliff:g id="source"> %s </xliff:g></string>
+ <string name="source">via <xliff:g id="source">%s</xliff:g></string>
<string name="filter">Filter</string>
<string name="users">Gebruikers</string>
<string name="keywords">Trefwoorden</string>
View
14 src/org/mariotaku/twidere/activity/MapViewerActivity.java
@@ -23,6 +23,7 @@
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.fragment.NativeMapFragment;
import org.mariotaku.twidere.fragment.WebMapFragment;
+import org.mariotaku.twidere.util.MapInterface;
import android.net.Uri;
import android.os.Bundle;
@@ -34,8 +35,6 @@
public class MapViewerActivity extends FragmentActivity implements Constants, OnClickListener {
- private Fragment mFragment;
-
@Override
public void onClick(final View view) {
switch (view.getId()) {
@@ -44,6 +43,9 @@ public void onClick(final View view) {
break;
}
case R.id.center: {
+ final Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.map_frame);
+ if (!(fragment instanceof MapInterface)) break;
+ ((MapInterface) fragment).center();
break;
}
}
@@ -73,13 +75,13 @@ protected void onCreate(final Bundle savedInstanceState) {
finish();
return;
}
- mFragment = isNativeMapSupported() ? new NativeMapFragment() : new WebMapFragment();
- mFragment.setArguments(bundle);
+ final Fragment fragment = isNativeMapSupported() ? new NativeMapFragment() : new WebMapFragment();
+ fragment.setArguments(bundle);
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
- ft.replace(R.id.map_frame, mFragment).commit();
+ ft.replace(R.id.map_frame, fragment).commit();
}
- private boolean isNativeMapSupported() {
+ private static boolean isNativeMapSupported() {
try {
Class.forName("com.google.android.maps.MapActivity");
Class.forName("com.google.android.maps.MapView");
View
24 src/org/mariotaku/twidere/activity/NativeMapActivity.java
@@ -40,6 +40,17 @@
private MapView mMapView;
+ public void center() {
+ final Bundle extras = getIntent().getExtras();
+ if (extras == null || !extras.containsKey(INTENT_KEY_LATITUDE) || !extras.containsKey(INTENT_KEY_LONGITUDE))
+ return;
+ final double lat = extras.getDouble(INTENT_KEY_LATITUDE, 0.0), lng = extras
+ .getDouble(INTENT_KEY_LONGITUDE, 0.0);
+ final GeoPoint gp = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
+ final MapController mc = mMapView.getController();
+ mc.animateTo(gp);
+ }
+
@Override
protected boolean isRouteDisplayed() {
return false;
@@ -48,18 +59,15 @@ protected boolean isRouteDisplayed() {
@Override
protected void onCreate(final Bundle icicle) {
super.onCreate(icicle);
- final Bundle bundle = getIntent().getExtras();
- if (bundle == null || !bundle.containsKey(INTENT_KEY_LATITUDE) || !bundle.containsKey(INTENT_KEY_LONGITUDE)) {
+ final Bundle extras = getIntent().getExtras();
+ if (extras == null || !extras.containsKey(INTENT_KEY_LATITUDE) || !extras.containsKey(INTENT_KEY_LONGITUDE)) {
finish();
return;
}
- mMapView = new MapView(this, GOOGLE_MAPS_API_KEY) {
- {
- setClickable(true);
- }
- };
+ mMapView = new MapView(this, GOOGLE_MAPS_API_KEY);
+ mMapView.setClickable(true);
final List<Overlay> overlays = mMapView.getOverlays();
- final double lat = bundle.getDouble(INTENT_KEY_LATITUDE, 0.0), lng = bundle
+ final double lat = extras.getDouble(INTENT_KEY_LATITUDE, 0.0), lng = extras
.getDouble(INTENT_KEY_LONGITUDE, 0.0);
final GeoPoint gp = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
final Drawable d = getResources().getDrawable(R.drawable.ic_map_marker);
View
10 src/org/mariotaku/twidere/fragment/NativeMapFragment.java
@@ -20,8 +20,16 @@
package org.mariotaku.twidere.fragment;
import org.mariotaku.twidere.activity.NativeMapActivity;
+import org.mariotaku.twidere.util.MapInterface;
-public class NativeMapFragment extends ActivityHostFragment<NativeMapActivity> {
+public class NativeMapFragment extends ActivityHostFragment<NativeMapActivity> implements MapInterface {
+
+ public void center() {
+ final NativeMapActivity a = getAttachedActivity();
+ if (a == null) return;
+ a.center();
+ }
+
@Override
protected Class<NativeMapActivity> getActivityClass() {
View
10 src/org/mariotaku/twidere/fragment/WebMapFragment.java
@@ -19,6 +19,8 @@
package org.mariotaku.twidere.fragment;
+import org.mariotaku.twidere.util.MapInterface;
+
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
@@ -27,13 +29,19 @@
import android.webkit.WebSettings;
import android.webkit.WebView;
-public class WebMapFragment extends WebViewFragment {
+public class WebMapFragment extends WebViewFragment implements MapInterface {
private final Uri mUri = Uri.parse("file:///android_asset/mapview.html");
private double latitude, longitude;
@Override
+ public void center() {
+ final WebView webview = getWebView();
+ webview.loadUrl("javascript:center();");
+ }
+
+ @Override
public void onActivityCreated(final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getLocation();
View
7 src/org/mariotaku/twidere/util/MapInterface.java
@@ -0,0 +1,7 @@
+package org.mariotaku.twidere.util;
+
+public interface MapInterface {
+
+ public void center();
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.