├── .gitignore
├── AndroidManifest.xml
├── LICENSE.txt
├── README.md
├── default.properties
├── pom.xml
├── res
├── drawable-hdpi-v11
│ └── action_bar_icon_settings.png
├── drawable-hdpi
│ ├── action_bar_icon_settings.png
│ └── icon.png
├── drawable-ldpi
│ └── icon.png
├── drawable-mdpi-v11
│ └── action_bar_icon_settings.png
├── drawable-mdpi
│ ├── action_bar_icon_settings.png
│ └── icon.png
├── drawable-xhdpi-v11
│ └── action_bar_icon_settings.png
├── drawable-xhdpi
│ ├── action_bar_icon_settings.png
│ └── background_item.9.png
├── layout
│ ├── package_row.xml
│ ├── settings_activity.xml
│ └── swipe_list_view_activity.xml
├── menu
│ └── menu_app.xml
├── values-v11
│ └── themes.xml
└── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ ├── styles.xml
│ └── themes.xml
├── screenshot_swipelistview_large.png
├── screenshot_swipelistview_small.png
└── src
└── main
└── java
└── com
└── fortysevendeg
└── android
└── swipelistview
└── sample
├── activities
├── SettingsActivity.java
└── SwipeListViewExampleActivity.java
├── adapters
├── PackageAdapter.java
└── PackageItem.java
├── dialogs
└── AboutDialog.java
└── utils
├── PreferencesManager.java
└── SettingsManager.java
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
22 |
23 |
25 |
26 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright 2013 47 Degrees
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | SwipeListView Demo ([Play Store Demo][1])
2 | ==================
3 |
4 | An Android List View implementation with support for drawable cells and many other swipe related features.
5 |
6 | Sample App for [47deg/android-swipelistview][2]
7 |
8 | [![SwipeListView screenshot][3]][4]
9 |
10 | # License
11 |
12 | Copyright (C) 2012 47 Degrees, LLC
13 | http://47deg.com
14 | hello@47deg.com
15 |
16 | Licensed under the Apache License, Version 2.0 (the "License");
17 | you may not use this file except in compliance with the License.
18 | You may obtain a copy of the License at
19 |
20 | http://www.apache.org/licenses/LICENSE-2.0
21 |
22 | Unless required by applicable law or agreed to in writing, software
23 | distributed under the License is distributed on an "AS IS" BASIS,
24 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 | See the License for the specific language governing permissions and
26 | limitations under the License.
27 |
28 | [1]: https://play.google.com/store/apps/details?id=com.fortysevendeg.android.swipelistview
29 | [2]: https://github.com/47deg/android-swipelistview
30 | [3]: https://raw.github.com/47deg/android-swipelistview-sample/master/screenshot_swipelistview_small.png
31 | [4]: https://raw.github.com/47deg/android-swipelistview-sample/master/screenshot_swipelistview_large.png
32 |
--------------------------------------------------------------------------------
/default.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2013 47 Degrees, LLC
3 | # http://47deg.com
4 | # hello@47deg.com
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | # File used by Eclipse to determine the target system
20 | # Project target.
21 | target=android-16
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
22 | 4.0.0
23 | com.fortysevendeg.android
24 | swipelistview-sample
25 | 1.0-SNAPSHOT
26 | apk
27 | android-swipelistview-sample
28 |
29 |
30 | 4.1.1.4
31 | android-swipelistview-sample
32 | master
33 | github
34 |
35 |
36 |
37 | https://github.com/47deg/${project.name.github}/tree/${scm.branch}
38 | scm:git:git://github.com/47deg/${project.name.github}.git
39 | scm:git:ssh://git@github.com/47deg/${project.name.github}.git
40 | HEAD
41 |
42 |
43 |
44 | Github Issue Tracking
45 | https://github.com/47deg/${project.name.github}/issues
46 |
47 |
48 |
49 |
50 | sonatype-nexus-snapshots
51 | Sonatype Nexus snapshot repository
52 | https://oss.sonatype.org/content/repositories/snapshots
53 |
54 |
55 | sonatype-nexus-staging
56 | Sonatype Nexus release repository
57 | https://oss.sonatype.org/service/local/staging/deploy/maven2/
58 |
59 |
60 |
61 |
62 |
63 | Apache 2.0
64 | http://www.apache.org/licenses/LICENSE-2.0
65 |
66 |
67 |
68 |
69 |
70 |
71 | sonatype
72 | https://oss.sonatype.org/content/groups/public/
73 |
74 | true
75 | daily
76 | fail
77 |
78 |
79 | true
80 | always
81 | ignore
82 |
83 |
84 |
85 |
86 |
87 |
88 | com.google.android
89 | android
90 | ${platform.version}
91 | provided
92 |
93 |
94 | com.google.android
95 | support-v4
96 | r7
97 |
98 |
99 | com.fortysevendeg.android
100 | swipelistview
101 | 1.0-SNAPSHOT
102 | apklib
103 |
104 |
105 | com.nineoldandroids
106 | nineoldandroids
107 | 2.4.0
108 |
109 |
110 |
111 |
112 |
113 |
114 | com.jayway.maven.plugins.android.generation2
115 | android-maven-plugin
116 | 3.5.0
117 |
118 | ${project.basedir}/AndroidManifest.xml
119 | ${project.basedir}/assets
120 | ${project.basedir}/res
121 | ${project.basedir}/src/main/native
122 |
123 | 16
124 |
125 | true
126 |
127 | true
128 |
129 |
130 |
131 | maven-compiler-plugin
132 | 2.5.1
133 |
134 | 1.6
135 | 1.6
136 |
137 |
138 |
139 |
140 | com.github.github
141 | downloads-maven-plugin
142 | 0.5
143 |
144 | ${project.version} release of ${project.name}
145 | true
146 | true
147 |
148 |
149 | *.jar
150 | *.apk
151 |
152 | true
153 |
154 |
155 |
156 |
157 | org.apache.maven.plugins
158 | maven-release-plugin
159 | 2.2.2
160 |
161 | -Dgpg.passphrase=${gpg.passphrase}
162 |
163 |
164 |
165 | maven-assembly-plugin
166 |
167 |
168 | jar-with-dependencies
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 | release-sign-artifacts
180 |
181 |
182 | performRelease
183 | true
184 |
185 |
186 |
187 |
188 |
189 | org.apache.maven.plugins
190 | maven-gpg-plugin
191 | 1.4
192 |
193 | ${gpg.passphrase}
194 |
195 |
196 |
197 | sign-artifacts
198 | verify
199 |
200 | sign
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
--------------------------------------------------------------------------------
/res/drawable-hdpi-v11/action_bar_icon_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mozuck/android-swipelistview-sample/f5c642795446c3b771d7cb4d3ab1fb7270b74d8f/res/drawable-hdpi-v11/action_bar_icon_settings.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/action_bar_icon_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mozuck/android-swipelistview-sample/f5c642795446c3b771d7cb4d3ab1fb7270b74d8f/res/drawable-hdpi/action_bar_icon_settings.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mozuck/android-swipelistview-sample/f5c642795446c3b771d7cb4d3ab1fb7270b74d8f/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mozuck/android-swipelistview-sample/f5c642795446c3b771d7cb4d3ab1fb7270b74d8f/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-mdpi-v11/action_bar_icon_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mozuck/android-swipelistview-sample/f5c642795446c3b771d7cb4d3ab1fb7270b74d8f/res/drawable-mdpi-v11/action_bar_icon_settings.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/action_bar_icon_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mozuck/android-swipelistview-sample/f5c642795446c3b771d7cb4d3ab1fb7270b74d8f/res/drawable-mdpi/action_bar_icon_settings.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mozuck/android-swipelistview-sample/f5c642795446c3b771d7cb4d3ab1fb7270b74d8f/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi-v11/action_bar_icon_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mozuck/android-swipelistview-sample/f5c642795446c3b771d7cb4d3ab1fb7270b74d8f/res/drawable-xhdpi-v11/action_bar_icon_settings.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/action_bar_icon_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mozuck/android-swipelistview-sample/f5c642795446c3b771d7cb4d3ab1fb7270b74d8f/res/drawable-xhdpi/action_bar_icon_settings.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/background_item.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mozuck/android-swipelistview-sample/f5c642795446c3b771d7cb4d3ab1fb7270b74d8f/res/drawable-xhdpi/background_item.9.png
--------------------------------------------------------------------------------
/res/layout/package_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
25 |
26 |
31 |
32 |
38 |
39 |
45 |
46 |
52 |
53 |
54 |
55 |
60 |
61 |
64 |
65 |
71 |
72 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/res/layout/settings_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
26 |
27 |
31 |
32 |
37 |
38 |
39 |
40 |
45 |
46 |
52 |
53 |
59 |
60 |
66 |
67 |
68 |
69 |
70 |
75 |
76 |
77 |
78 |
83 |
84 |
90 |
91 |
97 |
98 |
99 |
100 |
101 |
106 |
107 |
108 |
109 |
114 |
115 |
121 |
122 |
128 |
129 |
130 |
131 |
137 |
138 |
139 |
140 |
145 |
146 |
150 |
151 |
152 |
153 |
159 |
160 |
161 |
162 |
167 |
168 |
172 |
173 |
174 |
175 |
180 |
181 |
182 |
183 |
188 |
189 |
197 |
198 |
203 |
204 |
205 |
206 |
211 |
212 |
213 |
214 |
220 |
221 |
222 |
223 |
224 |
--------------------------------------------------------------------------------
/res/layout/swipe_list_view_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
26 |
27 |
39 |
40 |
--------------------------------------------------------------------------------
/res/menu/menu_app.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
--------------------------------------------------------------------------------
/res/values-v11/themes.xml:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 |
22 |
--------------------------------------------------------------------------------
/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 | #dedede
23 |
24 | #e3e3e3
25 | #ffffff
26 | #444444
27 | #7e7e7e
28 |
29 | #ffbcbcbc
30 |
31 |
--------------------------------------------------------------------------------
/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 |
23 | 3dp
24 | 8dp
25 | 5dp
26 | 1dp
27 |
28 |
29 | 90dp
30 | 64dp
31 | 17sp
32 | 15sp
33 |
34 | 20dp
35 |
36 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 | SwipeListView Demo
23 | Open
24 | Google Play
25 | Uninstall
26 |
27 | Can\'t open this application
28 | Settings
29 | Swipe Mode
30 | Left
31 | Right
32 | Both
33 | Left Action
34 | Reveal
35 | Dismiss
36 | Right Action
37 | Right Offset (%1$s dp)
38 | Left Offset (%1$s dp)
39 | dp
40 | Animation Time (Default: 0)
41 | Milliseconds
42 | Open On Long Press
43 |
44 | About
45 | This is just a simple demo for the Open Source SwipeListView Android Library by 47 Degrees. Find all source, documentation and packaged downloads at GitHub. Cheers!
46 | Ok
47 |
48 | Visit 47deg
49 | Go to GitHub
50 |
51 | Don\'t show this message again
52 | Others
53 |
54 | Loading
55 |
56 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 |
23 |
24 |
30 |
31 |
37 |
38 |
44 |
45 |
53 |
54 |
59 |
60 |
63 |
64 |
65 |
66 |
71 |
72 |
76 |
77 |
82 |
83 |
88 |
89 |
--------------------------------------------------------------------------------
/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 |
22 |
--------------------------------------------------------------------------------
/screenshot_swipelistview_large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mozuck/android-swipelistview-sample/f5c642795446c3b771d7cb4d3ab1fb7270b74d8f/screenshot_swipelistview_large.png
--------------------------------------------------------------------------------
/screenshot_swipelistview_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mozuck/android-swipelistview-sample/f5c642795446c3b771d7cb4d3ab1fb7270b74d8f/screenshot_swipelistview_small.png
--------------------------------------------------------------------------------
/src/main/java/com/fortysevendeg/android/swipelistview/sample/activities/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 47 Degrees, LLC
3 | * http://47deg.com
4 | * hello@47deg.com
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | package com.fortysevendeg.android.swipelistview.sample.activities;
20 |
21 | import android.app.Activity;
22 | import android.os.Bundle;
23 | import android.text.Editable;
24 | import android.text.TextUtils;
25 | import android.text.TextWatcher;
26 | import android.widget.*;
27 | import com.fortysevendeg.android.swipelistview.R;
28 | import com.fortysevendeg.android.swipelistview.SwipeListView;
29 | import com.fortysevendeg.android.swipelistview.sample.utils.SettingsManager;
30 |
31 | public class SettingsActivity extends Activity {
32 |
33 | private static int MAX_OFFSET = 200;
34 |
35 | private SettingsManager settings;
36 |
37 | private SeekBar sbOffsetLeft;
38 | private TextView tvOffsetLeft;
39 | private SeekBar sbOffsetRight;
40 | private TextView tvOffsetRight;
41 |
42 | CompoundButton.OnCheckedChangeListener radiosListener = new CompoundButton.OnCheckedChangeListener() {
43 | @Override
44 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
45 | if (isChecked) {
46 | switch (buttonView.getId()) {
47 | case R.id.mode_both:
48 | settings.setSwipeMode(SwipeListView.SWIPE_MODE_BOTH);
49 | break;
50 | case R.id.mode_left:
51 | settings.setSwipeMode(SwipeListView.SWIPE_MODE_LEFT);
52 | break;
53 | case R.id.mode_right:
54 | settings.setSwipeMode(SwipeListView.SWIPE_MODE_RIGHT);
55 | break;
56 | case R.id.action_left_dismiss:
57 | settings.setSwipeActionLeft(SwipeListView.SWIPE_ACTION_DISMISS);
58 | break;
59 | case R.id.action_left_reveal:
60 | settings.setSwipeActionLeft(SwipeListView.SWIPE_ACTION_REVEAL);
61 | break;
62 | case R.id.action_right_dismiss:
63 | settings.setSwipeActionRight(SwipeListView.SWIPE_ACTION_DISMISS);
64 | break;
65 | case R.id.action_right_reveal:
66 | settings.setSwipeActionRight(SwipeListView.SWIPE_ACTION_REVEAL);
67 | break;
68 | }
69 | }
70 | }
71 | };
72 |
73 | public void onCreate(Bundle savedInstanceState) {
74 | super.onCreate(savedInstanceState);
75 | setContentView(R.layout.settings_activity);
76 |
77 | settings = SettingsManager.getInstance();
78 |
79 | RadioButton rbModeBoth = (RadioButton) findViewById(R.id.mode_both);
80 | rbModeBoth.setOnCheckedChangeListener(radiosListener);
81 |
82 | RadioButton rbModeLeft = (RadioButton) findViewById(R.id.mode_left);
83 | rbModeLeft.setOnCheckedChangeListener(radiosListener);
84 |
85 | RadioButton rbModeRight = (RadioButton) findViewById(R.id.mode_right);
86 | rbModeRight.setOnCheckedChangeListener(radiosListener);
87 |
88 | if (settings.getSwipeMode() == SwipeListView.SWIPE_MODE_BOTH) {
89 | rbModeBoth.setChecked(true);
90 | } else if (settings.getSwipeMode() == SwipeListView.SWIPE_MODE_LEFT) {
91 | rbModeLeft.setChecked(true);
92 | } else if (settings.getSwipeMode() == SwipeListView.SWIPE_MODE_RIGHT) {
93 | rbModeRight.setChecked(true);
94 | }
95 |
96 | RadioButton rbActionLeftDismiss = (RadioButton) findViewById(R.id.action_left_dismiss);
97 | rbActionLeftDismiss.setOnCheckedChangeListener(radiosListener);
98 |
99 | RadioButton rbActionLeftReveal = (RadioButton) findViewById(R.id.action_left_reveal);
100 | rbActionLeftReveal.setOnCheckedChangeListener(radiosListener);
101 |
102 | if (settings.getSwipeActionLeft() == SwipeListView.SWIPE_ACTION_DISMISS) {
103 | rbActionLeftDismiss.setChecked(true);
104 | } else if (settings.getSwipeActionLeft() == SwipeListView.SWIPE_ACTION_REVEAL) {
105 | rbActionLeftReveal.setChecked(true);
106 | }
107 |
108 | RadioButton rbActionRightDismiss = (RadioButton) findViewById(R.id.action_right_dismiss);
109 | rbActionRightDismiss.setOnCheckedChangeListener(radiosListener);
110 |
111 | RadioButton rbActionRightReveal = (RadioButton) findViewById(R.id.action_right_reveal);
112 | rbActionRightReveal.setOnCheckedChangeListener(radiosListener);
113 |
114 | if (settings.getSwipeActionRight() == SwipeListView.SWIPE_ACTION_DISMISS) {
115 | rbActionRightDismiss.setChecked(true);
116 | } else if (settings.getSwipeActionRight() == SwipeListView.SWIPE_ACTION_REVEAL) {
117 | rbActionRightReveal.setChecked(true);
118 | }
119 |
120 | tvOffsetLeft = (TextView) findViewById(R.id.offset_label_left);
121 | tvOffsetLeft.setText(SettingsActivity.this.getString(R.string.leftOffset, (int) settings.getSwipeOffsetLeft()));
122 |
123 | sbOffsetLeft = (SeekBar) findViewById(R.id.offset_left);
124 | sbOffsetLeft.setMax(MAX_OFFSET);
125 | sbOffsetLeft.setProgress((int) settings.getSwipeOffsetLeft());
126 | sbOffsetLeft.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
127 | @Override
128 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
129 | settings.setSwipeOffsetLeft(progress);
130 | tvOffsetLeft.setText(SettingsActivity.this.getString(R.string.leftOffset, progress));
131 | }
132 |
133 | @Override
134 | public void onStartTrackingTouch(SeekBar seekBar) {
135 | }
136 |
137 | @Override
138 | public void onStopTrackingTouch(SeekBar seekBar) {
139 | }
140 | });
141 |
142 | tvOffsetRight = (TextView) findViewById(R.id.offset_label_right);
143 |
144 | sbOffsetRight = (SeekBar) findViewById(R.id.offset_right);
145 | tvOffsetRight.setText(SettingsActivity.this.getString(R.string.rightOffset, (int) settings.getSwipeOffsetRight()));
146 | sbOffsetRight.setMax(MAX_OFFSET);
147 | sbOffsetRight.setProgress((int) settings.getSwipeOffsetRight());
148 | sbOffsetRight.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
149 | @Override
150 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
151 | settings.setSwipeOffsetRight(progress);
152 | tvOffsetRight.setText(SettingsActivity.this.getString(R.string.rightOffset, progress));
153 | }
154 |
155 | @Override
156 | public void onStartTrackingTouch(SeekBar seekBar) {
157 | }
158 |
159 | @Override
160 | public void onStopTrackingTouch(SeekBar seekBar) {
161 | }
162 | });
163 |
164 | final EditText etAnimationTime = (EditText) findViewById(R.id.animation_time);
165 | etAnimationTime.setText(String.format("%d", (int) settings.getSwipeAnimationTime()));
166 | etAnimationTime.addTextChangedListener(new TextWatcher() {
167 | @Override
168 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {
169 | }
170 |
171 | @Override
172 | public void onTextChanged(CharSequence s, int start, int before, int count) {
173 | if (!TextUtils.isEmpty(s)) {
174 | try {
175 | settings.setSwipeAnimationTime(Integer.parseInt(s.toString()));
176 | } catch (NumberFormatException e) {
177 | etAnimationTime.setText("0");
178 | }
179 | }
180 | }
181 |
182 | @Override
183 | public void afterTextChanged(Editable s) {
184 | }
185 | });
186 |
187 | CheckBox cbLongPress = (CheckBox) findViewById(R.id.open_long_press);
188 | cbLongPress.setChecked(settings.isSwipeOpenOnLongPress());
189 | cbLongPress.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
190 | @Override
191 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
192 | settings.setSwipeOpenOnLongPress(isChecked);
193 | }
194 | });
195 |
196 | }
197 |
198 | }
--------------------------------------------------------------------------------
/src/main/java/com/fortysevendeg/android/swipelistview/sample/activities/SwipeListViewExampleActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 47 Degrees, LLC
3 | * http://47deg.com
4 | * hello@47deg.com
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | package com.fortysevendeg.android.swipelistview.sample.activities;
20 |
21 | import android.app.ProgressDialog;
22 | import android.content.Intent;
23 | import android.content.pm.ApplicationInfo;
24 | import android.content.pm.PackageManager;
25 | import android.os.AsyncTask;
26 | import android.os.Bundle;
27 | import android.support.v4.app.FragmentActivity;
28 | import android.util.DisplayMetrics;
29 | import android.util.Log;
30 | import android.view.Menu;
31 | import android.view.MenuInflater;
32 | import android.view.MenuItem;
33 | import com.fortysevendeg.android.swipelistview.R;
34 | import com.fortysevendeg.android.swipelistview.SwipeListView;
35 | import com.fortysevendeg.android.swipelistview.SwipeListViewListener;
36 | import com.fortysevendeg.android.swipelistview.sample.adapters.PackageAdapter;
37 | import com.fortysevendeg.android.swipelistview.sample.adapters.PackageItem;
38 | import com.fortysevendeg.android.swipelistview.sample.dialogs.AboutDialog;
39 | import com.fortysevendeg.android.swipelistview.sample.utils.PreferencesManager;
40 | import com.fortysevendeg.android.swipelistview.sample.utils.SettingsManager;
41 |
42 | import java.util.ArrayList;
43 | import java.util.Collections;
44 | import java.util.List;
45 |
46 | public class SwipeListViewExampleActivity extends FragmentActivity {
47 |
48 | private static final int REQUEST_CODE_SETTINGS = 0;
49 | private PackageAdapter adapter;
50 | private List data;
51 |
52 | private SwipeListView swipeListView;
53 |
54 | private ProgressDialog progressDialog;
55 |
56 | @Override
57 | public void onCreate(Bundle savedInstanceState) {
58 | super.onCreate(savedInstanceState);
59 |
60 | setContentView(R.layout.swipe_list_view_activity);
61 |
62 | data = new ArrayList();
63 |
64 | // PackageManager appInfo = getPackageManager();
65 | // List listInfo = appInfo.getInstalledApplications(0);
66 | // Collections.sort(listInfo, new ApplicationInfo.DisplayNameComparator(appInfo));
67 | //
68 | //
69 | // for (int index=0; index> {
200 |
201 | protected List doInBackground(Void... args) {
202 | PackageManager appInfo = getPackageManager();
203 | List listInfo = appInfo.getInstalledApplications(0);
204 | Collections.sort(listInfo, new ApplicationInfo.DisplayNameComparator(appInfo));
205 |
206 | List data = new ArrayList();
207 |
208 | for (int index=0; index result) {
229 | data.clear();
230 | data.addAll(result);
231 | adapter.notifyDataSetChanged();
232 | if (progressDialog != null) {
233 | progressDialog.dismiss();
234 | progressDialog = null;
235 | }
236 | if (PreferencesManager.getInstance(SwipeListViewExampleActivity.this).getShowAbout()) {
237 | AboutDialog logOutDialog = new AboutDialog();
238 | logOutDialog.show(getSupportFragmentManager(), "dialog");
239 | }
240 | }
241 | }
242 |
243 | }
244 |
--------------------------------------------------------------------------------
/src/main/java/com/fortysevendeg/android/swipelistview/sample/adapters/PackageAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 47 Degrees, LLC
3 | * http://47deg.com
4 | * hello@47deg.com
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | package com.fortysevendeg.android.swipelistview.sample.adapters;
20 |
21 | import android.content.Context;
22 | import android.content.Intent;
23 | import android.net.Uri;
24 | import android.view.LayoutInflater;
25 | import android.view.View;
26 | import android.view.ViewGroup;
27 | import android.widget.*;
28 | import com.fortysevendeg.android.swipelistview.R;
29 |
30 | import java.util.List;
31 |
32 | public class PackageAdapter extends BaseAdapter {
33 |
34 | private List data;
35 | private Context context;
36 |
37 | public PackageAdapter(Context context, List data) {
38 | this.context = context;
39 | this.data = data;
40 | }
41 |
42 | @Override
43 | public int getCount() {
44 | return data.size();
45 | }
46 |
47 | @Override
48 | public PackageItem getItem(int position) {
49 | return data.get(position);
50 | }
51 |
52 | @Override
53 | public long getItemId(int position) {
54 | return position;
55 | }
56 |
57 | @Override
58 | public View getView(final int position, View convertView, ViewGroup parent) {
59 | final PackageItem item = getItem(position);
60 | ViewHolder holder;
61 | if (convertView == null) {
62 | LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
63 | convertView = li.inflate(R.layout.package_row, parent, false);
64 | holder = new ViewHolder();
65 | holder.ivImage = (ImageView) convertView.findViewById(R.id.example_row_iv_image);
66 | holder.tvTitle = (TextView) convertView.findViewById(R.id.example_row_tv_title);
67 | holder.tvDescription = (TextView) convertView.findViewById(R.id.example_row_tv_description);
68 | holder.bAction1 = (Button) convertView.findViewById(R.id.example_row_b_action_1);
69 | holder.bAction2 = (Button) convertView.findViewById(R.id.example_row_b_action_2);
70 | holder.bAction3 = (Button) convertView.findViewById(R.id.example_row_b_action_3);
71 | convertView.setTag(holder);
72 | } else {
73 | holder = (ViewHolder) convertView.getTag();
74 | }
75 |
76 |
77 | holder.ivImage.setImageDrawable(item.getIcon());
78 | holder.tvTitle.setText(item.getName());
79 | holder.tvDescription.setText(item.getPackageName());
80 |
81 |
82 | holder.bAction1.setOnClickListener(new View.OnClickListener() {
83 | @Override
84 | public void onClick(View v) {
85 | Intent intent = context.getPackageManager().getLaunchIntentForPackage(item.getPackageName());
86 | if (intent != null) {
87 | context.startActivity(intent);
88 | } else {
89 | Toast.makeText(context, R.string.cantOpen, Toast.LENGTH_SHORT).show();
90 | }
91 | }
92 | });
93 |
94 | holder.bAction2.setOnClickListener(new View.OnClickListener() {
95 | @Override
96 | public void onClick(View v) {
97 | context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + item.getPackageName())));
98 | }
99 | });
100 |
101 | holder.bAction3.setOnClickListener(new View.OnClickListener() {
102 | @Override
103 | public void onClick(View v) {
104 | Uri packageUri = Uri.parse("package:" + item.getPackageName());
105 | Intent uninstallIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri);
106 | context.startActivity(uninstallIntent);
107 | }
108 | });
109 |
110 |
111 | return convertView;
112 | }
113 |
114 | static class ViewHolder {
115 | ImageView ivImage;
116 | TextView tvTitle;
117 | TextView tvDescription;
118 | Button bAction1;
119 | Button bAction2;
120 | Button bAction3;
121 | }
122 |
123 | }
124 |
--------------------------------------------------------------------------------
/src/main/java/com/fortysevendeg/android/swipelistview/sample/adapters/PackageItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 47 Degrees, LLC
3 | * http://47deg.com
4 | * hello@47deg.com
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | package com.fortysevendeg.android.swipelistview.sample.adapters;
20 |
21 | import android.graphics.drawable.Drawable;
22 |
23 | public class PackageItem {
24 |
25 | private Drawable icon;
26 |
27 | private String name;
28 |
29 | private String packageName;
30 |
31 | public String getPackageName() {
32 | return packageName;
33 | }
34 |
35 | public void setPackageName(String packageName) {
36 | this.packageName = packageName;
37 | }
38 |
39 | public String getName() {
40 | return name;
41 | }
42 |
43 | public void setName(String name) {
44 | this.name = name;
45 | }
46 |
47 | public Drawable getIcon() {
48 | return icon;
49 | }
50 |
51 | public void setIcon(Drawable icon) {
52 | this.icon = icon;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/fortysevendeg/android/swipelistview/sample/dialogs/AboutDialog.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 47 Degrees, LLC
3 | * http://47deg.com
4 | * hello@47deg.com
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | package com.fortysevendeg.android.swipelistview.sample.dialogs;
20 |
21 | import android.app.AlertDialog;
22 | import android.app.Dialog;
23 | import android.content.DialogInterface;
24 | import android.content.Intent;
25 | import android.graphics.Color;
26 | import android.net.Uri;
27 | import android.os.Build;
28 | import android.os.Bundle;
29 | import android.support.v4.app.DialogFragment;
30 | import android.widget.CheckBox;
31 | import com.fortysevendeg.android.swipelistview.R;
32 | import com.fortysevendeg.android.swipelistview.sample.utils.PreferencesManager;
33 |
34 | public class AboutDialog extends DialogFragment {
35 |
36 |
37 | /**
38 | * Constructor
39 | *
40 | */
41 | public AboutDialog() {
42 | }
43 |
44 | /**
45 | * @see android.support.v4.app.DialogFragment#onCreateDialog(android.os.Bundle)
46 | */
47 | @Override
48 | public Dialog onCreateDialog(Bundle savedInstanceState) {
49 |
50 | final CheckBox checkBox = new CheckBox(getActivity());
51 | checkBox.setText(R.string.dontShow);
52 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
53 | checkBox.setTextColor(Color.WHITE);
54 | }
55 |
56 | return new AlertDialog.Builder(getActivity())
57 | .setTitle(R.string.about)
58 | .setMessage(R.string.aboutMessage)
59 | .setView(checkBox)
60 | .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
61 | @Override
62 | public void onClick(DialogInterface dialog, int which) {
63 | PreferencesManager.getInstance(getActivity()).setShowAbout(!checkBox.isChecked());
64 | }
65 | })
66 | .setNegativeButton(R.string.visit47, new DialogInterface.OnClickListener() {
67 | @Override
68 | public void onClick(DialogInterface dialog, int which) {
69 | String url = "http://47deg.com";
70 | Intent i = new Intent(Intent.ACTION_VIEW);
71 | i.setData(Uri.parse(url));
72 | startActivity(i);
73 | }
74 | })
75 | .setNeutralButton(R.string.goToGitHub, new DialogInterface.OnClickListener() {
76 | @Override
77 | public void onClick(DialogInterface dialog, int which) {
78 | String url = "https://github.com/47deg/android-swipelistview";
79 | Intent i = new Intent(Intent.ACTION_VIEW);
80 | i.setData(Uri.parse(url));
81 | startActivity(i);
82 | }
83 | })
84 | .create();
85 |
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/main/java/com/fortysevendeg/android/swipelistview/sample/utils/PreferencesManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 47 Degrees, LLC
3 | * http://47deg.com
4 | * hello@47deg.com
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | package com.fortysevendeg.android.swipelistview.sample.utils;
20 |
21 | import android.content.Context;
22 | import android.content.SharedPreferences;
23 |
24 | public class PreferencesManager {
25 |
26 | public static final String SHARED_PREFERENCES_NAME = "SWIPE_LIST_VIEW_SAMPLE_PREFERENCES";
27 |
28 | /**
29 | * Instance
30 | */
31 | private static PreferencesManager preferencesManager = null;
32 |
33 | /**
34 | * Shared Preferences
35 | */
36 | private SharedPreferences sharedPreferences;
37 |
38 | /**
39 | * Preferences variables
40 | */
41 | private static final String SHARED_PREFERENCES_SHOW_ABOUT = "SHARED_PREFERENCES_SHOW_ABOUT";
42 |
43 | /**
44 | * Constructor
45 | *
46 | * @param context
47 | */
48 | private PreferencesManager(Context context) {
49 | sharedPreferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
50 | }
51 |
52 | public static PreferencesManager getInstance(Context context) {
53 | if (preferencesManager == null) {
54 | preferencesManager = new PreferencesManager(context);
55 | }
56 | return preferencesManager;
57 | }
58 |
59 | public void setShowAbout(boolean showAbout) {
60 | SharedPreferences.Editor editor = sharedPreferences.edit();
61 | editor.putBoolean(SHARED_PREFERENCES_SHOW_ABOUT, showAbout);
62 | editor.commit();
63 | }
64 |
65 | public boolean getShowAbout() {
66 | return sharedPreferences.getBoolean(SHARED_PREFERENCES_SHOW_ABOUT, true);
67 | }
68 |
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/src/main/java/com/fortysevendeg/android/swipelistview/sample/utils/SettingsManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 47 Degrees, LLC
3 | * http://47deg.com
4 | * hello@47deg.com
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | package com.fortysevendeg.android.swipelistview.sample.utils;
20 |
21 | import com.fortysevendeg.android.swipelistview.SwipeListView;
22 |
23 | public class SettingsManager {
24 |
25 | private int swipeMode = SwipeListView.SWIPE_MODE_BOTH;
26 | private boolean swipeOpenOnLongPress = true;
27 | private boolean swipeCloseAllItemsWhenMoveList = true;
28 | private long swipeAnimationTime = 0;
29 | private float swipeOffsetLeft = 0;
30 | private float swipeOffsetRight = 0;
31 | private int swipeActionLeft = SwipeListView.SWIPE_ACTION_REVEAL;
32 | private int swipeActionRight = SwipeListView.SWIPE_ACTION_REVEAL;
33 |
34 | private static SettingsManager settingsManager = new SettingsManager();
35 |
36 | public static SettingsManager getInstance() {
37 | return settingsManager;
38 | }
39 |
40 | public static SettingsManager getSettingsManager() {
41 | return settingsManager;
42 | }
43 |
44 | public static void setSettingsManager(SettingsManager settingsManager) {
45 | SettingsManager.settingsManager = settingsManager;
46 | }
47 |
48 | public long getSwipeAnimationTime() {
49 | return swipeAnimationTime;
50 | }
51 |
52 | public void setSwipeAnimationTime(long swipeAnimationTime) {
53 | this.swipeAnimationTime = swipeAnimationTime;
54 | }
55 |
56 | public boolean isSwipeCloseAllItemsWhenMoveList() {
57 | return swipeCloseAllItemsWhenMoveList;
58 | }
59 |
60 | public void setSwipeCloseAllItemsWhenMoveList(boolean swipeCloseAllItemsWhenMoveList) {
61 | this.swipeCloseAllItemsWhenMoveList = swipeCloseAllItemsWhenMoveList;
62 | }
63 |
64 | public int getSwipeMode() {
65 | return swipeMode;
66 | }
67 |
68 | public void setSwipeMode(int swipeMode) {
69 | this.swipeMode = swipeMode;
70 | }
71 |
72 | public float getSwipeOffsetLeft() {
73 | return swipeOffsetLeft;
74 | }
75 |
76 | public void setSwipeOffsetLeft(float swipeOffsetLeft) {
77 | this.swipeOffsetLeft = swipeOffsetLeft;
78 | }
79 |
80 | public float getSwipeOffsetRight() {
81 | return swipeOffsetRight;
82 | }
83 |
84 | public void setSwipeOffsetRight(float swipeOffsetRight) {
85 | this.swipeOffsetRight = swipeOffsetRight;
86 | }
87 |
88 | public boolean isSwipeOpenOnLongPress() {
89 | return swipeOpenOnLongPress;
90 | }
91 |
92 | public void setSwipeOpenOnLongPress(boolean swipeOpenOnLongPress) {
93 | this.swipeOpenOnLongPress = swipeOpenOnLongPress;
94 | }
95 |
96 | public int getSwipeActionLeft() {
97 | return swipeActionLeft;
98 | }
99 |
100 | public void setSwipeActionLeft(int swipeActionLeft) {
101 | this.swipeActionLeft = swipeActionLeft;
102 | }
103 |
104 | public int getSwipeActionRight() {
105 | return swipeActionRight;
106 | }
107 |
108 | public void setSwipeActionRight(int swipeActionRight) {
109 | this.swipeActionRight = swipeActionRight;
110 | }
111 | }
112 |
--------------------------------------------------------------------------------