36张图片打包
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
@@ -0,0 +1,34 @@
|
||||
[
|
||||
"11.png",
|
||||
"12.png",
|
||||
"13.png",
|
||||
"14.png",
|
||||
"21.png",
|
||||
"23.png",
|
||||
"24.png",
|
||||
"25.png",
|
||||
"26.png",
|
||||
"27.png",
|
||||
"32.png",
|
||||
"37.png",
|
||||
"4.png",
|
||||
"40.png",
|
||||
"41.png",
|
||||
"45.png",
|
||||
"48.png",
|
||||
"49.png",
|
||||
"5.png",
|
||||
"53.png",
|
||||
"56.png",
|
||||
"59.png",
|
||||
"6.png",
|
||||
"62.png",
|
||||
"65.png",
|
||||
"68.png",
|
||||
"7.png",
|
||||
"71.png",
|
||||
"76.png",
|
||||
"77.png",
|
||||
"78.png",
|
||||
"81.png"
|
||||
]
|
||||
@@ -1,13 +1,30 @@
|
||||
package com.hmwl.example;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.hmwl.face_sdk.InitArg;
|
||||
import com.hmwl.face_sdk.Motion;
|
||||
|
||||
|
||||
import com.hmwl.face_sdk.FaceActivity;
|
||||
public class MainActivity extends FaceActivity{
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MainActivity extends FaceActivity
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
@@ -17,7 +34,7 @@ public class MainActivity extends FaceActivity{
|
||||
motion.technique = "基础上妆";
|
||||
motion.step = "2按压";
|
||||
motion.show_type = "方向示意图";
|
||||
motion.png_name = "test";
|
||||
motion.png_name = "4.png";
|
||||
motion.png_num = 1;
|
||||
|
||||
InitArg initArg = new InitArg();
|
||||
@@ -25,7 +42,82 @@ public class MainActivity extends FaceActivity{
|
||||
initArg.zoom = 1.5f;
|
||||
initArg.motion = motion;
|
||||
SetInitArg(initArg.toJson());
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
FaceInit(this);
|
||||
Toast.makeText(this, "4.png", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
String GetCurMotionState(int index)
|
||||
{
|
||||
Motion motion = new Motion();
|
||||
motion.png_name = pngFilenames.get(index);
|
||||
motion.png_num = 1;
|
||||
return motion.toJson();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
// 获取触控动作
|
||||
int action = event.getAction();
|
||||
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
// 手指按下
|
||||
Log.d("TouchEvent", "手指按下 - X: " + event.getX() + ", Y: " + event.getY());
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
// 手指移动
|
||||
Log.d("TouchEvent", "手指移动 - X: " + event.getX() + ", Y: " + event.getY());
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_UP:
|
||||
// 手指抬起
|
||||
Log.d("TouchEvent", "手指抬起");
|
||||
curIndex++;
|
||||
if(curIndex > pngFilenames.size()-1)
|
||||
{
|
||||
curIndex = 0;
|
||||
}
|
||||
ChangeState(GetCurMotionState(curIndex));
|
||||
Toast.makeText(this, pngFilenames.get(curIndex), Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
}
|
||||
|
||||
return true; // 表示已处理该事件
|
||||
}
|
||||
|
||||
List<String> pngFilenames = null;
|
||||
int curIndex = 0;
|
||||
private void FaceInit(Context context){
|
||||
pngFilenames = readPngFilenamesFromAssets(context, "pic/png_filenames.json");
|
||||
}
|
||||
|
||||
private List<String> readPngFilenamesFromAssets(Context context, String filename) {
|
||||
List<String> pngFilenames = new ArrayList<>();
|
||||
|
||||
try {
|
||||
InputStream is = context.getAssets().open(filename);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
stringBuilder.append(line);
|
||||
}
|
||||
|
||||
JSONArray jsonArray = new JSONArray(stringBuilder.toString());
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
pngFilenames.add(jsonArray.getString(i));
|
||||
}
|
||||
|
||||
reader.close();
|
||||
is.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return pngFilenames;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">f20251028</string>
|
||||
<string name="app_name">f20251030</string>
|
||||
</resources>
|
||||