Skip to content

Commit

Permalink
Added option for showing or hiding view initially
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 committed Jan 31, 2019
1 parent 68bd1d5 commit 4d6cb11
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 108 deletions.
47 changes: 0 additions & 47 deletions .idea/assetWizardSettings.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/codeStyles/codeStyleConfig.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/dictionaries/nickmowen.xml

This file was deleted.

40 changes: 5 additions & 35 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.10'
ext.kotlin_version = '1.3.20'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-beta04'
classpath 'com.android.tools.build:gradle:3.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

//For Library
Expand Down
10 changes: 5 additions & 5 deletions linkpreview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 16
versionName "2.1"
versionCode 17
versionName "2.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down Expand Up @@ -43,8 +43,8 @@ dependencies {

//Testing libraries
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.2.31'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

ext {
Expand All @@ -54,7 +54,7 @@ ext {

publishedGroupId = 'com.nick.mowen.linkpreview'
artifact = 'linkpreview'
libraryVersion = '2.1'
libraryVersion = '2.2'
libraryDescription = 'A convenient view that shows a clickable preview of a link'
siteUrl = 'https://github.com/NickM-27/LinkPreview'
gitUrl = 'https://github.com/NickM-27/LinkPreview.git'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ object BindingAdapter {

@BindingAdapter("parsedLink")
@JvmStatic
fun setParsedLink(view: LinkPreview, link: String) {
view.parseTextForLink(link)
}
fun setParsedLink(view: LinkPreview, link: String) = view.parseTextForLink(link)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.browser.customtabs.CustomTabsIntent
import androidx.core.net.toUri
import androidx.core.view.isGone
import com.bumptech.glide.Glide
import com.nick.mowen.linkpreview.ImageType
import com.nick.mowen.linkpreview.R
Expand All @@ -35,6 +36,8 @@ open class LinkPreview : FrameLayout, View.OnClickListener {
var clickListener: LinkClickListener? = null
/** Optional click listener to override click behavior */
var articleColor: Int = Color.CYAN
/** Set whether or not to default to hidden while loading preview */
var hideWhileLoading = false

/** Color of the Chrome CustomTab that is launched on view click */

Expand Down Expand Up @@ -68,7 +71,9 @@ open class LinkPreview : FrameLayout, View.OnClickListener {
if (isInEditMode)
return

visibility = View.GONE
if (hideWhileLoading)
isGone = true

image = findViewById(R.id.preview_image)
text = findViewById(R.id.preview_text)
setOnClickListener(this)
Expand Down
4 changes: 2 additions & 2 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ dependencies {
//Testing Libraries
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.2.31'

androidTestImplementation 'androidx.test:runner:1.1.0-beta02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-beta02'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

0 comments on commit 4d6cb11

Please sign in to comment.