Browse Source

finish v1.0

liuyuqi-dellpc 3 years ago
parent
commit
85b0c40ded
35 changed files with 566 additions and 10 deletions
  1. 12 1
      app/src/main/AndroidManifest.xml
  2. 367 1
      app/src/main/java/me/yoqi/android/compass/MainActivity.java
  3. 54 0
      app/src/main/java/me/yoqi/android/compass/ui/CompassView.java
  4. 5 0
      app/src/main/res/drawable/background.xml
  5. 109 8
      app/src/main/res/layout/activity_main.xml
  6. BIN
      app/src/main/res/mipmap-hdpi/app_icon.png
  7. BIN
      app/src/main/res/mipmap-hdpi/background_bottom.9.png
  8. BIN
      app/src/main/res/mipmap-hdpi/background_compass.png
  9. BIN
      app/src/main/res/mipmap-hdpi/background_light.png
  10. BIN
      app/src/main/res/mipmap-hdpi/background_texture.png
  11. BIN
      app/src/main/res/mipmap-hdpi/compass.png
  12. BIN
      app/src/main/res/mipmap-hdpi/compass_cn.png
  13. BIN
      app/src/main/res/mipmap-hdpi/degree.png
  14. BIN
      app/src/main/res/mipmap-hdpi/e.png
  15. BIN
      app/src/main/res/mipmap-hdpi/e_cn.png
  16. BIN
      app/src/main/res/mipmap-hdpi/miui_cover.png
  17. BIN
      app/src/main/res/mipmap-hdpi/n.png
  18. BIN
      app/src/main/res/mipmap-hdpi/n_cn.png
  19. BIN
      app/src/main/res/mipmap-hdpi/number_0.png
  20. BIN
      app/src/main/res/mipmap-hdpi/number_1.png
  21. BIN
      app/src/main/res/mipmap-hdpi/number_2.png
  22. BIN
      app/src/main/res/mipmap-hdpi/number_3.png
  23. BIN
      app/src/main/res/mipmap-hdpi/number_4.png
  24. BIN
      app/src/main/res/mipmap-hdpi/number_5.png
  25. BIN
      app/src/main/res/mipmap-hdpi/number_6.png
  26. BIN
      app/src/main/res/mipmap-hdpi/number_7.png
  27. BIN
      app/src/main/res/mipmap-hdpi/number_8.png
  28. BIN
      app/src/main/res/mipmap-hdpi/number_9.png
  29. BIN
      app/src/main/res/mipmap-hdpi/prompt.png
  30. BIN
      app/src/main/res/mipmap-hdpi/s.png
  31. BIN
      app/src/main/res/mipmap-hdpi/s_cn.png
  32. BIN
      app/src/main/res/mipmap-hdpi/w.png
  33. BIN
      app/src/main/res/mipmap-hdpi/w_cn.png
  34. 11 0
      app/src/main/res/values-zh/strings.xml
  35. 8 0
      app/src/main/res/values/strings.xml

+ 12 - 1
app/src/main/AndroidManifest.xml

@@ -2,6 +2,10 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="me.yoqi.android.compass">
 
+    <uses-permission android:name="android.permission.VIBRATE" />
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+
+
     <application
         android:allowBackup="true"
         android:icon="@mipmap/ic_launcher"
@@ -9,12 +13,19 @@
         android:roundIcon="@mipmap/ic_launcher_round"
         android:supportsRtl="true"
         android:theme="@style/AppTheme">
-        <activity android:name=".MainActivity">
+        <activity android:name=".MainActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="portrait"
+            android:theme="@style/Theme.AppCompat.NoActionBar">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
+            <intent-filter >
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
         </activity>
     </application>
 

+ 367 - 1
app/src/main/java/me/yoqi/android/compass/MainActivity.java

@@ -1,14 +1,380 @@
 package me.yoqi.android.compass;
 
+import android.Manifest;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+import android.location.Criteria;
+import android.location.Location;
+import android.location.LocationListener;
+import android.location.LocationManager;
+import android.location.LocationProvider;
+import android.os.Bundle;
+import android.os.Handler;
+import android.text.TextUtils;
+import android.view.View;
+import android.view.ViewGroup.LayoutParams;
+import android.view.animation.AccelerateInterpolator;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
 import androidx.appcompat.app.AppCompatActivity;
+import androidx.core.app.ActivityCompat;
 
-import android.os.Bundle;
+import java.util.Locale;
+
+import me.yoqi.android.compass.ui.CompassView;
 
 public class MainActivity extends AppCompatActivity {
 
+    private final float MAX_ROATE_DEGREE = 1.0f;
+    private SensorManager mSensorManager;
+    private Sensor mOrientationSensor;
+    private LocationManager mLocationManager;
+    private String mLocationProvider;
+    private float mDirection;
+    private float mTargetDirection;
+    private AccelerateInterpolator mInterpolator;
+    protected final Handler mHandler = new Handler();
+    private boolean mStopDrawing;
+    private boolean mChinease;
+    Context mContext;
+
+    View mCompassView;
+    CompassView mPointer;
+    TextView mLocationTextView;
+    LinearLayout mDirectionLayout;
+    LinearLayout mAngleLayout;
+
+    protected Runnable mCompassViewUpdater = new Runnable() {
+        @Override
+        public void run() {
+            if (mPointer != null && !mStopDrawing) {
+                if (mDirection != mTargetDirection) {
+
+                    // calculate the short routine
+                    float to = mTargetDirection;
+                    if (to - mDirection > 180) {
+                        to -= 360;
+                    } else if (to - mDirection < -180) {
+                        to += 360;
+                    }
+
+                    // limit the max speed to MAX_ROTATE_DEGREE
+                    float distance = to - mDirection;
+                    if (Math.abs(distance) > MAX_ROATE_DEGREE) {
+                        distance = distance > 0 ? MAX_ROATE_DEGREE : (-1.0f * MAX_ROATE_DEGREE);
+                    }
+
+                    // need to slow down if the distance is short
+                    mDirection = normalizeDegree(mDirection
+                            + ((to - mDirection) * mInterpolator.getInterpolation(Math
+                            .abs(distance) > MAX_ROATE_DEGREE ? 0.4f : 0.3f)));
+                    mPointer.updateDirection(mDirection);
+                }
+
+                updateDirection();
+
+                mHandler.postDelayed(mCompassViewUpdater, 20);
+            }
+        }
+    };
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);
+        mContext = this;
+        initResources();
+        initServices();
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        //权限检测
+        if (mLocationProvider != null) {
+            if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+                // TODO: Consider calling
+                //    ActivityCompat#requestPermissions
+                // here to request the missing permissions, and then overriding
+                //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
+                //                                          int[] grantResults)
+                // to handle the case where the user grants the permission. See the documentation
+                // for ActivityCompat#requestPermissions for more details.
+                return;
+            }
+            updateLocation(mLocationManager.getLastKnownLocation(mLocationProvider));
+            mLocationManager.requestLocationUpdates(mLocationProvider, 2000, 10, mLocationListener);
+        } else {
+            mLocationTextView.setText(R.string.cannot_get_location);
+        }
+        if (mOrientationSensor != null) {
+            mSensorManager.registerListener(mOrientationSensorEventListener, mOrientationSensor,
+                    SensorManager.SENSOR_DELAY_GAME);
+        }
+        mStopDrawing = false;
+        mHandler.postDelayed(mCompassViewUpdater, 20);
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+        mStopDrawing = true;
+        if (mOrientationSensor != null) {
+            mSensorManager.unregisterListener(mOrientationSensorEventListener);
+        }
+        if (mLocationProvider != null) {
+            mLocationManager.removeUpdates(mLocationListener);
+        }
+    }
+
+    private void initResources() {
+        mDirection = 0.0f;
+        mTargetDirection = 0.0f;
+        mInterpolator = new AccelerateInterpolator();
+        mStopDrawing = true;
+        mChinease = TextUtils.equals(Locale.getDefault().getLanguage(), "zh");
+
+        mCompassView = findViewById(R.id.view_compass);
+        mPointer = (CompassView) findViewById(R.id.compass_pointer);
+        mLocationTextView = (TextView) findViewById(R.id.textview_location);
+        mDirectionLayout = (LinearLayout) findViewById(R.id.layout_direction);
+        mAngleLayout = (LinearLayout) findViewById(R.id.layout_angle);
+
+        mPointer.setImageResource(mChinease ? R.mipmap.compass_cn : R.mipmap.compass);
     }
+
+    private void initServices() {
+        // sensor manager
+        mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
+        mOrientationSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
+
+        // location manager
+        mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
+        Criteria criteria = new Criteria();
+        criteria.setAccuracy(Criteria.ACCURACY_FINE);
+        criteria.setAltitudeRequired(false);
+        criteria.setBearingRequired(false);
+        criteria.setCostAllowed(true);
+        criteria.setPowerRequirement(Criteria.POWER_LOW);
+        mLocationProvider = mLocationManager.getBestProvider(criteria, true);
+
+    }
+
+    private void updateDirection() {
+        LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+
+        mDirectionLayout.removeAllViews();
+        mAngleLayout.removeAllViews();
+
+        ImageView east = null;
+        ImageView west = null;
+        ImageView south = null;
+        ImageView north = null;
+        float direction = normalizeDegree(mTargetDirection * -1.0f);
+        if (direction > 22.5f && direction < 157.5f) {
+            // east
+            east = new ImageView(this);
+            east.setImageResource(mChinease ? R.mipmap.e_cn : R.mipmap.e);
+            east.setLayoutParams(lp);
+        } else if (direction > 202.5f && direction < 337.5f) {
+            // west
+            west = new ImageView(this);
+            west.setImageResource(mChinease ? R.mipmap.w_cn : R.mipmap.w);
+            west.setLayoutParams(lp);
+        }
+
+        if (direction > 112.5f && direction < 247.5f) {
+            // south
+            south = new ImageView(this);
+            south.setImageResource(mChinease ? R.mipmap.s_cn : R.mipmap.s);
+            south.setLayoutParams(lp);
+        } else if (direction < 67.5 || direction > 292.5f) {
+            // north
+            north = new ImageView(this);
+            north.setImageResource(mChinease ? R.mipmap.n_cn : R.mipmap.n);
+            north.setLayoutParams(lp);
+        }
+
+        if (mChinease) {
+            // east/west should be before north/south
+            if (east != null) {
+                mDirectionLayout.addView(east);
+            }
+            if (west != null) {
+                mDirectionLayout.addView(west);
+            }
+            if (south != null) {
+                mDirectionLayout.addView(south);
+            }
+            if (north != null) {
+                mDirectionLayout.addView(north);
+            }
+        } else {
+            // north/south should be before east/west
+            if (south != null) {
+                mDirectionLayout.addView(south);
+            }
+            if (north != null) {
+                mDirectionLayout.addView(north);
+            }
+            if (east != null) {
+                mDirectionLayout.addView(east);
+            }
+            if (west != null) {
+                mDirectionLayout.addView(west);
+            }
+        }
+
+        int direction2 = (int) direction;
+        boolean show = false;
+        if (direction2 >= 100) {
+            mAngleLayout.addView(getNumberImage(direction2 / 100));
+            direction2 %= 100;
+            show = true;
+        }
+        if (direction2 >= 10 || show) {
+            mAngleLayout.addView(getNumberImage(direction2 / 10));
+            direction2 %= 10;
+        }
+        mAngleLayout.addView(getNumberImage(direction2));
+
+        ImageView degreeImageView = new ImageView(this);
+        degreeImageView.setImageResource(R.mipmap.degree);
+        degreeImageView.setLayoutParams(lp);
+        mAngleLayout.addView(degreeImageView);
+    }
+
+    private ImageView getNumberImage(int number) {
+        ImageView image = new ImageView(this);
+        LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+        switch (number) {
+            case 0:
+                image.setImageResource(R.mipmap.number_0);
+                break;
+            case 1:
+                image.setImageResource(R.mipmap.number_1);
+                break;
+            case 2:
+                image.setImageResource(R.mipmap.number_2);
+                break;
+            case 3:
+                image.setImageResource(R.mipmap.number_3);
+                break;
+            case 4:
+                image.setImageResource(R.mipmap.number_4);
+                break;
+            case 5:
+                image.setImageResource(R.mipmap.number_5);
+                break;
+            case 6:
+                image.setImageResource(R.mipmap.number_6);
+                break;
+            case 7:
+                image.setImageResource(R.mipmap.number_7);
+                break;
+            case 8:
+                image.setImageResource(R.mipmap.number_8);
+                break;
+            case 9:
+                image.setImageResource(R.mipmap.number_9);
+                break;
+        }
+        image.setLayoutParams(lp);
+        return image;
+    }
+
+    private void updateLocation(Location location) {
+        if (location == null) {
+            mLocationTextView.setText(R.string.getting_location);
+        } else {
+            StringBuilder sb = new StringBuilder();
+            double latitude = location.getLatitude();
+            double longitude = location.getLongitude();
+
+            if (latitude >= 0.0f) {
+                sb.append(getString(R.string.location_north, getLocationString(latitude)));
+            } else {
+                sb.append(getString(R.string.location_south, getLocationString(-1.0 * latitude)));
+            }
+
+            sb.append("    ");
+
+            if (longitude >= 0.0f) {
+                sb.append(getString(R.string.location_east, getLocationString(longitude)));
+            } else {
+                sb.append(getString(R.string.location_west, getLocationString(-1.0 * longitude)));
+            }
+
+            mLocationTextView.setText(sb.toString());
+        }
+    }
+
+    private String getLocationString(double input) {
+        int du = (int) input;
+        int fen = (((int) ((input - du) * 3600))) / 60;
+        int miao = (((int) ((input - du) * 3600))) % 60;
+        return String.valueOf(du) + "°" + String.valueOf(fen) + "'" + String.valueOf(miao) + "\"";
+    }
+
+    private SensorEventListener mOrientationSensorEventListener = new SensorEventListener() {
+
+        @Override
+        public void onSensorChanged(SensorEvent event) {
+            float direction = event.values[0] * -1.0f;
+            mTargetDirection = normalizeDegree(direction);
+        }
+
+        @Override
+        public void onAccuracyChanged(Sensor sensor, int accuracy) {
+        }
+    };
+
+    private float normalizeDegree(float degree) {
+        return (degree + 720) % 360;
+    }
+
+    LocationListener mLocationListener = new LocationListener() {
+
+        @Override
+        public void onStatusChanged(String provider, int status, Bundle extras) {
+            if (status != LocationProvider.OUT_OF_SERVICE) {
+                //权限检测
+                if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) !=
+                        PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mContext,
+                        Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+                    // TODO: Consider calling
+                    //    ActivityCompat#requestPermissions
+                    // here to request the missing permissions, and then overriding
+                    //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
+                    //                                          int[] grantResults)
+                    // to handle the case where the user grants the permission. See the documentation
+                    // for ActivityCompat#requestPermissions for more details.
+                    return;
+                }
+                updateLocation(mLocationManager.getLastKnownLocation(mLocationProvider));
+            } else {
+                mLocationTextView.setText(R.string.cannot_get_location);
+            }
+        }
+
+        @Override
+        public void onProviderEnabled(String provider) {
+        }
+
+        @Override
+        public void onProviderDisabled(String provider) {
+        }
+
+        @Override
+        public void onLocationChanged(Location location) {
+            updateLocation(location);
+        }
+
+    };
 }

+ 54 - 0
app/src/main/java/me/yoqi/android/compass/ui/CompassView.java

@@ -0,0 +1,54 @@
+package me.yoqi.android.compass.ui;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import androidx.appcompat.widget.AppCompatImageView;
+
+/** 自定义 view
+ * @author liuyuqi.gov@msn.cn
+ * @Description TODO
+ * @createTime 7/3/2020
+ */
+
+public class CompassView extends AppCompatImageView {
+    private float mDirection;
+    private Drawable compass;
+
+    public CompassView(Context context) {
+        super(context);
+        mDirection = 0.0f;
+        compass = null;
+    }
+
+    public CompassView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        mDirection = 0.0f;
+        compass = null;
+    }
+
+    public CompassView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+        mDirection = 0.0f;
+        compass = null;
+    }
+
+    @Override
+    protected void onDraw(Canvas canvas) {
+        if (compass == null) {
+            compass = getDrawable();
+            compass.setBounds(0, 0, getWidth(), getHeight());
+        }
+
+        canvas.save();
+        canvas.rotate(mDirection, getWidth() / 2, getHeight() / 2);
+        compass.draw(canvas);
+        canvas.restore();
+    }
+
+    public void updateDirection(float direction) {
+        mDirection = direction;
+        invalidate();
+    }
+}

+ 5 - 0
app/src/main/res/drawable/background.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+    android:dither="true"
+    android:src="@mipmap/background_texture"
+    android:tileMode="repeat" />

+ 109 - 8
app/src/main/res/layout/activity_main.xml

@@ -6,13 +6,114 @@
     android:layout_height="match_parent"
     tools:context=".MainActivity">
 
-    <TextView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="Hello World!"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+    <FrameLayout
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:background="@drawable/background"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent">
+
+        <LinearLayout
+            android:id="@+id/view_compass"
+            android:layout_width="fill_parent"
+            android:layout_height="fill_parent"
+            android:background="@mipmap/background_light"
+            android:orientation="vertical">
+
+            <LinearLayout
+                android:layout_width="fill_parent"
+                android:layout_height="0dip"
+                android:layout_weight="1"
+                android:orientation="vertical">
+
+                <FrameLayout
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="@mipmap/prompt">
+
+                    <LinearLayout
+                        android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="center_horizontal"
+                        android:layout_marginTop="70dip"
+                        android:orientation="horizontal">
+
+                        <LinearLayout
+                            android:id="@+id/layout_direction"
+                            android:layout_width="0dip"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="1"
+                            android:gravity="right"
+                            android:orientation="horizontal"></LinearLayout>
+
+                        <ImageView
+                            android:layout_width="20dip"
+                            android:layout_height="fill_parent"></ImageView>
+
+                        <LinearLayout
+                            android:id="@+id/layout_angle"
+                            android:layout_width="0dip"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="1"
+                            android:gravity="left"
+                            android:orientation="horizontal"></LinearLayout>
+                    </LinearLayout>
+                </FrameLayout>
+
+                <LinearLayout
+                    android:layout_width="fill_parent"
+                    android:layout_height="0dip"
+                    android:layout_weight="1"
+                    android:orientation="vertical">
+
+                    <FrameLayout
+                        android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="center">
+
+                        <ImageView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_gravity="center"
+                            android:src="@mipmap/background_compass" />
+
+                        <me.yoqi.android.compass.ui.CompassView
+                            android:id="@+id/compass_pointer"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_gravity="center"
+                            android:src="@mipmap/compass" />
+
+                        <ImageView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_gravity="center"
+                            android:src="@mipmap/miui_cover" />
+                    </FrameLayout>
+                </LinearLayout>
+            </LinearLayout>
+
+            <FrameLayout
+                android:id="@+id/location_layout"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content">
+
+                <LinearLayout
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:background="@mipmap/background_bottom"
+                    android:orientation="vertical"></LinearLayout>
+
+                <TextView
+                    android:id="@+id/textview_location"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center"
+                    android:text="@string/getting_location"
+                    android:textAppearance="?android:attr/textAppearanceMedium"
+                    android:textColor="#7FFFFFFF" />
+            </FrameLayout>
+        </LinearLayout>
+    </FrameLayout>
 
 </androidx.constraintlayout.widget.ConstraintLayout>

BIN
app/src/main/res/mipmap-hdpi/app_icon.png


BIN
app/src/main/res/mipmap-hdpi/background_bottom.9.png


BIN
app/src/main/res/mipmap-hdpi/background_compass.png


BIN
app/src/main/res/mipmap-hdpi/background_light.png


BIN
app/src/main/res/mipmap-hdpi/background_texture.png


BIN
app/src/main/res/mipmap-hdpi/compass.png


BIN
app/src/main/res/mipmap-hdpi/compass_cn.png


BIN
app/src/main/res/mipmap-hdpi/degree.png


BIN
app/src/main/res/mipmap-hdpi/e.png


BIN
app/src/main/res/mipmap-hdpi/e_cn.png


BIN
app/src/main/res/mipmap-hdpi/miui_cover.png


BIN
app/src/main/res/mipmap-hdpi/n.png


BIN
app/src/main/res/mipmap-hdpi/n_cn.png


BIN
app/src/main/res/mipmap-hdpi/number_0.png


BIN
app/src/main/res/mipmap-hdpi/number_1.png


BIN
app/src/main/res/mipmap-hdpi/number_2.png


BIN
app/src/main/res/mipmap-hdpi/number_3.png


BIN
app/src/main/res/mipmap-hdpi/number_4.png


BIN
app/src/main/res/mipmap-hdpi/number_5.png


BIN
app/src/main/res/mipmap-hdpi/number_6.png


BIN
app/src/main/res/mipmap-hdpi/number_7.png


BIN
app/src/main/res/mipmap-hdpi/number_8.png


BIN
app/src/main/res/mipmap-hdpi/number_9.png


BIN
app/src/main/res/mipmap-hdpi/prompt.png


BIN
app/src/main/res/mipmap-hdpi/s.png


BIN
app/src/main/res/mipmap-hdpi/s_cn.png


BIN
app/src/main/res/mipmap-hdpi/w.png


BIN
app/src/main/res/mipmap-hdpi/w_cn.png


+ 11 - 0
app/src/main/res/values-zh/strings.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">Compass</string>
+    <string name="app_label">指南针</string>
+    <string name="getting_location">正在获取经纬度...</string>
+    <string name="cannot_get_location">无法获取经纬度</string>
+    <string name="location_north">北纬 %s</string>
+    <string name="location_south">南纬 %sS</string>
+    <string name="location_east">东经 %s</string>
+    <string name="location_west">西经 %s</string>
+</resources>

+ 8 - 0
app/src/main/res/values/strings.xml

@@ -1,3 +1,11 @@
 <resources>
     <string name="app_name">Compass</string>
+    <string name="app_label">Compass</string>
+    <string name="getting_location">Getting location...</string>
+    <string name="cannot_get_location">Cannot get your location</string>
+    <string name="location_north">%s N</string>
+    <string name="location_south">%s S</string>
+    <string name="location_east">%s E</string>
+    <string name="location_west">%s W</string>
+
 </resources>