-
Notifications
You must be signed in to change notification settings - Fork 0
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
12 changed files
with
148 additions
and
89 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,4 +30,4 @@ internal data class Connection( | |
return Connection(parts1[0] == "https", parts2[0], parts2[1].toInt()) | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,11 @@ import mehdi.sakout.aboutpage.Element | |
|
||
class AboutFragment : Fragment() { | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
val githubIcon = mehdi.sakout.aboutpage.R.drawable.about_icon_github | ||
val emailIcon = mehdi.sakout.aboutpage.R.drawable.about_icon_email | ||
val instagramIcon = mehdi.sakout.aboutpage.R.drawable.about_icon_instagram | ||
|
@@ -27,88 +31,81 @@ class AboutFragment : Fragment() { | |
.setImage(R.mipmap.ic_launcher_foreground) | ||
.setDescription(getString(R.string.about_description)) | ||
.addItem( | ||
Element().setTitle(String.format(getString(R.string.about_element_version), BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)) | ||
.setIconDrawable(githubIcon).setOnClickListener(showChangelog()) | ||
Element( | ||
String.format( | ||
getString(R.string.about_element_version), | ||
BuildConfig.VERSION_NAME, | ||
BuildConfig.VERSION_CODE | ||
), | ||
githubIcon | ||
).setOnClickListener { openUrl(getString(R.string.about_changelog_link)) } | ||
) | ||
.addGroup(getString(R.string.about_group_legal)) | ||
.addItem( | ||
Element().setTitle(getString(R.string.about_element_libraries)).setIconDrawable(R.drawable._ic_libraries) | ||
.setOnClickListener(showLibraries()) | ||
Element( | ||
getString(R.string.about_element_libraries), | ||
R.drawable._ic_libraries | ||
).setOnClickListener { showLibraries() } | ||
) | ||
.addItem( | ||
Element().setTitle(getString(R.string.about_element_icons)).setIconDrawable(R.drawable._ic_question).setOnClickListener(showIcons()) | ||
Element( | ||
getString(R.string.about_element_icons), | ||
R.drawable._ic_question | ||
).setOnClickListener { findNavController().navigate(R.id.nav_about_icons) } | ||
) | ||
.addItem( | ||
Element().setTitle(getString(R.string.about_element_animations)).setIconDrawable(R.drawable._ic_question) | ||
.setOnClickListener(showAnimations()) | ||
Element( | ||
getString(R.string.about_element_animations), | ||
R.drawable._ic_question | ||
).setOnClickListener { findNavController().navigate(R.id.nav_about_animations) } | ||
) | ||
.addGroup(getString(R.string.about_group_connect)) | ||
.addItem( | ||
Element().setTitle(getString(R.string.about_element_feedback_text)).setIconDrawable(githubIcon) | ||
.setOnClickListener(openGithubFeedback()) | ||
Element( | ||
getString(R.string.about_element_feedback_text), | ||
githubIcon | ||
).setOnClickListener { openUrl("https://github.com/cyb3rko/logviewer-for-openhab-app/") } | ||
) | ||
.addItem( | ||
Element().setTitle(getString(R.string.about_element_email_text)).setIconDrawable(emailIcon) | ||
.setOnClickListener(writeEmail()) | ||
Element( | ||
getString(R.string.about_element_email_text), | ||
emailIcon | ||
).setOnClickListener { writeEmail() } | ||
) | ||
.addItem( | ||
Element().setTitle(getString(R.string.about_element_github_text)) | ||
.setIconDrawable(githubIcon).setOnClickListener(openGithubProfile()) | ||
Element( | ||
getString(R.string.about_element_github_text), | ||
githubIcon | ||
).setOnClickListener { openUrl("https://github.com/cyb3rko/") } | ||
) | ||
.addItem( | ||
Element().setTitle(getString(R.string.about_element_instagram_text)).setIconDrawable(instagramIcon) | ||
.setIconTint(instagramColor).setOnClickListener(openInstaPage()) | ||
Element( | ||
getString(R.string.about_element_instagram_text), | ||
instagramIcon | ||
) | ||
.setIconTint(instagramColor) | ||
.setOnClickListener { openUrl("https://instagram.com/_u/cyb3rko") } | ||
) | ||
.create() | ||
} | ||
|
||
private fun showChangelog(): View.OnClickListener { | ||
return View.OnClickListener { openUrl(getString(R.string.about_changelog_link)) } | ||
} | ||
|
||
private fun showLibraries(): View.OnClickListener { | ||
return View.OnClickListener { | ||
context?.let { validContext -> | ||
LibsBuilder() | ||
.withLicenseShown(true) | ||
.withAboutIconShown(false) | ||
.withAboutVersionShown(false) | ||
.withActivityTitle(getString(R.string.about_element_libraries)) | ||
.withSearchEnabled(true) | ||
.start(validContext) | ||
} | ||
private fun showLibraries() { | ||
context?.let { validContext -> | ||
LibsBuilder() | ||
.withLicenseShown(true) | ||
.withAboutIconShown(false) | ||
.withAboutVersionShown(false) | ||
.withActivityTitle(getString(R.string.about_element_libraries)) | ||
.withSearchEnabled(true) | ||
.start(validContext) | ||
} | ||
} | ||
|
||
private fun showIcons(): View.OnClickListener { | ||
return View.OnClickListener { findNavController().navigate(R.id.nav_about_icons) } | ||
} | ||
|
||
private fun showAnimations(): View.OnClickListener { | ||
return View.OnClickListener { findNavController().navigate(R.id.nav_about_animations) } | ||
} | ||
|
||
private fun openGithubFeedback(): View.OnClickListener { | ||
return View.OnClickListener { openUrl("https://github.com/cyb3rko/logviewer-for-openhab-app/") } | ||
} | ||
|
||
private fun openGithubProfile(): View.OnClickListener { | ||
return View.OnClickListener { openUrl("https://github.com/cyb3rko/") } | ||
} | ||
|
||
private fun openInstaPage(): View.OnClickListener { | ||
return View.OnClickListener { openUrl("https://instagram.com/_u/cyb3rko") } | ||
} | ||
|
||
private fun writeEmail(): View.OnClickListener { | ||
return View.OnClickListener { | ||
val intent = Intent().apply { | ||
this.action = Intent.ACTION_SENDTO | ||
this.type = "text/plain" | ||
this.data = Uri.parse("mailto:") | ||
this.putExtra(Intent.EXTRA_EMAIL, arrayOf("[email protected]")) | ||
} | ||
startActivity(intent) | ||
private fun writeEmail() { | ||
val intent = Intent(Intent.ACTION_SENDTO).apply { | ||
setDataAndType(Uri.parse("mailto:"), "text/plain") | ||
putExtra(Intent.EXTRA_EMAIL, arrayOf("[email protected]")) | ||
} | ||
startActivity(intent) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.