Skip to content

Commit 08aa088

Browse files
committed
Add alot of new stuff
1 parent 6f5fc1c commit 08aa088

File tree

87 files changed

+1823
-150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1823
-150
lines changed

AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232

3333
<application
3434
android:allowBackup="false"
35-
android:icon="@drawable/ic_launcher"
35+
android:icon="@mipmap/ic_launcher"
36+
android:roundIcon="@mipmap/ic_launcher_round"
3637
android:label="@string/app_name"
3738
android:resizeableActivity="true"
3839
android:supportsPictureInPicture="false"
@@ -45,6 +46,7 @@
4546
android:configChanges="orientation|keyboardHidden|screenSize|keyboard"
4647
android:label="@string/app_name"
4748
android:launchMode="singleTop"
49+
4850
android:theme="@style/Theme.Nethunter">
4951
<intent-filter android:label="@string/app_nav_home_label">
5052
<action android:name="android.intent.action.MAIN" />
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
compileSdkVersion 28
5+
buildToolsVersion '29.0.2'
6+
useLibrary 'org.apache.http.legacy'
7+
8+
defaultConfig {
9+
minSdkVersion 14
10+
targetSdkVersion 28
11+
}
12+
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
17+
}
18+
}
19+
}
20+
21+
repositories {
22+
mavenCentral()
23+
jcenter()
24+
maven {
25+
url "https://maven.google.com"
26+
}
27+
}
28+
29+
dependencies {
30+
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
31+
implementation 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'
32+
implementation 'androidx.appcompat:appcompat:1.1.0'
33+
}

androidwversionmanager/license.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Android WVersion Manager
2+
3+
#########################################################
4+
https://github.com/winsontan520/Android-WVersionManager
5+
#########################################################
6+
7+
Copyright 2013 Winson Tan
8+
9+
Licensed under the Apache License, Version 2.0 (the "License");
10+
you may not use this file except in compliance with the License.
11+
You may obtain a copy of the License at
12+
13+
http://www.apache.org/licenses/LICENSE-2.0
14+
15+
Unless required by applicable law or agreed to in writing, software
16+
distributed under the License is distributed on an "AS IS" BASIS,
17+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
See the License for the specific language governing permissions and
19+
limitations under the License.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.winsontan520.wversionmanager.library"
3+
android:versionCode="3"
4+
android:versionName="1.3" >
5+
6+
<application
7+
android:label="@string/app_name"
8+
android:theme="@style/AppTheme" >
9+
</application>
10+
11+
</manifest>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.winsontan520.wversionmanager.library;
2+
3+
import org.xml.sax.XMLReader;
4+
5+
import android.text.Editable;
6+
import android.text.Html.TagHandler;
7+
8+
public class CustomTagHandler implements TagHandler{
9+
10+
@Override
11+
public void handleTag(boolean opening, String tag, Editable output,
12+
XMLReader xmlReader) {
13+
// you may add more tag handler which are not supported by android here
14+
if("li".equals(tag)){
15+
if(opening){
16+
output.append(" \u2022 ");
17+
}else{
18+
output.append("\n");
19+
}
20+
}
21+
}
22+
}
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
package com.winsontan520.wversionmanager.library;
2+
3+
import android.Manifest;
4+
import android.graphics.drawable.Drawable;
5+
6+
import androidx.annotation.NonNull;
7+
import androidx.annotation.Nullable;
8+
import androidx.annotation.RequiresPermission;
9+
10+
public interface IWVersionManager {
11+
/**
12+
* Displays a dialog asking user to rate your app
13+
*/
14+
public void askForRate();
15+
16+
/**
17+
* Initiates check for updates that may result in displaying a dialog with release notes
18+
* and options to update now, remind user about it later or ignore that version
19+
*/
20+
public void checkVersion();
21+
22+
/**
23+
* Initiates check for updates that may result in displaying a dialog with release notes
24+
* and options to update now, remind user about it later or ignore that version
25+
* @param forced <code>true</code> if you want to ignore reminder timer,
26+
* <code>false</code> otherwise
27+
*/
28+
public void checkVersion(boolean forced);
29+
30+
/**
31+
* @param icon Drawable of icon in dialog
32+
*/
33+
public void setIcon(@Nullable Drawable icon);
34+
35+
/**
36+
* @param title Title of dialog
37+
*/
38+
public void setTitle(@Nullable String title);
39+
40+
/**
41+
* @param message Message of dialog
42+
*/
43+
public void setMessage(@Nullable String message);
44+
45+
/**
46+
* Used to choose if Android's Download Manager should be used to download file at URL
47+
* from JSON file to Downloads folder (off by default) instead of opening a link in a browser
48+
* @param value <code>true</code> to use Download Manager, <code>false</code> otherwise
49+
*/
50+
@RequiresPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
51+
public void useDownloadManager(boolean value);
52+
53+
/**
54+
* Setting this to <code>true</code> when {@link #useDownloadManager(boolean)}
55+
* is also <code>true</code> will automatically fire APK installation dialog after download completes.
56+
* This requires Unknown Sources to be enabled (globally on Nougat and lower,
57+
* for your app specifically in Oreo or higher). If permission is not granted,
58+
* system's Download app will be launched.
59+
* @param value <code>true</code> to enable auto install, <code>false</code> otherwise
60+
*/
61+
@RequiresPermission(anyOf = {Manifest.permission.REQUEST_INSTALL_PACKAGES, Manifest.permission.INSTALL_PACKAGES})
62+
public void installAfterDownload(boolean value);
63+
64+
/**
65+
* @return message of dialog
66+
*/
67+
public @NonNull String getMessage();
68+
69+
/**
70+
* @return title of dialog
71+
*/
72+
public @NonNull String getTitle();
73+
74+
/**
75+
* @return drawable of icon
76+
*/
77+
public @NonNull Drawable getIcon();
78+
79+
/**
80+
* @return url to execute when update now button clicked. Default value is the link in google play based on app package name.
81+
*/
82+
public @NonNull String getUpdateUrl();
83+
84+
/**
85+
* @param updateUrl Set url to execute when update now button clicked
86+
*/
87+
public void setUpdateUrl(@Nullable String updateUrl);
88+
89+
/**
90+
* @return url which should return update content in json format
91+
*/
92+
public @Nullable String getVersionContentUrl();
93+
94+
/**
95+
* @param versionContentUrl Set the update content url
96+
*/
97+
public void setVersionContentUrl(@NonNull String versionContentUrl);
98+
99+
/**
100+
* @param minutes Set reminder time in minutes when remind me later button clicked
101+
*/
102+
public void setReminderTimer(int minutes);
103+
104+
/**
105+
* @return reminder timer in minutes
106+
*/
107+
public int getReminderTimer();
108+
109+
/**
110+
* @return current version code
111+
*/
112+
public int getCurrentVersionCode();
113+
114+
/**
115+
* @return version code which will be ignored
116+
*/
117+
public int getIgnoreVersionCode();
118+
119+
/**
120+
* @return whenever last received update data was telling that its blocking (app won't
121+
* function properly without it for long, for example due to server side changes).
122+
*/
123+
public boolean isBlockingUpdate();
124+
125+
/**
126+
* @return value telling if update dialog will be cancelable or not
127+
*/
128+
public boolean isDialogCancelable();
129+
130+
/**
131+
* @param dialogCancelable sets if update dialog should be cancelable or not
132+
*/
133+
public void setDialogCancelable(boolean dialogCancelable);
134+
135+
/**
136+
* @return CustomTagHandler object
137+
*/
138+
public @Nullable CustomTagHandler getCustomTagHandler();
139+
140+
/**
141+
* @param customTagHandler Set your own custom tag handler
142+
*/
143+
public void setCustomTagHandler(@Nullable CustomTagHandler customTagHandler);
144+
145+
/**
146+
* @param listener Set your own callback listener when receiving response from server.
147+
* Must implement {@link OnReceiveListener} interface.
148+
*/
149+
public void setOnReceiveListener(@Nullable OnReceiveListener listener);
150+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.winsontan520.wversionmanager.library;
2+
3+
public interface OnReceiveListener {
4+
5+
/**
6+
* Listener called once HTTP GET request for json file with update data is processed.
7+
*
8+
* @param status response code from HTTP request
9+
* @param isBlocking whenever update is blocking
10+
* @param result response data from HTTP request
11+
* @return return true to show default library dialog, false otherwise
12+
*/
13+
boolean onReceive(int status, boolean isBlocking, String result);
14+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.winsontan520.wversionmanager.library;
2+
3+
import androidx.core.content.FileProvider;
4+
5+
public class UpdateFileProvider extends FileProvider { }

0 commit comments

Comments
 (0)