Skip to content

Commit

Permalink
optimized code
Browse files Browse the repository at this point in the history
  • Loading branch information
yechao committed Oct 16, 2021
1 parent fffa415 commit d251111
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
/gradle
/gradlew
/gradlew.bat
/.idea/
13 changes: 0 additions & 13 deletions .idea/runConfigurations.xml

This file was deleted.

8 changes: 4 additions & 4 deletions app/src/main/java/com/yechaoa/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ class MainActivity : AppCompatActivity() {
set.add("-----" + array[i])
}

mBinding.button.setOnClickListener {
mBinding.btnStrSet.setOnClickListener {
SpUtil.setStringSet("testStringSet", set)
}

mBinding.button2.setOnClickListener {
mBinding.btnStrSet2.setOnClickListener {
val stringSet = SpUtil.getStringSet("testStringSet")
LogUtil.i(stringSet.toString())
}

mBinding.showLoading.setOnClickListener {
mBinding.btnShowLoading.setOnClickListener {
YUtils.showLoading(this, "test")
LogUtil.i("" + YUtils.loadingIsShowing())
}

mBinding.hideLoading.setOnClickListener {
mBinding.btnHideLoading.setOnClickListener {
ToastUtil.show("取消loading")
YUtils.hideLoading()
LogUtil.i("" + YUtils.loadingIsShowing())
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@
android:text="Hello World!" />

<Button
android:id="@+id/button"
android:id="@+id/btn_str_set"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="存StringSet" />

<Button
android:id="@+id/button2"
android:id="@+id/btn_str_set2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="读StringSet" />

<Button
android:id="@+id/showLoading"
android:id="@+id/btn_showLoading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="showLoading" />

<Button
android:id="@+id/hideLoading"
android:id="@+id/btn_hideLoading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
Expand Down

0 comments on commit d251111

Please sign in to comment.