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
<?xml version="1.0" encoding="utf-8"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
<gradient | |
android:angle="0"/> | |
<corners | |
android:bottomLeftRadius="@dimen/card_corner" | |
android:bottomRightRadius="@dimen/card_corner" | |
android:topLeftRadius="@dimen/card_corner" |
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
// Change card gradient based on POS | |
var background = ResourcesCompat.getDrawable(main.resources, R.drawable.card_gradient, null) as GradientDrawable | |
var colorList = IntArray(10) {getWhiteColor()} // Create an integer array of all white values | |
background.mutate() // Mutate the drawable so changes don't affect every other drawable | |
// background.setGradientCenter(0.1F, 0.5F) // Reset the center of the gradient (default is 0.5F, 0.5F)) - Only works for radial and sweep types | |
// Conditionaly change the last color in the integer array | |
when (word?.partOfSpeech) { | |
"noun" -> colorList[colorList.size-1] = Color.argb(255, 66, 133, 244) // Blue | |
"verb" -> colorList[colorList.size-1] = Color.argb(255, 15, 157, 88) // Green |
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
<com.google.android.material.textfield.TextInputLayout | |
android:id="@+id/search_container" | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:layout_marginStart="16dp" | |
android:layout_marginTop="8dp" | |
android:layout_marginEnd="16dp" | |
app:endIconMode="clear_text" | |
app:endIconTint="@color/primaryYellow" | |
app:layout_constraintEnd_toEndOf="parent" |
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
android:imeOptions="actionSearch" |
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
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
view.findViewById<View>(R.id.button_home).setOnClickListener { | |
val extras = FragmentNavigatorExtras( | |
textView to "exampleText" | |
) | |
val action = HomeFragmentDirections.actionHomeFragmentToHomeSecondFragment("From HomeFragment") | |
NavHostFragment.findNavController(this@HomeFragment).navigate(action,extras) | |
} |
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
override fun onCreateView( | |
inflater: LayoutInflater, container: ViewGroup?, | |
savedInstanceState: Bundle? | |
): View? { | |
// Determine how shared elements are handled | |
sharedElementEnterTransition = TransitionInflater.from(this.context).inflateTransition(R.transition.change_bounds) | |
sharedElementReturnTransition = TransitionInflater.from(this.context).inflateTransition(R.transition.change_bounds) | |
// Inflate the layout for this fragment | |
return inflater.inflate(R.layout.fragment_home_second, container, false) | |
} |
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
class SearchNews(var main: MainActivity) : AsyncTask<String, Void, String>() { | |
override fun doInBackground(vararg params: String): String { | |
var searchString = params.get(0) | |
val url = "https://news.google.com/rss/search?q=$searchString&hl=en-US&gl=US&ceid=US:en" | |
var parseDoc = Jsoup.connect(url).parser(Parser.xmlParser()).get() //can also use maxBodySize(0) and timeout(0) | |
var items : Elements? = parseDoc?.select("item") | |
Log.d("result",items.toString()) | |
return "Added" | |
} | |
} |
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
class SearchNews(var main: MainActivity) : AsyncTask<String, Void, String>() { | |
override fun doInBackground(vararg params: String): String { | |
var searchString = params.get(0) | |
val urlSearch = URLEncoder.encode(searchString,"UTF-8") | |
val url = "https://news.google.com/rss/search?q=$urlSearch&hl=en-US&gl=US&ceid=US:en" | |
var parseDoc = Jsoup.connect(url).parser(Parser.xmlParser()).get() | |
var items : Elements? = parseDoc?.select("item") | |
items?.forEach { | |
var title = it.getElementsByTag("title").html() | |
var link = it.getElementsByTag("link").html() |
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
class SearchNews(var main: MainActivity) : AsyncTask<String, Void, String>() { | |
override fun doInBackground(vararg params: String): String { | |
var searchString = params.get(0) | |
val urlSearch = URLEncoder.encode(searchString,"UTF-8") | |
val url = "https://news.google.com/rss/search?q=$urlSearch&hl=en-US&gl=US&ceid=US:en" | |
var parseDoc = Jsoup.connect(url).parser(Parser.xmlParser()).get() | |
var items : Elements? = parseDoc?.select("item") | |
items?.forEach { | |
var title = it.getElementsByTag("title").html() | |
var link = it.getElementsByTag("link").html() |
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
class SearchNews(var main: MainActivity) : AsyncTask<String, Void, String>() { | |
override fun doInBackground(vararg params: String): String { | |
var searchString = params.get(0) | |
val urlSearch = URLEncoder.encode(searchString,"UTF-8") | |
val url = "https://news.google.com/rss/search?q=$urlSearch&hl=en-US&gl=US&ceid=US:en" | |
var parseDoc = Jsoup.connect(url).parser(Parser.xmlParser()).get() | |
var items : Elements? = parseDoc?.select("item") | |
items?.forEach { | |
var title = it.getElementsByTag("title").html() | |
var link = it.getElementsByTag("link").html() |
OlderNewer