-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added more notifications fields, expanded state, testing in the sampl…
…e app
- Loading branch information
luca
committed
Nov 28, 2019
1 parent
6fe180e
commit 3b6836b
Showing
10 changed files
with
147 additions
and
25 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
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
44 changes: 44 additions & 0 deletions
44
sampleapp/src/main/java/com/kirkbushman/sampleapp/activities/NotificationActivity.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,44 @@ | ||
package com.kirkbushman.sampleapp.activities | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.kirkbushman.sampleapp.R | ||
import com.kirkbushman.sampleapp.SampleApplication | ||
import com.kirkbushman.sampleapp.doAsync | ||
import com.kirkbushman.zammad.models.OnlineNotification | ||
import kotlinx.android.synthetic.main.activity_notification.* | ||
|
||
class NotificationActivity : AppCompatActivity() { | ||
|
||
companion object { | ||
|
||
private const val PARAM_NOTIFICATION = "intent_param_notification" | ||
|
||
fun start(context: Context, notification: OnlineNotification) { | ||
|
||
val intent = Intent(context, NotificationActivity::class.java) | ||
intent.putExtra(PARAM_NOTIFICATION, notification) | ||
|
||
context.startActivity(intent) | ||
} | ||
} | ||
|
||
private val client by lazy { SampleApplication.instance.getClient() } | ||
private val notification by lazy { intent.getParcelableExtra(PARAM_NOTIFICATION) as OnlineNotification } | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_notification) | ||
|
||
var newNotification: OnlineNotification? = null | ||
doAsync(doWork = { | ||
|
||
newNotification = client?.onlineNotification(notification.id, true) | ||
}, onPost = { | ||
|
||
notification_text.text = newNotification.toString() | ||
}) | ||
} | ||
} |
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
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,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<TextView | ||
android:id="@+id/notification_text" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="16dp" | ||
/> | ||
|
||
</LinearLayout> |
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,15 +1,41 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<TextView | ||
android:id="@+id/notification_text" | ||
<com.google.android.material.card.MaterialCardView | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="8dp"> | ||
|
||
<LinearLayout | ||
android:id="@+id/container" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:textSize="16sp" | ||
android:textStyle="bold" | ||
android:layout_margin="8dp" /> | ||
android:layout_height="wrap_content"> | ||
|
||
<TextView | ||
android:id="@+id/notification_obj" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:textSize="16sp" | ||
android:textStyle="bold" | ||
android:layout_margin="8dp" /> | ||
|
||
<TextView | ||
android:id="@+id/notification_type" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="8dp" /> | ||
|
||
<TextView | ||
android:id="@+id/notification_user" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="8dp" /> | ||
|
||
<TextView | ||
android:id="@+id/notification_created" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="8dp" /> | ||
|
||
</LinearLayout> | ||
|
||
</LinearLayout> | ||
</com.google.android.material.card.MaterialCardView> |