| After Width: | Height: | Size: 1.4 KiB | 
| After Width: | Height: | Size: 14 KiB | 
| After Width: | Height: | Size: 16 KiB | 
| After Width: | Height: | Size: 12 KiB | 
| After Width: | Height: | Size: 7.7 KiB | 
| @ -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(); | ||||
| 	} | ||||
| } | ||||
| @ -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); | ||||
| 
 | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| } | ||||
| @ -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(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| @ -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<String> 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");
 | ||||
|             } | ||||
| 
 | ||||
|         }); | ||||
|     } | ||||
| } | ||||
| @ -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); | ||||
|     } | ||||
| } | ||||
| @ -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) { | ||||
| 
 | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,38 @@ | ||||
| package com.example.myapplication.weather; | ||||
| 
 | ||||
| import androidx.fragment.app.Fragment; | ||||
| 
 | ||||
| import android.content.Intent; | ||||
| 
 | ||||
| import com.example.myapplication.R; | ||||
| import com.example.myapplication.weather.SingleFragmentActivity; | ||||
| import com.example.myapplication.weather.WeatherFragment; | ||||
| 
 | ||||
| public class MainActivity1 extends SingleFragmentActivity implements WeatherFragment.Callbacks{ | ||||
|     @Override | ||||
|     protected Fragment createFragment() { | ||||
|         return WeatherFragment.newInstance(); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected int getLayoutId() { | ||||
|         return R.layout.activity_masterdetail; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected int getFragmentId() { | ||||
|         return R.id.fragment_container; | ||||
|     } | ||||
| 
 | ||||
|     public void onWeatherSelected(WeatherItem weatherItem){   //平板中选中天气
 | ||||
|         if(findViewById(R.id.detail_container)==null){ | ||||
|             Intent intent = WeatherDetailActivity.newIntent(this,weatherItem); | ||||
|             startActivity(intent); | ||||
|         }else{ | ||||
|             Fragment newDetail = WeatherDetailFragment.newInstance(weatherItem); | ||||
|             getSupportFragmentManager().beginTransaction() | ||||
|                     .replace(R.id.detail_container,newDetail) | ||||
|                     .commit(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,95 @@ | ||||
| package com.example.myapplication.weather; | ||||
| 
 | ||||
| import android.app.AlarmManager; | ||||
| import android.app.IntentService; | ||||
| import android.app.Notification; | ||||
| import android.app.NotificationChannel; | ||||
| import android.app.NotificationManager; | ||||
| import android.app.PendingIntent; | ||||
| import android.content.Context; | ||||
| import android.content.Intent; | ||||
| import android.content.SharedPreferences; | ||||
| import android.os.Build; | ||||
| import android.os.SystemClock; | ||||
| import android.util.Log; | ||||
| 
 | ||||
| import androidx.annotation.Nullable; | ||||
| import androidx.core.app.NotificationCompat; | ||||
| 
 | ||||
| import com.example.myapplication.R; | ||||
| import com.example.myapplication.weather.WeatherFragment; | ||||
| 
 | ||||
| public class NotificationService extends IntentService { | ||||
|     private static final String TAG = "NotificationService"; | ||||
| 
 | ||||
|     private static final int NOTIFICATION_INTERVAL = 1000*60; | ||||
| 
 | ||||
|     public static Intent newIntent(Context context){ | ||||
|         return new Intent(context,NotificationService.class); | ||||
|     } | ||||
| 
 | ||||
|     public NotificationService(){ | ||||
|         super(TAG); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected void onHandleIntent(@Nullable Intent intent) { | ||||
|         Log.i(TAG,"Intent there"); | ||||
| 
 | ||||
|         Intent i = WeatherFragment.newIntent(this); | ||||
|         PendingIntent pi = PendingIntent.getService(this,0,i,0); | ||||
| 
 | ||||
|         Notification notification = null; | ||||
|         SharedPreferences pref = this.getSharedPreferences("setting",Context.MODE_PRIVATE); | ||||
|         String unit = pref.getString("unit","摄氏度"); | ||||
|         String unit_text = "°"; | ||||
|         if (unit == "华氏度"){ | ||||
|             unit_text = "℉"; | ||||
|         } | ||||
|         NotificationCompat.Builder builder = new NotificationCompat.Builder(this) | ||||
|                                         .setTicker("ticker") | ||||
|                                         .setSmallIcon(R.drawable.a100) | ||||
|                                         .setContentTitle("今日天气") | ||||
|                                         .setContentText(pref.getString("city","北京")+ | ||||
|                                                 "  天气:"+pref.getString("text","")+ | ||||
|                                                 ", 最高温度:"+pref.getString("max_temp","")+unit_text+ | ||||
|                                                 ", 最低温度:"+pref.getString("min_temp","")+unit_text) | ||||
|                                         .setContentIntent(pi) | ||||
|                                         .setAutoCancel(true); | ||||
| 
 | ||||
|         NotificationManager notificationManager =(NotificationManager) | ||||
|                 getSystemService(NOTIFICATION_SERVICE); | ||||
| 
 | ||||
|         //一定要设置channel
 | ||||
|         if (Build.VERSION.SDK_INT >= 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(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -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(); | ||||
|     } | ||||
| } | ||||
| @ -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(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -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; | ||||
|     } | ||||
| } | ||||
| @ -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); | ||||
|     } | ||||
| } | ||||
| @ -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; | ||||
|     } | ||||
| } | ||||
| @ -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; | ||||
|     } | ||||
| } | ||||
| @ -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); | ||||
| 
 | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,30 @@ | ||||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:aapt="http://schemas.android.com/aapt" | ||||
|     android:width="108dp" | ||||
|     android:height="108dp" | ||||
|     android:viewportWidth="108" | ||||
|     android:viewportHeight="108"> | ||||
|     <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z"> | ||||
|         <aapt:attr name="android:fillColor"> | ||||
|             <gradient | ||||
|                 android:endX="85.84757" | ||||
|                 android:endY="92.4963" | ||||
|                 android:startX="42.9492" | ||||
|                 android:startY="49.59793" | ||||
|                 android:type="linear"> | ||||
|                 <item | ||||
|                     android:color="#44000000" | ||||
|                     android:offset="0.0" /> | ||||
|                 <item | ||||
|                     android:color="#00000000" | ||||
|                     android:offset="1.0" /> | ||||
|             </gradient> | ||||
|         </aapt:attr> | ||||
|     </path> | ||||
|     <path | ||||
|         android:fillColor="#FFFFFF" | ||||
|         android:fillType="nonZero" | ||||
|         android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z" | ||||
|         android:strokeWidth="1" | ||||
|         android:strokeColor="#00000000" /> | ||||
| </vector> | ||||
| After Width: | Height: | Size: 2.7 KiB | 
| After Width: | Height: | Size: 2.8 KiB | 
| After Width: | Height: | Size: 2.3 KiB | 
| After Width: | Height: | Size: 6.0 KiB | 
| After Width: | Height: | Size: 5.3 KiB | 
| After Width: | Height: | Size: 2.2 KiB | 
| After Width: | Height: | Size: 5.8 KiB | 
| After Width: | Height: | Size: 4.9 KiB | 
| After Width: | Height: | Size: 5.6 KiB | 
| After Width: | Height: | Size: 7.2 KiB | 
| After Width: | Height: | Size: 4.8 KiB | 
| After Width: | Height: | Size: 5.5 KiB | 
| After Width: | Height: | Size: 4.8 KiB | 
| After Width: | Height: | Size: 2.3 KiB | 
| After Width: | Height: | Size: 4.6 KiB | 
| After Width: | Height: | Size: 5.3 KiB | 
| After Width: | Height: | Size: 1.9 KiB | 
| After Width: | Height: | Size: 4.1 KiB | 
| After Width: | Height: | Size: 6.0 KiB | 
| After Width: | Height: | Size: 5.4 KiB | 
| After Width: | Height: | Size: 4.7 KiB | 
| After Width: | Height: | Size: 5.5 KiB | 
| After Width: | Height: | Size: 4.5 KiB | 
| After Width: | Height: | Size: 5.1 KiB | 
| After Width: | Height: | Size: 5.1 KiB | 
| After Width: | Height: | Size: 5.2 KiB | 
| After Width: | Height: | Size: 3.2 KiB | 
| After Width: | Height: | Size: 4.7 KiB | 
| After Width: | Height: | Size: 6.4 KiB | 
| After Width: | Height: | Size: 1.6 KiB | 
| After Width: | Height: | Size: 2.5 KiB | 
| After Width: | Height: | Size: 5.2 KiB | 
| After Width: | Height: | Size: 5.9 KiB | 
| After Width: | Height: | Size: 6.8 KiB | 
| After Width: | Height: | Size: 5.5 KiB | 
| After Width: | Height: | Size: 1.8 KiB | 
| After Width: | Height: | Size: 6.5 KiB | 
| After Width: | Height: | Size: 6.0 KiB | 
| After Width: | Height: | Size: 4.9 KiB | 
| After Width: | Height: | Size: 5.5 KiB | 
| After Width: | Height: | Size: 5.8 KiB | 
| After Width: | Height: | Size: 5.6 KiB | 
| After Width: | Height: | Size: 5.1 KiB | 
| After Width: | Height: | Size: 2.1 KiB | 
| After Width: | Height: | Size: 1.9 KiB | 
| After Width: | Height: | Size: 588 B | 
| After Width: | Height: | Size: 1.9 KiB | 
| After Width: | Height: | Size: 2.9 KiB | 
| After Width: | Height: | Size: 1.1 KiB | 
| After Width: | Height: | Size: 1.5 KiB | 
| After Width: | Height: | Size: 3.9 KiB | 
| After Width: | Height: | Size: 725 B | 
| After Width: | Height: | Size: 1.4 KiB | 
| After Width: | Height: | Size: 2.3 KiB | 
| After Width: | Height: | Size: 2.5 KiB | 
| After Width: | Height: | Size: 2.8 KiB | 
| After Width: | Height: | Size: 835 B | 
| After Width: | Height: | Size: 1.0 KiB | 
| After Width: | Height: | Size: 2.2 KiB | 
| After Width: | Height: | Size: 2.0 KiB | 
| After Width: | Height: | Size: 2.1 KiB | 
| @ -0,0 +1,170 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:width="108dp" | ||||
|     android:height="108dp" | ||||
|     android:viewportWidth="108" | ||||
|     android:viewportHeight="108"> | ||||
|     <path | ||||
|         android:fillColor="#008577" | ||||
|         android:pathData="M0,0h108v108h-108z" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M9,0L9,108" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M19,0L19,108" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M29,0L29,108" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M39,0L39,108" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M49,0L49,108" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M59,0L59,108" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M69,0L69,108" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M79,0L79,108" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M89,0L89,108" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M99,0L99,108" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M0,9L108,9" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M0,19L108,19" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M0,29L108,29" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M0,39L108,39" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M0,49L108,49" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M0,59L108,59" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M0,69L108,69" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M0,79L108,79" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M0,89L108,89" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M0,99L108,99" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M19,29L89,29" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M19,39L89,39" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M19,49L89,49" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M19,59L89,59" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M19,69L89,69" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M19,79L89,79" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M29,19L29,89" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M39,19L39,89" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M49,19L49,89" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M59,19L59,89" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M69,19L69,89" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
|     <path | ||||
|         android:fillColor="#00000000" | ||||
|         android:pathData="M79,19L79,89" | ||||
|         android:strokeWidth="0.8" | ||||
|         android:strokeColor="#33FFFFFF" /> | ||||
| </vector> | ||||
| @ -0,0 +1,5 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <FrameLayout android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:id="@+id/detail_container" | ||||
|     xmlns:android="http://schemas.android.com/apk/res/android" /> | ||||
| @ -0,0 +1,34 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:orientation="vertical"> | ||||
|     <TextView | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="70dp" | ||||
|         android:id="@+id/main_one" | ||||
|         android:textColor="#FF000000" | ||||
|         android:textStyle="bold" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="center_horizontal" | ||||
|         android:text="请选择您要查找的物品"/> | ||||
| 
 | ||||
|     <Button | ||||
|         android:id="@+id/button_item_wallet" | ||||
|         android:layout_width="265dp" | ||||
|         android:layout_height="100dp" | ||||
|         android:gravity="left" | ||||
|         android:text="钱包" | ||||
|         android:textSize="30sp" /> | ||||
| 
 | ||||
|     <Button | ||||
|         android:id="@+id/button_item_keys" | ||||
|         android:layout_width="265dp" | ||||
|         android:layout_height="100dp" | ||||
|         android:text="钥匙" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="left" /> | ||||
| 
 | ||||
| </LinearLayout> | ||||
| 
 | ||||
| 
 | ||||
| @ -0,0 +1,28 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:orientation="vertical"> | ||||
| 
 | ||||
|     <Button | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="70dp" | ||||
|         android:text="心率检测" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="left"></Button> | ||||
|     <Button | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="70dp" | ||||
|         android:text="警报提示" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="left"></Button> | ||||
|     <ImageView | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:src="@color/material_dynamic_neutral40"></ImageView> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| </LinearLayout> | ||||
| @ -0,0 +1,49 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:orientation="vertical"> | ||||
| 
 | ||||
|     <TextView | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="70dp" | ||||
|         android:id="@+id/main_one" | ||||
|         android:textColor="#FF000000" | ||||
|         android:textStyle="bold" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="center_horizontal" | ||||
|         android:text="欢迎来到老人小助手"/> | ||||
| 
 | ||||
|     <Button | ||||
|         android:id="@+id/button_main_1" | ||||
|         android:layout_width="265dp" | ||||
|         android:layout_height="140dp" | ||||
|         android:text="一键通" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="left"></Button> | ||||
|     <Button | ||||
|         android:layout_width="265dp" | ||||
|         android:id="@+id/button_main_2" | ||||
|         android:layout_height="140dp" | ||||
|         android:text="天气预报" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="left"></Button> | ||||
|     <Button | ||||
|         android:layout_width="265dp" | ||||
|         android:layout_height="140dp" | ||||
|         android:id="@+id/button_main_3" | ||||
|         android:text="找寻模块" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="left"></Button> | ||||
|     <Button | ||||
|         android:layout_width="265dp" | ||||
|         android:layout_height="140dp" | ||||
|         android:id="@+id/button_main_4" | ||||
|         android:text="语音识别" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="left"></Button> | ||||
| 
 | ||||
| 
 | ||||
| </LinearLayout> | ||||
|      | ||||
|      | ||||
| @ -0,0 +1,5 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <FrameLayout android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:id="@+id/fragment_container" | ||||
|     xmlns:android="http://schemas.android.com/apk/res/android" /> | ||||
| @ -0,0 +1,85 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     tools:context=".MapActivity1"> | ||||
| 
 | ||||
|     <!--百度地图控件--> | ||||
|     <com.baidu.mapapi.map.MapView | ||||
|         android:id="@+id/bmapview" | ||||
|         android:layout_width="fill_parent" | ||||
|         android:layout_height="fill_parent" | ||||
|         android:clickable="true" /> | ||||
|     <!--位置文本布局的背景色代码的前2位代码为透明度--> | ||||
|     <LinearLayout | ||||
|         android:layout_width="fill_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:background="#e0000000" | ||||
|         android:orientation="vertical" > | ||||
|         <LinearLayout | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginLeft="12dp" | ||||
|             android:layout_marginTop="20dp" | ||||
|             android:orientation="horizontal" > | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="纬度:" | ||||
|                 android:textColor="#ffffff" | ||||
|                 android:textSize="15dp" /> | ||||
|             <TextView | ||||
|                 android:id="@+id/tv_Lat" | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="" | ||||
|                 android:textColor="#ffffff" | ||||
|                 android:textSize="15dp" /> | ||||
|         </LinearLayout> | ||||
|         <LinearLayout | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginLeft="12dp" | ||||
|             android:layout_marginTop="10dp" | ||||
|             android:orientation="horizontal" > | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="经度:" | ||||
|                 android:textColor="#ffffff" | ||||
|                 android:textSize="15dp" /> | ||||
|             <TextView | ||||
|                 android:id="@+id/tv_Lon" | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="" | ||||
|                 android:textColor="#ffffff" | ||||
|                 android:textSize="15dp" /> | ||||
|         </LinearLayout> | ||||
|         <LinearLayout | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginBottom="10dp" | ||||
|             android:layout_marginLeft="12dp" | ||||
|             android:layout_marginTop="10dp" | ||||
|             android:orientation="horizontal" > | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="地址:" | ||||
|                 android:textColor="#ffffff" | ||||
|                 android:textSize="15dp" /> | ||||
| 
 | ||||
|             <TextView | ||||
|                 android:id="@+id/tv_Add" | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="" | ||||
|                 android:textColor="#ffffff" | ||||
|                 android:textSize="15dp" /> | ||||
|         </LinearLayout> | ||||
|     </LinearLayout> | ||||
| 
 | ||||
| </FrameLayout> | ||||
| @ -0,0 +1,74 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:orientation="vertical" android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:id="@+id/page"> | ||||
|     <LinearLayout | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:orientation="vertical" | ||||
|         android:padding="10dp"> | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="Location" | ||||
|             android:textSize="16dp" | ||||
|             android:textColor="#333"/> | ||||
|         <EditText | ||||
|             android:id="@+id/location" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="请输入地理位置" | ||||
|             android:textSize="13dp"/> | ||||
|     </LinearLayout> | ||||
|     <TextView | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="0.8dp" | ||||
|         android:background="#aaa"/> | ||||
|     <LinearLayout | ||||
|         android:id="@+id/unit" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:orientation="vertical" | ||||
|         android:padding="10dp"> | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="Unit" | ||||
|             android:textSize="16dp" | ||||
|             android:textColor="#333"/> | ||||
|         <TextView | ||||
|             android:id="@+id/unit_text" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="摄氏度" | ||||
|             android:textSize="12dp"/> | ||||
|     </LinearLayout> | ||||
|     <TextView | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="0.8dp" | ||||
|         android:background="#aaa"/> | ||||
|     <LinearLayout | ||||
|         android:id="@+id/send" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:orientation="vertical" | ||||
|         android:padding="10dp"> | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="开启通知" | ||||
|             android:textSize="16dp" | ||||
|             android:textColor="#333"/> | ||||
|         <TextView | ||||
|             android:id="@+id/send_text" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:text="是" | ||||
|             android:textSize="12dp"/> | ||||
|     </LinearLayout> | ||||
|     <TextView | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="0.8dp" | ||||
|         android:background="#aaa"/> | ||||
| </LinearLayout> | ||||
| @ -0,0 +1,16 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:orientation="horizontal" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent"> | ||||
|     <FrameLayout | ||||
|         android:layout_width="0dp" | ||||
|         android:layout_height="match_parent" | ||||
|         android:layout_weight="1" | ||||
|         android:id="@+id/fragment_container"/> | ||||
|     <FrameLayout | ||||
|         android:layout_width="0dp" | ||||
|         android:layout_height="match_parent" | ||||
|         android:layout_weight="3" | ||||
|         android:id="@+id/detail_container"/> | ||||
| </LinearLayout> | ||||
| @ -0,0 +1,9 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     tools:context=".WNaviGuideActivity"> | ||||
| 
 | ||||
| </androidx.constraintlayout.widget.ConstraintLayout> | ||||
| @ -0,0 +1,70 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:orientation="vertical"> | ||||
| 
 | ||||
|     <Button | ||||
|         android:id="@+id/button1" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="70dp" | ||||
|         android:text="一键出示健康码" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="left"></Button> | ||||
|     <Button | ||||
|         android:id="@+id/button2" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="70dp" | ||||
|         android:text="一键出示行程码" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="left"></Button> | ||||
| 
 | ||||
|     <Button | ||||
|         android:id="@+id/button3" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="70dp" | ||||
|         android:gravity="left" | ||||
|         android:text="一键出示核酸检测报告" | ||||
|         android:textSize="30sp"></Button> | ||||
| 
 | ||||
|     <Button | ||||
|         android:id="@+id/button4" | ||||
|         android:layout_width="429dp" | ||||
|         android:layout_height="70dp" | ||||
|         android:gravity="left" | ||||
|         android:text="一键进入扫码付款界面" | ||||
|         android:textSize="30sp"></Button> | ||||
|     <Button | ||||
|         android:id="@+id/button5" | ||||
|         android:layout_width="265dp" | ||||
|         android:layout_height="70dp" | ||||
|         android:text="一键出示付款码" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="left"></Button> | ||||
| 
 | ||||
|     <Button | ||||
|         android:id="@+id/button6" | ||||
|         android:layout_width="265dp" | ||||
|         android:layout_height="70dp" | ||||
|         android:text="一键出示收款码" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="left"></Button> | ||||
| 
 | ||||
|     <Button | ||||
|         android:id="@+id/button7" | ||||
|         android:layout_width="352dp" | ||||
|         android:layout_height="70dp" | ||||
|         android:gravity="left" | ||||
|         android:text="一键呼叫常用联系人" | ||||
|         android:textSize="30sp"></Button> | ||||
|     <Button | ||||
|         android:id="@+id/button8" | ||||
|         android:layout_width="265dp" | ||||
|         android:layout_height="70dp" | ||||
|         android:text="设置常用联系人" | ||||
|         android:textSize="30sp" | ||||
|         android:gravity="left"></Button> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| </LinearLayout> | ||||