Skip to content

Commit

Permalink
Merge pull request #7 from prolificinteractive/qc_chandelier
Browse files Browse the repository at this point in the history
Chandelier
  • Loading branch information
quentin41500 committed May 23, 2016
2 parents 59fe127 + 0b0c265 commit c704974
Show file tree
Hide file tree
Showing 27 changed files with 183 additions and 178 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Swipe Action Layout
===================
Chandelier
==========

A nice swipe layout that provides new actions with a material design look and feel.

Expand All @@ -9,23 +9,23 @@ A nice swipe layout that provides new actions with a material design look and fe
Usage
-----

1. Add `compile 'com.prolificinteractive:swipe-action-layout:1.0.0'` to your dependencies.
2. Wrap your list around `SwipeActionLayout` in your layouts or view hierarchy.
3. Add a list of `ActionItem` using `SwipeActionLayout#populateActionItems()` method.
1. Add `compile 'com.prolificinteractive:swipe-action-layout:0.0.1'` to your dependencies.
2. Wrap your list around `ChandelierLayout` in your layouts or view hierarchy.
3. Add a list of `ActionItem` using `ChandelierLayout#populateActionItems()` method.
4. Set a `OnActionSelectedListener` to listen for selected action and update the view accordingly.

Or

1. Add `compile 'com.prolificinteractive:swipe-action-layout:1.0.0'` to your dependencies.
2. Wrap your list around `SwipeActionLayout` in your layouts or view hierarchy.
3. Create Objects that extend `ActionItem` and add them using `SwipeActionLayout#populateActionItems()` method.
1. Add `compile 'com.prolificinteractive:swipe-action-layout:0.0.1'` to your dependencies.
2. Wrap your list around `ChandelierLayout` in your layouts or view hierarchy.
3. Create Objects that extend `ActionItem` and add them using `ChandelierLayout#populateActionItems()` method.
4. Override `ActionItem#Execute()` method to execute the action when selected.

Example:

```xml
<com.prolificinteractive.swipeactionlayout.widget.SwipeActionLayout
android:id="@+id/swipe_action_layout"
<com.prolificinteractive.chandelier.widget.ChandelierLayout
android:id="@+id/chandelier_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:al_background="?attr/colorPrimary"
Expand All @@ -34,7 +34,7 @@ Example:
<!-- Insert your list here -->
<include layout="@layout/example_recycler_view" />

</com.prolificinteractive.swipeactionlayout.widget.SwipeActionLayout>
</com.prolificinteractive.chandelier.widget.ChandelierLayout>
```

Customization
Expand All @@ -58,12 +58,12 @@ Would you like to contribute? Fork us and send a pull request! Be sure to checko

## License

Swipe Action Layout is Copyright (c) 2016 Prolific Interactive. It may be redistributed under the terms specified in the [LICENSE] file.
Chandelier is Copyright (c) 2016 Prolific Interactive. It may be redistributed under the terms specified in the [LICENSE] file.

[LICENSE]: /LICENSE

## Maintainers

![prolific](https://s3.amazonaws.com/prolificsitestaging/logos/Prolific_Logo_Full_Color.png)

Swipe Action Layout is maintained and funded by Prolific Interactive. The names and logos are trademarks of Prolific Interactive.
Chandelier is maintained and funded by Prolific Interactive. The names and logos are trademarks of Prolific Interactive.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ android {
buildToolsVersion "23.0.1"

defaultConfig {
applicationId "com.prolificinteractive.swipeactionlayout"
applicationId "com.prolificinteractive.chandelier"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.prolificinteractive.swipeactionlayout.sample"
package="com.prolificinteractive.chandelier.sample"
>

<uses-permission android:name="android.permission.INTERNET" />
Expand Down Expand Up @@ -32,7 +32,7 @@

<intent-filter>
<action android:name="android.intent.action.RUN"/>
<category android:name="com.prolificinteractive.swipeactionlayout.sample.SAMPLE"/>
<category android:name="com.prolificinteractive.chandelier.sample.SAMPLE"/>
</intent-filter>
</activity>
<activity
Expand All @@ -42,7 +42,7 @@
>
<intent-filter>
<action android:name="android.intent.action.RUN"/>
<category android:name="com.prolificinteractive.swipeactionlayout.sample.SAMPLE"/>
<category android:name="com.prolificinteractive.chandelier.sample.SAMPLE"/>
</intent-filter>
</activity>
</application>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.prolificinteractive.swipeactionlayout.sample;
package com.prolificinteractive.chandelier.sample;

import android.content.ComponentName;
import android.content.Context;
Expand All @@ -18,7 +18,7 @@
import java.util.List;

public class MainActivity extends AppCompatActivity {
private static final String CATEGORY_SAMPLE = "com.prolificinteractive.swipeactionlayout.sample.SAMPLE";
private static final String CATEGORY_SAMPLE = "com.prolificinteractive.chandelier.sample.SAMPLE";

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.prolificinteractive.swipeactionlayout.sample;
package com.prolificinteractive.chandelier.sample;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
Expand All @@ -12,13 +12,13 @@
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.prolificinteractive.swipeactionlayout.widget.ActionItem;
import com.prolificinteractive.swipeactionlayout.widget.SwipeActionLayout;
import com.prolificinteractive.chandelier.widget.Ornament;
import com.prolificinteractive.chandelier.widget.ChandelierLayout;
import java.util.Arrays;

public class RecyclerViewActivity extends AppCompatActivity {

private SwipeActionLayout swipeActionLayout;
private ChandelierLayout chandelierLayout;
private RecyclerView list;
private DummyAdapter adapter;

Expand All @@ -31,9 +31,9 @@ protected void onCreate(Bundle savedInstanceState) {
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

swipeActionLayout = (SwipeActionLayout) findViewById(R.id.swipe_action_layout);
swipeActionLayout.setOnActionSelectedListener(new SwipeActionLayout.OnActionListener() {
@Override public void onActionSelected(int index, ActionItem action) {
chandelierLayout = (ChandelierLayout) findViewById(R.id.chandelier_layout);
chandelierLayout.setOnActionSelectedListener(new ChandelierLayout.OnActionListener() {
@Override public void onActionSelected(int index, Ornament action) {
Toast.makeText(RecyclerViewActivity.this, String.format("%d", index), Toast.LENGTH_SHORT)
.show();
}
Expand All @@ -44,10 +44,10 @@ protected void onCreate(Bundle savedInstanceState) {
list.setLayoutManager(new LinearLayoutManager(this));
list.setAdapter(adapter);

swipeActionLayout.populateActionItems(Arrays.asList(
new ActionItem(R.drawable.ic_close),
new ActionItem(R.drawable.ic_add),
new ActionItem(R.drawable.ic_check)
chandelierLayout.populateActionItems(Arrays.asList(
new Ornament(R.drawable.ic_close),
new Ornament(R.drawable.ic_add),
new Ornament(R.drawable.ic_check)
));
}

Expand Down Expand Up @@ -97,7 +97,7 @@ public int getItemCount() {
}

@Override public boolean onLongClick(View v) {
swipeActionLayout.showActions();
chandelierLayout.showActions();
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.prolificinteractive.swipeactionlayout.sample;
package com.prolificinteractive.chandelier.sample;

import android.app.Application;
import com.squareup.leakcanary.LeakCanary;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.prolificinteractive.swipeactionlayout.sample;
package com.prolificinteractive.chandelier.sample;

import android.os.Bundle;
import android.support.annotation.DrawableRes;
Expand All @@ -12,8 +12,8 @@
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import com.prolificinteractive.swipeactionlayout.widget.ActionItem;
import com.prolificinteractive.swipeactionlayout.widget.SwipeActionLayout;
import com.prolificinteractive.chandelier.widget.Ornament;
import com.prolificinteractive.chandelier.widget.ChandelierLayout;
import java.util.Arrays;

public class WebViewActivity extends AppCompatActivity {
Expand All @@ -23,7 +23,7 @@ public class WebViewActivity extends AppCompatActivity {
public static final String GITHUB_PULLS_URL = GITHUB_URL + "pulls";
public static final String GITHUB_SEARCH_URL = GITHUB_URL + "search";

private SwipeActionLayout swipeActionLayout;
private ChandelierLayout chandelierLayout;
private WebView webView;

@Override
Expand Down Expand Up @@ -51,13 +51,13 @@ protected void onCreate(Bundle savedInstanceState) {
});
webView.loadUrl(GITHUB_URL);

swipeActionLayout = (SwipeActionLayout) findViewById(R.id.swipe_action_layout);
swipeActionLayout.setOnActionSelectedListener(new SwipeActionLayout.OnActionListener() {
@Override public void onActionSelected(int index, ActionItem action) {
chandelierLayout = (ChandelierLayout) findViewById(R.id.chandelier_layout);
chandelierLayout.setOnActionSelectedListener(new ChandelierLayout.OnActionListener() {
@Override public void onActionSelected(int index, Ornament action) {
action.execute();
}
});
swipeActionLayout.populateActionItems(Arrays.asList(
chandelierLayout.populateActionItems(Arrays.asList(
new GitHubAction.Builder()
.setDrawableResId(R.drawable.ic_notifications)
.setUrl(GITHUB_NOTIFICATIONS_URL)
Expand All @@ -84,7 +84,7 @@ public void onClick(View view) {
});
}

static class GitHubAction extends ActionItem {
static class GitHubAction extends Ornament {
private String url;
private WebView webView;

Expand Down
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 @@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.prolificinteractive.swipeactionlayout.sample.MainActivity">
tools:context="com.prolificinteractive.chandelier.sample.MainActivity">

<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/activity_recycler_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

<include layout="@layout/include_toolbar" />

<com.prolificinteractive.swipeactionlayout.widget.SwipeActionLayout
android:id="@+id/swipe_action_layout"
<com.prolificinteractive.chandelier.widget.ChandelierLayout
android:id="@+id/chandelier_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"
app:al_background="?attr/colorPrimary"
app:chandelier_background="?attr/colorPrimary"
>
<include layout="@layout/content_recycler_view" />
</com.prolificinteractive.swipeactionlayout.widget.SwipeActionLayout>
</com.prolificinteractive.chandelier.widget.ChandelierLayout>
</RelativeLayout>
60 changes: 32 additions & 28 deletions app/src/main/res/layout/activity_web_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,56 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.prolificinteractive.swipeactionlayout.sample.WebViewActivity">
tools:context="com.prolificinteractive.chandelier.sample.WebViewActivity"
>

<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
>

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
app:popupTheme="@style/AppTheme.PopupOverlay"
/>

</android.support.design.widget.AppBarLayout>
<com.prolificinteractive.swipeactionlayout.widget.SwipeActionLayout
android:id="@+id/swipe_action_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:al_selected_size="40dp"
app:al_selector="@drawable/al_github_selector"
<com.prolificinteractive.chandelier.widget.ChandelierLayout
android:id="@+id/chandelier_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:chandelier_selected_size="40dp"
app:chandelier_selector="@drawable/al_github_selector"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<android.support.v4.widget.NestedScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<android.support.v4.widget.NestedScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<include layout="@layout/content_web_view"/>
</android.support.v4.widget.NestedScrollView>
</com.prolificinteractive.swipeactionlayout.widget.SwipeActionLayout>
<include layout="@layout/content_web_view"/>
</android.support.v4.widget.NestedScrollView>
</com.prolificinteractive.chandelier.widget.ChandelierLayout>

<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_marginTop="-7dp"
android:elevation="4dp"
android:max="100"
/>
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-7dp"
android:elevation="4dp"
android:max="100"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_search"/>
android:src="@drawable/ic_search"
/>

</android.support.design.widget.CoordinatorLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/content_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main"
tools:context="com.prolificinteractive.swipeactionlayout.sample.MainActivity">
tools:context="com.prolificinteractive.chandelier.sample.MainActivity">

</android.support.v7.widget.RecyclerView>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/content_web_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:showIn="@layout/activity_web_view"
tools:context="com.prolificinteractive.swipeactionlayout.sample.WebViewActivity">
tools:context="com.prolificinteractive.chandelier.sample.WebViewActivity">
</WebView>
2 changes: 1 addition & 1 deletion app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<dimen name="fab_margin">16dp</dimen>
<dimen name="elevation">4dp</dimen>
<dimen name="action_selected_size">40dp</dimen>
<dimen name="swipe_action_margin">16dp</dimen>
<dimen name="chandelier_margin">16dp</dimen>
</resources>
5 changes: 3 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<resources>
<string name="app_name">SwipeActionLayout</string>
<string name="action_settings">Settings</string>
<string name="app_name">Chandelier</string>
<string name="action_settings">Settings</string>

<string name="title_activity_web_view">WebViewActivity</string>
<string name="title_activity_recycler_view">RecyclerViewActivity</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.prolificinteractive.swipeactionlayout;
package com.prolificinteractive.chandelier;

import org.junit.Test;

Expand Down
Loading

0 comments on commit c704974

Please sign in to comment.