Parse expiry date from website as well, added new screenshots
@ -28,6 +28,7 @@ Changelog
|
|||||||
----------------------
|
----------------------
|
||||||
0.5.2:
|
0.5.2:
|
||||||
1. New icon custom made for this app by cluck's deSiGN studio and released under CC-BY-SA-3.0, thanks!
|
1. New icon custom made for this app by cluck's deSiGN studio and released under CC-BY-SA-3.0, thanks!
|
||||||
|
2. Parse balance expiry date from website as well.
|
||||||
|
|
||||||
0.5.1:
|
0.5.1:
|
||||||
1. Page Plus requested I remove the app from the market because I am infringing on their IP, so this update changes the icon. New icon is © Nevit Dilmen [CC-BY-SA-3.0 or GFDL], via Wikimedia Commons
|
1. Page Plus requested I remove the app from the market because I am infringing on their IP, so this update changes the icon. New icon is © Nevit Dilmen [CC-BY-SA-3.0 or GFDL], via Wikimedia Commons
|
||||||
@ -88,4 +89,6 @@ Contributors
|
|||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
----------------------
|
----------------------
|
||||||
1. You suggest it, via a github issue or email!
|
1. Page plus sends dates in 3 different formats, '2013-06-21', 'June 21, 2013', and '6/21/2013',
|
||||||
|
perhaps parse those and display them in a single format?
|
||||||
|
2. You suggest it, via a github issue or email!
|
||||||
|
@ -8,3 +8,4 @@ convert -background none -resize 48x48\! ./orig/owl.svg ../res/drawable-mdpi/i
|
|||||||
# screen shots
|
# screen shots
|
||||||
convert -resize 480x854\! ./orig/ss1.png ss1.png
|
convert -resize 480x854\! ./orig/ss1.png ss1.png
|
||||||
convert -resize 480x854\! ./orig/ss2.png ss2.png
|
convert -resize 480x854\! ./orig/ss2.png ss2.png
|
||||||
|
convert -resize 480x854\! ./orig/ss3.png ss3.png
|
||||||
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 57 KiB |
BIN
android/market/orig/ss3.png
Normal file
After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 82 KiB |
BIN
android/market/ss3.png
Normal file
After Width: | Height: | Size: 93 KiB |
@ -7,6 +7,8 @@ import android.os.Bundle;
|
|||||||
import android.telephony.SmsMessage;
|
import android.telephony.SmsMessage;
|
||||||
import org.moparisthebest.pageplus.dto.Balance;
|
import org.moparisthebest.pageplus.dto.Balance;
|
||||||
|
|
||||||
|
import static org.moparisthebest.pageplus.dto.Balance.regexStrip;
|
||||||
|
|
||||||
public class SMSReceiver extends BroadcastReceiver {
|
public class SMSReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -29,15 +31,10 @@ public class SMSReceiver extends BroadcastReceiver {
|
|||||||
// split string by newlines
|
// split string by newlines
|
||||||
final String[] msgLines = message.split("\n");
|
final String[] msgLines = message.split("\n");
|
||||||
final Balance balance = new Balance();
|
final Balance balance = new Balance();
|
||||||
final String regexStrip = "^[^:]*: ";
|
|
||||||
// get balance
|
// get balance
|
||||||
balance.info[0] = String.format("%s (expires %s)",
|
balance.setBalance(msgLines[0], msgLines[1]);
|
||||||
msgLines[0].replaceFirst(regexStrip, ""),
|
|
||||||
msgLines[1].replaceFirst(regexStrip, ""));
|
|
||||||
// get plan
|
// get plan
|
||||||
balance.info[1] = String.format("%s (expires %s)",
|
balance.setPlan(msgLines[2], msgLines[3]);
|
||||||
msgLines[2],
|
|
||||||
msgLines[3].replaceFirst(regexStrip, ""));
|
|
||||||
// get minutes
|
// get minutes
|
||||||
balance.info[2] = msgLines[4].replaceFirst(regexStrip, "");
|
balance.info[2] = msgLines[4].replaceFirst(regexStrip, "");
|
||||||
// get text
|
// get text
|
||||||
|
@ -3,8 +3,11 @@ package org.moparisthebest.pageplus.dto;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class Balance {
|
public class Balance {
|
||||||
|
public static final String regexStrip = "^[^:]*: ";
|
||||||
|
|
||||||
private static final String[] names = new String[]{"Balance", "Plan", "Minutes", "SMS", "Data"};
|
private static final String[] names = new String[]{"Balance", "Plan", "Minutes", "SMS", "Data"};
|
||||||
private static String compactFormatDelim = "\n";
|
private static final String compactFormatDelim = "\n";
|
||||||
|
private static final String format = "%s (Expiring %s)";
|
||||||
|
|
||||||
public final String[] info = new String[names.length];
|
public final String[] info = new String[names.length];
|
||||||
public String error = null;
|
public String error = null;
|
||||||
@ -59,6 +62,20 @@ public class Balance {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Balance setBalance(String balance, String date) {
|
||||||
|
this.info[0] = String.format(format,
|
||||||
|
balance == null ? "" : balance.replaceFirst(regexStrip, ""),
|
||||||
|
date == null ? "" : date.replaceFirst(regexStrip, ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Balance setPlan(String plan, String date) {
|
||||||
|
this.info[1] = String.format(format,
|
||||||
|
plan == null ? "" : plan.replaceFirst(regexStrip, ""),
|
||||||
|
date == null ? "" : date.replaceFirst(regexStrip, ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Balance setError(String error) {
|
public Balance setError(String error) {
|
||||||
this.error = error;
|
this.error = error;
|
||||||
successDate = null;
|
successDate = null;
|
||||||
|
@ -104,14 +104,17 @@ public class PagePlusHTTP extends PPInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//System.out.println("doc: " + doc.html());
|
//System.out.println("doc: " + doc.html());
|
||||||
int index = -1;
|
|
||||||
try {
|
try {
|
||||||
ret.info[++index] = doc.select("span[id=ContentPlaceHolderDefault_mainContentArea_Item2_My Account Summary_5_Registred1_lblBalance]").first().text();
|
ret.setBalance(
|
||||||
|
doc.select("span[id=ContentPlaceHolderDefault_mainContentArea_Item2_My Account Summary_5_Registred1_lblBalance]").first().text(),
|
||||||
|
doc.select("span[id=ContentPlaceHolderDefault_mainContentArea_Item2_My Account Summary_5_Registred1_lblExpiryDate]").first().text()
|
||||||
|
);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
final Element balance = doc.select("div[id=ContentPlaceHolderDefault_mainContentArea_Item2_My Account Summary_5_Registred1_divBundleDetails]").first();
|
final Element balance = doc.select("div[id=ContentPlaceHolderDefault_mainContentArea_Item2_My Account Summary_5_Registred1_divBundleDetails]").first();
|
||||||
|
int index = 0;
|
||||||
ret.info[++index] = balance.select("tr.tableHeading").first().text();
|
ret.info[++index] = balance.select("tr.tableHeading").first().text();
|
||||||
for (Element row : balance.select("tr.odd").first().select("td"))
|
for (Element row : balance.select("tr.odd").first().select("td"))
|
||||||
ret.info[++index] = row.text();
|
ret.info[++index] = row.text();
|
||||||
|