-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
8 changed files
with
237 additions
and
28 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
5 changes: 3 additions & 2 deletions
5
app/src/main/java/de/felixnuesse/timedsilence/model/contacts/Contact.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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package de.felixnuesse.timedsilence.model.contacts | ||
|
||
class Contact(var name: String) { | ||
|
||
import android.graphics.Bitmap | ||
|
||
class Contact(var name: String) { | ||
var photo: Bitmap? = null | ||
} |
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
67 changes: 67 additions & 0 deletions
67
app/src/main/java/de/felixnuesse/timedsilence/ui/ContactsListAdapter.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,67 @@ | ||
package de.felixnuesse.timedsilence.ui; | ||
|
||
import androidx.recyclerview.widget.RecyclerView | ||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.appcompat.content.res.AppCompatResources | ||
import de.felixnuesse.timedsilence.handler.volume.VolumeState.Companion.TIME_SETTING_LOUD | ||
import de.felixnuesse.timedsilence.handler.volume.VolumeState.Companion.TIME_SETTING_SILENT | ||
import de.felixnuesse.timedsilence.handler.volume.VolumeState.Companion.TIME_SETTING_VIBRATE | ||
import de.felixnuesse.timedsilence.Constants.Companion.WIFI_TYPE_CONNECTED | ||
import de.felixnuesse.timedsilence.Constants.Companion.WIFI_TYPE_SEARCHING | ||
import de.felixnuesse.timedsilence.R | ||
import de.felixnuesse.timedsilence.databinding.AdapterContactListBinding | ||
import de.felixnuesse.timedsilence.databinding.AdapterWifiListBinding | ||
import de.felixnuesse.timedsilence.model.contacts.Contact | ||
import de.felixnuesse.timedsilence.model.data.WifiObject | ||
import de.felixnuesse.timedsilence.model.database.DatabaseHandler | ||
import kotlin.collections.ArrayList | ||
|
||
|
||
/** | ||
* Copyright (C) 2024 Felix Nüsse | ||
* Created on 06.01.24 - 21:53 | ||
* <p> | ||
* Edited by: Felix Nüsse felix.nuesse(at)t-online.de | ||
* <p> | ||
* <p> | ||
* This program is released under the GPLv3 license | ||
* <p> | ||
* <p> | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* <p> | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* <p> | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
*/ | ||
class ContactsListAdapter(private val myDataset: ArrayList<Contact>): RecyclerView.Adapter<ContactsListAdapter.ContactViewHolder>() { | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ContactViewHolder { | ||
val binding = AdapterContactListBinding.inflate(LayoutInflater.from(parent.context), parent, false) | ||
return ContactViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: ContactViewHolder, position: Int) { | ||
val context = holder.contactView.root.context | ||
var contact = myDataset[position] | ||
holder.contactView.name.text = contact.name | ||
holder.contactView.profile.setImageBitmap(contact.photo) | ||
|
||
} | ||
|
||
override fun getItemCount() = myDataset.size | ||
|
||
class ContactViewHolder(val contactView: AdapterContactListBinding) : | ||
RecyclerView.ViewHolder(contactView.root) | ||
|
||
} | ||
|
||
|
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,11 @@ | ||
<vector android:height="24dp" android:tint="@color/iconColor" | ||
android:viewportHeight="24" android:viewportWidth="24" | ||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillAlpha="0.3" | ||
android:fillColor="@android:color/white" | ||
android:pathData="M12,16c-2.69,0 -5.77,1.28 -6,2h12c-0.2,-0.71 -3.3,-2 -6,-2z" android:strokeAlpha="0.3"/> | ||
<path android:fillAlpha="0.3" | ||
android:fillColor="@android:color/white" | ||
android:pathData="M12,8m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0" android:strokeAlpha="0.3"/> | ||
<path android:fillColor="@android:color/white" android:pathData="M12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4zM6,18c0.22,-0.72 3.31,-2 6,-2 2.7,0 5.8,1.29 6,2L6,18zM12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,6c1.1,0 2,0.9 2,2s-0.9,2 -2,2 -2,-0.9 -2,-2 0.9,-2 2,-2z"/> | ||
</vector> |
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,62 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
|
||
<androidx.cardview.widget.CardView | ||
style="@style/tertiaryCard" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="@dimen/cardMargin" | ||
android:padding="@dimen/cardPadding" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"> | ||
|
||
<LinearLayout | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="8dp" | ||
android:gravity="center" | ||
android:orientation="horizontal"> | ||
|
||
<ImageView | ||
android:id="@+id/profile" | ||
android:layout_width="32dp" | ||
android:layout_height="32dp" | ||
android:background="@drawable/shape_circle" | ||
android:clipToOutline="true" | ||
android:cropToPadding="true" /> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" | ||
android:paddingStart="12dp"> | ||
|
||
<TextView | ||
android:id="@+id/name" | ||
style="@style/tertiaryCard" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="name" /> | ||
|
||
<TextView | ||
android:id="@+id/description" | ||
style="@style/tertiaryCard" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="4dp" | ||
android:text="description" /> | ||
</LinearLayout> | ||
|
||
</LinearLayout> | ||
|
||
</androidx.cardview.widget.CardView> | ||
|
||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
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