Skip to content

Commit

Permalink
- Added styling for:
Browse files Browse the repository at this point in the history
    - Elevation
    - Arrow color
    - Radius
    - Stroke width/color
    - Enable/Disable ripple

- Using MaterialCardView
- Updated libs
- Cleaned a bit
  • Loading branch information
Stjin committed Feb 1, 2020
1 parent 7f7012a commit c2d6bb0
Show file tree
Hide file tree
Showing 20 changed files with 196 additions and 183 deletions.
26 changes: 1 addition & 25 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.

11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ExpandableCardView

[ ![Download](https://api.bintray.com/packages/alespero/ExpandableCardView/ExpandableCardView/images/download.svg?version=0.8) ](https://bintray.com/alespero/ExpandableCardView/ExpandableCardView/0.8/link)
[ ![Download](https://api.bintray.com/packages/alespero/ExpandableCardView/ExpandableCardView/images/download.svg?version=0.8) ](https://jitpack.io/#Stjinchan/ExpandableCardView/)

![Example Gif](demo.gif)

Expand All @@ -21,17 +21,17 @@ Get it on the [Google Play Store](https://play.google.com/store/apps/details?id=
First of all, include the dependency in your app build.gradle:

```gradle
compile 'com.alespero:expandable-cardview:0.8'
compile 'host.stjin:expandable-cardview:0.8'
```

Or get the aar in the [Releases](https://github.com/AleSpero/ExpandableCardView/releases) section.
Or get the aar in the [Releases](https://github.com/Stjinchan/ExpandableCardView/releases) section.

## Declaring the view

After you have the Library correctly setup, just declare the ExpandableCardView in your xml:

```xml
<com.alespero.expandablecardview.ExpandableCardView
<host.stjin.expandablecardview.ExpandableCardView
android:id="@+id/profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -40,6 +40,7 @@ After you have the Library correctly setup, just declare the ExpandableCardView
app:inner_view="@layout/mycustomview"
app:expandOnClick="true"
app:animationDuration="300"
app:cardStrokeWidth="2dp"
app:startExpanded="false"/>
```
The only required attributes are `inner_view` and `title`. The other attributes are optional.
Expand Down Expand Up @@ -115,7 +116,7 @@ This library is still in its early stages, so feel free to contribute. I will re
```

## Author
Made By [Alessandro Sperotti](www.alessandrosperotti.com).
Forked project, Made By [Alessandro Sperotti](www.alessandrosperotti.com).

alessandrosperotti at gmail dot com

Expand Down
15 changes: 9 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
applicationId "com.alessandrosperotti.expandablecardviewexample"
minSdkVersion 22
targetSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -23,11 +23,14 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "com.google.android.material:material:1.0.0"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(':expandablecardview')

// https://mvnrepository.com/artifact/com.google.android.material/material
implementation 'com.google.android.material:material:1.1.0-rc02'
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.alessandrosperotti.expandablecardviewexample
package host.stjin.expandablecardviewexample

import androidx.test.InstrumentationRegistry
import androidx.test.runner.AndroidJUnit4
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"
<activity android:name="host.stjin.expandablecardviewexample.MainActivity"
android:windowSoftInputMode="stateHidden|stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.alessandrosperotti.expandablecardviewexample
package host.stjin.expandablecardviewexample

import android.content.res.ColorStateList
import android.graphics.Color
Expand All @@ -9,6 +9,7 @@ import android.widget.Toast
import android.content.Intent
import android.net.Uri
import android.view.MenuItem
import com.alessandrosperotti.expandablecardviewexample.R
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.location.*

Expand Down Expand Up @@ -49,19 +50,19 @@ class MainActivity : AppCompatActivity() {
when(item?.itemId){

R.id.aboutme -> {
uri = Uri.parse("https://www.alessandrosperotti.com")
uri = Uri.parse("https://stjin.host")
intent = Intent(Intent.ACTION_VIEW, uri)
startActivity(intent)
}

R.id.getlibrary -> {
uri = Uri.parse("https://github.com/AleSpero/ExpandableCardView")
uri = Uri.parse("https://github.com/Stjinchan/ExpandableCardView")
intent = Intent(Intent.ACTION_VIEW, uri)
startActivity(intent)
}

R.id.myotherapps -> {
uri = Uri.parse("market://search?q=alessandro%20sperotti")
uri = Uri.parse("https://stjin.host")
intent = Intent(Intent.ACTION_VIEW, uri)
startActivity(intent)
}
Expand Down
103 changes: 52 additions & 51 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,63 +36,64 @@

<androidx.core.widget.NestedScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:paddingBottom="20dp"
android:orientation="vertical"
android:clipChildren="false"
tools:context="com.alessandrosperotti.expandablecardviewexample.MainActivity"
android:background="#FAFAFA">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:clipChildren="false"
android:orientation="vertical"
android:paddingBottom="20dp">

<com.alespero.expandablecardview.ExpandableCardView
android:id="@+id/main_profile_card"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:title="Passengers"
app:icon="@drawable/ic_person"
app:inner_view="@layout/passengers"
app:expandOnClick="true" />
<host.stjin.expandablecardview.ExpandableCardView
android:id="@+id/main_profile_card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="10dp"
app:expandOnClick="true"
app:expandableCardRipple="true"
app:expandableCardRadius="100"
app:expandableCardStrokeWidth="15"
app:expandableCardElevation="70"
app:expandableCardStrokeColor="@color/colorAccent"
app:icon="@drawable/ic_person"
app:inner_view="@layout/passengers"
app:title="Passengers" />

<com.alespero.expandablecardview.ExpandableCardView
android:id="@+id/main_location"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:title="Location"
app:icon="@drawable/ic_location"
app:inner_view="@layout/location"
app:expandOnClick="true"/>
<host.stjin.expandablecardview.ExpandableCardView
android:id="@+id/main_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="10dp"
app:expandOnClick="true"
app:expandableCardElevation="200"
app:icon="@drawable/ic_location"
app:inner_view="@layout/location"
app:title="Location" />

<com.alespero.expandablecardview.ExpandableCardView
android:id="@+id/main_dates"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:title="Calendar"
app:icon="@drawable/ic_dates"
app:inner_view="@layout/dates"
app:expandOnClick="true"
app:animationDuration="900"/>
<host.stjin.expandablecardview.ExpandableCardView
android:id="@+id/main_dates"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="10dp"
app:animationDuration="900"
app:expandOnClick="true"
app:icon="@drawable/ic_dates"
app:expandableCardArrowColor="@color/colorAccent"
app:inner_view="@layout/dates"
app:title="Calendar" />

</LinearLayout>
</LinearLayout>

</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.alessandrosperotti.expandablecardviewexample
package host.stjin.expandablecardviewexample

import org.junit.Test

Expand Down
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.11'
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
21 changes: 12 additions & 9 deletions expandablecardview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

ext {
PUBLISH_GROUP_ID = 'com.alespero'
PUBLISH_GROUP_ID = 'host.stjin'
PUBLISH_ARTIFACT_ID = 'expandable-cardview'
PUBLISH_VERSION = '0.7'
PUBLISH_VERSION = '1.0'
}

android {
compileSdkVersion 28
compileSdkVersion 29

defaultConfig {
minSdkVersion 18
targetSdkVersion 28
targetSdkVersion 29
versionCode 3
versionName "0.7"
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand All @@ -33,15 +33,18 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation "androidx.cardview:cardview:1.0.0"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

// https://mvnrepository.com/artifact/com.google.android.material/material
implementation 'com.google.android.material:material:1.1.0-rc02'
}
repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.alespero.expandablecardview;
package host.stjin.expandablecardview;

import android.content.Context;
import androidx.test.InstrumentationRegistry;
Expand All @@ -17,10 +17,10 @@
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.alespero.expandablecardview.test", appContext.getPackageName());
assertEquals("host.stjin.expandablecardview.test", appContext.getPackageName());
}
}
2 changes: 1 addition & 1 deletion expandablecardview/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.alespero.expandablecardview" />
package="host.stjin.expandablecardview" />
Loading

0 comments on commit c2d6bb0

Please sign in to comment.