Skip to content

Commit fd1a95c

Browse files
author
Aritra Roy
committed
Updated README and some minor improvements in the sample app
1 parent fdb1512 commit fd1a95c

2 files changed

Lines changed: 51 additions & 56 deletions

File tree

README.md

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
A fast, light-weight and powerful Play Store information fetcher for Android.
44

55
### Specs
6-
[ ![Download](https://api.bintray.com/packages/aritraroy/maven/rxmagneto/images/download.svg) ](https://bintray.com/aritraroy/maven/rxmagneto/_latestVersion) [![API](https://img.shields.io/badge/API-15%2B-orange.svg?style=flat)](https://android-arsenal.com/api?level=15) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-RxMagneto-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5362)
6+
[ ![Download](https://api.bintray.com/packages/aritraroy/maven/rxmagneto/images/download.svg) ](https://bintray.com/aritraroy/maven/rxmagneto/_latestVersion) [![API](https://img.shields.io/badge/API-14%2B-orange.svg?style=flat)](https://android-arsenal.com/api?level=14) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-RxMagneto-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5362)
77

88
![RxMagneto](https://github.com/aritraroy/RxMagneto/blob/master/raw/logo_250.png)
99

@@ -22,7 +22,7 @@ This library is available in **jCenter** which is the default Maven repository u
2222
dependencies {
2323
// other dependencies here
2424
25-
compile 'com.andrognito.rxmagneto:rxmagneto:1.0.0'
25+
compile 'com.andrognito.rxmagneto:rxmagneto:2.0.0'
2626
}
2727
```
2828

@@ -32,14 +32,20 @@ dependencies {
3232
<dependency>
3333
<groupId>com.andrognito.rxmagneto</groupId>
3434
<artifactId>rxmagneto</artifactId>
35-
<version>1.0.0</version>
35+
<version>2.0.0</version>
3636
<type>pom</type>
3737
</dependency>
3838
```
3939

40+
# Migrating to Version 2
41+
42+
RxMagneto 2 brings some breaking changes from version 1. The entire library is re-written using RxJava 2. All the Observables are now changed into Singles, so there will be some re-work for you. You also do NOT need to perform these operations in the background thread as it is automatically done for you.
43+
44+
The core functionality of the library remains the same. Every feature in the new version of this library works in the same way and returns the same result as the previous version.
45+
46+
4047
### Spread Some :heart:
41-
[![GitHub stars](https://img.shields.io/github/stars/aritraroy/RxMagneto.svg?style=social&label=Star)](https://github.com/aritraroy) [![GitHub followers](https://img.shields.io/github/followers/aritraroy.svg?style=social&label=Follow)](https://github.com/aritraroy)
42-
[![Twitter Follow](https://img.shields.io/twitter/follow/aritraroy93.svg?style=social)](https://twitter.com/aritraroy93)
48+
[![GitHub stars](https://img.shields.io/github/stars/aritraroy/RxMagneto.svg?style=social&label=Star)](https://github.com/aritraroy) [![GitHub followers](https://img.shields.io/github/followers/aritraroy.svg?style=social&label=Follow)](https://github.com/aritraroy) [![Twitter Follow](https://img.shields.io/twitter/follow/aritraroy93.svg?style=social)](https://twitter.com/aritraroy93)
4349

4450
## Use Cases
4551

@@ -66,7 +72,7 @@ RxMagneto rxMagneto = RxMagneto.getInstance();
6672
rxMagneto.initialize(this);
6773
```
6874

69-
The initialize method takes a Context object. It can either be an Application context or Activity context.
75+
The initialize method takes a `Context` object. It can either be an `Application` context or `Activity` context.
7076

7177

7278
## Quick Example
@@ -77,14 +83,13 @@ Here is a quick example for you to get started right away in less than a minute.
7783
RxMagneto rxMagneto = RxMagneto.getInstance();
7884
rxMagneto.initialize(this);
7985

80-
Observable<String> observable = rxMagneto.grabVersion(packageName);
81-
observable.subscribeOn(Schedulers.io())
82-
.observeOn(AndroidSchedulers.mainThread())
83-
.subscribe(s -> {
84-
Log.d("RxMagneto", "Version: " + s);
85-
}, throwable -> {
86-
Log.d("RxMagneto", "Error");
87-
});
86+
Single<String> version = rxMagneto.grabVersion(packageName);
87+
version.observeOn(AndroidSchedulers.mainThread())
88+
.subscribe(s -> {
89+
Log.d("RxMagneto", "Version: " + s);
90+
}, throwable -> {
91+
Log.d("RxMagneto", "Error");
92+
});
8893
```
8994

9095
## All Features
@@ -97,95 +102,95 @@ Here is a list of all the featues offered by RxMagneto. I will be actively takin
97102
Gets the Play Store URL of the specified package. You can make this call in the main thread of the application.
98103

99104
```java
100-
Observable<String> urlObservable = rxMagneto.grabUrl(packageName);
105+
Single<String> urlSingle = rxMagneto.grabUrl(packageName);
101106
```
102107

103108
### Get Verified Play Store URL
104109

105-
Gets the verified Play Store URL of the specified package. You can NOT make this call in the main thread of the application.
110+
Gets the verified Play Store URL of the specified package. It automatically performs the operation in a background thread, so that you do NOT need to explicitly do it.
106111

107112
```java
108-
Observable<String> urlObservable = rxMagneto.grabVerifiedUrl(packageName);
113+
Single<String> urlSingle = rxMagneto.grabVerifiedUrl(packageName);
109114
```
110115

111116
### Get Version
112117

113-
Gets the latest version of the specified package from Play Store. You can NOT make this call in the main thread of the application.
118+
Gets the latest version of the specified package from Play Store. It automatically performs the operation in a background thread, so that you do NOT need to explicitly do it.
114119

115120
```java
116-
Observable<String> versionObservable = rxMagneto.grabVersion(packageName);
121+
Single<String> versionSingle = rxMagneto.grabVersion(packageName);
117122
```
118123

119124
### Check If Update Is Available
120125

121-
Check if an update is available for the specified package from Play Store. You can NOT make this call in the main thread of the application.
126+
Check if an update is available for the specified package from Play Store. It automatically performs the operation in a background thread, so that you do NOT need to explicitly do it.
122127

123128
```java
124-
Observable<Boolean> updateAvailableObservable = rxMagneto.isUpgradeAvailable(packageName);
129+
Single<Boolean> updateAvailableSingle = rxMagneto.isUpgradeAvailable(packageName);
125130
```
126131

127132
### Get Downloads
128133

129-
Gets the no. of downloads of the specified package from Play Store. You can NOT make this call in the main thread of the application.
134+
Gets the no. of downloads of the specified package from Play Store. It automatically performs the operation in a background thread, so that you do NOT need to explicitly do it.
130135

131136
```java
132-
Observable<String> downloadsObservable = rxMagneto.grabDownloads(packageName);
137+
Single<String> downloadsSingle = rxMagneto.grabDownloads(packageName);
133138
```
134139

135140
### Get Last Published Date
136141

137-
Gets the last published date of the specified package from Play Store. You can NOT make this call in the main thread of the application.
142+
Gets the last published date of the specified package from Play Store. It automatically performs the operation in a background thread, so that you do NOT need to explicitly do it.
138143

139144
```java
140-
Observable<String> publishedDateObservable = rxMagneto.grabPublishedDate(packageName);
145+
Single<String> publishedDateSingle = rxMagneto.grabPublishedDate(packageName);
141146
```
142147

143148
### Get OS Requirements
144149

145-
Gets the OS requirements of the specified package from Play Store. You can NOT make this call in the main thread of the application.
150+
Gets the OS requirements of the specified package from Play Store. It automatically performs the operation in a background thread, so that you do NOT need to explicitly do it.
146151

147152
```java
148-
Observable<String> osRequirementsObservable = rxMagneto.grabOsRequirements(packageName);
153+
Single<String> osRequirementsSingle = rxMagneto.grabOsRequirements(packageName);
149154
```
150155

151156
### Get Content Rating
152157

153-
Gets the content rating of the specified package from Play Store. You can NOT make this call in the main thread of the application.
158+
Gets the content rating of the specified package from Play Store. It automatically performs the operation in a background thread, so that you do NOT need to explicitly do it.
154159

155160
```java
156-
Observable<String> contentRatingObservable = rxMagneto.grabContentRating(packageName);
161+
Single<String> contentRatingSingle = rxMagneto.grabContentRating(packageName);
157162
```
158163

159164
### Get App Rating
160165

161-
Gets the app rating of the specified package from Play Store. You can NOT make this call in the main thread of the application.
166+
Gets the app rating of the specified package from Play Store. It automatically performs the operation in a background thread, so that you do NOT need to explicitly do it.
162167

163168
```java
164-
Observable<String> appRatingObservable = rxMagneto.grabAppRating(packageName);
169+
Single<String> appRatingSingle = rxMagneto.grabAppRating(packageName);
165170
```
166171

167172
### Get App Ratings Count
168173

169-
Gets the no. of app ratings of the specified package from Play Store. You can NOT make this call in the main thread of the application.
174+
Gets the no. of app ratings of the specified package from Play Store. It automatically performs the operation in a background thread, so that you do NOT need to explicitly do it.
170175

171176
```java
172-
Observable<String> appRatingsCount = rxMagneto.grabAppRatingsCount(packageName);
177+
Single<String> appRatingsCountSingle = rxMagneto.grabAppRatingsCount(packageName);
173178
```
174179

175180
### Get Recent Changelog (as Array)
176181

177-
Gets the recent changelog (as array) of the specified package from Play Store. You can NOT make this call in the main thread of the application.
182+
Gets the recent changelog (as array) of the specified package from Play Store. It automatically performs the operation in a background thread, so that you do NOT need to explicitly do it.
178183

179184
```java
180-
Observable<ArrayList<String>> changelogObservable = rxMagneto.grabPlayStoreRecentChangelogArray(packageName);
185+
Single<ArrayList<String>> changelogSingle = rxMagneto.grabPlayStoreRecentChangelogArray(packageName);
181186
```
182187

183188
### Get Recent Changelog (as String)
184189

185-
Gets the recent changelog (as string) of the specified package from Play Store. You can NOT make this call in the main thread of the application.
190+
Gets the recent changelog (as string) of the specified package from Play Store. It automatically performs the operation in a background thread, so that you do NOT need to explicitly do it.
186191

187192
```java
188-
Observable<String> changelogObservable = rxMagneto.grabPlayStoreRecentChangelog(packageName);
193+
Single<String> changelogSingle = rxMagneto.grabPlayStoreRecentChangelog(packageName);
189194
```
190195

191196
# Contribution

app/src/main/java/com/aritraroy/rxmagnetodemo/MainActivity.java

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import io.reactivex.Single;
2727
import io.reactivex.android.schedulers.AndroidSchedulers;
28-
import io.reactivex.schedulers.Schedulers;
2928

3029
public class MainActivity extends AppCompatActivity {
3130

@@ -146,8 +145,7 @@ private void getPlayStoreVersion(String packageName) {
146145
getResources().getString(R.string.message_grabbing));
147146

148147
Single<String> versionSingle = rxMagneto.grabVersion(packageName);
149-
versionSingle.subscribeOn(Schedulers.io())
150-
.observeOn(AndroidSchedulers.mainThread())
148+
versionSingle.observeOn(AndroidSchedulers.mainThread())
151149
.subscribe(s -> {
152150
if (progressDialog != null && progressDialog.isShowing()) {
153151
progressDialog.dismiss();
@@ -167,8 +165,7 @@ private void checkIsUpdateAvailable(String packageName) {
167165
getResources().getString(R.string.message_grabbing));
168166

169167
Single<Boolean> updateAvailableSingle = rxMagneto.isUpgradeAvailable(packageName);
170-
updateAvailableSingle.subscribeOn(Schedulers.io())
171-
.observeOn(AndroidSchedulers.mainThread())
168+
updateAvailableSingle.observeOn(AndroidSchedulers.mainThread())
172169
.subscribe(aBoolean -> {
173170
if (progressDialog != null && progressDialog.isShowing()) {
174171
progressDialog.dismiss();
@@ -190,8 +187,7 @@ private void getDownloads(String packageName) {
190187
getResources().getString(R.string.message_grabbing));
191188

192189
Single<String> downloadsSingle = rxMagneto.grabDownloads(packageName);
193-
downloadsSingle.subscribeOn(Schedulers.io())
194-
.observeOn(AndroidSchedulers.mainThread())
190+
downloadsSingle.observeOn(AndroidSchedulers.mainThread())
195191
.subscribe(s -> {
196192
if (progressDialog != null && progressDialog.isShowing()) {
197193
progressDialog.dismiss();
@@ -212,8 +208,7 @@ private void getLastPublishedDate(String packageName) {
212208
getResources().getString(R.string.message_grabbing));
213209

214210
Single<String> publishedDateSingle = rxMagneto.grabPublishedDate(packageName);
215-
publishedDateSingle.subscribeOn(Schedulers.io())
216-
.observeOn(AndroidSchedulers.mainThread())
211+
publishedDateSingle.observeOn(AndroidSchedulers.mainThread())
217212
.subscribe(s -> {
218213
if (progressDialog != null && progressDialog.isShowing()) {
219214
progressDialog.dismiss();
@@ -234,8 +229,7 @@ private void getOSRequirements(String packageName) {
234229
getResources().getString(R.string.message_grabbing));
235230

236231
Single<String> osRequirementsSingle = rxMagneto.grabOsRequirements(packageName);
237-
osRequirementsSingle.subscribeOn(Schedulers.io())
238-
.observeOn(AndroidSchedulers.mainThread())
232+
osRequirementsSingle.observeOn(AndroidSchedulers.mainThread())
239233
.subscribe(s -> {
240234
if (progressDialog != null && progressDialog.isShowing()) {
241235
progressDialog.dismiss();
@@ -256,8 +250,7 @@ private void getContentRating(String packageName) {
256250
getResources().getString(R.string.message_grabbing));
257251

258252
Single<String> contentRatingSingle = rxMagneto.grabContentRating(packageName);
259-
contentRatingSingle.subscribeOn(Schedulers.io())
260-
.observeOn(AndroidSchedulers.mainThread())
253+
contentRatingSingle.observeOn(AndroidSchedulers.mainThread())
261254
.subscribe(s -> {
262255
if (progressDialog != null && progressDialog.isShowing()) {
263256
progressDialog.dismiss();
@@ -278,8 +271,7 @@ private void getAppRating(String packageName) {
278271
getResources().getString(R.string.message_grabbing));
279272

280273
Single<String> appRatingSingle = rxMagneto.grabAppRating(packageName);
281-
appRatingSingle.subscribeOn(Schedulers.io())
282-
.observeOn(AndroidSchedulers.mainThread())
274+
appRatingSingle.observeOn(AndroidSchedulers.mainThread())
283275
.subscribe(s -> {
284276
if (progressDialog != null && progressDialog.isShowing()) {
285277
progressDialog.dismiss();
@@ -300,8 +292,7 @@ private void getAppRatingsCount(String packageName) {
300292
getResources().getString(R.string.message_grabbing));
301293

302294
Single<String> appRatingsCountSingle = rxMagneto.grabAppRatingsCount(packageName);
303-
appRatingsCountSingle.subscribeOn(Schedulers.io())
304-
.observeOn(AndroidSchedulers.mainThread())
295+
appRatingsCountSingle.observeOn(AndroidSchedulers.mainThread())
305296
.subscribe(s -> {
306297
if (progressDialog != null && progressDialog.isShowing()) {
307298
progressDialog.dismiss();
@@ -322,8 +313,7 @@ private void getRecentChangelog(String packageName) {
322313
getResources().getString(R.string.message_grabbing));
323314

324315
Single<String> changelogSingle = rxMagneto.grabPlayStoreRecentChangelog(packageName);
325-
changelogSingle.subscribeOn(Schedulers.io())
326-
.observeOn(AndroidSchedulers.mainThread())
316+
changelogSingle.observeOn(AndroidSchedulers.mainThread())
327317
.subscribe(s -> {
328318
if (progressDialog != null && progressDialog.isShowing()) {
329319
progressDialog.dismiss();

0 commit comments

Comments
 (0)