mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-25 01:18:17 -05:00
Add a Contact Me button in the preferences
This can not be tested on an emulator, requires a full device
This commit is contained in:
parent
27c1c1aa5e
commit
04f6f1f49b
@ -0,0 +1,35 @@
|
||||
package org.bspeice.minimalbible.activity.settings
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.preference.Preference
|
||||
import android.content.Intent
|
||||
import org.bspeice.minimalbible.R
|
||||
import android.os.Build
|
||||
import android.net.Uri
|
||||
|
||||
class ContactPreference(val ctx: Context, val attrs: AttributeSet)
|
||||
: Preference(ctx, attrs), Preference.OnPreferenceClickListener {
|
||||
|
||||
{
|
||||
setOnPreferenceClickListener(this);
|
||||
}
|
||||
|
||||
override fun onPreferenceClick(preference: Preference?): Boolean {
|
||||
val address = ctx.getString(R.string.contact_developer_address)
|
||||
val pInfo = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0)
|
||||
|
||||
|
||||
val i = Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", address, null))
|
||||
i.putExtra(Intent.EXTRA_SUBJECT, ctx.getString(R.string.contact_developer_subject))
|
||||
i.putExtra(Intent.EXTRA_TEXT, """
|
||||
|
||||
Useful information for the developer:
|
||||
Build code: ${pInfo.versionCode}
|
||||
Build name: ${pInfo.versionName}
|
||||
Android SDK: ${Build.VERSION.SDK_INT}""")
|
||||
ctx.startActivity(i)
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -11,4 +11,7 @@
|
||||
|
||||
<string name="error_book_refresh">Error refreshing. Try again later</string>
|
||||
|
||||
<string name="contact_developer_address">bspeice.nc@gmail.com</string>
|
||||
<string name="contact_developer_subject">MinimalBible Feedback</string>
|
||||
|
||||
</resources>
|
||||
|
@ -25,4 +25,9 @@ but I will likely want to re-implement this in the future -->
|
||||
android:key="defaultBookInitials"
|
||||
android:title="Active Book" />
|
||||
|
||||
<org.bspeice.minimalbible.activity.settings.ContactPreference
|
||||
android:key="null"
|
||||
android:summary="Let the developers know what you think of the app!"
|
||||
android:title="Contact Me" />
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user