Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit f341ac36 authored by solokot's avatar solokot Committed by GitHub
Browse files

Merge pull request #45 from SimpleMobileTools/master

upd
parents d0fb9af7 f150922f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ buildscript {
        propMinSdkVersion = 21
        propTargetSdkVersion = propCompileSdkVersion
        propVersionCode = 1
        propVersionName = '5.2.0'
        propVersionName = '5.2.9'
        kotlin_version = '1.2.71'
    }

+5 −8
Original line number Diff line number Diff line
package com.simplemobiletools.commons.activities

import android.annotation.SuppressLint
import android.app.Activity
import android.app.ActivityManager
import android.content.Context
@@ -82,12 +81,12 @@ abstract class BaseSimpleActivity : AppCompatActivity() {
        funAfterOTGPermission = null
    }

    override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) {
        android.R.id.home -> {
            finish()
            true
    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        when (item.itemId) {
            android.R.id.home -> finish()
            else -> return super.onOptionsItemSelected(item)
        }
        else -> super.onOptionsItemSelected(item)
        return true
    }

    override fun attachBaseContext(newBase: Context) {
@@ -192,10 +191,8 @@ abstract class BaseSimpleActivity : AppCompatActivity() {

    private fun isProperOTGFolder(uri: Uri) = isExternalStorageDocument(uri) && isRootUri(uri) && !isInternalStorage(uri)

    @SuppressLint("NewApi")
    private fun isRootUri(uri: Uri) = DocumentsContract.getTreeDocumentId(uri).endsWith(":")

    @SuppressLint("NewApi")
    private fun isInternalStorage(uri: Uri) = isExternalStorageDocument(uri) && DocumentsContract.getTreeDocumentId(uri).contains("primary")

    private fun isExternalStorageDocument(uri: Uri) = "com.android.externalstorage.documents" == uri.authority
+0 −2
Original line number Diff line number Diff line
@@ -148,8 +148,6 @@ abstract class MyRecyclerViewAdapter(val activity: BaseSimpleActivity, val recyc
        }
    }

    protected fun isKeySelected(key: Int) = selectedKeys.contains(key)

    protected fun getSelectedItemPositions(sortDescending: Boolean = true): ArrayList<Int> {
        val positions = ArrayList<Int>()
        val keys = selectedKeys.toList()
+10 −20
Original line number Diff line number Diff line
@@ -2,9 +2,6 @@ package com.simplemobiletools.commons.dialogs

import android.app.Activity
import android.graphics.Color
import androidx.appcompat.app.AlertDialog
import android.text.Editable
import android.text.TextWatcher
import android.view.MotionEvent
import android.view.View
import android.view.View.OnTouchListener
@@ -12,6 +9,7 @@ import android.view.ViewGroup
import android.view.WindowManager
import android.widget.EditText
import android.widget.ImageView
import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.views.ColorPickerSquare
@@ -109,17 +107,10 @@ class ColorPickerDialog(val activity: Activity, color: Int, val removeDimmedBack
            false
        })

        newHexField.addTextChangedListener(object : TextWatcher {
            override fun afterTextChanged(s: Editable?) {
            }

            override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
            }

            override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
                if (s.length == 6 && !isHueBeingDragged) {
        newHexField.onTextChangeListener {
            if (it.length == 6 && !isHueBeingDragged) {
                try {
                        val newColor = Color.parseColor("#$s")
                    val newColor = Color.parseColor("#$it")
                    Color.colorToHSV(newColor, currentColorHsv)
                    updateHue()
                    moveColorPicker()
@@ -127,7 +118,6 @@ class ColorPickerDialog(val activity: Activity, color: Int, val removeDimmedBack
                }
            }
        }
        })

        val textColor = activity.baseConfig.textColor
        dialog = AlertDialog.Builder(activity)
+2 −2
Original line number Diff line number Diff line
package com.simplemobiletools.commons.dialogs

import android.app.Activity
import androidx.appcompat.app.AlertDialog
import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.DAY_SECONDS
@@ -39,7 +39,7 @@ class CustomIntervalPickerDialog(val activity: Activity, val selectedSeconds: In
        }

        dialog = AlertDialog.Builder(activity)
                .setPositiveButton(R.string.ok, { dialogInterface, i -> confirmReminder() })
                .setPositiveButton(R.string.ok) { dialogInterface, i -> confirmReminder() }
                .setNegativeButton(R.string.cancel, null)
                .create().apply {
                    activity.setupDialogStuff(view, this) {
Loading