test: update testcase of Android

This commit is contained in:
Kraity 2023-02-13 21:25:29 +08:00 committed by 温绍锦
parent 2ed4551633
commit 30744f2f6e
43 changed files with 443 additions and 539 deletions

View File

@ -14,8 +14,11 @@ ij_continuation_indent_size = 8
ij_java_doc_align_exception_comments = false
ij_java_doc_align_param_comments = false
[*.{yaml,yml,sh,ps1}]
[*.{yaml, yml, sh, ps1}]
indent_size = 2
[*.{md,mkd,markdown}]
[*.{md, mkd, markdown}]
trim_trailing_whitespace = false
[{**/res/**.xml, **/AndroidManifest.xml}]
ij_continuation_indent_size = 4

View File

@ -4,15 +4,14 @@ plugins {
}
android {
compileSdk 32
compileSdk 31
defaultConfig {
applicationId "com.alibaba.fastjson2.android"
minSdk 26
targetSdk 26
targetSdk 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -22,11 +21,15 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
namespace 'com.alibaba.fastjson2.android'
buildFeatures {
viewBinding true
}
}
dependencies {
@ -41,7 +44,9 @@ dependencies {
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
testImplementation 'junit:junit:5.8.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
}

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.alibaba.fastjson2.android">
<application
android:allowBackup="false"
@ -7,10 +8,13 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Fastjson2">
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:exported="true">
android:configChanges="orientation|screenSize|screenLayout"
android:exported="true"
android:launchMode="singleTask"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -19,4 +23,4 @@
</activity>
</application>
</manifest>
</manifest>

View File

@ -0,0 +1,33 @@
{
"images": [
{
"height": 768,
"size": "LARGE",
"title": "Javaone Keynote",
"uri": "http://javaone.com/keynote_large.jpg",
"width": 1024
},
{
"height": 240,
"size": "SMALL",
"title": "Javaone Keynote",
"uri": "http://javaone.com/keynote_small.jpg",
"width": 320
}
],
"media": {
"bitrate": 262144,
"duration": 18000000,
"format": "video/mpg4",
"height": 480,
"persons": [
"Bill Gates",
"Steve Jobs"
],
"player": "JAVA",
"size": 58982400,
"title": "Javaone Keynote",
"uri": "http://javaone.com/keynote.mpg",
"width": 640
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -1,68 +1,228 @@
package com.alibaba.fastjson2.android;
import android.content.res.AssetManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.CheckBox;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.android.eishay.MediaContent;
import com.alibaba.fastjson2.android.databinding.ActivityMainBinding;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Consumer;
import java.util.function.Function;
public class MainActivity extends AppCompatActivity {
static final int SERDE_LOOP_COUNT = 10_000;
static final int PARSE_LOOP_COUNT = 1000;
Gson g = new Gson();
ObjectMapper objectMapper = new ObjectMapper();
static final String[] LIB_NAMES = {
"fastjson2", "fastjson1", "gson", "jackson"
};
static final String[] TAG_NAMES = {
"SERDE", "PARSE"
};
static final String[] ITEM_NAMES = {
"eishay", "cart", "homepage", "h5 api"
};
private Gson gson;
private ObjectMapper mapper;
private final String[] texts = new String[ITEM_NAMES.length];
private final StringBuilder result = new StringBuilder(128);
private Map<Object, Map<Object, Map<Object, Runnable>>> tester;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityMainBinding inflate =
ActivityMainBinding.inflate(
getLayoutInflater()
);
setContentView(inflate.getRoot());
CART_STR = readString("cart.json");
HOMEPAGE_STR = readString("homepage.json");
H5API_STR = readString("h5api.json");
int white = getResources().getColor(
R.color.white, null
);
setContentView(R.layout.activity_main);
}
CheckBox[] libBoxes = new CheckBox[LIB_NAMES.length];
for (int i = 0; i < LIB_NAMES.length; i++) {
CheckBox box = new CheckBox(this);
libBoxes[i] = box;
box.setChecked(i == 0);
box.setTag(LIB_NAMES[i]);
box.setText(LIB_NAMES[i]);
box.setTextColor(white);
inflate.libs.addView(box);
}
private String readString(String path) {
StringBuffer buffer = new StringBuffer();
AssetManager assets = getApplicationContext().getAssets();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(assets.open(path), "utf-8"))) {
String line;
while ((line = reader.readLine()) != null) {
buffer.append(line);
RadioButton[] tagRadios = new RadioButton[TAG_NAMES.length];
for (int i = 0; i < TAG_NAMES.length; i++) {
RadioButton radio = new RadioButton(this);
tagRadios[i] = radio;
radio.setTag(TAG_NAMES[i]);
radio.setText(TAG_NAMES[i]);
radio.setTextColor(white);
inflate.tags.addView(radio);
}
RadioButton[] itemRadios = new RadioButton[ITEM_NAMES.length];
for (int i = 0; i < ITEM_NAMES.length; i++) {
RadioButton radio = new RadioButton(this);
itemRadios[i] = radio;
radio.setTag(ITEM_NAMES[i]);
radio.setText(ITEM_NAMES[i]);
radio.setTextColor(white);
inflate.items.addView(radio);
}
byte[] buffer = new byte[2048];
ByteArrayOutputStream stream = new ByteArrayOutputStream(5120);
String[] paths = {
"eishay.json", "cart.json", "homepage.json", "h5api.json"
};
for (int i = 0; i < texts.length; i++) {
try (InputStream in = getResources().getAssets().open(paths[i])
) {
int size;
stream.reset();
while ((size = in.read(buffer)) != -1) {
stream.write(buffer, 0, size);
}
} catch (Exception e) {
Log.d("Error getting resource", e.getMessage());
} finally {
try {
texts[i] = stream.toString("UTF-8");
} catch (UnsupportedEncodingException e) {
Log.d("Error getting resource", e.getMessage());
}
}
} catch (Exception e) {
Log.d("fastjson", e.getMessage());
}
return buffer.toString();
}
private void appendInfo(String str) {
TextView textView10 = findViewById(R.id.textView);
String text = textView10.getText().toString();
if (text.isEmpty()) {
text = str;
} else {
text = text + "\n" + str;
gson = new Gson();
tester = new HashMap<>();
mapper = new ObjectMapper();
{
Map<Object, Map<Object, Runnable>> tags = new HashMap<>();
tester.put("fastjson2", tags);
{
Map<Object, Runnable> items = new HashMap<>();
tags.put("SERDE", items);
items.put("eishay", this::fastjson2EishaySerde);
}
{
Map<Object, Runnable> items = new HashMap<>();
tags.put("PARSE", items);
for (int i = 0; i < ITEM_NAMES.length; i++) {
String text = texts[i];
String item = ITEM_NAMES[i];
items.put(item, () -> fastjson2Parse(text, item));
}
}
}
textView10.setText(text);
}
{
Map<Object, Map<Object, Runnable>> tags = new HashMap<>();
tester.put("fastjson1", tags);
{
Map<Object, Runnable> items = new HashMap<>();
tags.put("SERDE", items);
items.put("eishay", this::fastjson1EishaySerde);
}
{
Map<Object, Runnable> items = new HashMap<>();
tags.put("PARSE", items);
for (int i = 0; i < ITEM_NAMES.length; i++) {
String text = texts[i];
String item = ITEM_NAMES[i];
items.put(item, () -> fastjson1Parse(text, item));
}
}
}
{
Map<Object, Map<Object, Runnable>> tags = new HashMap<>();
tester.put("gson", tags);
{
Map<Object, Runnable> items = new HashMap<>();
tags.put("SERDE", items);
items.put("eishay", this::gsonEishaySerde);
}
}
{
Map<Object, Map<Object, Runnable>> tags = new HashMap<>();
tester.put("jackson", tags);
{
Map<Object, Runnable> items = new HashMap<>();
tags.put("SERDE", items);
items.put("eishay", this::jacksonEishaySerde);
}
}
Runnable updater = () -> inflate.result.setText(result);
ExecutorService executor = Executors.newCachedThreadPool();
Consumer<Runnable> consumer =
runnable -> executor.execute(() -> {
runnable.run();
runOnUiThread(updater);
});
Function<RadioButton[], Object> target = radios -> {
for (RadioButton btn : radios) {
if (btn.isChecked()) {
return btn.getTag();
}
}
return null;
};
inflate.submit.setOnClickListener(v -> {
final Object tag = target.apply(tagRadios);
final Object item = target.apply(itemRadios);
if (tag == null || item == null) {
Toast.makeText(this, "Unselected", Toast.LENGTH_SHORT).show();
return;
}
result.setLength(0);
inflate.result.setText(
result.append(tag).append(" ").append(item).append("\n\n")
);
Toast.makeText(this, "Testing", Toast.LENGTH_SHORT).show();
for (CheckBox box : libBoxes) {
if (box.isChecked()) {
Optional.ofNullable(tester.get(box.getTag()))
.map((tags -> tags.get(tag))).map((items) -> items.get(item)).ifPresent(consumer);
}
}
});
}
public void fastjson1EishaySerde() {
MediaContent mediaContent = JSON.parseObject(EISHAY_STR, MediaContent.class);
MediaContent mediaContent = JSON.parseObject(texts[0], MediaContent.class);
long toStringTotal;
{
long start = System.currentTimeMillis();
@ -76,17 +236,19 @@ public class MainActivity extends AppCompatActivity {
{
long start = System.currentTimeMillis();
for (int i = 0; i < SERDE_LOOP_COUNT; i++) {
com.alibaba.fastjson.JSON.parseObject(EISHAY_STR, MediaContent.class);
com.alibaba.fastjson.JSON.parseObject(texts[0], MediaContent.class);
}
parseObjectTotal = System.currentTimeMillis() - start;
}
appendInfo("fastjson1 serde : " + toStringTotal + ", " + parseObjectTotal);
synchronized (result) {
result.append("fastjson1 serde : ").append(toStringTotal).append(", ").append(parseObjectTotal).append("\n");
}
}
public void fastjson2EishaySerde() {
MediaContent mediaContent = JSON.parseObject(EISHAY_STR, MediaContent.class);
MediaContent mediaContent = JSON.parseObject(texts[0], MediaContent.class);
long toStringTotal;
{
@ -101,42 +263,46 @@ public class MainActivity extends AppCompatActivity {
{
long start = System.currentTimeMillis();
for (int i = 0; i < SERDE_LOOP_COUNT; i++) {
JSON.parseObject(EISHAY_STR, MediaContent.class);
JSON.parseObject(texts[0], MediaContent.class);
}
parseObjectTotal = System.currentTimeMillis() - start;
}
appendInfo("fastjson2 serde : " + toStringTotal + ", " + parseObjectTotal);
synchronized (result) {
result.append("fastjson2 serde : ").append(toStringTotal).append(", ").append(parseObjectTotal).append("\n");
}
}
public void gsonEishaySerde() {
MediaContent mediaContent = JSON.parseObject(EISHAY_STR, MediaContent.class);
MediaContent mediaContent = JSON.parseObject(texts[0], MediaContent.class);
long start = System.currentTimeMillis();
for (int i = 0; i < SERDE_LOOP_COUNT; i++) {
g.toJson(mediaContent);
gson.toJson(mediaContent);
}
long toStringTotal = System.currentTimeMillis() - start;
start = System.currentTimeMillis();
for (int i = 0; i < SERDE_LOOP_COUNT; i++) {
g.fromJson(EISHAY_STR, MediaContent.class);
gson.fromJson(texts[0], MediaContent.class);
}
long parseObjectTotal = System.currentTimeMillis() - start;
appendInfo("gson serde : " + toStringTotal + ", " + parseObjectTotal);
synchronized (result) {
result.append("gson serde : ").append(toStringTotal).append(", ").append(parseObjectTotal).append("\n");
}
}
public void jacksonEishaySerde() {
MediaContent mediaContent = JSON.parseObject(EISHAY_STR, MediaContent.class);
MediaContent mediaContent = JSON.parseObject(texts[0], MediaContent.class);
try {
long toStringTotal;
{
long start = System.currentTimeMillis();
for (int i = 0; i < SERDE_LOOP_COUNT; i++) {
objectMapper.writeValueAsString(mediaContent);
mapper.writeValueAsString(mediaContent);
}
toStringTotal = System.currentTimeMillis() - start;
}
@ -145,38 +311,18 @@ public class MainActivity extends AppCompatActivity {
{
long start = System.currentTimeMillis();
for (int i = 0; i < SERDE_LOOP_COUNT; i++) {
objectMapper.readValue(EISHAY_STR, MediaContent.class);
mapper.readValue(texts[0], MediaContent.class);
}
parseObjectTotal = System.currentTimeMillis() - start;
}
appendInfo("jackson serde : " + toStringTotal + ", " + parseObjectTotal);
synchronized (result) {
result.append("jackson serde : ").append(toStringTotal).append(", ").append(parseObjectTotal).append("\n");
}
} catch (Exception e) {
Log.d("fastjson", e.getMessage());
}
}
public void fastjson1Serde(View view) {
if (((RadioButton) findViewById(R.id.eishaySerde)).isChecked()) {
fastjson1EishaySerde();
}
}
public void fastjson2Serde(View view) {
if (((RadioButton) findViewById(R.id.eishaySerde)).isChecked()) {
fastjson2EishaySerde();
}
}
public void gsonSerde(View view) {
if (((RadioButton) findViewById(R.id.eishaySerde)).isChecked()) {
gsonEishaySerde();
}
}
public void jacksonSerde(View view) {
if (((RadioButton) findViewById(R.id.eishaySerde)).isChecked()) {
jacksonEishaySerde();
synchronized (result) {
result.append("jackson error : ").append(e.getMessage()).append("\n");
}
}
}
@ -186,7 +332,9 @@ public class MainActivity extends AppCompatActivity {
com.alibaba.fastjson.JSON.parseObject(str);
}
long millis = System.currentTimeMillis() - start;
appendInfo("fastjson1 parse " + name + " : " + millis);
synchronized (result) {
result.append("fastjson1 parse ").append(name).append(" : ").append(millis).append("\n");
}
}
public void fastjson2Parse(String str, String name) {
@ -195,7 +343,9 @@ public class MainActivity extends AppCompatActivity {
JSON.parseObject(str);
}
long millis = System.currentTimeMillis() - start;
appendInfo("fastjson2 parse " + name + " : " + millis);
synchronized (result) {
result.append("fastjson2 parse ").append(name).append(" : ").append(millis).append("\n");
}
}
public void orgjsonParse(String str, String name) {
@ -205,109 +355,13 @@ public class MainActivity extends AppCompatActivity {
new org.json.JSONObject(str);
}
long millis = System.currentTimeMillis() - start;
appendInfo("orgjson parse " + name + " : " + millis);
synchronized (result) {
result.append("orgjson parse ").append(name).append(" : ").append(millis).append("\n");
}
} catch (Exception e) {
Log.d("fastjson", e.getMessage());
synchronized (result) {
result.append("orgjson error : ").append(e.getMessage()).append("\n");
}
}
}
public void fastjson1Parse(View view) {
String str = null, name = null;
if (((RadioButton) findViewById(R.id.eishayParse)).isChecked()) {
str = EISHAY_STR;
name = "eishay";
} else if (((RadioButton) findViewById(R.id.cartParse)).isChecked()) {
str = CART_STR;
name = "cart";
} else if (((RadioButton) findViewById(R.id.homepageParse)).isChecked()) {
str = HOMEPAGE_STR;
name = "homepage";
} else if (((RadioButton) findViewById(R.id.h5apiParse)).isChecked()) {
str = H5API_STR;
name = "h5api";
}
if (str != null) {
fastjson1Parse(str, name);
}
}
public void fastjson2Parse(View view) {
String str = null, name = null;
if (((RadioButton) findViewById(R.id.eishayParse)).isChecked()) {
str = EISHAY_STR;
name = "eishay";
} else if (((RadioButton) findViewById(R.id.cartParse)).isChecked()) {
str = CART_STR;
name = "cart";
} else if (((RadioButton) findViewById(R.id.homepageParse)).isChecked()) {
str = HOMEPAGE_STR;
name = "homepage";
} else if (((RadioButton) findViewById(R.id.h5apiParse)).isChecked()) {
str = H5API_STR;
name = "h5api";
}
if (str != null) {
fastjson2Parse(str, name);
}
}
public void orgjsonParse(View view) {
String str = null, name = null;
if (((RadioButton) findViewById(R.id.eishayParse)).isChecked()) {
str = EISHAY_STR;
name = "eishay";
} else if (((RadioButton) findViewById(R.id.cartParse)).isChecked()) {
str = CART_STR;
name = "cart";
} else if (((RadioButton) findViewById(R.id.homepageParse)).isChecked()) {
str = HOMEPAGE_STR;
name = "homepage";
} else if (((RadioButton) findViewById(R.id.h5apiParse)).isChecked()) {
str = H5API_STR;
name = "h5api";
}
if (str != null) {
orgjsonParse(str, name);
}
}
public void clear(View view) {
TextView textView10 = findViewById(R.id.textView);
textView10.setText("");
}
static final String EISHAY_STR = "{\"images\": [{\n" +
" \"height\":768,\n" +
" \"size\":\"LARGE\",\n" +
" \"title\":\"Javaone Keynote\",\n" +
" \"uri\":\"http://javaone.com/keynote_large.jpg\",\n" +
" \"width\":1024\n" +
" }, {\n" +
" \"height\":240,\n" +
" \"size\":\"SMALL\",\n" +
" \"title\":\"Javaone Keynote\",\n" +
" \"uri\":\"http://javaone.com/keynote_small.jpg\",\n" +
" \"width\":320\n" +
" }\n" +
" ],\n" +
" \"media\": {\n" +
" \"bitrate\":262144,\n" +
" \"duration\":18000000,\n" +
" \"format\":\"video/mpg4\",\n" +
" \"height\":480,\n" +
" \"persons\": [\n" +
" \"Bill Gates\",\n" +
" \"Steve Jobs\"\n" +
" ],\n" +
" \"player\":\"JAVA\",\n" +
" \"size\":58982400,\n" +
" \"title\":\"Javaone Keynote\",\n" +
" \"uri\":\"http://javaone.com/keynote.mpg\",\n" +
" \"width\":640\n" +
" }\n" +
"}";
static String CART_STR;
static String HOMEPAGE_STR;
static String H5API_STR;
}
}

View File

@ -1,30 +0,0 @@
<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>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/item" />
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
</shape>

View File

@ -1,170 +0,0 @@
<?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>

View File

@ -1,133 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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="wrap_content"
android:layout_height="wrap_content"
tools:context=".MainActivity">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dark"
android:paddingStart="20dp"
android:paddingEnd="20dp"
tools:ignore="HardcodedText">
<RadioGroup
android:id="@+id/eishaySerdeGroup"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="HardcodedText">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="Fastjson2 Test"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="5dp"
android:text="Select libs"
android:textColor="@color/white"
android:textSize="14sp" />
<LinearLayout
android:id="@+id/libs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="-6dp"
android:orientation="horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Select tag"
android:textColor="@color/white"
android:textSize="14sp" />
<RadioGroup
android:id="@+id/tags"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="-6dp"
android:layout_marginTop="5dp"
android:orientation="horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Select item"
android:textColor="@color/white"
android:textSize="14sp" />
<RadioGroup
android:id="@+id/items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="-6dp"
android:layout_marginTop="5dp"
android:orientation="horizontal" />
<TextView
android:id="@+id/result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<RelativeLayout
android:id="@+id/submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn"
android:foreground="?android:attr/selectableItemBackground"
android:paddingStart="2dp"
android:paddingTop="14dp"
android:paddingEnd="2dp"
android:paddingBottom="14dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/guideline"
app:layout_constraintWidth_percent="0.78">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Test"
android:textColor="@color/white"
android:textSize="20sp" />
</RelativeLayout>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
app:layout_constraintGuide_percent="0.8" />
<RadioButton
android:id="@+id/eishaySerde"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="eishay"
android:checked="true"
/>
</RadioGroup>
<Button
android:id="@+id/fastjson1Serde"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/eishaySerdeGroup"
android:onClick="fastjson1Serde"
android:text="FASTJSON 1 SERDE" />
<Button
android:id="@+id/fastjson2Serde"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/fastjson1Serde"
android:text="FASTJSON 2 SERDE"
android:onClick="fastjson2Serde"/>
<Button
android:id="@+id/gsonSerde"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/fastjson2Serde"
android:text="ORG JSON SERDE"
android:onClick="gsonSerde"/>
<Button
android:id="@+id/jacksonSerde"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/gsonSerde"
android:text="JACKSON SERDE"
android:onClick="jacksonSerde"/>
<RadioGroup
android:id="@+id/parseGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@id/jacksonSerde"
>
<RadioButton
android:id="@+id/eishayParse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="eishay"
android:checked="true"
/>
<RadioButton
android:id="@+id/cartParse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="cart" />
<RadioButton
android:id="@+id/homepageParse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="homepage" />
<RadioButton
android:id="@+id/h5apiParse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="h5 api" />
</RadioGroup>
<Button
android:id="@+id/fastjson1Parse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/parseGroup"
android:onClick="fastjson1Parse"
android:text="FASTJSON 1 PARSE" />
<Button
android:id="@+id/fastjson2Parse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/fastjson1Parse"
android:text="FASTJSON 2 PARSE"
android:onClick="fastjson2Parse"/>
<Button
android:id="@+id/orgjsonParse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/fastjson2Parse"
android:text="ORG JSON PARSE"
android:onClick="orgjsonParse"/>
<Button
android:id="@+id/btnClear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/orgjsonParse"
android:text="clear"
android:onClick="clear"/>
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/btnClear" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,5 +1,5 @@
<?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>
<background android:drawable="@color/white"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@ -1,5 +1,5 @@
<?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>
<background android:drawable="@color/white"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

View File

@ -1,7 +0,0 @@
<resources>
<style name="Theme.Fastjson2" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/purple_200</item>
</style>
</resources>

View File

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="corner">#303030</color>
<color name="dark">#212121</color>
<color name="item">#303030</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>
</resources>

View File

@ -1,7 +1,18 @@
<resources>
<style name="Theme.Fastjson2" parent="Theme.AppCompat.Light.NoActionBar">
<style name="App" parent="Theme.AppCompat.Light.NoActionBar" />
<style name="AppTheme" parent="App">
<item name="colorPrimary">@color/purple_500</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:statusBarColor">@color/dark</item>
<item name="colorControlNormal">@color/white</item>
<item name="colorControlActivated">@color/white</item>
</style>
</resources>
<style name="SplashTheme" parent="AppTheme">
<item name="android:windowBackground">@color/dark</item>
</style>
</resources>

View File

@ -6,8 +6,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
}
}
@ -22,4 +22,4 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}
}

View File

@ -1,3 +1,4 @@
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true
android.enableJetifier=true
android.injected.testOnly=false

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip