Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

Commit

Permalink
Generated new icon, removed round one
Browse files Browse the repository at this point in the history
Replaced `compile` with `implementation` in gradle configs
ExpandableTextView now extends from AppCompatTextView to support fonts
Demo module updates with font usage
  • Loading branch information
arslancharyev31 committed Jul 28, 2017
1 parent c6bb65f commit b4060a0
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 24 deletions.
14 changes: 7 additions & 7 deletions demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ android {
}

dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile project(':expandable-textview')
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion"
compile "org.jetbrains.anko:anko:$ankoVersion"
compile "com.android.support:appcompat-v7:$supportLibraryVersion"
compile "com.android.support:cardview-v7:$supportLibraryVersion"
testImplementation 'junit:junit:4.12'
implementation project(':expandable-textview')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion"
implementation "org.jetbrains.anko:anko:$ankoVersion"
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.android.support:cardview-v7:$supportLibraryVersion"
}

kotlin {
Expand Down
2 changes: 0 additions & 2 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme">
<activity android:name=".KotlinActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@

import tm.charlie.expandabletextview.ExpandableTextView;

import static tm.charlie.expandabletextview.demo.ExtensionsKt.makeClickable;
// Generated by Kotlin
import static tm.charlie.expandabletextview.demo.ExtensionsKt.makeClickable; // Generated by Kotlin

public class JavaActivity extends AppCompatActivity{
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.java_activity_main);

final ExpandableTextView expandableText = (ExpandableTextView) findViewById(R.id.expandable_textview);
final ToggleButton toggleButton = (ToggleButton) findViewById(R.id.toggle_expand);
final ExpandableTextView expandableText = findViewById(R.id.expandable_textview);
final ToggleButton toggleButton = findViewById(R.id.toggle_expand);

makeClickable(expandableText, false);
expandableText.setOnClickListener(new View.OnClickListener(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tm.charlie.expandabletextview.demo

import android.graphics.Color
import android.os.Bundle
import android.support.v4.content.res.ResourcesCompat
import android.support.v7.app.AppCompatActivity
import android.text.TextUtils.TruncateAt
import android.widget.ToggleButton
Expand Down Expand Up @@ -34,6 +35,7 @@ class KotlinActivity: AppCompatActivity() {
ellipsize = TruncateAt.START
textSize = 17f
textColor = Color.BLACK
typeface = ResourcesCompat.getFont(context, R.font.lato_black)
animationDuration = 300

makeClickable()
Expand Down
Binary file added demo/src/main/res/font/lato_black.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions demo/src/main/res/layout/java_activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:ellipsize="end"
android:fontFamily="@font/lato_black"
android:maxLines="3"
android:text="@string/lipsum_long"
android:textColor="@android:color/black"
Expand Down
Binary file modified demo/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed demo/src/main/res/mipmap-hdpi/ic_launcher_round.png
Binary file not shown.
Binary file modified demo/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed demo/src/main/res/mipmap-mdpi/ic_launcher_round.png
Binary file not shown.
Binary file modified demo/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed demo/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Binary file not shown.
Binary file modified demo/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
5 changes: 3 additions & 2 deletions expandable-textview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ android {
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion"
compile "org.jetbrains.anko:anko:$ankoVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion"
implementation "org.jetbrains.anko:anko:$ankoVersion"
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
}

// Configs for publishing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import android.animation.ValueAnimator
import android.content.Context
import android.os.Parcel
import android.os.Parcelable
import android.support.v7.widget.AppCompatTextView
import android.util.AttributeSet
import android.view.View.MeasureSpec.makeMeasureSpec
import android.view.animation.AccelerateDecelerateInterpolator
import android.widget.TextView
import org.jetbrains.anko.wrapContent

open class ExpandableTextView: TextView {
open class ExpandableTextView: AppCompatTextView {
constructor(context: Context): super(context) {
initAttrs()
}
Expand All @@ -26,11 +26,6 @@ open class ExpandableTextView: TextView {
initAttrs(attrs, defStyleAttr)
}

constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int)
: super(context, attrs, defStyleAttr, defStyleRes) {
initAttrs(attrs, defStyleAttr, defStyleRes)
}

// private properties
private var collapsedHeight: Int = 0
private var expandedHeight: Int = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
package tm.charlie.expandabletextview

import android.support.v7.widget.AppCompatTextView
import android.view.ViewManager
import android.widget.TextView
import org.jetbrains.anko.AnkoViewDslMarker
import org.jetbrains.anko.custom.ankoView

inline fun ViewManager.expandableTextView(init: (@AnkoViewDslMarker ExpandableTextView).() -> Unit) = expandableTextView("", init)
// Public extensions

inline fun ViewManager.expandableTextView(init: (@AnkoViewDslMarker ExpandableTextView).() -> Unit) = expandableTextView("", init)
inline fun ViewManager.expandableTextView(text: String = "", init: (@AnkoViewDslMarker ExpandableTextView).() -> Unit)
= ankoView(::ExpandableTextView, 0) { setText(text); init() }

inline val TextView.isEllipsized get() = layout.getEllipsisCount(lineCount - 1) > 0
// Internal extensions
internal inline fun ViewManager.textViewCompat(text: CharSequence?, init: (@AnkoViewDslMarker AppCompatTextView).() -> Unit)
= ankoView(::AppCompatTextView, 0, { setText(text); init() })

internal inline val TextView.isEllipsized get() = layout.getEllipsisCount(lineCount - 1) > 0

0 comments on commit b4060a0

Please sign in to comment.