-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from TheRealAgentK/master
4.0.0 release
- Loading branch information
Showing
18 changed files
with
259 additions
and
54 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
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
83 changes: 83 additions & 0 deletions
83
app/src/main/java/com/raygun/raygun4android/sample/SecondActivity.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,83 @@ | ||
package com.raygun.raygun4android.sample | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.support.v7.app.AppCompatActivity | ||
import android.util.Log | ||
import android.widget.Button | ||
import android.widget.TextView | ||
import com.raygun.raygun4android.RaygunClient | ||
import com.raygun.raygun4android.messages.shared.RaygunUserInfo | ||
|
||
class SecondActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_second) | ||
|
||
supportActionBar?.setDisplayHomeAsUpEnabled(true) | ||
|
||
val buttonSend = findViewById<Button>(R.id.button_send) | ||
val buttonCrash = findViewById<Button>(R.id.button_crash) | ||
val buttonHandleException = findViewById<Button>(R.id.button_handleException) | ||
val buttonSetUserAnon = findViewById<Button>(R.id.button_set_user_anon) | ||
val buttonSetUserA = findViewById<Button>(R.id.button_set_user_A) | ||
val buttonSetUserB = findViewById<Button>(R.id.button_set_user_B) | ||
val textViewAppVersion = findViewById<TextView>(R.id.textView_appVersion) | ||
val textViewProviderVersion = findViewById<TextView>(R.id.textView_providerVersion) | ||
|
||
buttonSend.setOnClickListener { | ||
val tw = HashMap<String,String>() | ||
tw["secondkey"] = "secondvalue" | ||
|
||
// Manual exception creation & sending | ||
RaygunClient.send(Exception("Congratulations, you have sent errors with Raygun4Android from SecondActivity"), null, tw) | ||
} | ||
|
||
buttonCrash.setOnClickListener { | ||
// A real exception will be thrown here, which will be caught & sent by RaygunClient | ||
val i = 3 / 0 | ||
Log.d("Raygun4Android-Sample", "This is here purely so that our division by zero calculation in i gets used and not optimised away in a release build: $i") | ||
} | ||
|
||
buttonHandleException.setOnClickListener { | ||
// Handle an exception yourself - nothing should be sent to Raygun | ||
try { | ||
val i = 3 / 0 | ||
Log.d("Raygun4Android-Sample", "This is here purely so that our division by zero calculation in i gets used and not optimised away in a release build: $i") | ||
} catch (ex: Exception) { | ||
val i = 4 | ||
Log.d("Raygun4Android-Sample", "This is here purely so that our alternative value for i gets used and not optimised away in a release build: $i") | ||
} | ||
} | ||
|
||
buttonSetUserAnon.setOnClickListener { | ||
val user = RaygunUserInfo() | ||
RaygunClient.setUser(user) | ||
} | ||
|
||
buttonSetUserA.setOnClickListener { | ||
val user = RaygunUserInfo("superuser3") | ||
user.fullName = "User Name C" | ||
user.firstName = "User C" | ||
user.email = "[email protected]" | ||
RaygunClient.setUser(user) | ||
} | ||
|
||
buttonSetUserB.setOnClickListener{ | ||
val user = RaygunUserInfo("superuser4") | ||
user.fullName = "User Name D" | ||
user.firstName = "User D" | ||
user.email = "[email protected]" | ||
RaygunClient.setUser(user) | ||
} | ||
|
||
textViewAppVersion.text = "App ${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE} ${BuildConfig.BUILD_TYPE})" | ||
textViewProviderVersion.text = "Provider ${com.raygun.raygun4android.BuildConfig.VERSION_NAME} (${com.raygun.raygun4android.BuildConfig.VERSION_CODE} ${BuildConfig.BUILD_TYPE})" | ||
} | ||
|
||
companion object { | ||
fun getIntent(context: Context): Intent = Intent(context, SecondActivity::class.java) | ||
} | ||
} |
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,94 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".MainActivity"> | ||
|
||
<TextView | ||
android:id="@+id/textView" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Hello World!" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintVertical_bias="0.378" /> | ||
|
||
<Button | ||
android:id="@+id/button_send" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Send an error" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/textView" /> | ||
|
||
<Button | ||
android:id="@+id/button_crash" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Crash app" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/button_send" /> | ||
|
||
<Button | ||
android:id="@+id/button_set_user_anon" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Set user anonymous" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/button_handleException" /> | ||
|
||
<Button | ||
android:id="@+id/button_set_user_A" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Set user A" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/button_set_user_anon" /> | ||
|
||
<Button | ||
android:id="@+id/button_set_user_B" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Set user B" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/button_set_user_A" /> | ||
|
||
<TextView | ||
android:id="@+id/textView_appVersion" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginEnd="16dp" | ||
android:layout_marginRight="16dp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/textView_providerVersion" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginEnd="16dp" | ||
android:layout_marginRight="16dp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/textView_appVersion" /> | ||
|
||
<Button | ||
android:id="@+id/button_handleException" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Handle Crash" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/button_crash" /> | ||
|
||
</android.support.constraint.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
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
Oops, something went wrong.