Skip to content

Commit

Permalink
modulation completed 🚀 v1.0 ready for publish
Browse files Browse the repository at this point in the history
  • Loading branch information
AsynctaskCoffee committed Dec 12, 2020
1 parent 3acd22d commit a402cf4
Show file tree
Hide file tree
Showing 28 changed files with 340 additions and 26 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

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

1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation project(":cardstack")
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.asynctaskcoffee.tinderlikecardstack">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
Expand All @@ -11,7 +11,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.TinderLikeCardStack">
<activity android:name=".ui.MainActivity">
<activity android:name=".ui.calendar.CalendarActivity" />
<activity android:name=".ui.social.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.asynctaskcoffee.tinderlikecardstack.ui.calendar

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.asynctaskcoffee.cardstack.CardContainer
import com.asynctaskcoffee.tinderlikecardstack.R

class CalendarActivity : AppCompatActivity() {

var cardContainer: CardContainer? = null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_calendar)
cardContainer = findViewById(R.id.cardContainer)
cardContainer?.setAdapter(CalendarAdapter(this, getTestModels()))
}

private fun getTestModels(): ArrayList<CalendarModel> {
val list: ArrayList<CalendarModel> = arrayListOf()
list.add(CalendarModel("December", 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", "Saturday"))
list.add(CalendarModel("December", 13, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", "Sunday"))
list.add(CalendarModel("December", 14, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", "Monday"))
list.add(CalendarModel("December", 15, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", "Tuesday"))
list.add(CalendarModel("December", 16, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", "Wednesday"))
list.add(CalendarModel("December", 17, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", "Thursday"))
list.add(CalendarModel("December", 18, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", "Friday"))
return list
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.asynctaskcoffee.tinderlikecardstack.ui.calendar

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import com.asynctaskcoffee.cardstack.CardContainerAdapter
import com.asynctaskcoffee.tinderlikecardstack.R

class CalendarAdapter(var context: Context, var days: List<CalendarModel>) :
CardContainerAdapter() {
override fun getItem(position: Int): CalendarModel = days[position]

override fun getView(position: Int): View {
val v = LayoutInflater.from(context).inflate(R.layout.item_calendar, null)
val day = v.findViewById<TextView>(R.id.day)
val month = v.findViewById<TextView>(R.id.month)
val dayName = v.findViewById<TextView>(R.id.dayName)

day.text = getItem(position).day.toString()
month.text = getItem(position).month
dayName.text = getItem(position).dayName

return v
}

override fun getCount() = days.size
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.asynctaskcoffee.tinderlikecardstack.ui.calendar

class CalendarModel(var month: String,var day: Int,var toDo: String,var dayName: String)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.asynctaskcoffee.tinderlikecardstack.ui
package com.asynctaskcoffee.tinderlikecardstack.ui.social

import android.graphics.Color
import android.os.Bundle
Expand All @@ -9,11 +9,11 @@ import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.asynctaskcoffee.cardstack.CardContainer
import com.asynctaskcoffee.cardstack.CardListener
import com.asynctaskcoffee.cardstack.pulse
import com.asynctaskcoffee.cardstack.px
import com.asynctaskcoffee.tinderlikecardstack.R
import com.asynctaskcoffee.tinderlikecardstack.lib.CardContainer
import com.asynctaskcoffee.tinderlikecardstack.lib.CardListener
import com.asynctaskcoffee.tinderlikecardstack.lib.pulse
import com.asynctaskcoffee.tinderlikecardstack.lib.px

class MainActivity : AppCompatActivity(), CardListener {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.asynctaskcoffee.tinderlikecardstack.ui
package com.asynctaskcoffee.tinderlikecardstack.ui.social

import android.annotation.SuppressLint
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.asynctaskcoffee.cardstack.CardContainerAdapter
import com.asynctaskcoffee.tinderlikecardstack.R
import com.asynctaskcoffee.tinderlikecardstack.lib.CardContainerAdapter
import com.squareup.picasso.Picasso

class MainAdapter(private val list: ArrayList<MainTestModel>, context: Context) :
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.asynctaskcoffee.tinderlikecardstack.ui
package com.asynctaskcoffee.tinderlikecardstack.ui.social

import com.asynctaskcoffee.tinderlikecardstack.R
import kotlin.collections.ArrayList
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.asynctaskcoffee.tinderlikecardstack.ui
package com.asynctaskcoffee.tinderlikecardstack.ui.social

class MainTestModel(
var userName: String,
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/res/layout/activity_calendar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient_foreground"
tools:context=".ui.calendar.CalendarActivity">

<com.asynctaskcoffee.cardstack.CardContainer
android:id="@+id/cardContainer"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="300dp" />

</FrameLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
android:layout_height="match_parent"
android:background="@drawable/gradient_background"
android:orientation="vertical"
tools:context=".ui.MainActivity">
tools:context=".ui.social.MainActivity">


<com.asynctaskcoffee.tinderlikecardstack.lib.CardContainer
<com.asynctaskcoffee.cardstack.CardContainer
android:id="@+id/cardContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/card_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="center"
android:layout_margin="16dp"
android:orientation="vertical">

Expand All @@ -26,6 +27,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:letterSpacing="-0.02"
android:gravity="center"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold" />
Expand All @@ -34,7 +36,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:gravity="center_vertical"
android:gravity="center"
android:orientation="horizontal">

<ImageView
Expand Down
42 changes: 42 additions & 0 deletions app/src/main/res/layout/item_calendar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">

<TextView
android:id="@+id/month"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/holo_red_dark"
android:gravity="center"
android:textColor="@color/white"
android:textSize="34dp"
android:textStyle="bold"
tools:text="MAY" />

<TextView
android:id="@+id/day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textColor="@android:color/black"
android:textSize="64dp"
android:textStyle="bold"
tools:text="24" />

<TextView
android:id="@+id/dayName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:textColor="@android:color/darker_gray"
android:textSize="34dp"
android:textStyle="bold"
tools:text="Monday" />



</LinearLayout>
1 change: 1 addition & 0 deletions cardstack/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
44 changes: 44 additions & 0 deletions cardstack/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
}

android {
compileSdkVersion 30
buildToolsVersion "30.0.2"

defaultConfig {
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
Empty file added cardstack/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions cardstack/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.asynctaskcoffee.cardstack

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.asynctaskcoffee.cardstack.test", appContext.packageName)
}
}
5 changes: 5 additions & 0 deletions cardstack/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.asynctaskcoffee.cardstack">

</manifest>
Loading

0 comments on commit a402cf4

Please sign in to comment.