diff --git a/other/200340044操烨鑫-实践总结报告.docx b/other/200340044操烨鑫-实践总结报告.docx new file mode 100644 index 0000000..1842333 Binary files /dev/null and b/other/200340044操烨鑫-实践总结报告.docx differ diff --git a/other/200740046白家璇-实践总结报告.docx b/other/200740046白家璇-实践总结报告.docx new file mode 100644 index 0000000..d153075 Binary files /dev/null and b/other/200740046白家璇-实践总结报告.docx differ diff --git a/other/201540170 陈江翰 实践总结报告.docx b/other/201540170 陈江翰 实践总结报告.docx new file mode 100644 index 0000000..a7d2e2d Binary files /dev/null and b/other/201540170 陈江翰 实践总结报告.docx differ diff --git a/other/201540708刘俊希-实践总结报告.docx b/other/201540708刘俊希-实践总结报告.docx new file mode 100644 index 0000000..765244a Binary files /dev/null and b/other/201540708刘俊希-实践总结报告.docx differ diff --git a/other/201540743崔天宇-实践总结报告.docx b/other/201540743崔天宇-实践总结报告.docx new file mode 100644 index 0000000..f4ea765 Binary files /dev/null and b/other/201540743崔天宇-实践总结报告.docx differ diff --git a/other/201540974伍洲行-实践总结报告.docx b/other/201540974伍洲行-实践总结报告.docx new file mode 100644 index 0000000..d72eb4a Binary files /dev/null and b/other/201540974伍洲行-实践总结报告.docx differ diff --git a/other/~$软件开发项目的个人自评报告.xlsx b/other/~$软件开发项目的个人自评报告.xlsx new file mode 100644 index 0000000..e69de29 diff --git a/other/软件开发项目的个人自评报告.xlsx b/other/软件开发项目的个人自评报告.xlsx new file mode 100644 index 0000000..7c26c0b Binary files /dev/null and b/other/软件开发项目的个人自评报告.xlsx differ diff --git a/other/软件开发项目的团队自评报告.xlsx b/other/软件开发项目的团队自评报告.xlsx new file mode 100644 index 0000000..fac4465 Binary files /dev/null and b/other/软件开发项目的团队自评报告.xlsx differ diff --git a/other/软件视频录像.mp4 b/other/软件视频录像.mp4 new file mode 100644 index 0000000..af09e05 Binary files /dev/null and b/other/软件视频录像.mp4 differ diff --git a/src/MyApplicatio n/AndroidManifest.xml b/src/MyApplicatio n/AndroidManifest.xml new file mode 100644 index 0000000..d1fcaed --- /dev/null +++ b/src/MyApplicatio n/AndroidManifest.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/MyApplicatio n/assets/iflytek/recognize.xml b/src/MyApplicatio n/assets/iflytek/recognize.xml new file mode 100644 index 0000000..78300c1 Binary files /dev/null and b/src/MyApplicatio n/assets/iflytek/recognize.xml differ diff --git a/src/MyApplicatio n/assets/iflytek/voice_bg.9.png b/src/MyApplicatio n/assets/iflytek/voice_bg.9.png new file mode 100644 index 0000000..217f9dc Binary files /dev/null and b/src/MyApplicatio n/assets/iflytek/voice_bg.9.png differ diff --git a/src/MyApplicatio n/assets/iflytek/voice_empty.png b/src/MyApplicatio n/assets/iflytek/voice_empty.png new file mode 100644 index 0000000..08ffc43 Binary files /dev/null and b/src/MyApplicatio n/assets/iflytek/voice_empty.png differ diff --git a/src/MyApplicatio n/assets/iflytek/voice_full.png b/src/MyApplicatio n/assets/iflytek/voice_full.png new file mode 100644 index 0000000..4bf5bbc Binary files /dev/null and b/src/MyApplicatio n/assets/iflytek/voice_full.png differ diff --git a/src/MyApplicatio n/assets/iflytek/waiting.png b/src/MyApplicatio n/assets/iflytek/waiting.png new file mode 100644 index 0000000..d13bb33 Binary files /dev/null and b/src/MyApplicatio n/assets/iflytek/waiting.png differ diff --git a/src/MyApplicatio n/assets/iflytek/warning.png b/src/MyApplicatio n/assets/iflytek/warning.png new file mode 100644 index 0000000..48150ff Binary files /dev/null and b/src/MyApplicatio n/assets/iflytek/warning.png differ diff --git a/src/MyApplicatio n/java/com/example/myapplication/JsonParser.java b/src/MyApplicatio n/java/com/example/myapplication/JsonParser.java new file mode 100644 index 0000000..ac8babb --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/JsonParser.java @@ -0,0 +1,117 @@ +package com.example.myapplication; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.json.JSONTokener; + +/** + * Json结果解析类 + */ +public class JsonParser { + + public static String parseIatResult(String json) { + StringBuffer ret = new StringBuffer(); + try { + JSONTokener tokener = new JSONTokener(json); + JSONObject joResult = new JSONObject(tokener); + + JSONArray words = joResult.getJSONArray("ws"); + for (int i = 0; i < words.length(); i++) { + // 转写结果词,默认使用第一个结果 + JSONArray items = words.getJSONObject(i).getJSONArray("cw"); + JSONObject obj = items.getJSONObject(0); + ret.append(obj.getString("w")); +// 如果需要多候选结果,解析数组其他字段 +// for(int j = 0; j < items.length(); j++) +// { +// JSONObject obj = items.getJSONObject(j); +// ret.append(obj.getString("w")); +// } + } + } catch (Exception e) { + e.printStackTrace(); + } + return ret.toString(); + } + + public static String parseGrammarResult(String json) { + StringBuffer ret = new StringBuffer(); + try { + JSONTokener tokener = new JSONTokener(json); + JSONObject joResult = new JSONObject(tokener); + + JSONArray words = joResult.getJSONArray("ws"); + for (int i = 0; i < words.length(); i++) { + JSONArray items = words.getJSONObject(i).getJSONArray("cw"); + for(int j = 0; j < items.length(); j++) + { + JSONObject obj = items.getJSONObject(j); + if(obj.getString("w").contains("nomatch")) + { + ret.append("没有匹配结果."); + return ret.toString(); + } + ret.append("【结果】" + obj.getString("w")); + ret.append("【置信度】" + obj.getInt("sc")); + ret.append("\n"); + } + } + } catch (Exception e) { + e.printStackTrace(); + ret.append("没有匹配结果."); + } + return ret.toString(); + } + + public static String parseLocalGrammarResult(String json) { + StringBuffer ret = new StringBuffer(); + try { + JSONTokener tokener = new JSONTokener(json); + JSONObject joResult = new JSONObject(tokener); + + JSONArray words = joResult.getJSONArray("ws"); + for (int i = 0; i < words.length(); i++) { + JSONArray items = words.getJSONObject(i).getJSONArray("cw"); + for(int j = 0; j < items.length(); j++) + { + JSONObject obj = items.getJSONObject(j); + if(obj.getString("w").contains("nomatch")) + { + ret.append("没有匹配结果."); + return ret.toString(); + } + ret.append("【结果】" + obj.getString("w")); + ret.append("\n"); + } + } + ret.append("【置信度】" + joResult.optInt("sc")); + + } catch (Exception e) { + e.printStackTrace(); + ret.append("没有匹配结果."); + } + return ret.toString(); + } + + public static String parseTransResult(String json,String key) { + StringBuffer ret = new StringBuffer(); + try { + JSONTokener tokener = new JSONTokener(json); + JSONObject joResult = new JSONObject(tokener); + String errorCode = joResult.optString("ret"); + if(!errorCode.equals("0")) { + return joResult.optString("errmsg"); + } + JSONObject transResult = joResult.optJSONObject("trans_result"); + ret.append(transResult.optString(key)); + /*JSONArray words = joResult.getJSONArray("results"); + for (int i = 0; i < words.length(); i++) { + JSONObject obj = words.getJSONObject(i); + ret.append(obj.getString(key)); + }*/ + } catch (Exception e) { + e.printStackTrace(); + } + return ret.toString(); + } +} diff --git a/src/MyApplicatio n/java/com/example/myapplication/MainActivity.java b/src/MyApplicatio n/java/com/example/myapplication/MainActivity.java new file mode 100644 index 0000000..d161cb7 --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/MainActivity.java @@ -0,0 +1,69 @@ +package com.example.myapplication; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import com.example.myapplication.weather.MainActivity1; +import com.example.myapplication.weather.SettingActivity; +import com.example.myapplication.weather.WeatherItem; + +public class MainActivity extends AppCompatActivity { + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + Button button_main_1=findViewById(R.id.button_main_1); + //点击 + button_main_1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent1=new Intent(MainActivity.this,yijiantong.class); + startActivity(intent1); + + } + }); + //点击 + Button button_main_2=findViewById(R.id.button_main_2); + button_main_2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent2=new Intent(MainActivity.this, MainActivity1.class); + startActivity(intent2); + + } + }); + Button button_main_3=findViewById(R.id.button_main_3); + //点击 + button_main_3.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Object packageContext; + Intent intent3=new Intent(MainActivity.this,zhaoxun.class); + startActivity(intent3); + + } + }); + Button button_main_4=findViewById(R.id.button_main_4); + //点击 + button_main_4.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Object packageContext; + Intent intent1=new Intent(MainActivity.this,yuyin.class); + startActivity(intent1); + + } + }); + + + + + } +} \ No newline at end of file diff --git a/src/MyApplicatio n/java/com/example/myapplication/MapActivity1.java b/src/MyApplicatio n/java/com/example/myapplication/MapActivity1.java new file mode 100644 index 0000000..08bb720 --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/MapActivity1.java @@ -0,0 +1,221 @@ +package com.example.myapplication; +import android.Manifest; +import android.app.Activity; +import android.content.pm.PackageManager; +import android.os.Bundle; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.ActivityCompat; + +import com.baidu.location.BDAbstractLocationListener; +import com.baidu.location.BDLocation; +import com.baidu.location.BDLocationListener; +import com.baidu.location.LocationClient; +import com.baidu.location.LocationClientOption; +import com.baidu.mapapi.SDKInitializer; +import com.baidu.mapapi.map.BaiduMap; +import com.baidu.mapapi.map.BitmapDescriptor; +import com.baidu.mapapi.map.BitmapDescriptorFactory; +import com.baidu.mapapi.map.MapStatus; +import com.baidu.mapapi.map.MapStatusUpdate; +import com.baidu.mapapi.map.MapStatusUpdateFactory; +import com.baidu.mapapi.map.MapView; +import com.baidu.mapapi.map.MyLocationConfiguration; +import com.baidu.mapapi.map.MyLocationData; +import com.baidu.mapapi.model.LatLng; +/* +public class MapActivity1 extends Activity { + private MapView mMapView = null; + private BaiduMap mBaiduMap; + private LocationClient mLocationClient; + private BitmapDescriptor mMarker; + private boolean ifFrist = true; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + SDKInitializer.initialize(getApplicationContext()); + setContentView(R.layout.activity_map1); + mMapView = findViewById(R.id.bmapview); + mBaiduMap = mMapView.getMap(); + mLocationClient = new LocationClient(this); + + MyLocationListener myLocationListener = new MyLocationListener(); + mLocationClient.registerLocationListener(myLocationListener); + + //覆盖物 用于显示当前位置 + mMarker = BitmapDescriptorFactory.fromResource(com.baidu.bikenavi.R.drawable.icon_start_walk); + mBaiduMap.setMyLocationEnabled(true); + LocationClientOption option = new LocationClientOption(); + //可选,默认高精度,设置定位模式,高精度,低功耗,仅设备 + option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); + option.setOpenGps(true); // 打开gps + option.setCoorType("bd09ll"); // 设置坐标类型 + option.setScanSpan(1000); + option.setIsNeedAddress(true); + mLocationClient.setLocOption(option); + mLocationClient.start(); + } + + + public class MyLocationListener extends BDAbstractLocationListener { + @Override + public void onReceiveLocation(BDLocation location) { + //mapView 销毁后不在处理新接收的位置 + if (location == null || mMapView == null){ + return; + } + MyLocationData locData = new MyLocationData.Builder() + .accuracy(location.getRadius()) + // 此处设置开发者获取到的方向信息,顺时针0-360 + .latitude(location.getLatitude()) + .longitude(location.getLongitude()) + .direction(location.getDirection()) + .build(); + mBaiduMap.setMyLocationData(locData); + + MyLocationConfiguration configuration = new MyLocationConfiguration( + MyLocationConfiguration.LocationMode.NORMAL, false, mMarker); + + mBaiduMap.setMyLocationConfiguration(configuration); + + if (ifFrist) { + LatLng ll = new LatLng(location.getLatitude(), location.getLongitude()); + MapStatus.Builder builder = new MapStatus.Builder(); + builder.target(ll); + builder.zoom(18.0f); + mBaiduMap.setMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); + //放大层级 + ifFrist = false; + } + + } + } + + @Override + protected void onResume() { + super.onResume(); + mMapView.onResume(); + } + @Override + protected void onPause() { + super.onPause(); + mMapView=findViewById(R.id.bmapview); + mMapView.onResume(); + } + @Override + protected void onDestroy() { + super.onDestroy(); + mLocationClient.stop(); + mMapView.onDestroy(); + } +} +*/ + +public class MapActivity1 extends AppCompatActivity { + private BitmapDescriptor mMarker; + LocationClient mLocationClient; //定位客户端 + MapView mapView; //Android Widget地图控件 + BaiduMap baiduMap; + boolean isFirstLocate = true; + + TextView tv_Lat; //纬度 + TextView tv_Lon; //经度 + TextView tv_Add; //地址 + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + //如果没有定位权限,动态请求用户允许使用该权限 + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1); + }else { + requestLocation(); + } + } + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + // super.onRequestPermissionsResult(requestCode, permissions, grantResults); + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + switch (requestCode) { + case 1: + if (grantResults[0] != PackageManager.PERMISSION_GRANTED) { + Toast.makeText(this, "没有定位权限!", Toast.LENGTH_LONG).show(); + finish(); + } else { + requestLocation(); + } + } + } + private void requestLocation() { + initLocation(); + mLocationClient.start(); + } + private void initLocation() { //初始化 + mLocationClient = new LocationClient(getApplicationContext()); + mLocationClient.registerLocationListener(new MyLocationListener()); + SDKInitializer.initialize(getApplicationContext()); + setContentView(R.layout.activity_map1); + // mMarker = BitmapDescriptorFactory.fromResource(com.baidu.bikenavi.R.drawable.icon_start_walk); + mapView = findViewById(R.id.bmapview); + baiduMap = mapView.getMap(); + tv_Lat = findViewById(R.id.tv_Lat); + tv_Lon = findViewById(R.id.tv_Lon); + tv_Add = findViewById(R.id.tv_Add); + + LocationClientOption option = new LocationClientOption(); + //设置扫描时间间隔 + option.setScanSpan(1000); + //设置定位模式,三选一 + option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); + + //设置需要地址信息 + option.setIsNeedAddress(true); + //保存定位参数 + mLocationClient.setLocOption(option); + } + //内部类,百度位置监听器 + private class MyLocationListener implements BDLocationListener { + @Override + public void onReceiveLocation(BDLocation bdLocation) { + tv_Lat.setText(bdLocation.getLatitude()+""); + tv_Lon.setText(bdLocation.getLongitude()+""); + tv_Add.setText(bdLocation.getAddrStr()); + if(bdLocation.getLocType()==BDLocation.TypeGpsLocation || bdLocation.getLocType()==BDLocation.TypeNetWorkLocation){ + navigateTo(bdLocation); + } + } + MyLocationConfiguration configuration = new MyLocationConfiguration( + MyLocationConfiguration.LocationMode.NORMAL, false, mMarker); +// + // baiduMap.setMyLocationConfiguration(configuration); + } + private void navigateTo(BDLocation bdLocation) { + if(isFirstLocate){ + LatLng ll = new LatLng(bdLocation.getLatitude(),bdLocation.getLongitude()); + MapStatusUpdate update = MapStatusUpdateFactory.newLatLng(ll); + baiduMap.animateMapStatus(update); + + isFirstLocate = false; + } + } + @Override + protected void onResume() { + super.onResume(); + mapView.onResume(); + } + @Override + protected void onPause() { + super.onPause(); + mapView=findViewById(R.id.bmapview); + mapView.onResume(); + } + @Override + protected void onDestroy() { + super.onDestroy(); + mLocationClient.stop(); + mapView.onDestroy(); + } +} diff --git a/src/MyApplicatio n/java/com/example/myapplication/SpeechApplication.java b/src/MyApplicatio n/java/com/example/myapplication/SpeechApplication.java new file mode 100644 index 0000000..a808003 --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/SpeechApplication.java @@ -0,0 +1,18 @@ +package com.example.myapplication; + +import android.app.Application; + +import com.iflytek.cloud.SpeechUtility; + +public class SpeechApplication extends Application { + + @Override + public void onCreate() { + + // 5ef048e1 为在开放平台注册的APPID 注意没有空格,直接替换即可 + SpeechUtility.createUtility(SpeechApplication.this, "appid=6d0c39e4"); + + super.onCreate(); + } +} + diff --git a/src/MyApplicatio n/java/com/example/myapplication/WNaviGuideActivity.java b/src/MyApplicatio n/java/com/example/myapplication/WNaviGuideActivity.java new file mode 100644 index 0000000..7d561af --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/WNaviGuideActivity.java @@ -0,0 +1,231 @@ +package com.example.myapplication; +import android.annotation.SuppressLint; +import android.app.Activity; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.util.Log; +import android.view.View; +import android.widget.Toast; + +import androidx.annotation.NonNull; + +import com.baidu.mapapi.walknavi.WalkNavigateHelper; +import com.baidu.mapapi.walknavi.adapter.IWNaviStatusListener; +import com.baidu.mapapi.walknavi.adapter.IWRouteGuidanceListener; +import com.baidu.mapapi.walknavi.adapter.IWTTSPlayer; +import com.baidu.mapapi.walknavi.model.RouteGuideKind; +import com.baidu.platform.comapi.walknavi.WalkNaviModeSwitchListener; +import com.baidu.platform.comapi.walknavi.widget.ArCameraView; + +public class WNaviGuideActivity extends Activity { + private final static String TAG = WNaviGuideActivity.class.getSimpleName(); + + private WalkNavigateHelper mNaviHelper; + + private boolean isPreSPEAKtotal = true; + private String orient = ""; + + @Override + protected void onDestroy() { + super.onDestroy(); + mNaviHelper.quit(); + } + + @Override + protected void onResume() { + super.onResume(); + mNaviHelper.resume(); + } + + @Override + protected void onPause() { + super.onPause(); + mNaviHelper.pause(); + } + + + Handler handler = new Handler() { + @SuppressLint("HandlerLeak") + @Override + public void handleMessage(Message msg) { + super.handleMessage(msg); + if (msg.what == 0x001) { + ChangeState(); + handler.sendEmptyMessageDelayed(0x001, 45000); + } + if (msg.what == 0x002) { + handler.sendEmptyMessageDelayed(0x002, 30000); + } + if (msg.what == 0x003) { + + startActivity(new Intent(WNaviGuideActivity.this, MainActivity.class)); + } + } + }; + + private void ChangeState() { + isPreSPEAKtotal = true; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mNaviHelper = WalkNavigateHelper.getInstance(); + try { + View view = mNaviHelper.onCreate(WNaviGuideActivity.this); + if (view != null) { + setContentView(view); + } + } catch (Exception e) { + e.printStackTrace(); + } + //设置步行导航状态监听 + mNaviHelper.setWalkNaviStatusListener(new IWNaviStatusListener() { + @Override + public void onWalkNaviModeChange(int mode, WalkNaviModeSwitchListener listener) { + Log.d("======", "onWalkNaviModeChange : " + mode); + mNaviHelper.switchWalkNaviMode(WNaviGuideActivity.this, mode, listener); + } + + /* @Description: 这个是在退出导航时自动调用的方法,在这里要把对象进行释放,避免空对象的产生 + * @Author: LiY ue + */ + @Override + public void onNaviExit() { + Log.d("======", "onNaviExit"); + handler.removeMessages(0x001); + handler.removeMessages(0x002); + handler.removeMessages(0x003); + } + }); + + + mNaviHelper.setTTsPlayer(new IWTTSPlayer() { + @Override + public int playTTSText(final String s, boolean b) { + Log.d(TAG, "tts: " + s); + return 0; + } + }); + + + boolean startResult = mNaviHelper.startWalkNavi(WNaviGuideActivity.this); + Log.e(TAG, "startWalkNavi result : " + startResult); + //设置路线指引监听 + mNaviHelper.setRouteGuidanceListener(this, new + + IWRouteGuidanceListener() { + + @Override + public void onRouteGuideIconUpdate(Drawable icon) { + + } + + @Override + public void onRouteGuideKind(RouteGuideKind routeGuideKind) { + Log.d("======", "onRouteGuideKind: " + routeGuideKind); + if (routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_PassRoad_Left || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_PassRoad_Right || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_Right_PassRoad_Front || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_Right_PassRoad_UTurn) + + if (routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Front || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Left || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Left_Front || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Right || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Right_Back || routeGuideKind == RouteGuideKind.NE_Maneuver_Kind_RightDiagonal_PassRoad_Right_Front){ + Log.d("========", "onRouteGuideKind: aaaaaa"); + } + + } + + /** + * @Description: 诱导信息 + */ + @Override + public void onRoadGuideTextUpdate(CharSequence charSequence, CharSequence + charSequence1) { + Log.d(TAG, "onRoadGuideTextUpdate charSequence=: " + charSequence + " charSequence1 = : " + + charSequence1); + orient = charSequence.toString() + charSequence1.toString(); + + } + + + @Override + public void onRemainDistanceUpdate(CharSequence charSequence) { + Log.d(TAG, "onRemainDistanceUpdate: charSequence = :" + charSequence); + if (isPreSPEAKtotal) { + } + } + + + @Override + public void onRemainTimeUpdate(CharSequence charSequence) { + Log.d(TAG, "onRemainTimeUpdate: charSequence = :" + charSequence); + if (isPreSPEAKtotal) { + isPreSPEAKtotal = false; + } + } + + + @Override + public void onGpsStatusChange(CharSequence charSequence, Drawable drawable) { + Log.d(TAG, "onGpsStatusChange: charSequence = :" + charSequence); + + } + + + @Override + public void onRouteFarAway(CharSequence charSequence, Drawable drawable) { + Log.d(TAG, "onRouteFarAway: charSequence = :" + charSequence); + } + + + @Override + public void onRoutePlanYawing(CharSequence charSequence, Drawable drawable) { + Log.d(TAG, "onRoutePlanYawing: charSequence = :" + charSequence); + + } + + + @Override + public void onReRouteComplete() { + } + + @Override + public void onArriveDest() { + handler.sendEmptyMessageDelayed(0x003, 6000); + } + + @Override + public void onIndoorEnd(Message msg) { + + } + + @Override + public void onFinalEnd(Message msg) { + + } + + @Override + public void onVibrate() { + + } + }); + handler.sendEmptyMessage(0x001); + handler.sendEmptyMessage(0x002); + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, + int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + if (requestCode == ArCameraView.WALK_AR_PERMISSION) { + if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_DENIED) { + Toast.makeText(WNaviGuideActivity.this, "没有相机权限,请打开后重试", Toast.LENGTH_SHORT).show(); + } else if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + mNaviHelper.startCameraAndSetMapView(WNaviGuideActivity.this); + } + } + } +} + + diff --git a/src/MyApplicatio n/java/com/example/myapplication/itemfound.java b/src/MyApplicatio n/java/com/example/myapplication/itemfound.java new file mode 100644 index 0000000..232730e --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/itemfound.java @@ -0,0 +1,224 @@ +package com.example.myapplication; + +import androidx.appcompat.app.AppCompatActivity; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +import com.baidu.mapapi.bikenavi.BikeNavigateHelper; +import com.baidu.mapapi.walknavi.adapter.IWRoutePlanListener; +import com.baidu.mapapi.walknavi.model.WalkRoutePlanError; +import com.baidu.mapapi.walknavi.params.*; +import com.baidu.mapapi.CoordType; +import com.baidu.mapapi.SDKInitializer; +import com.baidu.mapapi.model.LatLng; +import java.util.ArrayList; +import java.util.List; + +import android.widget.ImageButton; +import android.widget.TextView; +import android.annotation.SuppressLint; +import android.os.Bundle; +import com.baidu.baidunavis.BaiduNaviParams; +import com.baidu.mapapi.SDKInitializer; +import com.baidu.mapapi.map.MapView; +import com.baidu.mapapi.model.LatLng; +import com.baidu.mapapi.walknavi.WalkNavigateHelper; +import com.baidu.mapapi.walknavi.adapter.IWEngineInitListener; +import com.baidu.mapapi.walknavi.params.WalkNaviLaunchParam; + +public class itemfound extends AppCompatActivity { + private WalkNavigateHelper helper = null; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + //initPermissions(); // 初始化权限 + setContentView(R.layout.activity_itemfound); // 填充视图 + + // 点击按钮开始导航 + Button imageButton = findViewById(R.id.button_item_keys); + imageButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + // 初始化步行导航 + startBikeNavi(); + } + }); + Button imageButtonwallet = findViewById(R.id.button_item_wallet); + imageButtonwallet.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + // 初始化步行导航 + startBikeNavi(); + } + }); + } + // 初始化权限 + /* + private void initPermissions() { + if (Build.VERSION.SDK_INT >= 23) { + ArrayList permissionsList = new ArrayList<>(); + String[] permissions = { + Manifest.permission.ACCESS_NETWORK_STATE, + Manifest.permission.INTERNET, + Manifest.permission.ACCESS_COARSE_LOCATION, + Manifest.permission.ACCESS_FINE_LOCATION, + Manifest.permission.WRITE_EXTERNAL_STORAGE, + }; + + for (String perm : permissions) { + if (PackageManager.PERMISSION_GRANTED != checkSelfPermission(perm)) { + permissionsList.add(perm); + // 进入到这里代表没有权限. + } + if (!permissionsList.isEmpty()) { + String[] strings = new String[permissionsList.size()]; + requestPermissions(permissionsList.toArray(strings), 0); + } + } + + } + }*/ + private void startBikeNavi() { + //Log.d("=========", "startBikeNavi"); + try { + helper = WalkNavigateHelper.getInstance(); + helper.initNaviEngine(this, new IWEngineInitListener() { + @Override + public void engineInitSuccess() { + // Log.d("=========", "BikeNavi engineInitSuccess引擎初始化成功"); + startWebNavi(); + } + + @Override + public void engineInitFail() { + // Log.d("=========", "BikeNavi engineInitFail"); + BikeNavigateHelper.getInstance().unInitNaviEngine(); + } + }); + } catch (Exception e) { + // Log.d("=========", "startBikeNavi Exception"); + e.printStackTrace(); + } + } + private void startWebNavi() { + //起终点位置 + LatLng walkStartNode = new LatLng(39.110132, 117.358512); + LatLng walkEndNode = new LatLng(39.111348, 117.358940); + + WalkRouteNodeInfo startNode = new WalkRouteNodeInfo(); + startNode.setLocation(walkStartNode); + WalkRouteNodeInfo endNode = new WalkRouteNodeInfo(); + endNode.setLocation(walkEndNode); + // 官网 + //构造WalkNaviLaunchParam + WalkNaviLaunchParam walkParam = new WalkNaviLaunchParam().startNodeInfo(startNode).endNodeInfo(endNode); + //获取WalkNavigateHelper实例 //发起算路 + helper.routePlanWithRouteNode(walkParam, new IWRoutePlanListener() { + @Override + public void onRoutePlanStart() { + // Log.d("=======", "WalkNavi onRoutePlanStart开始步行导航"); + } + + @Override + public void onRoutePlanSuccess() { + // Log.d("========", "onRoutePlanSuccess算路成功"); + Intent intent = new Intent(itemfound.this,WNaviGuideActivity.class); + // intent.setClass(getContext(), WNaviGuideActivity.class); + startActivity(intent); + } + + @Override + public void onRoutePlanFail(WalkRoutePlanError error) { +// Log.d("Walk", "WalkNavi onRoutePlanFail"); + } + + }); + } + + +/* + @Override + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_itemfound); + Button find_wallet=findViewById(R.id.button_item_wallet); + Button find_keys=findViewById(R.id.button_item_keys); + find_wallet.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) {//Intent + double locationX; + double locationy; + //BaiduMapNavigation + + + } + }); + find_keys.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) {//Intent + //NaviParaOption para=new Navi(); + + } + }); + }*/ private void startBikeNavi1() { + //Log.d("=========", "startBikeNavi"); + try { + helper = WalkNavigateHelper.getInstance(); + helper.initNaviEngine(this, new IWEngineInitListener() { + @Override + public void engineInitSuccess() { + // Log.d("=========", "BikeNavi engineInitSuccess引擎初始化成功"); + startWebNavi1(); + } + + @Override + public void engineInitFail() { + // Log.d("=========", "BikeNavi engineInitFail"); + BikeNavigateHelper.getInstance().unInitNaviEngine(); + } + }); + } catch (Exception e) { + // Log.d("=========", "startBikeNavi Exception"); + e.printStackTrace(); + } +} + private void startWebNavi1() { + //起终点位置 + LatLng walkStartNode = new LatLng(39.110132, 117.358512); + LatLng walkEndNode = new LatLng(39.112286, 117.359619); + + WalkRouteNodeInfo startNode = new WalkRouteNodeInfo(); + startNode.setLocation(walkStartNode); + WalkRouteNodeInfo endNode = new WalkRouteNodeInfo(); + endNode.setLocation(walkEndNode); + // 官网 + //构造WalkNaviLaunchParam + WalkNaviLaunchParam walkParam = new WalkNaviLaunchParam().startNodeInfo(startNode).endNodeInfo(endNode); + //获取WalkNavigateHelper实例 //发起算路 + helper.routePlanWithRouteNode(walkParam, new IWRoutePlanListener() { + @Override + public void onRoutePlanStart() { + // Log.d("=======", "WalkNavi onRoutePlanStart开始步行导航"); + } + + @Override + public void onRoutePlanSuccess() { + // Log.d("========", "onRoutePlanSuccess算路成功"); + Intent intent = new Intent(itemfound.this,WNaviGuideActivity.class); + // intent.setClass(getContext(), WNaviGuideActivity.class); + startActivity(intent); + } + + @Override + public void onRoutePlanFail(WalkRoutePlanError error) { +// Log.d("Walk", "WalkNavi onRoutePlanFail"); + } + + }); + } +} diff --git a/src/MyApplicatio n/java/com/example/myapplication/jiankang.java b/src/MyApplicatio n/java/com/example/myapplication/jiankang.java new file mode 100644 index 0000000..f2fef3c --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/jiankang.java @@ -0,0 +1,14 @@ +package com.example.myapplication; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class jiankang extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_jiankang); + } +} \ No newline at end of file diff --git a/src/MyApplicatio n/java/com/example/myapplication/weather/DatabaseHelper.java b/src/MyApplicatio n/java/com/example/myapplication/weather/DatabaseHelper.java new file mode 100644 index 0000000..95deb0b --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/weather/DatabaseHelper.java @@ -0,0 +1,24 @@ +package com.example.myapplication.weather; + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + +public class DatabaseHelper extends SQLiteOpenHelper { + private static final int VERSION = 1; + private static final String NAME = "weather"; + + public DatabaseHelper(Context context){ + super(context,NAME,null,VERSION); + } + + @Override + public void onCreate(SQLiteDatabase db) { + db.execSQL("create table weather (_id INTEGER PRIMARY KEY AUTOINCREMENT,date text,max_temp text,min_temp text,text text,humidity text,pressure text,wind text,icon text)"); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + + } +} \ No newline at end of file diff --git a/src/MyApplicatio n/java/com/example/myapplication/weather/FlickrFetcher.java b/src/MyApplicatio n/java/com/example/myapplication/weather/FlickrFetcher.java new file mode 100644 index 0000000..670e37f --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/weather/FlickrFetcher.java @@ -0,0 +1,103 @@ +package com.example.myapplication.weather; + +import android.util.Log; + +import org.json.JSONArray; +import org.json.JSONObject; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +//获取数据的二进制数组/字符串形式 +//获取JSON数组 +//解析JSON数组,变成WeatherItem的数组形式 + +public class FlickrFetcher { + public static final String TAG = "FlickrFetcher"; + + public byte[] getUrlBytes(String urlSpec) throws Exception{ + URL url = new URL(urlSpec); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); +// connection.setInstanceFollowRedirects(false); //跟踪重定向 +// String redirect = connection.getHeaderField("Location"); +// if (redirect != null){ +// connection = (HttpURLConnection)new URL(redirect).openConnection(); +// } + + try{ + ByteArrayOutputStream out = new ByteArrayOutputStream(); + InputStream in = connection.getInputStream(); + + if(connection.getResponseCode() != HttpURLConnection.HTTP_OK){ + throw new IOException(connection.getResponseMessage() + " :with "+urlSpec); + } + + int bytesRead = 0; + byte[] buffer = new byte[1024]; + while((bytesRead = in.read(buffer)) > 0){ + out.write(buffer,0,bytesRead); + } + out.close(); + return out.toByteArray(); + }finally { + connection.disconnect(); + } + } + + public String getUrlString(String urlSpec)throws Exception{ + return new String(getUrlBytes(urlSpec)); + } + + public List fetchItems(String urlSpec){ + List items = new ArrayList<>(); + try{ + String jsonString = getUrlString(urlSpec); + Log.i(TAG,"result: "+jsonString); + JSONObject jsonBody = new JSONObject(jsonString); + parseItems(items,jsonBody); + }catch (Exception e){ + Log.i(TAG,"Failed!"+e); + } + return items; + } + + public JSONObject fetchCity(String urlSpec){ + String locationID = ""; + JSONObject jsonObject = null; + try{ + String jsonString = getUrlString(urlSpec); + Log.i(TAG,"result: "+jsonString); + JSONObject jsonBody = new JSONObject(jsonString); + JSONArray locationJsonArray = jsonBody.getJSONArray("location"); + jsonObject = locationJsonArray.getJSONObject(0); +// locationID = locationJsonArray.getJSONObject(0).getString("id"); +// String lat = locationJsonArray.getJSONObject(0).getString("lat"); +// String lon = locationJsonArray.getJSONObject(0).getString("lon"); + }catch (Exception e){ + Log.i(TAG,"Failed!"+e); + } + return jsonObject; + } + + private void parseItems(List items,JSONObject jsonBody) throws Exception{ //将从url获得的json转换成MarsItem + JSONArray weatherJsonArray = jsonBody.getJSONArray("daily"); + for(int i=0;i= Build.VERSION_CODES.O) { + NotificationChannel channel = new NotificationChannel("to-do" + , "待办消息", + NotificationManager.IMPORTANCE_HIGH); + channel.enableVibration(true); + channel.setVibrationPattern(new long[]{500}); + notificationManager.createNotificationChannel(channel); + builder.setChannelId("to-do"); + notification = builder.build(); + } else { + notification = builder.build(); + } + + notificationManager.notify(0,notification); + System.out.println(notification); + } + + public static void setServiceAlarm(Context context,boolean isOn){ + Intent i = NotificationService.newIntent(context); + PendingIntent pi = PendingIntent.getService(context,0,i,0); + + AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); + + if(isOn){ + alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(), + NOTIFICATION_INTERVAL,pi); + }else{ + alarmManager.cancel(pi); + pi.cancel(); + } + } +} diff --git a/src/MyApplicatio n/java/com/example/myapplication/weather/SettingActivity.java b/src/MyApplicatio n/java/com/example/myapplication/weather/SettingActivity.java new file mode 100644 index 0000000..8b9f5b7 --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/weather/SettingActivity.java @@ -0,0 +1,132 @@ +package com.example.myapplication.weather; + +import android.content.DialogInterface; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.View; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; + +import com.example.myapplication.R; + +public class SettingActivity extends AppCompatActivity { + private EditText location; + private TextView unit_text; + private TextView send_text; + private LinearLayout page; + private LinearLayout unit; + private LinearLayout send; + private String city; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_setting); + + location = (EditText) findViewById(R.id.location); + unit = (LinearLayout)findViewById(R.id.unit); + page = (LinearLayout)findViewById(R.id.page); + unit_text = (TextView)findViewById(R.id.unit_text); + send = (LinearLayout)findViewById(R.id.send); + send_text = (TextView)findViewById(R.id.send_text); + + SharedPreferences pref = getSharedPreferences("setting",MODE_PRIVATE); + location.setText(pref.getString("city","北京")); + unit_text.setText(pref.getString("unit","摄氏度")); + send_text.setText(pref.getString("send","是")); + + page.setOnClickListener(new View.OnClickListener(){ + public void onClick(View v){ + location.clearFocus(); + } + }); + + location.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + city = s.toString(); + SharedPreferences.Editor editor = getSharedPreferences("setting",MODE_PRIVATE).edit(); + editor.putString("city",city); + editor.commit(); + } + + @Override + public void afterTextChanged(Editable s) { + + } + }); + + unit.setOnClickListener(new View.OnClickListener(){ + public void onClick(View v){ + click(); + } + }); + + send.setOnClickListener(new View.OnClickListener(){ + public void onClick(View v){ + click2(); + } + }); + } + + //点击按钮弹出一个单选对话框 + public void click() { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("请选择温度单位"); + final String items[] = {"摄氏度","华氏度"}; + +//-1代表没有条目被选中 + builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //1.把选中的条目取出来 + String item = items[which]; + Toast.makeText(getApplicationContext(),item.toString(),Toast.LENGTH_LONG).show(); + unit_text.setText(item.toString()); + SharedPreferences.Editor editor = getSharedPreferences("setting",MODE_PRIVATE).edit(); + editor.putString("unit",item.toString()); + editor.commit(); + //2.然后把对话框关闭 + dialog.dismiss(); + } + }); +//一样要show + builder.show(); + } + + public void click2() { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("请选择是否开启通知"); + final String items[] = {"是","否"}; + +//-1代表没有条目被选中 + builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //1.把选中的条目取出来 + String item = items[which]; + Toast.makeText(getApplicationContext(),item.toString(),Toast.LENGTH_LONG).show(); + send_text.setText(item.toString()); + SharedPreferences.Editor editor = getSharedPreferences("setting",MODE_PRIVATE).edit(); + editor.putString("send",item.toString()); + editor.commit(); + //2.然后把对话框关闭 + dialog.dismiss(); + } + }); +//一样要show + builder.show(); + } +} diff --git a/src/MyApplicatio n/java/com/example/myapplication/weather/SingleFragmentActivity.java b/src/MyApplicatio n/java/com/example/myapplication/weather/SingleFragmentActivity.java new file mode 100644 index 0000000..e9478b3 --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/weather/SingleFragmentActivity.java @@ -0,0 +1,30 @@ +package com.example.myapplication.weather; + +import android.os.Bundle; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; + +public abstract class SingleFragmentActivity extends AppCompatActivity { + protected abstract Fragment createFragment(); + protected abstract int getLayoutId(); + protected abstract int getFragmentId(); + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(getLayoutId()); + + FragmentManager fm = getSupportFragmentManager(); + Fragment fragment = fm.findFragmentById(getFragmentId()); + + if(fragment == null){ + fragment = createFragment(); + fm.beginTransaction(). + add(getFragmentId(),fragment) + .commit(); + } + } +} diff --git a/src/MyApplicatio n/java/com/example/myapplication/weather/WeatherDetailActivity.java b/src/MyApplicatio n/java/com/example/myapplication/weather/WeatherDetailActivity.java new file mode 100644 index 0000000..e98a864 --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/weather/WeatherDetailActivity.java @@ -0,0 +1,34 @@ +package com.example.myapplication.weather; + +import android.content.Context; +import android.content.Intent; + +import androidx.fragment.app.Fragment; + +import com.example.myapplication.R; + +public class WeatherDetailActivity extends SingleFragmentActivity{ + public static final String EXTRA_WEATHER_ITEM = "com.example.weather.weatherItem"; + + @Override + protected Fragment createFragment() { + WeatherItem weatherItem = (WeatherItem)getIntent().getSerializableExtra(EXTRA_WEATHER_ITEM); + return WeatherDetailFragment.newInstance(weatherItem); + } + + @Override + protected int getLayoutId() { + return R.layout.activity_detail; + } + + @Override + protected int getFragmentId() { + return R.id.detail_container; + } + + public static Intent newIntent(Context packageContext, WeatherItem weatherItem){ + Intent intent = new Intent(packageContext,WeatherDetailActivity.class); + intent.putExtra(EXTRA_WEATHER_ITEM,weatherItem); + return intent; + } +} diff --git a/src/MyApplicatio n/java/com/example/myapplication/weather/WeatherDetailFragment.java b/src/MyApplicatio n/java/com/example/myapplication/weather/WeatherDetailFragment.java new file mode 100644 index 0000000..9dc2b31 --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/weather/WeatherDetailFragment.java @@ -0,0 +1,133 @@ +package com.example.myapplication.weather; + +import android.content.Context; +import android.content.Intent; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import com.example.myapplication.R; + +public class WeatherDetailFragment extends Fragment { + private WeatherItem mWeatherItem; //用来设置UI + + private TextView mDeatilDate; + private TextView mDetailMaxTemp; + private TextView mDetailMinTemp; + private ImageView mDetialIcon; + private TextView mDetailDesc; + private TextView mDetailHumidity; + private TextView mDetailPressure; + private TextView mDetailWind; + + private static final String TAG = "WeatherDetailFragment"; + private static final String ARG_ITEM = "args_item"; + private String unit_text = "°"; + + public static WeatherDetailFragment newInstance(WeatherItem weatherItem) { + Bundle args = new Bundle(); + args.putSerializable(ARG_ITEM,weatherItem); + WeatherDetailFragment fragment = new WeatherDetailFragment(); + fragment.setArguments(args); + return fragment; + } + + //获取drawable图标资源的id + public int getIconId(Context mContext, String icon){ + int i= getResources().getIdentifier(icon, "drawable", mContext.getPackageName()) ; + if(i>0){ + Log.i(TAG,"Success to get drawable resoure"); + }else{ + Log.i(TAG,"Fail to get drawable resoure"); + } + return i; + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setHasOptionsMenu(true); + mWeatherItem = (WeatherItem) getArguments().getSerializable(ARG_ITEM); + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View v = inflater.inflate(R.layout.fragment_weather_detail,container,false); + if(getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE).getString("unit","摄氏度")=="华氏度"){ + unit_text = "℉"; + } + + mDeatilDate = (TextView) v.findViewById(R.id.detail_date); + mDetailMaxTemp = (TextView) v.findViewById(R.id.detail_max_temp); + mDetailMinTemp = (TextView) v.findViewById(R.id.detail_min_temp); + mDetialIcon = (ImageView) v.findViewById(R.id.detail_icon); + mDetailHumidity = (TextView) v.findViewById(R.id.detail_humidity); + mDetailPressure = (TextView) v.findViewById(R.id.detail_pressure); + mDetailWind = (TextView) v.findViewById(R.id.detail_wind); + mDetailDesc = (TextView) v.findViewById(R.id.detail_desc); + + mDeatilDate.setText(mWeatherItem.getData()); + mDetailMaxTemp.setText(mWeatherItem.getMax_temp()+unit_text); + mDetailMinTemp.setText(mWeatherItem.getMin_temp()+unit_text); + String icon = "a"+mWeatherItem.getIcon(); + int id = getIconId(getContext(),icon); + Drawable drawable = getResources().getDrawable(id); + mDetialIcon.setImageDrawable(drawable); + mDetailHumidity.setText("Humidity: "+mWeatherItem.getHumidity()+" %"); + mDetailPressure.setText("Pressure: "+mWeatherItem.getPressure()+" hPa"); + mDetailWind.setText("Wind: "+mWeatherItem.getWind()+" km/h SE"); + mDetailDesc.setText(mWeatherItem.getText()); + + return v; + } + + public String createMessage(){ + String message = ""; + message += "今天的天气状况为:"+mWeatherItem.getText(); + message += " 今天的最高温度是: "+mWeatherItem.getMax_temp(); + message += " 今天的最低温度是: "+mWeatherItem.getMin_temp(); + message += " 今天的湿度为: "+mWeatherItem.getHumidity(); + message += " 今天的风速为:"+mWeatherItem.getWind(); + message += " 今天的气压为:"+mWeatherItem.getPressure(); + message += " 希望您拥有美好的一天!"; + return message; + } + + @Override + public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { + super.onCreateOptionsMenu(menu, inflater); + if(getActivity().findViewById(R.id.fragment_container)==null){ //是手机模式 + inflater.inflate(R.menu.fragment_detail,menu); + } + } + + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + switch (item.getItemId()){ + case R.id.menu_setting: + Intent intent = new Intent(getActivity(),SettingActivity.class); + startActivity(intent); + return true; + case R.id.menu_share: + Intent i = new Intent(Intent.ACTION_SEND); + i.setType("text/plain"); + i.putExtra(Intent.EXTRA_TEXT,createMessage()); + startActivity(i); + return true; + } + return super.onOptionsItemSelected(item); + } +} diff --git a/src/MyApplicatio n/java/com/example/myapplication/weather/WeatherFragment.java b/src/MyApplicatio n/java/com/example/myapplication/weather/WeatherFragment.java new file mode 100644 index 0000000..81c9a71 --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/weather/WeatherFragment.java @@ -0,0 +1,372 @@ +package com.example.myapplication.weather; + +import android.app.Activity; +import android.content.ContentValues; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.drawable.Drawable; +import android.net.ConnectivityManager; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.myapplication.R; + +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.List; + +public class WeatherFragment extends Fragment { + private static final String TAG="WeatherFragment"; + private RecyclerView mWeatherRecyclerView; + //今日天气板块 + private TextView mTodayTime; + private TextView mTodayMaxTemp; + private TextView mTodayMinTemp; + private ImageView mTodayIcon; + private TextView mTodayIconDesc; + + private String location = "北京"; //记录当前的城市ID,如果有变化,需要刷新你页面 + private String temp_unit = "摄氏度"; + private String unit_text = "°"; + private List mItems = new ArrayList<>(); //七天的天气详情对象 + + private Callbacks mCallbacks; + + private SQLiteDatabase mDatabase; + + public static WeatherFragment newInstance(){ + return new WeatherFragment(); + } + + /*回调函数,fragment调用activity的函数,这样点击列表后,方便出发事件,不应该用fragment执行其他fragment的细节*/ + public interface Callbacks{ + void onWeatherSelected(WeatherItem weatherItem); + } + + public static Intent newIntent(Context context){ + Intent i = new Intent(context, MainActivity1.class); + return i; + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + mCallbacks = (Callbacks)activity; + } + + @Override + public void onDetach() { + super.onDetach(); + mCallbacks = null; + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + SharedPreferences.Editor editor = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE).edit(); + setRetainInstance(true); + + //设置其他选项,让manager知道fragment替activity进行处理 + setHasOptionsMenu(true); + + //创建数据库 + mDatabase = new DatabaseHelper(getActivity()).getWritableDatabase(); + + new FetchItemsTask().execute(); //异步执行,获取网站上的json内容 + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View v = inflater.inflate(R.layout.fragment_weather,container,false); + + mWeatherRecyclerView = (RecyclerView) v.findViewById(R.id.fragment_weather_recycler_view); + mWeatherRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); + + //绑定今日天气模块 + mTodayTime = (TextView)v.findViewById(R.id.today_time); + mTodayMaxTemp = (TextView)v.findViewById(R.id.today_max_temp); + mTodayMinTemp = (TextView)v.findViewById(R.id.today_min_temp); + mTodayIcon = (ImageView)v.findViewById(R.id.today_icon); + mTodayIconDesc = (TextView)v.findViewById(R.id.today_icon_desc); + return v; + } + + @Override + public void onResume() { + super.onResume(); + SharedPreferences pref = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE); + String city = pref.getString("city","北京"); + String unit = pref.getString("unit","摄氏度"); + String send = pref.getString("send","是"); + if(city!=location){ //在重新启动页面的时候,如果地址改变了,需要刷新 + location = city; + new FetchItemsTask().execute(); //异步执行,获取网站上的json内容 + return; + } + if(unit!=temp_unit){ //在重新启动页面的时候,如果地址改变了,需要刷新 + temp_unit = unit; + new FetchItemsTask().execute(); //异步执行,获取网站上的json内容 + return; + } + if (send=="是"){ + //开启后台服务,启动定时器,发送通知消息 + NotificationService.setServiceAlarm(getActivity(),true); + }else{ + NotificationService.setServiceAlarm(getActivity(),false); + } + } + + @Override + public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { + super.onCreateOptionsMenu(menu, inflater); + inflater.inflate(R.menu.fragment_weather,menu); + } + + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + SharedPreferences pref = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE); + switch (item.getItemId()){ + case R.id.menu_setting: + Intent intent = new Intent(getActivity(),SettingActivity.class); + startActivity(intent); + return true; + case R.id.menu_map: + //调用腾讯地图 + Intent intent_txmap = new Intent(); + System.out.println("lat is :"+pref.getString("lat","39.90498")); + System.out.println("lon is :"+pref.getString("lon","116.40528")); + intent_txmap.setData(Uri.parse("qqmap://map/geocoder?coord="+ + pref.getString("lat","39.90498")+ + "," +pref.getString("lon","116.40528")+ + "&referer=BJWBZ-EXJ3U-IUGV4-4A74J-754OJ-KXFVX")); + startActivity(intent_txmap); + } + return super.onOptionsItemSelected(item); + } + + //获取drawable图标资源的id + public int getIconId(Context mContext, String icon){ + int i= getResources().getIdentifier(icon, "drawable", mContext.getPackageName()) ; + if(i>0){ + //Log.i(TAG,"Success to get drawable resoure"); + }else{ + Log.i(TAG,"Fail to get drawable resoure"); + } + return i; + } + + // 异步从URL获取天气对象 + private class FetchItemsTask extends AsyncTask> { + SharedPreferences.Editor editor = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE).edit(); + SharedPreferences pref = getActivity().getSharedPreferences("setting",Context.MODE_PRIVATE); + String city = pref.getString("city","北京"); + String unit = pref.getString("unit","摄氏度"); + String city_url = "https://geoapi.qweather.com/v2/city/lookup?location="+city+"&key=6b01a87a7f3347a19c7b6b84f2ba35e3"; + + @Override + protected List doInBackground(Void... voids) { + List weatherItems = new ArrayList<>(); + unit_text = "°"; + if(unit=="华氏度"){ + unit_text = "℉"; + } + + System.out.println("network is :"+isNetworkConnected(getActivity().getApplicationContext())); + //如果没有网络连接,从数据库获取信息 + if(!isNetworkConnected(getActivity().getApplicationContext())){ + Cursor cursor = mDatabase.query ("weather",null,null,null,null,null,null); + cursor.moveToFirst(); + for(int i=0;i weatherItems) { + mItems = weatherItems; + + SharedPreferences.Editor editor = getActivity().getSharedPreferences("setting", Context.MODE_PRIVATE).edit(); + + //实现今天天气部分的UI + WeatherItem item = mItems.get(0); + mTodayTime.setText("Today,"+location); + mTodayMaxTemp.setText(item.getMax_temp()+unit_text); + editor.putString("max_temp",item.getMax_temp()); + mTodayMinTemp.setText(item.getMin_temp()+unit_text); + editor.putString("min_temp",item.getMin_temp()); + mTodayIconDesc.setText(item.getText()); + editor.putString("text",item.getText()); + String icon = "a"+item.getIcon(); + int id = getIconId(getContext(),icon); + Drawable drawable = getResources().getDrawable(id); + mTodayIcon.setImageDrawable(drawable); + + editor.commit(); + + //实现recyclerview部分的UI + setupAdapter(); + + //如果是ipad,就手动更新详情页面 + if(getActivity().findViewById(R.id.detail_container)!=null){ + mCallbacks.onWeatherSelected(item); + } + } + } + + public class WeatherHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ + private WeatherItem mWeatherItem; + private TextView mItemMaxWeather; + private TextView mItemMinWeather; + private ImageView mItemIcon; + private TextView mItemDate; + private TextView mItemDesc; + + public void setDay(String day){ + mItemDate.setText(day); + } + + public WeatherHolder(View itemView){ + super(itemView); + itemView.setOnClickListener(this); + mItemMaxWeather = (TextView) itemView.findViewById(R.id.item_max_weather); + mItemMinWeather = (TextView) itemView.findViewById(R.id.item_min_weather); + mItemIcon = (ImageView) itemView.findViewById(R.id.item_icon); + mItemDate = (TextView) itemView.findViewById(R.id.item_date); + mItemDesc = (TextView) itemView.findViewById(R.id.item_desc); + } + + public void bindWeatherItem(WeatherItem weatherItem){ + mWeatherItem = weatherItem; + mItemMaxWeather.setText(weatherItem.getMax_temp()+unit_text); + mItemMinWeather.setText(weatherItem.getMin_temp()+unit_text); + String icon = "a"+weatherItem.getIcon(); + int id = getIconId(getContext(),icon); + Drawable drawable = getResources().getDrawable(id); + mItemIcon.setImageDrawable(drawable); + mItemDate.setText(weatherItem.getData()); + mItemDesc.setText(weatherItem.getText()); + } + + //点击列表,跳转到详情页面 + @Override + public void onClick(View v) { + Log.i(TAG,"click"); + mCallbacks.onWeatherSelected(mWeatherItem); + } + } + + private class WeatherAdaper extends RecyclerView.Adapter{ + private List mWeatherList = new ArrayList<>(); + + public WeatherAdaper(List items){ + mWeatherList = items; + } + + @Override + public int getItemCount() { + return mWeatherList.size(); + } + + @Override + public WeatherHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + //实例化mars_item布局 + LayoutInflater inflater = LayoutInflater.from(getActivity()); + View view = inflater.inflate(R.layout.weather_item,parent,false); + return new WeatherHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull WeatherHolder holder, int position) { + WeatherItem weatherItem = mWeatherList.get(position); + holder.bindWeatherItem(weatherItem); + if(position==0){ + holder.setDay("Today"); + } + if(position==1){ + holder.setDay("Tomorrow"); + } + } + } + + private void setupAdapter(){ + if(isAdded()){ + mWeatherRecyclerView.setAdapter(new WeatherAdaper(mItems)); + } + } + + //判断网络是否连接 + public boolean isNetworkConnected(Context context) { + ConnectivityManager cm = (ConnectivityManager)getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); + boolean isNetworkAvailable = cm.getActiveNetwork() != null; + boolean isNetworkConnected = isNetworkAvailable && cm.getActiveNetworkInfo().isConnected(); + return isNetworkConnected; + } +} diff --git a/src/MyApplicatio n/java/com/example/myapplication/weather/WeatherItem.java b/src/MyApplicatio n/java/com/example/myapplication/weather/WeatherItem.java new file mode 100644 index 0000000..b6b33f9 --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/weather/WeatherItem.java @@ -0,0 +1,78 @@ +package com.example.myapplication.weather; + +import java.io.Serializable; + +public class WeatherItem implements Serializable { + private String data; //天气日期 + private String max_temp; //最高温度 + private String min_temp; //最低温度 + private String text; //天气描述 + private String humidity; //适度 + private String pressure; //气压 + private String wind; //风力 + private String icon; //图标 + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + public String getMax_temp() { + return max_temp; + } + + public void setMax_temp(String max_temp) { + this.max_temp = max_temp; + } + + public String getMin_temp() { + return min_temp; + } + + public void setMin_temp(String min_temp) { + this.min_temp = min_temp; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public String getHumidity() { + return humidity; + } + + public void setHumidity(String humidity) { + this.humidity = humidity; + } + + public String getPressure() { + return pressure; + } + + public void setPressure(String pressure) { + this.pressure = pressure; + } + + public String getWind() { + return wind; + } + + public void setWind(String wind) { + this.wind = wind; + } +} diff --git a/src/MyApplicatio n/java/com/example/myapplication/yijiantong.java b/src/MyApplicatio n/java/com/example/myapplication/yijiantong.java new file mode 100644 index 0000000..0241c47 --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/yijiantong.java @@ -0,0 +1,142 @@ +package com.example.myapplication; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.provider.ContactsContract; +import android.view.View; +import android.widget.Button; + +public class yijiantong extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_yijiantong); + if (shouldAskPermissions()) { + askPermissions(); + } + + + Button button1 = findViewById(R.id.button1); + //点击 + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=20000067&chInfo=ch_desktop&url=https%3A%2F%2F68687564.h5app.alipay.com%2Fwww%2Findex.html"); + Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); + startActivity(intent10); + + } + }); + + Button button2 = findViewById(R.id.button2); + //点击 + button2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Uri uri = Uri.parse("alipayqr://platformapi/startapp?saId=2021002170600786"); + Intent intent = new Intent(Intent.ACTION_VIEW, uri); + startActivity(intent); + + } + }); + Button button3 = findViewById(R.id.button3); + //点击 + button3.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Uri uri = Uri.parse("alipayqr://platformapi/startapp?saId=2021001123608001"); + Intent intent = new Intent(Intent.ACTION_VIEW, uri); + startActivity(intent); + + } + }); + Button button4 = findViewById(R.id.button4); + //点击 + button4.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Uri uri = Uri.parse("alipayqr://platformapi/startapp?saId=10000007"); + Intent intent = new Intent(Intent.ACTION_VIEW, uri); + startActivity(intent); + + } + }); + + + Button button5 = findViewById(R.id.button5); + //点击 + button5.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Uri uri1 = Uri.parse("alipayqr://platformapi/startapp?saId=20000056"); + Intent intent1 = new Intent(Intent.ACTION_VIEW, uri1); + startActivity(intent1); + + } + }); + Button button6 = findViewById(R.id.button6); + //点击 + button6.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Uri uri2 = Uri.parse("alipayqr://platformapi/startapp?saId=20000123"); + Intent intent2 = new Intent(Intent.ACTION_VIEW, uri2); + startActivity(intent2); + + } + }); + Button button7 = findViewById(R.id.button8); + //点击 + button7.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent addIntent = new Intent(Intent.ACTION_INSERT, Uri.withAppendedPath(Uri.parse("content://com.android.contacts"), "contacts")); + addIntent.setType("vnd.android.cursor.dir/person"); + addIntent.setType("vnd.android.cursor.dir/contact"); + addIntent.setType("vnd.android.cursor.dir/raw_contact"); + boolean number = false; + addIntent.putExtra(ContactsContract.Intents.Insert.NAME, number); + + boolean numberForNewConstant = false; + addIntent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE, numberForNewConstant); + startActivity(addIntent); + + } + }); + Button button8 = findViewById(R.id.button7); + //点击 + button8.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + //调用系统方法拨打电话 + Intent intent = new Intent(); + intent.setAction(Intent.ACTION_CALL); + intent.setData(Uri.parse("tel:" + "15607989193")); + startActivity(intent); + } + }); + + + + } + + private boolean askPermissions() { + return (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1); + } + + private boolean shouldAskPermissions() { + String[] permissions = { + "android.permission.CALL_PHONE" + }; + int requestCode = 200; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + requestPermissions(permissions, requestCode); + } + return true; + } +} \ No newline at end of file diff --git a/src/MyApplicatio n/java/com/example/myapplication/yuyin.java b/src/MyApplicatio n/java/com/example/myapplication/yuyin.java new file mode 100644 index 0000000..74f7ce4 --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/yuyin.java @@ -0,0 +1,450 @@ +package com.example.myapplication; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; + +import android.Manifest; +import android.annotation.SuppressLint; +import android.app.Activity; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.provider.ContactsContract; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; +import android.widget.Toast; + +import com.iflytek.cloud.ErrorCode; +import com.iflytek.cloud.InitListener; +import com.iflytek.cloud.RecognizerListener; +import com.iflytek.cloud.RecognizerResult; +import com.iflytek.cloud.SpeechConstant; +import com.iflytek.cloud.SpeechError; +import com.iflytek.cloud.SpeechRecognizer; +import com.iflytek.cloud.ui.RecognizerDialog; +import com.iflytek.cloud.ui.RecognizerDialogListener; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; + +public class yuyin extends AppCompatActivity implements View.OnClickListener { + + private static final String TAG = "MainActivity"; + + private SpeechRecognizer mIat;// 语音听写对象 + private RecognizerDialog mIatDialog;// 语音听写UI + + // 用HashMap存储听写结果 + private HashMap mIatResults = new LinkedHashMap(); + + private SharedPreferences mSharedPreferences;//缓存 + + private String mEngineType = SpeechConstant.TYPE_CLOUD;// 引擎类型 + private String language = "zh_cn";//识别语言 + + private TextView tvResult;//识别结果 + private Button btnStart;//开始识别 + private String resultType = "json";//结果内容数据格式 + private Button go; + private TextView tvResult1; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_yuyin); + tvResult = findViewById(R.id.tv_result); + btnStart = findViewById(R.id.btn_start); + go=findViewById(R.id.go); + btnStart.setOnClickListener(this); + tvResult1=findViewById(R.id.tv_result1); + + initPermission();//权限请求 + + + // 使用SpeechRecognizer对象,可根据回调消息自定义界面; + mIat = SpeechRecognizer.createRecognizer(yuyin.this, mInitListener); + // 使用UI听写功能,请根据sdk文件目录下的notice.txt,放置布局文件和图片资源 + mIatDialog = new RecognizerDialog(yuyin.this, mInitListener); + mSharedPreferences = getSharedPreferences("ASR", + Activity.MODE_PRIVATE); + } + + @Override + public void onClick(View v) { + if( null == mIat ){ + // 创建单例失败,与 21001 错误为同样原因,参考 http://bbs.xfyun.cn/forum.php?mod=viewthread&tid=9688 + showMsg( "创建对象失败,请确认 libmsc.so 放置正确,且有调用 createUtility 进行初始化" ); + return; + } + + mIatResults.clear();//清除数据 + setParam(); // 设置参数 + mIatDialog.setListener(mRecognizerDialogListener);//设置监听 + mIatDialog.show();// 显示对话框 + } + + + /** + * 初始化监听器。 + */ + private InitListener mInitListener = new InitListener() { + + @Override + public void onInit(int code) { + Log.d(TAG, "SpeechRecognizer init() code = " + code); + if (code != ErrorCode.SUCCESS) { + showMsg("初始化失败,错误码:" + code + ",请点击网址https://www.xfyun.cn/document/error-code查询解决方案"); + } + } + }; + + + /** + * 听写UI监听器 + */ + private RecognizerDialogListener mRecognizerDialogListener = new RecognizerDialogListener() { + public void onResult(RecognizerResult results, boolean isLast) { + + printResult(results);//结果数据解析 + printButton(results); + + } + + /** + * 识别回调错误. + */ + public void onError(SpeechError error) { + showMsg(error.getPlainDescription(true)); + } + + }; + + /** + * 数据解析 + * + * @param results + */ + private void printResult(RecognizerResult results) { + String text = JsonParser.parseIatResult(results.getResultString()); + + String sn = null; + // 读取json结果中的sn字段 + try { + JSONObject resultJson = new JSONObject(results.getResultString()); + sn = resultJson.optString("sn"); + } catch (JSONException e) { + e.printStackTrace(); + } + + mIatResults.put(sn, text); + + StringBuffer resultBuffer = new StringBuffer(); + for (String key : mIatResults.keySet()) { + resultBuffer.append(mIatResults.get(key)); + } + + tvResult.setText(resultBuffer.toString());//听写结果显示 + + } + private void printButton(RecognizerResult results) { + String text = JsonParser.parseIatResult(results.getResultString()); + + String sn = null; + // 读取json结果中的sn字段 + try { + JSONObject resultJson = new JSONObject(results.getResultString()); + sn = resultJson.optString("sn"); + } catch (JSONException e) { + e.printStackTrace(); + } + + mIatResults.put(sn, text); + + StringBuffer resultBuffer = new StringBuffer(); + for (String key : mIatResults.keySet()) { + resultBuffer.append(mIatResults.get(key)); + } + if(resultBuffer.toString().equals("健康。")){ + Button button1 = findViewById(R.id.go); + tvResult1.setText(resultBuffer.toString()); + + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=20000067&chInfo=ch_desktop&url=https%3A%2F%2F68687564.h5app.alipay.com%2Fwww%2Findex.html"); + Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); + startActivity(intent10); + + } + }); + } + else if(resultBuffer.toString().equals("行程。")){ + Button button1 = findViewById(R.id.go); + tvResult1.setText(resultBuffer.toString()); + + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=2021002170600786"); + Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); + startActivity(intent10); + + } + }); + } + else if(resultBuffer.toString().equals("核酸检测。")){ + Button button1 = findViewById(R.id.go); + tvResult1.setText(resultBuffer.toString()); + + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=2021001123608001"); + Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); + startActivity(intent10); + + } + }); + } + else if(resultBuffer.toString().equals("扫码付款。")){ + Button button1 = findViewById(R.id.go); + tvResult1.setText(resultBuffer.toString()); + + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=10000007"); + Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); + startActivity(intent10); + + } + }); + } + else if(resultBuffer.toString().equals("付款码。")){ + Button button1 = findViewById(R.id.go); + tvResult1.setText(resultBuffer.toString()); + + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=20000056"); + Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); + startActivity(intent10); + + } + }); + } + else if(resultBuffer.toString().equals("收款码。")){ + Button button1 = findViewById(R.id.go); + tvResult1.setText(resultBuffer.toString()); + + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Uri uri10 = Uri.parse("alipayqr://platformapi/startapp?saId=20000123"); + Intent intent10 = new Intent(Intent.ACTION_VIEW, uri10); + startActivity(intent10); + + } + }); + } + else if(resultBuffer.toString().equals("设置常用联系人。")){ + Button button1 = findViewById(R.id.go); + tvResult1.setText(resultBuffer.toString()); + + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent addIntent = new Intent(Intent.ACTION_INSERT, Uri.withAppendedPath(Uri.parse("content://com.android.contacts"), "contacts")); + addIntent.setType("vnd.android.cursor.dir/person"); + addIntent.setType("vnd.android.cursor.dir/contact"); + addIntent.setType("vnd.android.cursor.dir/raw_contact"); + boolean number = false; + addIntent.putExtra(ContactsContract.Intents.Insert.NAME, number); + + boolean numberForNewConstant = false; + addIntent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE, numberForNewConstant); + startActivity(addIntent); + + } + }); + } + else if(resultBuffer.toString().equals("呼叫。")){ + Button button1 = findViewById(R.id.go); + tvResult1.setText(resultBuffer.toString()); + + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(); + intent.setAction(Intent.ACTION_CALL); + intent.setData(Uri.parse("tel:" + "15607989193")); + startActivity(intent); + + } + }); + } + else if(resultBuffer.toString().equals("一键通。")){ + Button button1 = findViewById(R.id.go); + tvResult1.setText(resultBuffer.toString()); + + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent1=new Intent(yuyin.this,yijiantong.class); + startActivity(intent1);; + + } + }); + } + else if(resultBuffer.toString().equals("找寻。")){ + Button button1 = findViewById(R.id.go); + tvResult1.setText(resultBuffer.toString()); + + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent1=new Intent(yuyin.this,zhaoxun.class); + startActivity(intent1);; + + } + }); + } + else if(resultBuffer.toString().equals("健康。")){ + Button button1 = findViewById(R.id.go); + tvResult1.setText(resultBuffer.toString()); + + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent1=new Intent(yuyin.this,jiankang.class); + startActivity(intent1);; + + } + }); + } + else{ + + } + + + + + + } + + /** + * 参数设置 + * + * @return + */ + public void setParam() { + // 清空参数 + mIat.setParameter(SpeechConstant.PARAMS, null); + // 设置听写引擎 + mIat.setParameter(SpeechConstant.ENGINE_TYPE, mEngineType); + // 设置返回结果格式 + mIat.setParameter(SpeechConstant.RESULT_TYPE, resultType); + + if (language.equals("zh_cn")) { + String lag = mSharedPreferences.getString("iat_language_preference", + "mandarin"); + Log.e(TAG, "language:" + language);// 设置语言 + mIat.setParameter(SpeechConstant.LANGUAGE, "zh_cn"); + // 设置语言区域 + mIat.setParameter(SpeechConstant.ACCENT, lag); + } else { + + mIat.setParameter(SpeechConstant.LANGUAGE, language); + } + Log.e(TAG, "last language:" + mIat.getParameter(SpeechConstant.LANGUAGE)); + + //此处用于设置dialog中不显示错误码信息 + //mIat.setParameter("view_tips_plain","false"); + + // 设置语音前端点:静音超时时间,即用户多长时间不说话则当做超时处理 + mIat.setParameter(SpeechConstant.VAD_BOS, mSharedPreferences.getString("iat_vadbos_preference", "4000")); + + // 设置语音后端点:后端点静音检测时间,即用户停止说话多长时间内即认为不再输入, 自动停止录音 + mIat.setParameter(SpeechConstant.VAD_EOS, mSharedPreferences.getString("iat_vadeos_preference", "1000")); + + // 设置标点符号,设置为"0"返回结果无标点,设置为"1"返回结果有标点 + mIat.setParameter(SpeechConstant.ASR_PTT, mSharedPreferences.getString("iat_punc_preference", "1")); + + // 设置音频保存路径,保存音频格式支持pcm、wav,设置路径为sd卡请注意WRITE_EXTERNAL_STORAGE权限 + mIat.setParameter(SpeechConstant.AUDIO_FORMAT, "wav"); + mIat.setParameter(SpeechConstant.ASR_AUDIO_PATH, Environment.getExternalStorageDirectory() + "/msc/iat.wav"); + } + + /** + * 提示消息 + * @param msg + */ + private void showMsg(String msg) { + Toast.makeText(yuyin.this, msg, Toast.LENGTH_SHORT).show(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + + if (null != mIat) { + // 退出时释放连接 + mIat.cancel(); + mIat.destroy(); + } + } + + + /** + * android 6.0 以上需要动态申请权限 + */ + private void initPermission() { + String permissions[] = {Manifest.permission.RECORD_AUDIO, + Manifest.permission.ACCESS_NETWORK_STATE, + Manifest.permission.INTERNET, + Manifest.permission.WRITE_EXTERNAL_STORAGE + }; + + ArrayList toApplyList = new ArrayList(); + + for (String perm : permissions) { + if (PackageManager.PERMISSION_GRANTED != ContextCompat.checkSelfPermission(this, perm)) { + toApplyList.add(perm); + } + } + String tmpList[] = new String[toApplyList.size()]; + if (!toApplyList.isEmpty()) { + ActivityCompat.requestPermissions(this, toApplyList.toArray(tmpList), 123); + } + + } + + /** + * 权限申请回调,可以作进一步处理 + * + * @param requestCode + * @param permissions + * @param grantResults + */ + @Override + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + // 此处为android 6.0以上动态授权的回调,用户自行实现。 + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + } + + +} diff --git a/src/MyApplicatio n/java/com/example/myapplication/zhaoxun.java b/src/MyApplicatio n/java/com/example/myapplication/zhaoxun.java new file mode 100644 index 0000000..9d19533 --- /dev/null +++ b/src/MyApplicatio n/java/com/example/myapplication/zhaoxun.java @@ -0,0 +1,42 @@ +package com.example.myapplication; + +import androidx.appcompat.app.AppCompatActivity; + +import android.annotation.SuppressLint; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.Toast; + +public class zhaoxun extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_zhaoxun); + Button buttonitem=findViewById(R.id.myitem); + Button buttonmap=findViewById(R.id.map); + buttonitem.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) {//Intent + /* Toast.makeText(zhaoxun.this,"正在打开地图",Toast.LENGTH_SHORT).show(); + Intent intent=new Intent(zhaoxun.this,MapActivity1.class); + startActivity(intent);*/ + Intent intent=new Intent(zhaoxun.this,itemfound.class); + startActivity(intent); + } + }); + buttonmap.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) {//Intent + Toast.makeText(zhaoxun.this,"正在打开地图",Toast.LENGTH_SHORT).show(); + Intent intent=new Intent(zhaoxun.this,MapActivity1.class); + startActivity(intent); + + } + }); + + } +} \ No newline at end of file diff --git a/src/MyApplicatio n/res/drawable-v24/ic_launcher_foreground.xml b/src/MyApplicatio n/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/src/MyApplicatio n/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/MyApplicatio n/res/drawable/a100.png b/src/MyApplicatio n/res/drawable/a100.png new file mode 100644 index 0000000..e435546 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a100.png differ diff --git a/src/MyApplicatio n/res/drawable/a101.png b/src/MyApplicatio n/res/drawable/a101.png new file mode 100644 index 0000000..43f4ab2 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a101.png differ diff --git a/src/MyApplicatio n/res/drawable/a102.png b/src/MyApplicatio n/res/drawable/a102.png new file mode 100644 index 0000000..b23965b Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a102.png differ diff --git a/src/MyApplicatio n/res/drawable/a103.png b/src/MyApplicatio n/res/drawable/a103.png new file mode 100644 index 0000000..9dcad7a Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a103.png differ diff --git a/src/MyApplicatio n/res/drawable/a104.png b/src/MyApplicatio n/res/drawable/a104.png new file mode 100644 index 0000000..86ff29f Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a104.png differ diff --git a/src/MyApplicatio n/res/drawable/a150.png b/src/MyApplicatio n/res/drawable/a150.png new file mode 100644 index 0000000..a3886f8 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a150.png differ diff --git a/src/MyApplicatio n/res/drawable/a153.png b/src/MyApplicatio n/res/drawable/a153.png new file mode 100644 index 0000000..cb94f14 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a153.png differ diff --git a/src/MyApplicatio n/res/drawable/a154.png b/src/MyApplicatio n/res/drawable/a154.png new file mode 100644 index 0000000..de89a6f Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a154.png differ diff --git a/src/MyApplicatio n/res/drawable/a300.png b/src/MyApplicatio n/res/drawable/a300.png new file mode 100644 index 0000000..977a857 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a300.png differ diff --git a/src/MyApplicatio n/res/drawable/a301.png b/src/MyApplicatio n/res/drawable/a301.png new file mode 100644 index 0000000..6384e67 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a301.png differ diff --git a/src/MyApplicatio n/res/drawable/a302.png b/src/MyApplicatio n/res/drawable/a302.png new file mode 100644 index 0000000..83f096d Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a302.png differ diff --git a/src/MyApplicatio n/res/drawable/a303.png b/src/MyApplicatio n/res/drawable/a303.png new file mode 100644 index 0000000..94c1d05 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a303.png differ diff --git a/src/MyApplicatio n/res/drawable/a304.png b/src/MyApplicatio n/res/drawable/a304.png new file mode 100644 index 0000000..3b3cc28 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a304.png differ diff --git a/src/MyApplicatio n/res/drawable/a305.png b/src/MyApplicatio n/res/drawable/a305.png new file mode 100644 index 0000000..6dd845a Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a305.png differ diff --git a/src/MyApplicatio n/res/drawable/a306.png b/src/MyApplicatio n/res/drawable/a306.png new file mode 100644 index 0000000..630ad92 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a306.png differ diff --git a/src/MyApplicatio n/res/drawable/a307.png b/src/MyApplicatio n/res/drawable/a307.png new file mode 100644 index 0000000..d76028c Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a307.png differ diff --git a/src/MyApplicatio n/res/drawable/a308.png b/src/MyApplicatio n/res/drawable/a308.png new file mode 100644 index 0000000..d218a85 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a308.png differ diff --git a/src/MyApplicatio n/res/drawable/a309.png b/src/MyApplicatio n/res/drawable/a309.png new file mode 100644 index 0000000..717e779 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a309.png differ diff --git a/src/MyApplicatio n/res/drawable/a310.png b/src/MyApplicatio n/res/drawable/a310.png new file mode 100644 index 0000000..e5004aa Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a310.png differ diff --git a/src/MyApplicatio n/res/drawable/a311.png b/src/MyApplicatio n/res/drawable/a311.png new file mode 100644 index 0000000..8d5f541 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a311.png differ diff --git a/src/MyApplicatio n/res/drawable/a312.png b/src/MyApplicatio n/res/drawable/a312.png new file mode 100644 index 0000000..0f74f47 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a312.png differ diff --git a/src/MyApplicatio n/res/drawable/a313.png b/src/MyApplicatio n/res/drawable/a313.png new file mode 100644 index 0000000..5429d60 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a313.png differ diff --git a/src/MyApplicatio n/res/drawable/a314.png b/src/MyApplicatio n/res/drawable/a314.png new file mode 100644 index 0000000..9feaa6b Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a314.png differ diff --git a/src/MyApplicatio n/res/drawable/a315.png b/src/MyApplicatio n/res/drawable/a315.png new file mode 100644 index 0000000..5b83793 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a315.png differ diff --git a/src/MyApplicatio n/res/drawable/a316.png b/src/MyApplicatio n/res/drawable/a316.png new file mode 100644 index 0000000..411aa73 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a316.png differ diff --git a/src/MyApplicatio n/res/drawable/a317.png b/src/MyApplicatio n/res/drawable/a317.png new file mode 100644 index 0000000..e2aeb2e Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a317.png differ diff --git a/src/MyApplicatio n/res/drawable/a318.png b/src/MyApplicatio n/res/drawable/a318.png new file mode 100644 index 0000000..b729b4a Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a318.png differ diff --git a/src/MyApplicatio n/res/drawable/a350.png b/src/MyApplicatio n/res/drawable/a350.png new file mode 100644 index 0000000..81dcaaa Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a350.png differ diff --git a/src/MyApplicatio n/res/drawable/a351.png b/src/MyApplicatio n/res/drawable/a351.png new file mode 100644 index 0000000..a3adce4 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a351.png differ diff --git a/src/MyApplicatio n/res/drawable/a399.png b/src/MyApplicatio n/res/drawable/a399.png new file mode 100644 index 0000000..a87be77 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a399.png differ diff --git a/src/MyApplicatio n/res/drawable/a400.png b/src/MyApplicatio n/res/drawable/a400.png new file mode 100644 index 0000000..b764670 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a400.png differ diff --git a/src/MyApplicatio n/res/drawable/a401.png b/src/MyApplicatio n/res/drawable/a401.png new file mode 100644 index 0000000..a4a619d Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a401.png differ diff --git a/src/MyApplicatio n/res/drawable/a402.png b/src/MyApplicatio n/res/drawable/a402.png new file mode 100644 index 0000000..d46ec85 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a402.png differ diff --git a/src/MyApplicatio n/res/drawable/a403.png b/src/MyApplicatio n/res/drawable/a403.png new file mode 100644 index 0000000..c33e15d Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a403.png differ diff --git a/src/MyApplicatio n/res/drawable/a404.png b/src/MyApplicatio n/res/drawable/a404.png new file mode 100644 index 0000000..4fcf44c Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a404.png differ diff --git a/src/MyApplicatio n/res/drawable/a405.png b/src/MyApplicatio n/res/drawable/a405.png new file mode 100644 index 0000000..c4e7471 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a405.png differ diff --git a/src/MyApplicatio n/res/drawable/a406.png b/src/MyApplicatio n/res/drawable/a406.png new file mode 100644 index 0000000..c0fc63b Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a406.png differ diff --git a/src/MyApplicatio n/res/drawable/a407.png b/src/MyApplicatio n/res/drawable/a407.png new file mode 100644 index 0000000..9ff95f2 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a407.png differ diff --git a/src/MyApplicatio n/res/drawable/a408.png b/src/MyApplicatio n/res/drawable/a408.png new file mode 100644 index 0000000..c006569 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a408.png differ diff --git a/src/MyApplicatio n/res/drawable/a409.png b/src/MyApplicatio n/res/drawable/a409.png new file mode 100644 index 0000000..5f9d6c2 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a409.png differ diff --git a/src/MyApplicatio n/res/drawable/a410.png b/src/MyApplicatio n/res/drawable/a410.png new file mode 100644 index 0000000..db28ffc Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a410.png differ diff --git a/src/MyApplicatio n/res/drawable/a456.png b/src/MyApplicatio n/res/drawable/a456.png new file mode 100644 index 0000000..20949c7 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a456.png differ diff --git a/src/MyApplicatio n/res/drawable/a457.png b/src/MyApplicatio n/res/drawable/a457.png new file mode 100644 index 0000000..334c3d1 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a457.png differ diff --git a/src/MyApplicatio n/res/drawable/a499.png b/src/MyApplicatio n/res/drawable/a499.png new file mode 100644 index 0000000..7f9ef59 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a499.png differ diff --git a/src/MyApplicatio n/res/drawable/a500.png b/src/MyApplicatio n/res/drawable/a500.png new file mode 100644 index 0000000..ea99407 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a500.png differ diff --git a/src/MyApplicatio n/res/drawable/a501.png b/src/MyApplicatio n/res/drawable/a501.png new file mode 100644 index 0000000..d9b1eca Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a501.png differ diff --git a/src/MyApplicatio n/res/drawable/a502.png b/src/MyApplicatio n/res/drawable/a502.png new file mode 100644 index 0000000..19d3a41 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a502.png differ diff --git a/src/MyApplicatio n/res/drawable/a503.png b/src/MyApplicatio n/res/drawable/a503.png new file mode 100644 index 0000000..406758f Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a503.png differ diff --git a/src/MyApplicatio n/res/drawable/a504.png b/src/MyApplicatio n/res/drawable/a504.png new file mode 100644 index 0000000..50af230 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a504.png differ diff --git a/src/MyApplicatio n/res/drawable/a507.png b/src/MyApplicatio n/res/drawable/a507.png new file mode 100644 index 0000000..9c0c5da Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a507.png differ diff --git a/src/MyApplicatio n/res/drawable/a508.png b/src/MyApplicatio n/res/drawable/a508.png new file mode 100644 index 0000000..f1c84a1 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a508.png differ diff --git a/src/MyApplicatio n/res/drawable/a509.png b/src/MyApplicatio n/res/drawable/a509.png new file mode 100644 index 0000000..5dbd197 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a509.png differ diff --git a/src/MyApplicatio n/res/drawable/a510.png b/src/MyApplicatio n/res/drawable/a510.png new file mode 100644 index 0000000..0fc21a0 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a510.png differ diff --git a/src/MyApplicatio n/res/drawable/a511.png b/src/MyApplicatio n/res/drawable/a511.png new file mode 100644 index 0000000..294da17 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a511.png differ diff --git a/src/MyApplicatio n/res/drawable/a512.png b/src/MyApplicatio n/res/drawable/a512.png new file mode 100644 index 0000000..e6a3b34 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a512.png differ diff --git a/src/MyApplicatio n/res/drawable/a513.png b/src/MyApplicatio n/res/drawable/a513.png new file mode 100644 index 0000000..a532a39 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a513.png differ diff --git a/src/MyApplicatio n/res/drawable/a514.png b/src/MyApplicatio n/res/drawable/a514.png new file mode 100644 index 0000000..acb49e3 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a514.png differ diff --git a/src/MyApplicatio n/res/drawable/a515.png b/src/MyApplicatio n/res/drawable/a515.png new file mode 100644 index 0000000..83b2de0 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a515.png differ diff --git a/src/MyApplicatio n/res/drawable/a900.png b/src/MyApplicatio n/res/drawable/a900.png new file mode 100644 index 0000000..d8b4c19 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a900.png differ diff --git a/src/MyApplicatio n/res/drawable/a901.png b/src/MyApplicatio n/res/drawable/a901.png new file mode 100644 index 0000000..bc28f5f Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a901.png differ diff --git a/src/MyApplicatio n/res/drawable/a999.png b/src/MyApplicatio n/res/drawable/a999.png new file mode 100644 index 0000000..ff99a92 Binary files /dev/null and b/src/MyApplicatio n/res/drawable/a999.png differ diff --git a/src/MyApplicatio n/res/drawable/ic_launcher_background.xml b/src/MyApplicatio n/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..0d025f9 --- /dev/null +++ b/src/MyApplicatio n/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MyApplicatio n/res/layout/activity_detail.xml b/src/MyApplicatio n/res/layout/activity_detail.xml new file mode 100644 index 0000000..8676b91 --- /dev/null +++ b/src/MyApplicatio n/res/layout/activity_detail.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/src/MyApplicatio n/res/layout/activity_itemfound.xml b/src/MyApplicatio n/res/layout/activity_itemfound.xml new file mode 100644 index 0000000..71db188 --- /dev/null +++ b/src/MyApplicatio n/res/layout/activity_itemfound.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/MyApplicatio n/res/layout/activity_main.xml b/src/MyApplicatio n/res/layout/activity_main.xml new file mode 100644 index 0000000..24e19db --- /dev/null +++ b/src/MyApplicatio n/res/layout/activity_main.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + diff --git a/src/MyApplicatio n/res/layout/activity_main1.xml b/src/MyApplicatio n/res/layout/activity_main1.xml new file mode 100644 index 0000000..dc30be7 --- /dev/null +++ b/src/MyApplicatio n/res/layout/activity_main1.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/src/MyApplicatio n/res/layout/activity_map1.xml b/src/MyApplicatio n/res/layout/activity_map1.xml new file mode 100644 index 0000000..e939697 --- /dev/null +++ b/src/MyApplicatio n/res/layout/activity_map1.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/MyApplicatio n/res/layout/activity_setting.xml b/src/MyApplicatio n/res/layout/activity_setting.xml new file mode 100644 index 0000000..5447e4d --- /dev/null +++ b/src/MyApplicatio n/res/layout/activity_setting.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/MyApplicatio n/res/layout/activity_twopane.xml b/src/MyApplicatio n/res/layout/activity_twopane.xml new file mode 100644 index 0000000..4396ba4 --- /dev/null +++ b/src/MyApplicatio n/res/layout/activity_twopane.xml @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/src/MyApplicatio n/res/layout/activity_wnavi_guide.xml b/src/MyApplicatio n/res/layout/activity_wnavi_guide.xml new file mode 100644 index 0000000..cc26e01 --- /dev/null +++ b/src/MyApplicatio n/res/layout/activity_wnavi_guide.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/src/MyApplicatio n/res/layout/activity_yijiantong.xml b/src/MyApplicatio n/res/layout/activity_yijiantong.xml new file mode 100644 index 0000000..36c211a --- /dev/null +++ b/src/MyApplicatio n/res/layout/activity_yijiantong.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/MyApplicatio n/res/layout/activity_yuyin.xml b/src/MyApplicatio n/res/layout/activity_yuyin.xml new file mode 100644 index 0000000..4316595 --- /dev/null +++ b/src/MyApplicatio n/res/layout/activity_yuyin.xml @@ -0,0 +1,39 @@ + + + + + +