Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lulululbj committed Nov 29, 2019
1 parent 87baceb commit 4117e84
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 8 deletions.
10 changes: 9 additions & 1 deletion app/src/main/java/luyao/box/about/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import android.os.Build
import android.view.Gravity
import android.view.MenuItem
import androidx.appcompat.widget.PopupMenu
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView
import de.psdev.licensesdialog.LicensesDialog
import de.psdev.licensesdialog.licenses.ApacheSoftwareLicense20
import de.psdev.licensesdialog.model.Notice
Expand Down Expand Up @@ -32,7 +34,13 @@ class AboutActivity : BaseActivity() {
source.setOnClickListener { openBrowser(GITHUB_PAGE) }
feedback.setOnClickListener { showFeedBackMenu() }
thirdLib.setOnClickListener { showLicenseDialog() }
developer.setOnClickListener { openBrowser(HOME_PAGE) }
developer.setOnClickListener { showMe() }
}

private fun showMe(){
MaterialDialog(this).show {
customView(R.layout.dialog_me)
}
}

private fun showOwnLicense() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/luyao/box/bean/HistoryBean.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ package luyao.box.bean
* on 2019/1/10 13:18
*/
data class HistoryBean(
val packageName:String,
val windowName:String
val packageName:String?,
val windowName:String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class BoxAccessibilityService : AccessibilityService() {
override fun onAccessibilityEvent(event: AccessibilityEvent) {
if (event.eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
"${event.packageName}$\n${event.className}".loge("box")
FloatWindowManager.addItem(HistoryBean(event.packageName.toString(), event.className.toString()))
FloatWindowManager.addItem(HistoryBean(event.packageName?.toString(), event.className?.toString()))
}
}

Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/luyao/box/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.view.Menu
import android.view.MenuItem
import android.widget.TextView
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.core.view.GravityCompat
import androidx.recyclerview.widget.GridLayoutManager
Expand Down Expand Up @@ -151,10 +152,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
}

private fun requestPermission() {
request(permission) {
onGranted { createBaseFile() }
onShowRationale { checkPermissions() }
}
ActivityCompat.requestPermissions(this,arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),1000)
}

private fun createBaseFile() = launch(Dispatchers.IO) {
Expand Down
Binary file added app/src/main/res/drawable-xxhdpi/wechat.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions app/src/main/res/layout/dialog_me.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">

<ImageView
android:layout_width="160dp"
android:layout_height="160dp"
android:src="@drawable/wechat"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="扫一扫,添加我的微信。"
android:textColor="@color/black"
android:textSize="16sp"
android:layout_marginTop="10dp"/>

</LinearLayout>

0 comments on commit 4117e84

Please sign in to comment.