[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update styles.xml #13

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7976204
Experimental theme support.
rumboalla Aug 23, 2016
297ace2
Improved multi theme support.
rumboalla Aug 23, 2016
07b7537
Merge remote-tracking branch 'origin/master'
rumboalla Aug 24, 2016
da3dc12
Fixing clearUpdatesFromSharedPrefs.
rumboalla Aug 25, 2016
d1a3130
Cleaning up settings activity.
rumboalla Aug 25, 2016
9e98524
Adding a Toolbar to the Settings Activity.
rumboalla Aug 25, 2016
8070c88
Adding a Toolbar to the Settings Activity.
rumboalla Aug 25, 2016
0e6a320
Fixing default values for ignore list.
rumboalla Aug 26, 2016
6c35c42
Fiixing bug wth notification progress when more than one source was s…
rumboalla Aug 26, 2016
a77ab6e
Updated version number.
rumboalla Aug 27, 2016
9e8c137
Merge remote-tracking branch 'origin/master'
rumboalla Aug 27, 2016
85b4d4d
Fixed issue with notification on 2.3 android devices.
rumboalla Aug 28, 2016
bd54851
Fixed dark themes on 2.3
rumboalla Aug 28, 2016
0487716
Don't mark as error if app not found in Google Play.
rumboalla Aug 29, 2016
afdd97b
Replaced PreferenceActivity for a PreferenceFragmentCompat. App is no…
rumboalla Aug 30, 2016
fd3e7b8
Changing version.
rumboalla Aug 30, 2016
999f90f
Adding SettingsFragment
rumboalla Aug 31, 2016
051ee43
Added a log fragment.
rumboalla Aug 31, 2016
923a87f
Fixed some theming issues with snackbar.
rumboalla Aug 31, 2016
1d5a984
Improving logs.
rumboalla Aug 31, 2016
e7fc28b
Improving logs.
rumboalla Aug 31, 2016
d8514c5
Improved logs.
rumboalla Aug 31, 2016
8061fd8
Fixed theming issue with log.
rumboalla Sep 1, 2016
b27bb44
Saving log instance state.
rumboalla Sep 1, 2016
4132ab7
* Updating versioncode.
rumboalla Oct 10, 2016
8ed5da5
* Updating versioncode.
rumboalla Oct 10, 2016
1ae4df1
* Added missing resource.
rumboalla Oct 11, 2016
21fe679
Update styles.xml
Nov 7, 2016
c8f5927
Merge branch 'master' into patch-2
rumboalla Feb 15, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improving logs.
  • Loading branch information
rumboalla committed Aug 31, 2016
commit 1d5a98489b281b6f4d59ba3b6c3f8a5aec20b0fe
15 changes: 5 additions & 10 deletions app/src/main/java/com/apkupdater/updater/UpdaterAPKMirror.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class UpdaterAPKMirror
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static final private String BaseUrl = "http://www.apkmirror.com";
static final private String Type = "APKMirror";

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Expand All @@ -29,7 +30,7 @@ public UpdaterAPKMirror(
String pname,
String cversion
) {
super(context, pname, cversion);
super(context, pname, cversion, "APKMirror");
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -57,7 +58,6 @@ protected UpdaterStatus parseUrl(
}

// Check all the approws with apps
List<Integer> cversion = VersionUtil.getVersionFromString(mCurrentVersion);
for (Element row: doc.getElementsByClass("listWidget").get(0).getElementsByClass("appRow")) {
try {
String app = row.getElementsByTag("h5").get(0).attr("title");
Expand All @@ -66,23 +66,18 @@ protected UpdaterStatus parseUrl(
continue;
}

int r = VersionUtil.compareVersion(
cversion,
VersionUtil.getVersionFromString(app)
);

if (r == -1) {
if (compareVersions(mCurrentVersion, app) == -1) {
mResultUrl = BaseUrl + row.getElementsByTag("a").get(0).attr("href");
return UpdaterStatus.STATUS_UPDATE_FOUND;
}
} catch (Exception e) {
mError = e;
mError = addCommonInfoToError(e);
return UpdaterStatus.STATUS_ERROR;
}
}
return UpdaterStatus.STATUS_UPDATE_NOT_FOUND;
} catch (Exception e) {
mError = e;
mError = addCommonInfoToError(e);
return UpdaterStatus.STATUS_ERROR;
}
}
Expand Down
13 changes: 4 additions & 9 deletions app/src/main/java/com/apkupdater/updater/UpdaterAPKPure.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class UpdaterAPKPure
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static final private String BaseUrl = "https://apkpure.com";
static final private String Type = "APKPure";

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Expand All @@ -26,7 +27,7 @@ public UpdaterAPKPure(
String pname,
String cversion
) {
super(context, pname, cversion);
super(context, pname, cversion, "APKPure");
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -63,21 +64,15 @@ protected UpdaterStatus parseUrl(
return UpdaterStatus.STATUS_UPDATE_NOT_FOUND;
}

// Check the version
int r = VersionUtil.compareVersion(
VersionUtil.getVersionFromString(mCurrentVersion),
VersionUtil.getVersionFromString(elements.get(0).text())
);

// If version is old, report update
if (r == -1) {
if (compareVersions(mCurrentVersion, elements.get(0).text()) == -1) {
mResultUrl = url;
return UpdaterStatus.STATUS_UPDATE_FOUND;
}

return UpdaterStatus.STATUS_UPDATE_NOT_FOUND;
} catch (Exception e) {
mError = e;
mError = addCommonInfoToError(e);
return UpdaterStatus.STATUS_ERROR;
}
}
Expand Down
38 changes: 37 additions & 1 deletion app/src/main/java/com/apkupdater/updater/UpdaterBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

import android.content.Context;

import com.apkupdater.util.VersionUtil;

import java.util.List;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

public class UpdaterBase
Expand All @@ -18,19 +22,22 @@ public class UpdaterBase
protected Throwable mError;
protected UpdaterStatus mResultStatus;
protected String mCurrentVersion;
protected String mUpdaterType;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

UpdaterBase(
Context context,
String pname,
String cversion
String cversion,
String type
) {
super(context);
mCurrentVersion = cversion;
mResultUrl = "";
mPname = pname;
mResultStatus = parseUrl(getUrl(mPname));
mUpdaterType = type;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -51,6 +58,35 @@ protected UpdaterStatus parseUrl(

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

protected Throwable addCommonInfoToError(
Throwable error
) {
return new Exception(error.getMessage() == null ? "" : error.getMessage() + " | App: " + mPname + " | Source: " + mUpdaterType);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

protected int compareVersions(
String cv,
String ev
)
throws Exception
{
List<Integer> cvl = VersionUtil.getVersionFromString(cv);
if (cvl == null) {
throw new Exception("Unable to parse version: " + cv + ".");
}

List<Integer> evl = VersionUtil.getVersionFromString(ev);
if (evl == null) {
throw new Exception("Unable to parse version: " + ev + ".");
}

return VersionUtil.compareVersion(cvl, evl);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

@Override
public String getResultUrl(
) {
Expand Down
13 changes: 4 additions & 9 deletions app/src/main/java/com/apkupdater/updater/UpdaterGooglePlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public UpdaterGooglePlay(
String pname,
String cversion
) {
super(context, pname, cversion);
super(context, pname, cversion, "GooglePlay");
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -55,12 +55,7 @@ protected UpdaterStatus parseUrl(
return UpdaterStatus.STATUS_UPDATE_NOT_FOUND;
}

int r = VersionUtil.compareVersion(
VersionUtil.getVersionFromString(mCurrentVersion),
VersionUtil.getVersionFromString(elements.get(0).text())
);

if (r == -1) {
if (compareVersions(mCurrentVersion, elements.get(0).text()) == -1) {
mResultUrl = DownloadUrl + mPname;
return UpdaterStatus.STATUS_UPDATE_FOUND;
}
Expand All @@ -70,11 +65,11 @@ protected UpdaterStatus parseUrl(
if (status.getStatusCode() == 404) {
return UpdaterStatus.STATUS_UPDATE_NOT_FOUND;
} else {
mError = status;
mError = addCommonInfoToError(status);
return UpdaterStatus.STATUS_ERROR;
}
} catch (Exception e) {
mError = e;
mError = addCommonInfoToError(e);
return UpdaterStatus.STATUS_ERROR;
}
}
Expand Down