android studio – Guardar el estado de un Recycler view y poder borrar los elementos

estoy haciendo una aplicación de tareas en Kotlin con Android Studio en la que utilizo un recycler view, en ella se puede añadir una tarea que se queda añadida en el recycler view y que luego se puede pulsar en ella para ver información en detalle.

El problema que tengo es que no he encontrado la forma de implementar algo para que las tareas que añades se queden guardadas al cerrar la aplicación, he visto cosas como el preference manager o una base de datos, pero me gustaría que alguien me ayudase y me dijese que es lo mejor para lo que busco y como debo implementarlo ya que no lo consigo, aparte de esto me gustaría saber como hacer que pueda al mantener pulsado un item que este se borre tanto de la memoria del dispositivo como del recycler view.

A continuación dejo tanto el mainActivity como el adapter que uso.

MainActivity:

package com.kyler.myaccounts

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.bottomnavigation.BottomNavigationView
import kotlinx.android.synthetic.main.activity_main.*


class MainActivity : AppCompatActivity(){

    val plusButtonCode = 1

    lateinit var tareaAdapter: TareaAdapter
    
    override fun onCreate(savedInstance: Bundle?) {
        super.onCreate(savedInstance)
        setContentView(R.layout.activity_main)


        var mbottomNavigation: BottomNavigationView? = null

        mbottomNavigation = findViewById<View>(R.id.bottomNavigation) as BottomNavigationView
        mbottomNavigation!!.setOnNavigationItemSelectedListener { item ->
            if (item.itemId == R.id.home_button) {
                val intent1 = Intent(this, MainActivity::class.java)
                intent1.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                startActivity(intent1)
            }
            if (item.itemId == R.id.plus_button) {
                val intent2 = Intent(this, PlusActivity::class.java)
                intent2.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                startActivityForResult(intent2, plusButtonCode)
            }
            if (item.itemId == R.id.graphics_button) {
                val intent3 = Intent(this, GraphicsActivity::class.java)
                intent3.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                startActivity(intent3)
            }
            true
        }



        val tareas = ArrayList<Tarea>()


        tareaAdapter = TareaAdapter(tareas,this)


        recycler_view.adapter = TareaAdapter(tareas, this)
        recycler_view.layoutManager = LinearLayoutManager(this)




    }
 //Agregar item
    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?){
        super.onActivityResult(requestCode, resultCode, data)
        if(requestCode == plusButtonCode){
            if(resultCode == Activity.RESULT_OK){
                val tareaDescripcion = data!!.extras!!("editText_tarea") as String

                tareaAdapter.agregarTarea(Tarea(tareaDescripcion))

            }
        }
    }



}

Adapter del recycler view:

package com.kyler.myaccounts


import android.content.Context
import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.plus_layout.*
import kotlinx.android.synthetic.main.tarea_item.view.*


const val EXTRA_MESSAGE = "com.kyler.myaccounts.nombre_tarea"

const val FECHA = "com.kyler.myaccounts.fecha_tarea"

class TareaAdapter(public var tareas : ArrayList<Tarea>, private var contexto: Context) : RecyclerView.Adapter<TareaAdapter.TareaViewHolder>() {


    fun agregarTarea(tarea: Tarea){
        tareas.add(tarea)
        notifyItemInserted(itemCount)
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TareaViewHolder {
        return TareaViewHolder(LayoutInflater.from(parent.context)
            .inflate(R.layout.tarea_item, parent, false), contexto)
    }

    override fun getItemCount(): Int {
        return tareas.size
    }

    override fun onBindViewHolder(holder: TareaViewHolder, position: Int) {
        holder.itemView.boton_tarea.text = tareas(position).nombre
        println(tareas(position).nombre)
        holder.bind(tareas(position),tareas)

    }



    //Abrir actividad con el nuevo item
    class TareaViewHolder(private var vista: View,private var contexto:Context) : RecyclerView.ViewHolder(vista){
        fun bind (tarea: Tarea, tareas: ArrayList<Tarea>){
            vista.boton_tarea.setOnClickListener{
                contexto.startActivity(Intent(contexto, tarea_info::class.java).putExtra(
                   EXTRA_MESSAGE,tarea.nombre))

            }
        }
    }

}

Si alguien necesita algún archivo mas de la aplicación para poder resolver el problema que me lo diga, que no tendré problema en subirlo.

De antemano agradezco enormemente la ayuda que se me proporcione.

Default All Documents view in a SharePoint document library got corrupted

Some how the default view (All Documents – …/Forms/AllItems.aspx) in a document library in SharePoint Online got corrupted and now shows gibberish:

“…PK!A�.fT(Content_Types).xml �(����n�0E����� �tQUUH},�HM?����/����;@��(�I6H0s�=xF��V� |���d� H�(!M����(�H��LY9�B ����h�uT���E�����YȬ���z�”���:�X �~0x�ܚ&��� ��l�b��� ɷ��$�Mc���+��@�j<�p�a�)�Y�:)q@��2T�=a!)�Æ������}���R@2e>�3�)tm����Fev���- ɡ�Wn�(!�w�*k+�I����q� ���폇Qp ��s/��W��c�R`����”…

As a temporary solution I created a new default view, but need to restore the old one at AllItems.aspx as users have links to it…

What is the best way to restore or repair the view?
Shall I delete the view and recreate new with the same AllItems.aspx address?

Thank you in advance.

Regards,

modal view – Position of Done button on iOS WebViews

On iOS modal screens, I’m following a pattern of always positioning key/affirmative actions on the right (Save, Add, etc) and dismissive actions on the left (Done, Cancel, Close). However, if a dismissive action is the only action on the modal, it will be positioned on the right.

On iOS WebViews, it’s standard to have a refresh icon allowing users to reload/refresh the page. Most WebViews have this refresh icon positioned on the right, while a Done button is positioned on the left. This follows the logic mentioned above, however, my assumption is that closing the WebView (i.e. selecting Done) would be much more common and used compared with the refresh action on the right. Would it make sense to swap the positions here and have Done on the right? Or would such exception be inconsistent with iOS patterns?

How to disable “Mini Call View” feature in Google’s latest Phone app?

The latest version of Google’s Phone (v 23) app has a feature called “Mini Call View” in which when you answer a call it won’t open the phone dialer. Instead there is a notification in the notification bar and if you expand the notification bar you will see an on going call and a button to hang up and another button to start speaker phone.

I don’t like this feature and want to disable it. I want the full phone dialer to open up when answering a call.

Does anyone know how to disable Mini Call View in Google’s Phone app? Or at the very least does anyone know how to open the phone dial pad by default when answering a call?

Get Now YouTube Standard Promotion Package for $10

Get Now YouTube Standard Promotion Package

Hello Viewers
Welcome To My Services,


I will Give You Non Drop YouTube Real
300 Subscriber
300 Like
50 Custom Comment
100 video View

Service Description :

No wants Admin secret Or Personal info.

My service is skilled & super quick.

Quality Of YouTube Subscriber

1.YouTube Subscribers Like Comment View aren’t 100% real.

2.Subscribers Like Comment View return from worldwide name profile.

3. A Refund Warranted If Not Work .

4. keep very while on your YouTube channel.

5. variety of them is born once several days however its chance is extremely few.

6. Quickly deliver before point.

7. Get some further YouTube Subscribers Like Comment View.


Thank you.

Just order American state ..


Note: I offers all Services from channels Its Come from worldwide.

Send Me Your YouTube Video Link

If You Need More Services Please Inbox Me.

.

Google Chrome pdf view inside an iframe

I have this screenshot displaying a pdf in an iframe. My device is a Samsung S9+. The problem I have is that when I click on the open button, nothing happens. I’ve also opened the same page in the default Samsung browser and the pdf begins to download immediately.

Does anybody know what is going on with this pdf on Google Chrome?

iframe screenshot