diff --git a/app/build.gradle b/app/build.gradle index 7c556c1..1112ddf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 27 - buildToolsVersion "27.0.0" + buildToolsVersion "27.0.3" defaultConfig { applicationId "com.borjabravo.readmoretextview" diff --git a/app/src/main/java/com/borjabravo/readmoretextviewsample/MainActivity.java b/app/src/main/java/com/borjabravo/readmoretextviewsample/MainActivity.java index 8f50499..c3d5c00 100644 --- a/app/src/main/java/com/borjabravo/readmoretextviewsample/MainActivity.java +++ b/app/src/main/java/com/borjabravo/readmoretextviewsample/MainActivity.java @@ -2,7 +2,11 @@ import android.os.Bundle; import android.support.v7.app.AppCompatActivity; +import android.view.View; import android.widget.TextView; +import android.widget.Toast; + +import com.borjabravo.readmoretextview.ReadMoreTextView; public class MainActivity extends AppCompatActivity { @@ -10,10 +14,17 @@ public class MainActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - TextView text1 = findViewById(R.id.text1); + ReadMoreTextView text1 = findViewById(R.id.text1); text1.setText(getString(R.string.lorem_ipsum)); - TextView text2 = findViewById(R.id.text2); + + ReadMoreTextView text2 = findViewById(R.id.text2); text2.setText(getString(R.string.lorem_ipsum2)); + text2.setOnClickReadMore(new ReadMoreTextView.onClickReadMore() { + @Override + public void onClick(View view) { + Toast.makeText(view.getContext(),"Move to details of text",Toast.LENGTH_LONG).show(); + } + }); TextView text3 = findViewById(R.id.text3); text3.setText(getString(R.string.lorem_ipsum3)); TextView text4 = findViewById(R.id.text4); diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 01a64c6..b799239 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -12,8 +12,7 @@ + android:layout_height="wrap_content"/>