diff --git a/ceshi/.gitignore b/ceshi/.gitignore deleted file mode 100644 index aa724b7..0000000 --- a/ceshi/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/caches -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml -.DS_Store -/build -/captures -.externalNativeBuild -.cxx -local.properties diff --git a/ceshi/.idea/.gitignore b/ceshi/.idea/.gitignore deleted file mode 100644 index 359bb53..0000000 --- a/ceshi/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# 默认忽略的文件 -/shelf/ -/workspace.xml diff --git a/ceshi/.idea/compiler.xml b/ceshi/.idea/compiler.xml deleted file mode 100644 index fb7f4a8..0000000 --- a/ceshi/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/ceshi/.idea/deploymentTargetDropDown.xml b/ceshi/.idea/deploymentTargetDropDown.xml deleted file mode 100644 index 1674049..0000000 --- a/ceshi/.idea/deploymentTargetDropDown.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ceshi/.idea/gradle.xml b/ceshi/.idea/gradle.xml deleted file mode 100644 index cfc986a..0000000 --- a/ceshi/.idea/gradle.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/ceshi/.idea/misc.xml b/ceshi/.idea/misc.xml deleted file mode 100644 index bdd9278..0000000 --- a/ceshi/.idea/misc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/ceshi/app/.gitignore b/ceshi/app/.gitignore deleted file mode 100644 index 42afabf..0000000 --- a/ceshi/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/ceshi/app/build.gradle b/ceshi/app/build.gradle deleted file mode 100644 index e260dab..0000000 --- a/ceshi/app/build.gradle +++ /dev/null @@ -1,44 +0,0 @@ -plugins { - id 'com.android.application' -} - -android { - compileSdk 33 - - defaultConfig { - applicationId "com.example.ceshi" - minSdk 23 - targetSdk 33 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -dependencies { - - implementation 'androidx.appcompat:appcompat:1.3.0' - implementation 'com.google.android.material:material:1.4.0' - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' - implementation files('D:\\ceshi\\app\\src\\main\\res\\aip-java-sdk-4.16.9.jar') - implementation files('D:\\ceshi\\app\\src\\main\\res\\json-20160810.jar') - implementation files('D:\\ceshi\\app\\src\\main\\res\\slf4j-api-1.7.25.jar') - implementation files('D:\\ceshi\\app\\src\\main\\res\\slf4j-simple-1.7.25.jar') - implementation files('D:\\ceshi\\app\\src\\main\\res\\gson-2.8.6.jar') - implementation 'com.android.car.ui:car-ui-lib:2.0.0' - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' -} \ No newline at end of file diff --git a/ceshi/app/lib/gson-2.8.6.jar b/ceshi/app/lib/gson-2.8.6.jar deleted file mode 100644 index 4765c4a..0000000 Binary files a/ceshi/app/lib/gson-2.8.6.jar and /dev/null differ diff --git a/ceshi/app/lib/java-sdk-4.15.7.jar b/ceshi/app/lib/java-sdk-4.15.7.jar deleted file mode 100644 index 81230b9..0000000 Binary files a/ceshi/app/lib/java-sdk-4.15.7.jar and /dev/null differ diff --git a/ceshi/app/lib/json.jar b/ceshi/app/lib/json.jar deleted file mode 100644 index 2c0bf83..0000000 Binary files a/ceshi/app/lib/json.jar and /dev/null differ diff --git a/ceshi/app/lib/json.zip b/ceshi/app/lib/json.zip deleted file mode 100644 index bb45401..0000000 Binary files a/ceshi/app/lib/json.zip and /dev/null differ diff --git a/ceshi/app/lib/lib.zip b/ceshi/app/lib/lib.zip deleted file mode 100644 index 24604a5..0000000 Binary files a/ceshi/app/lib/lib.zip and /dev/null differ diff --git a/ceshi/app/proguard-rules.pro b/ceshi/app/proguard-rules.pro deleted file mode 100644 index 481bb43..0000000 --- a/ceshi/app/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/ceshi/app/release/app-release.apk b/ceshi/app/release/app-release.apk deleted file mode 100644 index 7749c52..0000000 Binary files a/ceshi/app/release/app-release.apk and /dev/null differ diff --git a/ceshi/app/release/output-metadata.json b/ceshi/app/release/output-metadata.json deleted file mode 100644 index 9b578b9..0000000 --- a/ceshi/app/release/output-metadata.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "version": 3, - "artifactType": { - "type": "APK", - "kind": "Directory" - }, - "applicationId": "com.example.ceshi", - "variantName": "release", - "elements": [ - { - "type": "SINGLE", - "filters": [], - "attributes": [], - "versionCode": 1, - "versionName": "1.0", - "outputFile": "app-release.apk" - } - ], - "elementType": "File" -} \ No newline at end of file diff --git a/ceshi/app/src/androidTest/java/com/example/ceshi/ExampleInstrumentedTest.java b/ceshi/app/src/androidTest/java/com/example/ceshi/ExampleInstrumentedTest.java deleted file mode 100644 index 095c030..0000000 --- a/ceshi/app/src/androidTest/java/com/example/ceshi/ExampleInstrumentedTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.example.ceshi; - -import android.content.Context; -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - assertEquals("com.example.ceshi", appContext.getPackageName()); - } -} \ No newline at end of file diff --git a/ceshi/app/src/main/AndroidManifest.xml b/ceshi/app/src/main/AndroidManifest.xml deleted file mode 100644 index 9ef8134..0000000 --- a/ceshi/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ceshi/app/src/main/java/com/baidu/ai/aip/ImgCombination.java b/ceshi/app/src/main/java/com/baidu/ai/aip/ImgCombination.java deleted file mode 100644 index cc78110..0000000 --- a/ceshi/app/src/main/java/com/baidu/ai/aip/ImgCombination.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.baidu.ai.aip; - -import com.baidu.ai.aip.utils.HttpUtil; -import com.baidu.ai.aip.utils.GsonUtils; - -import java.util.*; - -/** - * 图像识别组合API - */ -public class ImgCombination { - - /** - * 重要提示代码中所需工具类 - * FileUtil,Base64Util,HttpUtil,GsonUtils请从 - * https://ai.baidu.com/file/658A35ABAB2D404FBF903F64D47C1F72 - * https://ai.baidu.com/file/C8D81F3301E24D2892968F09AE1AD6E2 - * https://ai.baidu.com/file/544D677F5D4E4F17B4122FBD60DB82B3 - * https://ai.baidu.com/file/470B3ACCA3FE43788B5A963BF0B625F3 - * 下载 - */ - public static String imgCombination() { - // 请求url - String url = "https://aip.baidubce.com/api/v1/solution/direct/imagerecognition/combination"; - try { - Map map = new HashMap<>(); - map.put("imgUrl", "https://pic1.zhimg.com/80/v2-31242331d504e03c96015dcc09101c90_1440w.webp"); - List scenes = new ArrayList<>(); - - scenes.add("ingredient"); - - map.put("scenes", scenes); - - String param = GsonUtils.toJson(map); - - // 注意这里仅为了简化编码每一次请求都去获取access_token,线上环境access_token有过期时间, 客户端可自行缓存,过期后重新获取。 - String accessToken = "24.bb5baa6f79502180928d105dd8ea46c8.2592000.1668576873.282335-27944955"; - - String result = HttpUtil.post(url, accessToken, "application/json", param); - //System.out.println("**************************"); - //System.out.println(result); - //System.out.println("**************************"); - return result; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - -} \ No newline at end of file diff --git a/ceshi/app/src/main/java/com/baidu/ai/aip/ToIngredient.java b/ceshi/app/src/main/java/com/baidu/ai/aip/ToIngredient.java deleted file mode 100644 index c154823..0000000 --- a/ceshi/app/src/main/java/com/baidu/ai/aip/ToIngredient.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baidu.ai.aip; - -import com.baidu.ai.aip.ImgCombination; -import com.example.ceshi.four; - -public class ToIngredient extends ImgCombination{ - - //public static void main(String[] args) { - public static String x(){ - ImgCombination img=new ImgCombination(); - String str = img.imgCombination(); - String name=str.substring(str.indexOf("name")+7,str.indexOf("\"}")); - String odds=str.substring(str.indexOf("score")+7,str.indexOf(",")); - String name_odds="有"+odds.substring(0,4)+"的概率是"+name; - return name_odds; - } - //System.out.println("有"+odds.substring(0,4)+"的概率是"+name); - //} -} - diff --git a/ceshi/app/src/main/java/com/baidu/ai/aip/utils/Base64Util.java b/ceshi/app/src/main/java/com/baidu/ai/aip/utils/Base64Util.java deleted file mode 100644 index 9772165..0000000 --- a/ceshi/app/src/main/java/com/baidu/ai/aip/utils/Base64Util.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.baidu.ai.aip.utils; - -/** - * Base64 工具类 - */ -public class Base64Util { - private static final char last2byte = (char) Integer.parseInt("00000011", 2); - private static final char last4byte = (char) Integer.parseInt("00001111", 2); - private static final char last6byte = (char) Integer.parseInt("00111111", 2); - private static final char lead6byte = (char) Integer.parseInt("11111100", 2); - private static final char lead4byte = (char) Integer.parseInt("11110000", 2); - private static final char lead2byte = (char) Integer.parseInt("11000000", 2); - private static final char[] encodeTable = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'}; - - public Base64Util() { - } - - public static String encode(byte[] from) { - StringBuilder to = new StringBuilder((int) ((double) from.length * 1.34D) + 3); - int num = 0; - char currentByte = 0; - - int i; - for (i = 0; i < from.length; ++i) { - for (num %= 8; num < 8; num += 6) { - switch (num) { - case 0: - currentByte = (char) (from[i] & lead6byte); - currentByte = (char) (currentByte >>> 2); - case 1: - case 3: - case 5: - default: - break; - case 2: - currentByte = (char) (from[i] & last6byte); - break; - case 4: - currentByte = (char) (from[i] & last4byte); - currentByte = (char) (currentByte << 2); - if (i + 1 < from.length) { - currentByte = (char) (currentByte | (from[i + 1] & lead2byte) >>> 6); - } - break; - case 6: - currentByte = (char) (from[i] & last2byte); - currentByte = (char) (currentByte << 4); - if (i + 1 < from.length) { - currentByte = (char) (currentByte | (from[i + 1] & lead4byte) >>> 4); - } - } - - to.append(encodeTable[currentByte]); - } - } - - if (to.length() % 4 != 0) { - for (i = 4 - to.length() % 4; i > 0; --i) { - to.append("="); - } - } - - return to.toString(); - } -} diff --git a/ceshi/app/src/main/java/com/baidu/ai/aip/utils/FileUtil.java b/ceshi/app/src/main/java/com/baidu/ai/aip/utils/FileUtil.java deleted file mode 100644 index 540f45c..0000000 --- a/ceshi/app/src/main/java/com/baidu/ai/aip/utils/FileUtil.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.baidu.ai.aip.utils; - -import java.io.*; - -/** - * 文件读取工具类 - */ -public class FileUtil { - - /** - * 读取文件内容,作为字符串返回 - */ - public static String readFileAsString(String filePath) throws IOException { - File file = new File(filePath); - if (!file.exists()) { - throw new FileNotFoundException(filePath); - } - - if (file.length() > 1024 * 1024 * 1024) { - throw new IOException("File is too large"); - } - - StringBuilder sb = new StringBuilder((int) (file.length())); - // 创建字节输入流 - FileInputStream fis = new FileInputStream(filePath); - // 创建一个长度为10240的Buffer - byte[] bbuf = new byte[10240]; - // 用于保存实际读取的字节数 - int hasRead = 0; - while ( (hasRead = fis.read(bbuf)) > 0 ) { - sb.append(new String(bbuf, 0, hasRead)); - } - fis.close(); - return sb.toString(); - } - - /** - * 根据文件路径读取byte[] 数组 - */ - public static byte[] readFileByBytes(String filePath) throws IOException { - File file = new File(filePath); - if (!file.exists()) { - throw new FileNotFoundException(filePath); - } else { - ByteArrayOutputStream bos = new ByteArrayOutputStream((int) file.length()); - BufferedInputStream in = null; - - try { - in = new BufferedInputStream(new FileInputStream(file)); - short bufSize = 1024; - byte[] buffer = new byte[bufSize]; - int len1; - while (-1 != (len1 = in.read(buffer, 0, bufSize))) { - bos.write(buffer, 0, len1); - } - - byte[] var7 = bos.toByteArray(); - return var7; - } finally { - try { - if (in != null) { - in.close(); - } - } catch (IOException var14) { - var14.printStackTrace(); - } - - bos.close(); - } - } - } -} diff --git a/ceshi/app/src/main/java/com/baidu/ai/aip/utils/GsonUtils.java b/ceshi/app/src/main/java/com/baidu/ai/aip/utils/GsonUtils.java deleted file mode 100644 index 541462c..0000000 --- a/ceshi/app/src/main/java/com/baidu/ai/aip/utils/GsonUtils.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2017 Baidu, Inc. All Rights Reserved. - */ -package com.baidu.ai.aip.utils; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonParseException; - -import java.lang.reflect.Type; - -/** - * Json工具类. - */ -public class GsonUtils { - private static Gson gson = new GsonBuilder().create(); - - public static String toJson(Object value) { - return gson.toJson(value); - } - - public static T fromJson(String json, Class classOfT) throws JsonParseException { - return gson.fromJson(json, classOfT); - } - - public static T fromJson(String json, Type typeOfT) throws JsonParseException { - return (T) gson.fromJson(json, typeOfT); - } -} diff --git a/ceshi/app/src/main/java/com/baidu/ai/aip/utils/HttpUtil.java b/ceshi/app/src/main/java/com/baidu/ai/aip/utils/HttpUtil.java deleted file mode 100644 index 7728dc6..0000000 --- a/ceshi/app/src/main/java/com/baidu/ai/aip/utils/HttpUtil.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.baidu.ai.aip.utils; - -import java.io.BufferedReader; -import java.io.DataOutputStream; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.List; -import java.util.Map; - -/** - * http 工具类 - */ -public class HttpUtil { - - public static String post(String requestUrl, String accessToken, String params) - throws Exception { - String contentType = "application/x-www-form-urlencoded"; - return HttpUtil.post(requestUrl, accessToken, contentType, params); - } - - public static String post(String requestUrl, String accessToken, String contentType, String params) - throws Exception { - String encoding = "UTF-8"; - if (requestUrl.contains("nlp")) { - encoding = "GBK"; - } - return HttpUtil.post(requestUrl, accessToken, contentType, params, encoding); - } - - public static String post(String requestUrl, String accessToken, String contentType, String params, String encoding) - throws Exception { - String url = requestUrl + "?access_token=" + accessToken; - return HttpUtil.postGeneralUrl(url, contentType, params, encoding); - } - - public static String postGeneralUrl(String generalUrl, String contentType, String params, String encoding) - throws Exception { - URL url = new URL(generalUrl); - // 打开和URL之间的连接 - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setRequestMethod("POST"); - // 设置通用的请求属性 - connection.setRequestProperty("Content-Type", contentType); - connection.setRequestProperty("Connection", "Keep-Alive"); - connection.setUseCaches(false); - connection.setDoOutput(true); - connection.setDoInput(true); - - // 得到请求的输出流对象 - DataOutputStream out = new DataOutputStream(connection.getOutputStream()); - out.write(params.getBytes(encoding)); - out.flush(); - out.close(); - - // 建立实际的连接 - connection.connect(); - // 获取所有响应头字段 - Map> headers = connection.getHeaderFields(); - // 遍历所有的响应头字段 - for (String key : headers.keySet()) { - System.err.println(key + "--->" + headers.get(key)); - } - // 定义 BufferedReader输入流来读取URL的响应 - BufferedReader in = null; - in = new BufferedReader( - new InputStreamReader(connection.getInputStream(), encoding)); - String result = ""; - String getLine; - while ((getLine = in.readLine()) != null) { - result += getLine; - } - in.close(); - System.err.println("result:" + result); - return result; - } -} diff --git a/ceshi/app/src/main/java/com/example/ceshi/collection.java b/ceshi/app/src/main/java/com/example/ceshi/collection.java deleted file mode 100644 index 123c49c..0000000 --- a/ceshi/app/src/main/java/com/example/ceshi/collection.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.ceshi; - -import android.content.Intent; -import android.view.View; -import android.widget.Button; -import androidx.appcompat.app.AppCompatActivity; -import android.os.Bundle; -public class collection extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.collview); - } -} \ No newline at end of file diff --git a/ceshi/app/src/main/java/com/example/ceshi/first.java b/ceshi/app/src/main/java/com/example/ceshi/first.java deleted file mode 100644 index 5ebb924..0000000 --- a/ceshi/app/src/main/java/com/example/ceshi/first.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.example.ceshi; - -import android.content.Intent; -import android.view.View; -import android.widget.Button; -import androidx.appcompat.app.AppCompatActivity; -import android.os.Bundle; - -public class first extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.firstview); - - //获取按钮 - Button button = findViewById(R.id.button); - Button button2 = findViewById(R.id.button2); - Button button3 = findViewById(R.id.button3); - Button button4 = findViewById(R.id.button4); - //按钮进行监听 - button.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - //监听按钮,如果点击,就跳转 - Intent intent = new Intent(); - //前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面 - intent.setClass(first.this,second.class); - startActivity(intent); - } - }); - button2.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - //监听按钮,如果点击,就跳转 - Intent intent = new Intent(); - //前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面 - intent.setClass(first.this,third.class); - startActivity(intent); - } - }); - button3.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - //监听按钮,如果点击,就跳转 - Intent intent = new Intent(); - //前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面 - intent.setClass(first.this, four.class); - startActivity(intent); - } - }); - button4.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - //监听按钮,如果点击,就跳转 - Intent intent = new Intent(); - //前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面 - intent.setClass(first.this, collection.class); - startActivity(intent); - } - }); - } -} diff --git a/ceshi/app/src/main/java/com/example/ceshi/four.java b/ceshi/app/src/main/java/com/example/ceshi/four.java deleted file mode 100644 index 0c91fc7..0000000 --- a/ceshi/app/src/main/java/com/example/ceshi/four.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.example.ceshi; - - -import android.content.Intent; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; -import android.provider.MediaStore; -import android.view.View; -import android.widget.Button; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.content.FileProvider; - -import com.baidu.ai.aip.ImgCombination; -import com.baidu.ai.aip.ToIngredient; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; - -public class four extends AppCompatActivity { - final int TAKE_PHOTO=1; - ImageView iv_photo; - Uri imageUri; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.fourview); - Button btn_1=findViewById(R.id.btn_takephoto); - iv_photo=findViewById(R.id.img_photo); - - btn_1.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - File output=new File(getExternalCacheDir(),"output_image.jpg"); - try { - if (output.exists()){ - output.delete(); - } - output.createNewFile(); - }catch (IOException e){ - e.printStackTrace(); - } - if (Build.VERSION.SDK_INT>=24){ -//图片的保存路径 - imageUri= FileProvider.getUriForFile(four.this,"com.example.takephoto.fileprovider",output); - } - else { imageUri=Uri.fromFile(output);} - //跳转界面到系统自带的拍照界面 - Intent intent=new Intent("android.media.action.IMAGE_CAPTURE"); - intent.putExtra(MediaStore.EXTRA_OUTPUT,imageUri); - startActivityForResult(intent,TAKE_PHOTO); - } - }); - - -// String str = ImgCombination.imgCombination(); -// String name=str.substring(str.indexOf("name")+7,str.indexOf("\"}")); -// String odds=str.substring(str.indexOf("score")+7,str.indexOf(",")); - - - } - protected void onActivityResult(int requestCode,int resultCode,Intent data) { - super.onActivityResult(requestCode, resultCode, data); - switch (requestCode){ - case TAKE_PHOTO: - if (resultCode==RESULT_OK){ - // 使用try让程序运行在内报错 - try { - //将图片保存 - Bitmap bitmap= BitmapFactory.decodeStream(getContentResolver().openInputStream(imageUri)); - iv_photo.setImageBitmap(bitmap); - - - //ToIngredient to_in=new ToIngredient(); - -// ImgCombination img1=new ImgCombination(); -// String str1 =img1.imgCombination(); -//// ToIngredient ii= new ToIngredient(); -// String aa=ii.x(); - //String name=str.substring(str.indexOf("name")+7,str.indexOf("\"}")); - TextView t1=findViewById(R.id.textView11); - t1.setText("*"+ImgCombination.imgCombination()+"A"); - }catch (FileNotFoundException e){ - e.printStackTrace(); - } - } - break; - default:break; - } - } - -} \ No newline at end of file diff --git a/ceshi/app/src/main/java/com/example/ceshi/second.java b/ceshi/app/src/main/java/com/example/ceshi/second.java deleted file mode 100644 index 1d095c0..0000000 --- a/ceshi/app/src/main/java/com/example/ceshi/second.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.example.ceshi; - -import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; - -public class second extends AppCompatActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.secondview); - } - -} \ No newline at end of file diff --git a/ceshi/app/src/main/java/com/example/ceshi/third.java b/ceshi/app/src/main/java/com/example/ceshi/third.java deleted file mode 100644 index 3f1c634..0000000 --- a/ceshi/app/src/main/java/com/example/ceshi/third.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.ceshi; - -import android.content.Intent; -import android.view.View; -import android.widget.Button; -import androidx.appcompat.app.AppCompatActivity; -import android.os.Bundle; -public class third extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.thirdview); - } -} \ No newline at end of file diff --git a/ceshi/app/src/main/res/aip-java-sdk-4.16.9.jar b/ceshi/app/src/main/res/aip-java-sdk-4.16.9.jar deleted file mode 100644 index 4d33737..0000000 Binary files a/ceshi/app/src/main/res/aip-java-sdk-4.16.9.jar and /dev/null differ diff --git a/ceshi/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/ceshi/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 1ee1493..0000000 --- a/ceshi/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/ceshi/app/src/main/res/drawable/green.jpg b/ceshi/app/src/main/res/drawable/green.jpg deleted file mode 100644 index a4b67ff..0000000 Binary files a/ceshi/app/src/main/res/drawable/green.jpg and /dev/null differ diff --git a/ceshi/app/src/main/res/drawable/ic_launcher_background.xml b/ceshi/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 956b344..0000000 --- a/ceshi/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ceshi/app/src/main/res/drawable/search.png b/ceshi/app/src/main/res/drawable/search.png deleted file mode 100644 index caef6a6..0000000 Binary files a/ceshi/app/src/main/res/drawable/search.png and /dev/null differ diff --git a/ceshi/app/src/main/res/gson-2.8.6.jar b/ceshi/app/src/main/res/gson-2.8.6.jar deleted file mode 100644 index 4765c4a..0000000 Binary files a/ceshi/app/src/main/res/gson-2.8.6.jar and /dev/null differ diff --git a/ceshi/app/src/main/res/json-20160810.jar b/ceshi/app/src/main/res/json-20160810.jar deleted file mode 100644 index a90e448..0000000 Binary files a/ceshi/app/src/main/res/json-20160810.jar and /dev/null differ diff --git a/ceshi/app/src/main/res/layout/collview.xml b/ceshi/app/src/main/res/layout/collview.xml deleted file mode 100644 index a2fc681..0000000 --- a/ceshi/app/src/main/res/layout/collview.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - diff --git a/ceshi/app/src/main/res/layout/firstview.xml b/ceshi/app/src/main/res/layout/firstview.xml deleted file mode 100644 index 15394cb..0000000 --- a/ceshi/app/src/main/res/layout/firstview.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - -