-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
359 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
app/src/main/java/de/msdevs/einschlafhilfe/AboutLibrariesActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package de.msdevs.einschlafhilfe | ||
import android.os.Bundle | ||
import com.mikepenz.aboutlibraries.LibsBuilder | ||
import com.mikepenz.aboutlibraries.ui.LibsActivity | ||
|
||
|
||
class AboutLibrariesActivity : LibsActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
intent = LibsBuilder() | ||
.withEdgeToEdge(true) | ||
.withAboutMinimalDesign(true) | ||
.withActivityTitle(getString(R.string.about_libs)) | ||
.withSearchEnabled(true) | ||
.intent(this) | ||
super.onCreate(savedInstanceState) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
app/src/main/java/de/msdevs/einschlafhilfe/adapter/AutoCompleteTextViewAdapter.kt
This file was deleted.
Oops, something went wrong.
79 changes: 79 additions & 0 deletions
79
app/src/main/java/de/msdevs/einschlafhilfe/adapter/FilterListeAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package de.msdevs.einschlafhilfe.adapter | ||
|
||
import android.content.Context | ||
import android.util.Log | ||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import android.widget.ImageView | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.bumptech.glide.Glide | ||
import com.bumptech.glide.load.engine.DiskCacheStrategy | ||
import de.msdevs.einschlafhilfe.databinding.ItemFolgeBinding | ||
import de.msdevs.einschlafhilfe.models.JsonResponse | ||
import de.msdevs.einschlafhilfe.utils.NetworkUtils | ||
import de.msdevs.einschlafhilfe.R | ||
|
||
class FilterListeAdapter(private val folgeList: List<JsonResponse>, private val onDeleteItemListener: OnDeleteItemListener? = null) : | ||
RecyclerView.Adapter<FilterListeAdapter.FolgeViewHolder>() { | ||
private var networkUtils = NetworkUtils() | ||
|
||
inner class FolgeViewHolder(private val binding: ItemFolgeBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
|
||
fun bind(folgeTitle: String, nummer : String, type : String) { | ||
binding.tvFolgenName.text = folgeTitle | ||
binding.tvFolgenNummer.text = binding.tvFolgenNummer.context.getString(R.string.nummer, nummer) | ||
loadCover(nummer,type, binding.ivCover) | ||
|
||
binding.ivDelete.setOnClickListener{ | ||
onDeleteItemListener?.onDeleteItem(folgeTitle) | ||
} | ||
} | ||
} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FolgeViewHolder { | ||
val binding = | ||
ItemFolgeBinding.inflate(LayoutInflater.from(parent.context), parent, false) | ||
return FolgeViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: FolgeViewHolder, position: Int) { | ||
val item = folgeList[position] | ||
holder.bind(item.name,item.nummer.toString(), item.type) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return folgeList.size | ||
} | ||
|
||
private fun loadCover(nummer : String, type : String, iv : ImageView){ | ||
val context : Context = iv.context | ||
var prefix = "" | ||
if(type == "ddf"){ | ||
prefix = "" | ||
}else if(type == "d3"){ | ||
prefix = "dd" | ||
}else if(type == "kids"){ | ||
prefix = "k" | ||
}else if(type == "sonderfolgen"){ | ||
prefix = "x" | ||
}else{ | ||
prefix = "s" | ||
} | ||
val url : String = if(prefix == "dd"){ | ||
context.getString(R.string.cover_citroncode_dd_url) + (nummer) + ".png" | ||
}else{ | ||
context.getString(R.string.cover_citroncode_url) + prefix + (nummer) + ".png" | ||
} | ||
Log.e("FilterListeAdapter", "Cover URL: $url") | ||
if(networkUtils.isConnected(context)){ | ||
Glide.with(context) | ||
.load(url) | ||
.diskCacheStrategy(DiskCacheStrategy.ALL) | ||
.into(iv) | ||
} | ||
} | ||
interface OnDeleteItemListener { | ||
fun onDeleteItem(name: String) | ||
} | ||
} |
Oops, something went wrong.