Commit 0f87d9d0 authored by hemin's avatar hemin

调整图片,协议参数

parent ad3a060b
......@@ -4,7 +4,7 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/Dev/project/SourceApp/app/src/main/res/drawable/noseprint_selector_btn_blue.xml" value="0.34270833333333334" />
<entry key="..\:/Dev/project/SourceApp/app/src/main/res/layout/activity_main.xml" value="0.5" />
<entry key="..\:/Dev/project/SourceApp/app/src/main/res/layout/activity_splash.xml" value="0.16979166666666667" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
}
android {
......
......@@ -4,19 +4,16 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/app_ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/app_ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.SouceApp">
<activity android:name=".MainActivity"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTask">
<intent-filter>
<data
android:host="souceapp"
......@@ -25,9 +22,11 @@
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.source.app
import android.content.Intent
import android.content.IntentFilter
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
import android.widget.Button
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
val receiver = MyBroadcastReceiver()
val appCode = "ed3htuo7"
val targetPackageName = "com.inajiu.youdianmeng"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// intent?.run {
// val type = getStringExtra("type")
// val taskId = getIntExtra("taskId",0)
// val petId = getStringExtra("petId")
// Log.d("leon=====", "onCreate: type:${type} taskId:${taskId} petId:${petId}}")
// }
val filter = IntentFilter()
filter.addAction("com.example.broadcast.MY_NOTIFICATION")
registerReceiver(receiver, filter)
findViewById<Button>(R.id.tvCreate).setOnClickListener {
// val packageName = "com.inajiu.youdianmeng"
// val intent = packageManager.getLaunchIntentForPackage(packageName)
// if (intent != null) {
// intent!!.putExtra("type", "create")
// intent!!.putExtra("taskId",100)
// intent!!.putExtra("petId","pet100")
// startActivity(intent)
// } else {
// Toast.makeText(this, "请先安装有点萌!", Toast.LENGTH_LONG).show()
// }
val intent = Intent()
intent.setData(Uri.parse("ydm://ydmpet:9999/nose?optype=archive&taskid=100&petid=pet100&cbscheme=sapp://souceapp"))
intent.setAction("android.intent.action.VIEW")
startActivity(intent)
supportActionBar?.setTitle("鼻纹")
//建档
tvCreate.setOnClickListener {
gotoArchive()
}
findViewById<Button>(R.id.tvRecognize).setOnClickListener {
// val packageName = "com.inajiu.youdianmeng"
// val intent = packageManager.getLaunchIntentForPackage(packageName)
// if (intent != null) {
// intent!!.putExtra("type", "check")
// intent!!.putExtra("taskId",100)
// intent!!.putExtra("petId","pet100")
// startActivity(intent)
// } else {
// Toast.makeText(this, "请先安装有点萌!", Toast.LENGTH_LONG).show()
// }
val packageName = "com.inajiu.youdianmeng"
if (!checkPackInfo(packageName)) {
Toast.makeText(this, "请先安装有点萌!", Toast.LENGTH_LONG).show()
return@setOnClickListener
}
//验证
tvRecognize.setOnClickListener {
gotoCheck()
}
// val intent = Intent()
// val cn = ComponentName(packageName, "com.inajiu.youdianmeng.app.ui.MainActivity")
// try {
// intent.component = cn
// intent.putExtra("type", "check")
// intent.putExtra("taskId",100)
// intent.putExtra("petId","pet100")
// startActivity(intent)
// } catch (e: Exception) {
// e.printStackTrace()
// }
val intent = Intent()
intent.setData(Uri.parse("ydm://ydmpet:9999/nose?optype=check&taskid=100&petid=pet100&cbscheme=sapp://souceapp"))
intent.setAction("android.intent.action.VIEW")
startActivity(intent)
checkScheme(intent)
}
private fun gotoArchive() {
if (!checkPackInfo(targetPackageName)) {
Toast.makeText(this, "请先安装有点萌!", Toast.LENGTH_LONG).show()
return
}
val uriStr = intent.dataString
try {
var uri = Uri.parse(uriStr)
val optype = uri.getQueryParameter("optype")
val taskid = uri.getQueryParameter("taskid")
val petid = uri.getQueryParameter("petid")
val recode = uri.getQueryParameter("recode")
Log.d(
"leon=====",
"nose callback: type:${optype} taskid:${taskid} petid:${petid} recode:${recode}"
)
} catch (e: Exception) {
e.printStackTrace()
val petNo = etPetNo.text.toString()
val taskId = etTaskId.text.toString()
if (TextUtils.isEmpty(petNo)) {
Toast.makeText(this, "petNo不能为空", Toast.LENGTH_LONG).show()
return
}
if (TextUtils.isEmpty(taskId)) {
Toast.makeText(this, "taskId不能为空", Toast.LENGTH_LONG).show()
return
}
val intent = Intent()
intent.setData(Uri.parse("ydm://ydmpet:9999/nose?appcode=${appCode}&optype=archive&taskid=${taskId}&petno=${petNo}&cbscheme=sapp://souceapp"))
intent.setAction("android.intent.action.VIEW")
startActivity(intent)
}
private fun gotoCheck() {
if (!checkPackInfo(targetPackageName)) {
Toast.makeText(this, "请先安装有点萌!", Toast.LENGTH_LONG).show()
return
}
val petNo = etPetNo.text.toString()
val taskId = etTaskId.text.toString()
if (TextUtils.isEmpty(petNo)) {
Toast.makeText(this, "petNo不能为空", Toast.LENGTH_LONG).show()
return
}
if (TextUtils.isEmpty(taskId)) {
Toast.makeText(this, "taskId不能为空", Toast.LENGTH_LONG).show()
return
}
val intent = Intent()
intent.setData(Uri.parse("ydm://ydmpet:9999/nose?appcode=${appCode}&optype=check&taskid=${taskId}&petno=${petNo}&cbscheme=sapp://souceapp"))
intent.setAction("android.intent.action.VIEW")
startActivity(intent)
}
/**
......@@ -119,11 +103,27 @@ class MainActivity : AppCompatActivity() {
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
checkScheme(intent)
}
override fun onDestroy() {
super.onDestroy()
unregisterReceiver(receiver)
//回调数据
private fun checkScheme(intent:Intent?) {
val uriStr = intent?.dataString
try {
if(TextUtils.isEmpty(uriStr)){
return
}
var uri = Uri.parse(uriStr)
val optype = uri.getQueryParameter("optype")
val taskid = uri.getQueryParameter("taskid")
val petno = uri.getQueryParameter("petno")
val recode = uri.getQueryParameter("recode")
Log.d(
"leon=====",
"nose callback: type:${optype} taskid:${taskid} petno:${petno} recode:${recode}"
)
} catch (e: Exception) {
e.printStackTrace()
}
}
}
\ No newline at end of file
package com.source.app;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class MyBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("leon======", "onReceive: data:"+intent.getStringExtra("data"));
}
}
<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>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="180"
android:endColor="#ff5996fa"
android:startColor="#ff1d71fd"
android:type="linear"
android:useLevel="true" />
<corners
android:bottomLeftRadius="44dp"
android:bottomRightRadius="44dp"
android:topLeftRadius="44dp"
android:topRightRadius="44dp" />
</shape>
\ No newline at end of file
<?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="#3DDC84"
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>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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"
android:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<TextView
android:id="@+id/tvLablePetNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PetNo"
android:textColor="@color/color_gray"
android:textSize="14dp" />
<EditText
android:id="@+id/etPetNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:gravity="right|center_vertical"
android:hint="请输入"
android:textColor="#9B9B9B"
android:textColorHint="#9B9B9B"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/color_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<TextView
android:id="@+id/tvLableTask"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TaskId"
android:textColor="@color/color_gray"
android:textSize="14dp" />
<EditText
android:id="@+id/etTaskId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:gravity="right|center_vertical"
android:hint="请输入"
android:textColor="#9B9B9B"
android:textColorHint="#9B9B9B"
android:textSize="14sp" />
</LinearLayout>
<View
android:id="@+id/lineView"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/color_gray" />
<View
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:id="@+id/tvCreate"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/app_shape_btn_blue"
android:text="建档"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:textColor="@color/white" />
<Button
android:id="@+id/tvRecognize"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
android:background="@drawable/app_shape_btn_blue"
android:text="识别"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvCreate" />
android:textColor="@color/white" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
......@@ -7,4 +7,5 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="color_gray">#585858</color>
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.SouceApp" parent="Theme.AppCompat.Light.NoActionBar">
<style name="Theme.SouceApp" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimary">#1e90ff</item>
<!-- <item name="colorPrimaryVariant">@color/purple_700</item>-->
<!-- <item name="colorOnPrimary">@color/white</item>-->
<!-- Secondary brand color. -->
......@@ -14,4 +14,11 @@
<!-- Customize your theme here. -->
<item name="colorAccent">@color/teal_700</item>
</style>
<style name="activity_fullscreen" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
</style>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment