Skip to content

Commit

Permalink
added arts
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves committed Jun 18, 2019
1 parent 714f673 commit ab069e5
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 38 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ dependencies {
implementation project(":androidveil")
}

apply from: '../spotless.gradle'
apply from: '../spotless.gradle'
39 changes: 21 additions & 18 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.skydoves.androidveildemo">
xmlns:tools="http://schemas.android.com/tools"
package="com.skydoves.androidveildemo">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".DetailActivity"
android:theme="@style/DetailTheme" />
</application>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".DetailActivity"
android:theme="@style/DetailTheme" />
<activity android:name=".SecondActivity" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import java.util.concurrent.TimeUnit
*/

class MainActivity : AppCompatActivity(),
VeiledItemOnClickListener,
ProfileViewHolder.Delegate {
VeiledItemOnClickListener,
ProfileViewHolder.Delegate {

private val adapter by lazy { ProfileAdapter(this) }

Expand All @@ -59,8 +59,8 @@ class MainActivity : AppCompatActivity(),

// delay-auto-unveil
Observable.just(0).delay(5000, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe { veilRecyclerView.unVeil() }
.observeOn(AndroidSchedulers.mainThread())
.subscribe { veilRecyclerView.unVeil() }
}

/** OnItemClickListener by Veiled Item */
Expand Down
45 changes: 45 additions & 0 deletions app/src/main/java/com/skydoves/androidveildemo/SecondActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.skydoves.androidveildemo

import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.GridLayoutManager
import com.skydoves.androidveil.VeiledItemOnClickListener
import com.skydoves.androidveildemo.profile.ListItemUtils
import com.skydoves.androidveildemo.profile.Profile
import com.skydoves.androidveildemo.profile.ProfileAdapter
import com.skydoves.androidveildemo.profile.ProfileViewHolder
import kotlinx.android.synthetic.main.activity_second.*

class SecondActivity : AppCompatActivity(), VeiledItemOnClickListener,
ProfileViewHolder.Delegate {

private val adapter by lazy { ProfileAdapter(this) }

@SuppressLint("CheckResult")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_second)

// sets VeilRecyclerView's properties
veilFrameView.setVeilLayout(R.layout.item_preview, this)
veilFrameView.setAdapter(adapter)
veilFrameView.setLayoutManager(GridLayoutManager(this, 2))
veilFrameView.addVeiledItems(12)

// add profile times to adapter
adapter.addProfiles(ListItemUtils.getProfiles(this))
}

/** OnItemClickListener by Veiled Item */
override fun onItemClicked(pos: Int) {
Toast.makeText(this, getString(R.string.msg_loading), Toast.LENGTH_SHORT).show()
}

/** OnItemClickListener by User Item */
override fun onItemClickListener(profile: Profile) {
startActivity(Intent(this, DetailActivity::class.java))
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
app:veilFrame_highlightAlpha="1.0"
app:veilFrame_highlightColor="@android:color/holo_green_light"
app:veilFrame_layout="@layout/item_profile"
app:veilFrame_radius="8dp"
app:veilFrame_radius="4dp"
app:veilFrame_shimmerEnable="true"
app:veilFrame_veiled="true" />
</LinearLayout>
27 changes: 27 additions & 0 deletions app/src/main/res/layout/activity_second.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/background">

<androidx.appcompat.widget.Toolbar
android:id="@+id/detail_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
app:title="@string/app_name" />

<com.skydoves.androidveil.VeilRecyclerFrameView
android:id="@+id/veilFrameView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:veilFrame_baseColor="@color/shimmerBase0"
app:veilFrame_highlightColor="@color/shimmerHighlight1"
app:veilFrame_layout="@layout/item_profile"
app:veilFrame_radius="4dp"
app:veilFrame_shimmerEnable="true"
app:veilFrame_veiled="true" />
</LinearLayout>
24 changes: 24 additions & 0 deletions app/src/main/res/layout/item_preview.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:orientation="vertical"
android:padding="20dp">

<ImageView
android:layout_width="match_parent"
android:layout_height="140dp" />

<TextView
android:layout_width="match_parent"
android:layout_height="12dp"
android:layout_marginTop="20dp" />

<TextView
android:layout_width="match_parent"
android:layout_height="12dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="40dp"
android:layout_marginRight="40dp" />
</LinearLayout>
4 changes: 1 addition & 3 deletions app/src/main/res/layout/item_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"
android:layout_marginRight="15dp"
android:layout_margin="13dp"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal">

Expand Down
21 changes: 11 additions & 10 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3d95c9</color>
<color name="colorPrimaryDark">#2485be</color>
<color name="colorAccent">#3d95c9</color>
<color name="background">#303030</color>
<color name="background800">#424242</color>
<color name="background900">#212121</color>
<color name="HintText">#87ffffff</color>
<color name="preview">#b0abb0</color>
<color name="shimmerBase0">#c2c2c2</color>
<color name="shimmerHighlight0">#ffffff</color>
<color name="colorPrimary">#3d95c9</color>
<color name="colorPrimaryDark">#2485be</color>
<color name="colorAccent">#3d95c9</color>
<color name="background">#303030</color>
<color name="background800">#424242</color>
<color name="background900">#212121</color>
<color name="HintText">#87ffffff</color>
<color name="preview">#b0abb0</color>
<color name="shimmerBase0">#c2c2c2</color>
<color name="shimmerHighlight0">#ffffff</color>
<color name="shimmerHighlight1">#DFDEDE</color>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">AndroidVeilDemo</string>
<string name="app_name">AndroidVeilDemo</string>
</resources>
Binary file added art/shimmer01.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/shimmer02.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ab069e5

Please sign in to comment.