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

Commit a3442170 authored by Arnau Vàzquez's avatar Arnau Vàzquez
Browse files

Merge branch 'issue-116' into 'master'

Remove installing view for xapk

See merge request e/apps/apps!18
parents 19ecfd8b 79cdb445
Loading
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -23,7 +23,8 @@
        android:roundIcon="@mipmap/ic_launcher"
        android:supportsRtl="true"
        android:largeHeap="true"
        android:launchMode="singleTask"
        android:launchMode="singleInstance"
        android:alwaysRetainTaskState="true"
        android:theme="@style/AppTheme">
<!--        <activity android:name=".application.PwaInstaller"/>-->
        <activity android:name=".settings.AppRequestActivity" />
@@ -63,9 +64,9 @@
        <activity
            android:name=".XAPK.InstallSplitApksActivity"
            android:configChanges="screenSize|orientation|keyboardHidden"
            android:label="XAPK Installer"
            android:launchMode="singleTask"
            android:windowSoftInputMode="adjustResize" />
            android:launchMode="singleInstance"
            android:windowSoftInputMode="adjustResize"
            android:theme="@style/AppTheme1"/>
    </application>

</manifest>
+1 −3
Original line number Diff line number Diff line
@@ -11,11 +11,9 @@ abstract class BaseActivity : RxAppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        init()
        nextStep()
        finish()
    }

    protected open fun init() {}

    protected open fun nextStep() {}
}
+0 −17
Original line number Diff line number Diff line
package foundation.e.apps.XAPK

import org.greenrobot.eventbus.EventBus


object EventManager {

    fun register(subscriber: Any) {
        EventBus.getDefault().register(subscriber)
    }

    fun unregister(subscriber: Any) {
        EventBus.getDefault().unregister(subscriber)
    }


}
 No newline at end of file
+0 −23
Original line number Diff line number Diff line
package foundation.e.apps.XAPK


abstract class IBaseActivity : BaseActivity(){

    override fun init() {
        super.init()
        setContentView(getLayout())
//        EventManager.register(this)
    }

    override fun onDestroy() {
        super.onDestroy()
//        EventManager.unregister(this)
    }


    protected abstract fun getLayout(): Int




}
+10 −34
Original line number Diff line number Diff line
@@ -13,8 +13,8 @@ import android.view.KeyEvent
import android.view.View
import android.widget.TextView
import androidx.annotation.RequiresApi
import com.makeramen.roundedimageview.BuildConfig
import com.makeramen.roundedimageview.RoundedImageView
import foundation.e.apps.BuildConfig
import foundation.e.apps.R
import java.io.File
import java.io.FileInputStream
@@ -22,7 +22,7 @@ import java.io.IOException


@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
class InstallSplitApksActivity : IBaseActivity() {
class InstallSplitApksActivity : BaseActivity() {
    private  var apksBean: ApksBean?=null

    companion object{
@@ -37,10 +37,6 @@ class InstallSplitApksActivity : IBaseActivity() {
        }
    }

    override fun getLayout(): Int {
        return R.layout.activity_install_split_apks
    }

    override fun nextStep() {
        super.nextStep()
        apksBean = intent.getParcelableExtra(KEY_PARAM)
@@ -51,25 +47,6 @@ class InstallSplitApksActivity : IBaseActivity() {
            finish()
            return
        }
        val iconRiv: RoundedImageView = findViewById(R.id.icon_riv)
        val titleTv: TextView = findViewById(R.id.title_tv)
        titleTv.text = apksBean!!.label
        val apkAssetType = apksBean!!.apkAssetType
        val iconUrl = apksBean!!.iconPath
        if (!TextUtils.isEmpty(iconUrl) && apkAssetType != null) {
            iconRiv.visibility = View.VISIBLE
//            if (apkAssetType == ApkAssetType.XAPK) {
//                ImageLoader.Builder(mContext, XApkIconUrl(iconUrl))
//                    .setRequestOptions(ImageLoader.defaultRequestOptions(R.color.placeholder_color))
//                    .build(iconRiv)
//            } else if (apkAssetType == ApkAssetType.Apks) {
//                ImageLoader.Builder(mContext, ApkIconUrl(iconUrl, -1))
//                    .setRequestOptions(ImageLoader.defaultRequestOptions(R.color.placeholder_color))
//                    .build(iconRiv)
//            }
        } else {
            iconRiv.visibility = View.GONE
        }
        Handler(Looper.getMainLooper()).postDelayed({ this.install() }, 500)
    }

@@ -93,6 +70,7 @@ class InstallSplitApksActivity : IBaseActivity() {
            val statusReceiver = pendingIntent.intentSender
            // Commit the session (this will start the installation workflow).
            session!!.commit(statusReceiver)
            finish()
        } catch (e: IOException) {
            e.printStackTrace()
            finish()
@@ -165,19 +143,17 @@ class InstallSplitApksActivity : IBaseActivity() {
                        FsUtils.deleteFileOrDir(it)
                    }
                }
                findViewById<View>(R.id.installing_status_view).visibility = View.GONE
                findViewById<View>(R.id.installed_status_view).visibility = View.VISIBLE
            }
        }
    }

    override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
        return if (keyCode == KeyEvent.KEYCODE_BACK) {
            true
        } else {
            super.onKeyDown(keyCode, event)
        }
    }
//    override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
//        return if (keyCode == KeyEvent.KEYCODE_BACK) {
//            true
//        } else {
//            super.onKeyDown(keyCode, event)
//        }
//    }

}

Loading