diff --git a/app/src/main/java/com/common/commonlibtest/DemoActivity.java b/app/src/main/java/com/common/commonlibtest/DemoActivity.java index a15085f..27d5150 100644 --- a/app/src/main/java/com/common/commonlibtest/DemoActivity.java +++ b/app/src/main/java/com/common/commonlibtest/DemoActivity.java @@ -2,6 +2,7 @@ package com.common.commonlibtest; import android.content.Intent; import android.os.Bundle; +import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; @@ -15,6 +16,7 @@ import com.common.commonlib.net.interceptor.RequestHeadInterceptor; import com.common.commonlib.net.interceptor.ResponseHeadInterceptor; import com.common.commonlib.utils.BaseUtils; import com.common.commonlib.utils.FTPUtils; +import com.common.commonlib.utils.MMKVUtils; import com.common.commonlibtest.bean.ArticlesResponse; import com.common.commonlibtest.bean.CollectionResponse; import com.common.commonlibtest.bean.LoginResponse; @@ -78,7 +80,8 @@ public class DemoActivity extends AppCompatActivity { binding.btn.setOnClickListener(l -> { List interceptors = new ArrayList<>(); RequestHeadInterceptor.Builder builder = new RequestHeadInterceptor.Builder(); - builder.addHeadParams("Cookie", "loginUserName_wanandroid_com=wang11;token_pass_wanandroid_com=6fbec4fe15d69af8b4531171798f3926;loginUserName=wang11;token_pass=6fbec4fe15d69af8b4531171798f3926"); + builder.addHeadParams("Cookie", + "loginUserName_wanandroid_com=wang11;token_pass_wanandroid_com=6fbec4fe15d69af8b4531171798f3926;loginUserName=wang11;token_pass=6fbec4fe15d69af8b4531171798f3926"); interceptors.add(builder.build()); CollectionLoader loader = new CollectionLoader(interceptors); loader.getCollections(0, new RequestNoResultCallBack() { @@ -119,11 +122,18 @@ public class DemoActivity extends AppCompatActivity { Thread thread = new Thread(new Runnable() { @Override public void run() { - FTPUtils.RESULT result = FTPUtils.INSTANCE.ftpUpload("192.168.101.215", "2221", "admin", "123456", filePath, fileName); + FTPUtils.RESULT result = FTPUtils.INSTANCE.ftpUpload("192.168.101.215", "2221", "admin", "123456", + filePath, fileName); Logger.INSTANCE.d(result.name()); } }); thread.start(); }); + + binding.mmkv.setOnClickListener(l -> { + MMKVUtils.INSTANCE.put("key", 100, "aa"); + int value = MMKVUtils.INSTANCE.getInt("key", "bb"); + Toast.makeText(DemoActivity.this, ""+value, Toast.LENGTH_SHORT).show(); + }); } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 69229b1..5914f02 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,6 +1,7 @@ @@ -93,4 +94,16 @@ app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.83" /> +