-
-
Notifications
You must be signed in to change notification settings - Fork 348
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 #3777 from FloEdelmann/links
Add two achievement links, add debug link activity
- Loading branch information
Showing
9 changed files
with
143 additions
and
46 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
40 changes: 40 additions & 0 deletions
40
app/src/main/java/de/westnordost/streetcomplete/settings/ShowLinksActivity.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,40 @@ | ||
package de.westnordost.streetcomplete.settings | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.core.net.toUri | ||
import androidx.recyclerview.widget.DividerItemDecoration | ||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import de.westnordost.streetcomplete.BaseActivity | ||
import de.westnordost.streetcomplete.R | ||
import de.westnordost.streetcomplete.data.user.achievements.Link | ||
import de.westnordost.streetcomplete.databinding.FragmentShowLinksBinding | ||
import de.westnordost.streetcomplete.ktx.viewBinding | ||
import de.westnordost.streetcomplete.user.GroupedLinksAdapter | ||
import org.koin.android.ext.android.inject | ||
import org.koin.core.qualifier.named | ||
|
||
/** activity only used in debug, to show all achievement links */ | ||
class ShowLinksActivity : BaseActivity() { | ||
private val links: List<Link> by inject(named("Links")) | ||
private val binding by viewBinding(FragmentShowLinksBinding::inflate) | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.fragment_show_links) | ||
binding.toolbarLayout.toolbar.navigationIcon = getDrawable(R.drawable.ic_close_24dp) | ||
binding.toolbarLayout.toolbar.setNavigationOnClickListener { onBackPressed() } | ||
binding.toolbarLayout.toolbar.title = "Show Achievement Links" | ||
|
||
binding.linksList.apply { | ||
addItemDecoration(DividerItemDecoration(context, DividerItemDecoration.VERTICAL)) | ||
layoutManager = LinearLayoutManager(context) | ||
adapter = GroupedLinksAdapter(links, ::openUrl) | ||
} | ||
} | ||
|
||
private fun openUrl(url: String) { | ||
val intent = Intent(Intent.ACTION_VIEW, url.toUri()) | ||
startActivity(intent) | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="192dp" | ||
android:height="192dp" | ||
android:viewportWidth="192" | ||
android:viewportHeight="192"> | ||
<path | ||
android:pathData="M168,96C168,125.833 149.856,151.429 124,162.353C110.634,168 106,171 102,179C101.611,179.779 101.278,180.52 100.969,181.208C99.691,184.055 98.818,186 96,186C93.182,186 92.309,184.055 91.031,181.208C90.722,180.52 90.39,179.779 90,179C86,171 81,168 68,162.353C42.145,151.429 24,125.833 24,96C24,56.236 56.236,24 96,24C135.765,24 168,56.236 168,96ZM136,96C136,118.091 118.091,136 96,136C73.909,136 56,118.091 56,96C56,73.909 73.909,56 96,56C118.091,56 136,73.909 136,96Z" | ||
android:fillColor="#FF8800" | ||
android:fillType="evenOdd"/> | ||
</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,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical"> | ||
|
||
<FrameLayout | ||
android:id="@+id/toolbarContainer" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<include android:id="@+id/toolbarLayout" | ||
layout="@layout/toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"/> | ||
|
||
</FrameLayout> | ||
|
||
<androidx.recyclerview.widget.RecyclerView | ||
android:id="@+id/linksList" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:paddingTop="@dimen/activity_vertical_margin" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
android:paddingLeft="@dimen/activity_horizontal_margin" | ||
android:paddingRight="@dimen/activity_horizontal_margin" | ||
android:orientation="vertical" | ||
tools:listitem="@layout/card_link_item" | ||
android:clipToPadding="false" /> | ||
|
||
</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
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