├── .gitattributes
├── .gitignore
├── README.md
├── app
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ ├── Montserrat-Regular.ttf
│ ├── countries.json
│ ├── nopie_openvpn.arm64-v8a
│ ├── nopie_openvpn.armeabi
│ ├── nopie_openvpn.armeabi-v7a
│ ├── nopie_openvpn.mips
│ ├── nopie_openvpn.x86
│ ├── nopie_openvpn.x86_64
│ ├── pie_openvpn.arm64-v8a
│ ├── pie_openvpn.armeabi
│ ├── pie_openvpn.armeabi-v7a
│ ├── pie_openvpn.mips
│ ├── pie_openvpn.x86
│ ├── pie_openvpn.x86_64
│ └── world_map.geo.json
│ ├── java
│ └── com
│ │ └── oneconnect
│ │ └── demoapp
│ │ ├── AdManager.java
│ │ ├── OneConnect.java
│ │ ├── OneConnectActivities
│ │ ├── ActivityOneConnect.kt
│ │ ├── MainActivity.java
│ │ ├── OneConnectPolicy.java
│ │ ├── OneConnectPolicyDetails.java
│ │ ├── Servers.java
│ │ ├── SplashScreen.java
│ │ ├── SubscriptionsActivity.java
│ │ └── Utility.java
│ │ ├── OneConnectAdapter
│ │ ├── FBNativeAdapter.java
│ │ ├── RecyclerViewAdapterWrapper.java
│ │ ├── ServerAdapter.java
│ │ ├── ServerFreeAdapter.java
│ │ └── ServerProAdapter.java
│ │ ├── OneConnectFragments
│ │ ├── OneConnectFree.java
│ │ └── OneConnectPro.java
│ │ ├── OneConnectModel
│ │ └── Countries.java
│ │ ├── SubscriptionId.java
│ │ ├── Utils
│ │ ├── Constants.java
│ │ └── CustomTxTRegular.java
│ │ └── ui
│ │ └── SideBarActivity.kt
│ └── res
│ ├── drawable-hdpi
│ ├── flag_default.png
│ ├── flag_image.png
│ ├── ic_drop_down.png
│ └── logo.png
│ ├── drawable-ldpi
│ ├── flag_default.png
│ ├── flag_image.png
│ └── logo.png
│ ├── drawable-mdpi
│ ├── flag_default.png
│ ├── flag_image.png
│ ├── ic_drop_down.png
│ └── logo.png
│ ├── drawable-xhdpi
│ ├── flag_default.png
│ ├── flag_image.png
│ ├── ic_drop_down.png
│ ├── logo.png
│ └── trans.png
│ ├── drawable-xxhdpi
│ ├── flag_default.png
│ ├── ic_drop_down.png
│ └── logo.png
│ ├── drawable-xxxhdpi
│ ├── flag_default.png
│ ├── ic_drop_down.png
│ └── logo.png
│ ├── drawable
│ ├── button_background.xml
│ ├── button_bg2.xml
│ ├── connect_btn1.xml
│ ├── connect_btn2.xml
│ ├── connect_btn2_on.xml
│ ├── connect_btn3.xml
│ ├── connect_btn3_on.xml
│ ├── ic_baseline_arrow_back_ios_24.xml
│ ├── ic_baseline_location_on_24.xml
│ ├── ic_baseline_power_settings_new_24.xml
│ ├── ic_baseline_signal_cellular_alt_24.xml
│ ├── ic_baseline_signal_cellular_alt_24_off.xml
│ ├── logo.png
│ ├── main_bg.xml
│ ├── main_bg2.xml
│ ├── one_month.xml
│ ├── premium_server.png
│ ├── white_round_2.xml
│ └── white_rounded_bg.xml
│ ├── layout
│ ├── free_item.xml
│ ├── free_server.xml
│ ├── item_facebook_native_ad.xml
│ ├── item_facebook_native_ad_outline.xml
│ ├── layout_bottom_sheet.xml
│ ├── main_activity.xml
│ ├── native_banner_ad_layout.xml
│ ├── native_layout.xml
│ ├── oneconnect_main.xml
│ ├── oneconnect_policy.xml
│ ├── oneconnect_tab.xml
│ ├── privacy_policy.xml
│ ├── pro_item.xml
│ ├── pro_server.xml
│ ├── splash.xml
│ ├── subscription.xml
│ └── subscription_item.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-ldpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ ├── raw
│ ├── homel.json
│ ├── main_load.json
│ └── server_loading.json
│ ├── values-v21
│ └── styles.xml
│ ├── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
│ └── xml
│ └── network_security_config.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # Intellij
36 | *.iml
37 | .idea/workspace.xml
38 | .idea/tasks.xml
39 | .idea/gradle.xml
40 | .idea/dictionaries
41 | .idea/libraries
42 | .idea
43 |
44 | # Keystore files
45 | *.jks
46 |
47 | # External native build folder generated in Android Studio 2.2 and later
48 | .externalNativeBuild
49 |
50 | # Google Services (e.g. APIs or Firebase)
51 | google-services.json
52 |
53 | # Freeline
54 | freeline.py
55 | freeline/
56 | freeline_project_description.json
57 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
We Accept the Payment Via Coincardx.com and Debit & Credit Card For Buy Paid Plans
2 |
3 | Click here to View Detailed Documentation
4 |
5 |
6 |
7 | This SDK Project is Created By OneConnect Team.
8 | # This Project Content OneConnect Library
9 |
10 | # For Use, the SDK Required OneConnect API Key,
11 | Visit on this Website https://developer.oneconnect.top and Create Account and get the Key.
12 |
13 | # Once You have the OneConnect API Key, Then You have Put inside SplashScreen.java
14 | You will Get the Key inside API Tab https://developer.oneconnect.top/dashboard/api/
15 | After that, You need to Put Your App Package Name Inside OneConnect API Tab.
16 |
17 |
18 |
19 | # You have to Put inside SplashScreen.java Please See Screenshot
20 |
21 |
22 |
# This Project Content AdMob & Facebook Ads those developers want to Add Another Ads SDK
23 | they need to follow the Exiting Method of Ads SDK and Also Have IAP Subscription.
24 |
25 | # And Need to Put Your Google-Services.JSON file inside Project, You will get from Firebase.
26 |
27 | # For Full Documentation, Visit on GitHub Our Official Developer Page https://github.com/oneconnectapi
28 |
29 | # Note :- Any Developer, those who want to Use or Sell for end Client
30 | they need to make the sufficient Changes in the Original Demo Project.
31 |
32 | # Just Smile after get the Project..... (^_^)
33 |
34 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 |
2 | apply plugin: 'com.android.application'
3 | apply plugin: 'com.google.gms.google-services'
4 | apply plugin: 'kotlin-android'
5 | apply plugin: 'kotlin-android-extensions'
6 |
7 | ext {
8 | androidSupportLibraryVersion = "28.0.0"
9 | }
10 |
11 | android {
12 | compileSdkVersion 33
13 |
14 | packagingOptions {
15 | pickFirst '**/*.so'
16 | }
17 |
18 | defaultConfig {
19 | configurations.all {
20 | resolutionStrategy { force 'androidx.core:core-ktx:1.6.0' }
21 | }
22 | applicationId 'com.oneconnect.demoapp'
23 | minSdkVersion 21
24 | targetSdkVersion 33
25 | versionCode 1
26 | versionName "1.0"
27 |
28 |
29 | multiDexEnabled true
30 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
31 | vectorDrawables.useSupportLibrary = true
32 | dataBinding {
33 | enabled = true
34 | }
35 | }
36 |
37 | buildTypes {
38 | release {
39 |
40 | lintOptions {
41 | disable 'MissingTranslation'
42 | checkReleaseBuilds false
43 | abortOnError false
44 | }
45 |
46 | debuggable false
47 | jniDebuggable false
48 | renderscriptDebuggable false
49 | pseudoLocalesEnabled false
50 | zipAlignEnabled true
51 | shrinkResources false
52 | minifyEnabled false
53 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
54 |
55 | }
56 | debug {
57 | }
58 | }
59 | compileOptions {
60 | sourceCompatibility 1.8
61 | targetCompatibility 1.8
62 | }
63 |
64 | kotlinOptions {
65 | jvmTarget = "1.8"
66 | }
67 | }
68 |
69 | dependencies {
70 | implementation fileTree(dir: 'libs', include: ['*.jar'])
71 |
72 | // OneConnect Implementation
73 | implementation 'com.github.oneconnectapi:OneConnectLib:v1.1.0'
74 | // OneConnect Implementation
75 |
76 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
77 | implementation 'androidx.appcompat:appcompat:1.1.0'
78 | implementation 'androidx.annotation:annotation:1.2.0'
79 | implementation 'androidx.cardview:cardview:1.0.0'
80 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
81 | implementation 'androidx.legacy:legacy-support-v4:1.0.0'
82 | implementation 'androidx.multidex:multidex:2.0.1'
83 | implementation 'androidx.recyclerview:recyclerview:1.1.0'
84 | implementation 'com.android.volley:volley:1.1.1'
85 | implementation 'com.android.billingclient:billing:3.0.3'
86 | implementation 'com.cardiomood.android:android-widgets:0.1.1'
87 | implementation 'com.etebarian:meow-bottom-navigation:1.2.0'
88 | implementation 'com.facebook.android:audience-network-sdk:6.6.0'
89 | implementation 'com.github.anastr:speedviewlib:1.3.0'
90 | implementation 'com.github.bmarrdev:android-DecoView-charting:v1.2'
91 | implementation 'com.github.bumptech.glide:glide:4.10.0'
92 | annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
93 | implementation 'com.github.daoibrahim:AdmobAdvancedNativeRecyclerview:1.0.0'
94 | implementation 'com.github.GrenderG:Toasty:1.2.5'
95 | implementation 'com.github.javiersantos:MaterialStyledDialogs:2.1'
96 | implementation 'com.github.oatrice:internet-speed-testing:1.0.1'
97 | implementation 'com.github.Shashank02051997:FancyAlertDialog-Android:0.1'
98 | implementation 'com.github.Shashank02051997:FancyGifDialog-Android:1.2'
99 | implementation 'com.google.android.gms:play-services-ads:20.3.0'
100 | implementation 'com.google.android.gms:play-services-basement:17.6.0'
101 | implementation 'com.google.android.material:material:1.0.0'
102 | implementation 'com.google.android.play:core:1.10.0'
103 | implementation 'com.google.android.play:core-ktx:1.8.1'
104 | implementation 'com.google.firebase:firebase-analytics:19.0.1'
105 | implementation 'com.google.firebase:firebase-database:20.0.2'
106 | implementation 'com.infideap.drawerbehavior:drawer-behavior:1.0.4'
107 | implementation 'com.intuit.sdp:sdp-android:1.0.4'
108 | implementation 'com.jakewharton:butterknife:10.1.0'
109 | annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
110 | def work_version = "2.7.0"
111 | implementation "androidx.work:work-runtime:$work_version"
112 | implementation "androidx.work:work-runtime-ktx:$work_version"
113 | implementation 'com.pixplicity.easyprefs:library:1.9.0'
114 | implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
115 | implementation 'com.yarolegovich:lovely-dialog:1.1.0'
116 | implementation 'com.zys:brokenview:1.0.3'
117 | implementation 'devlight.io:navigationtabbar:1.2.5'
118 | implementation 'fr.bmartel:jspeedtest:1.32.1'
119 | implementation 'io.github.dreierf:material-intro-screen:0.0.6'
120 | implementation 'jp.wasabeef:recyclerview-animators:2.2.5'
121 | implementation 'me.itangqi.waveloadingview:library:0.3.5'
122 | implementation 'net.cachapa.expandablelayout:expandablelayout:[2.9.2]'
123 | implementation 'net.grandcentrix.tray:tray:0.12.0'
124 | implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'
125 | implementation 'com.codemybrainsout.rating:ratingdialog:1.0.8';
126 | implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]'
127 | implementation 'com.github.jama5262:CarouselView:1.1.0'
128 | implementation 'com.google.ads.mediation:facebook:6.6.0.0'
129 | implementation 'com.google.android.ads:mediation-test-suite:2.0.0'
130 | implementation 'com.google.ads.mediation:facebook:6.6.0.0'
131 | implementation 'com.google.android.ads:mediation-test-suite:2.0.0'
132 | implementation 'com.github.bumptech.glide:glide:4.10.0'
133 | annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
134 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
135 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
136 |
137 | def lottieVersion = '3.3.1'
138 | implementation "com.airbnb.android:lottie:$lottieVersion"
139 |
140 | testImplementation 'junit:junit:4.12'
141 |
142 | }
143 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flag in this file are appended to flag specified
3 | # in /usr/local/Cellar/android-sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
40 |
41 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
54 |
55 |
56 |
57 |
63 |
64 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/app/src/main/assets/Montserrat-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/assets/Montserrat-Regular.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/nopie_openvpn.arm64-v8a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/assets/nopie_openvpn.arm64-v8a
--------------------------------------------------------------------------------
/app/src/main/assets/nopie_openvpn.armeabi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/assets/nopie_openvpn.armeabi
--------------------------------------------------------------------------------
/app/src/main/assets/nopie_openvpn.armeabi-v7a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/assets/nopie_openvpn.armeabi-v7a
--------------------------------------------------------------------------------
/app/src/main/assets/nopie_openvpn.mips:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/assets/nopie_openvpn.mips
--------------------------------------------------------------------------------
/app/src/main/assets/nopie_openvpn.x86:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/assets/nopie_openvpn.x86
--------------------------------------------------------------------------------
/app/src/main/assets/nopie_openvpn.x86_64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/assets/nopie_openvpn.x86_64
--------------------------------------------------------------------------------
/app/src/main/assets/pie_openvpn.arm64-v8a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/assets/pie_openvpn.arm64-v8a
--------------------------------------------------------------------------------
/app/src/main/assets/pie_openvpn.armeabi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/assets/pie_openvpn.armeabi
--------------------------------------------------------------------------------
/app/src/main/assets/pie_openvpn.armeabi-v7a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/assets/pie_openvpn.armeabi-v7a
--------------------------------------------------------------------------------
/app/src/main/assets/pie_openvpn.mips:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/assets/pie_openvpn.mips
--------------------------------------------------------------------------------
/app/src/main/assets/pie_openvpn.x86:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/assets/pie_openvpn.x86
--------------------------------------------------------------------------------
/app/src/main/assets/pie_openvpn.x86_64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/assets/pie_openvpn.x86_64
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/AdManager.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 |
12 | import android.app.Activity;
13 | import android.content.Context;
14 |
15 | import androidx.annotation.NonNull;
16 | import androidx.annotation.Nullable;
17 |
18 | import com.google.android.gms.ads.AdRequest;
19 | import com.google.android.gms.ads.FullScreenContentCallback;
20 | import com.google.android.gms.ads.OnPaidEventListener;
21 | import com.google.android.gms.ads.ResponseInfo;
22 | import com.google.android.gms.ads.interstitial.InterstitialAd;
23 |
24 | public class AdManager {
25 | static InterstitialAd ad;
26 | private Context ctx;
27 |
28 | public AdManager(Context ctx) {
29 | this.ctx = ctx;
30 | createAd();
31 | }
32 |
33 | public void createAd() {
34 | ad = new InterstitialAd() {
35 | @NonNull
36 | @Override
37 | public String getAdUnitId() {
38 | return null;
39 | }
40 |
41 | @Override
42 | public void show(@NonNull Activity activity) {
43 |
44 | }
45 |
46 | @Override
47 | public void setFullScreenContentCallback(@Nullable FullScreenContentCallback fullScreenContentCallback) {
48 |
49 | }
50 |
51 | @Nullable
52 | @Override
53 | public FullScreenContentCallback getFullScreenContentCallback() {
54 | return null;
55 | }
56 |
57 | @Override
58 | public void setImmersiveMode(boolean b) {
59 |
60 | }
61 |
62 | @NonNull
63 | @Override
64 | public ResponseInfo getResponseInfo() {
65 | return null;
66 | }
67 |
68 | @Override
69 | public void setOnPaidEventListener(@Nullable OnPaidEventListener onPaidEventListener) {
70 |
71 | }
72 |
73 | @Nullable
74 | @Override
75 | public OnPaidEventListener getOnPaidEventListener() {
76 | return null;
77 | }
78 | };
79 |
80 |
81 | final AdRequest adRequest = new AdRequest.Builder().build();
82 |
83 |
84 |
85 | }
86 |
87 | public InterstitialAd getAd() {
88 | return ad;
89 | }
90 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnect.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 | import android.app.Application;
12 |
13 |
14 | public class OneConnect extends Application {
15 |
16 |
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectActivities/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectActivities;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 | import android.app.NotificationChannel;
12 | import android.app.NotificationManager;
13 | import android.content.BroadcastReceiver;
14 | import android.content.Context;
15 | import android.content.Intent;
16 | import android.content.IntentFilter;
17 | import android.content.IntentSender;
18 | import android.net.VpnService;
19 | import android.os.Build;
20 | import android.os.Bundle;
21 | import android.os.PersistableBundle;
22 | import android.os.RemoteException;
23 | import android.text.TextUtils;
24 | import android.util.Log;
25 |
26 | import androidx.annotation.NonNull;
27 | import androidx.annotation.Nullable;
28 | import androidx.localbroadcastmanager.content.LocalBroadcastManager;
29 | import com.android.billingclient.api.BillingClient;
30 | import com.android.billingclient.api.BillingClientStateListener;
31 | import com.android.billingclient.api.BillingResult;
32 | import com.android.billingclient.api.Purchase;
33 | import com.android.billingclient.api.PurchasesUpdatedListener;
34 | import com.android.billingclient.api.SkuDetails;
35 | import com.android.billingclient.api.SkuDetailsParams;
36 | import com.bumptech.glide.Glide;
37 | import com.codemybrainsout.ratingdialog.RatingDialog;
38 | import com.google.android.gms.ads.MobileAds;
39 | import com.google.android.gms.ads.initialization.InitializationStatus;
40 | import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
41 | import com.google.android.gms.ads.interstitial.InterstitialAd;
42 | import com.google.android.play.core.appupdate.AppUpdateInfo;
43 | import com.google.android.play.core.appupdate.AppUpdateManager;
44 | import com.google.android.play.core.appupdate.AppUpdateManagerFactory;
45 | import com.google.android.play.core.install.model.AppUpdateType;
46 | import com.google.android.play.core.install.model.UpdateAvailability;
47 | import com.google.android.play.core.tasks.OnSuccessListener;
48 | import com.google.android.play.core.tasks.Task;
49 | import com.oneconnect.demoapp.SubscriptionId;
50 | import com.oneconnect.demoapp.OneConnectFragments.OneConnectPro;
51 | import com.oneconnect.demoapp.R;
52 | import com.oneconnect.demoapp.OneConnectModel.Countries;
53 | import java.util.ArrayList;
54 | import java.util.Arrays;
55 | import java.util.HashMap;
56 | import java.util.List;
57 | import java.util.Map;
58 | import top.oneconnectapi.app.OpenVpnApi;
59 | import top.oneconnectapi.app.core.OpenVPNThread;
60 |
61 |
62 | public class MainActivity extends ActivityOneConnect implements OneConnectPro.RegionChooserInterface, PurchasesUpdatedListener, BillingClientStateListener {
63 |
64 | private static final String CHANNEL_ID = "vpn";
65 | public static String facebook_reward_id = "";
66 | public static String admob_reward="ca-app-pub-3940256099942544/5224354917";
67 | public Countries selectedCountry = null;
68 |
69 | public static String type = "ad";
70 | public static String admob_id = "ca-app-pub-3940256099942544~3347511713";
71 | public static String admob_banner_id = "ca-app-pub-3940256099942544/6300978111";
72 | public static String admob_interstitial_id = "ca-app-pub-3940256099942544/1033173712";
73 | public static String admob_native_id = "ca-app-pub-3940256099942544/2247696110";
74 | public static String fb_banner_id = "385157572510735_385163332510159";
75 | public static String fb_interstitial_id = "2840783936022266_2840931686007491";
76 | public static boolean all_ads_on_off = false;
77 | public static boolean remove_premium = false;
78 | public static boolean remove_all_video_ads_button = false;
79 | private InterstitialAd mInterstitialAdMob;
80 |
81 | private OpenVPNThread vpnThread = new OpenVPNThread();
82 |
83 | private BillingClient billingClient;
84 | private Map skusWithSkuDetails = new HashMap<>();
85 | private final List allSubs = new ArrayList<>(Arrays.asList(
86 | SubscriptionId.ALL_MONTH,
87 | SubscriptionId.THREE_MONTH,
88 | SubscriptionId.SIX_MONTH,
89 | SubscriptionId.TWELVE_MONTH));
90 |
91 | private void connectToBillingService() {
92 | if (!billingClient.isReady()) {
93 | billingClient.startConnection(this);
94 | }
95 | }
96 |
97 | @Override
98 | public void onBillingSetupFinished(@NonNull BillingResult billingResult) {
99 | if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
100 | querySkuDetailsAsync(
101 | BillingClient.SkuType.SUBS,
102 | allSubs
103 | );
104 | queryPurchases();
105 | }
106 | updateSubscription();
107 | }
108 |
109 | @Override
110 | public void onBillingServiceDisconnected() {
111 | connectToBillingService();
112 | }
113 |
114 | @Override
115 | public void onPurchasesUpdated(@NonNull BillingResult billingResult, @Nullable List purchases) {
116 |
117 | }
118 |
119 | private void queryPurchases() {
120 | Purchase.PurchasesResult result = billingClient.queryPurchases(BillingClient.SkuType.SUBS);
121 | List purchases = result.getPurchasesList();
122 | List skus = new ArrayList<>();
123 |
124 | if (purchases != null) {
125 | for (Purchase purchase : purchases) {
126 | skus.add(purchase.getSku());
127 | }
128 |
129 | if (skus.contains(SubscriptionId.ALL_MONTH) ||
130 | skus.contains(SubscriptionId.THREE_MONTH) ||
131 | skus.contains(SubscriptionId.SIX_MONTH) ||
132 | skus.contains(SubscriptionId.TWELVE_MONTH)
133 | ) {
134 | SubscriptionId.OneConnectSubThree = true;
135 | }
136 | }
137 | }
138 |
139 | private void querySkuDetailsAsync(@BillingClient.SkuType String skuType, List skuList) {
140 | SkuDetailsParams params = SkuDetailsParams
141 | .newBuilder()
142 | .setSkusList(skuList)
143 | .setType(skuType)
144 | .build();
145 |
146 | billingClient.querySkuDetailsAsync(
147 | params, (billingResult, skuDetailsList) -> {
148 | if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK && skuDetailsList != null) {
149 | for (SkuDetails details : skuDetailsList) {
150 | skusWithSkuDetails.put(details.getSku(), details);
151 | }
152 | }
153 | }
154 | );
155 | }
156 |
157 | @Override
158 | protected void onStart() {
159 | super.onStart();
160 |
161 | LocalBroadcastManager.getInstance(this).registerReceiver(broadcastReceiver, new IntentFilter("connectionState"));
162 |
163 |
164 | MobileAds.initialize(this, new OnInitializationCompleteListener() {
165 | @Override
166 | public void onInitializationComplete(InitializationStatus initializationStatus) {
167 | Log.e("REWARDED INITIALIZ", initializationStatus.getAdapterStatusMap().toString());
168 | }
169 | });
170 |
171 | if (TextUtils.isEmpty(type)) {
172 | type = "";
173 | }
174 |
175 | final RatingDialog ratingDialog = new RatingDialog.Builder(this)
176 | .session(7)
177 | .threshold(4)
178 | .onThresholdFailed(new RatingDialog.Builder.RatingThresholdFailedListener() {
179 | @Override
180 | public void onThresholdFailed(RatingDialog ratingDialog, float rating, boolean thresholdCleared) {
181 | showMessage("Thank you for your feedback!", "");
182 | ratingDialog.dismiss();
183 | }
184 | })
185 | .negativeButtonText("Never")
186 | .negativeButtonTextColor(R.color.grey_500)
187 | .playstoreUrl("https://play.google.com/store/apps/details?id=" + this.getPackageName())
188 | .onRatingBarFormSumbit(feedback -> {}).build();
189 |
190 | ratingDialog.show();
191 |
192 | billingClient = BillingClient
193 | .newBuilder(this)
194 | .setListener(this)
195 | .enablePendingPurchases()
196 | .build();
197 |
198 | connectToBillingService();
199 |
200 | Intent intent = getIntent();
201 |
202 | if(getIntent().getExtras() != null) {
203 | selectedCountry = getIntent().getExtras().getParcelable("c");
204 | updateUI("LOAD");
205 | }
206 |
207 | if (intent.getStringExtra("type") != null) {
208 | type = intent.getStringExtra("type");
209 | admob_banner_id = intent.getStringExtra("admob_banner");
210 | admob_interstitial_id = intent.getStringExtra("admob_interstitial");
211 | fb_banner_id = intent.getStringExtra("fb_banner");
212 | fb_interstitial_id = intent.getStringExtra("fb_interstitial");
213 | }
214 |
215 | if (!Utility.isOnline(getApplicationContext())) {
216 | showMessage("No Internet Connection", "error");
217 | } else {
218 | if (selectedCountry != null) {
219 | showInterstitialAndConnect();
220 | }
221 | }
222 | }
223 |
224 | @Override
225 | protected void onStop() {
226 | super.onStop();
227 |
228 | }
229 |
230 |
231 | @Override
232 | public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
233 | super.onCreate(savedInstanceState, persistentState);
234 | inAppUpdate();
235 | }
236 |
237 | public void prepareVpn() {
238 |
239 | updateCurrentVipServerIcon(selectedCountry.getFlagUrl());
240 | flagName.setText(selectedCountry.getCountry());
241 |
242 | if (Utility.isOnline(getApplicationContext())) {
243 |
244 | if(selectedCountry != null) {
245 | Intent intent = VpnService.prepare(this);
246 | Log.v("CHECKSTATE", "start");
247 |
248 | if (intent != null) {
249 | startActivityForResult(intent, 1);
250 | } else
251 | startVpn();
252 | } else {
253 | showMessage("Please select a server first", "");
254 | }
255 |
256 | } else {
257 | showMessage("No Internet Connection", "error");
258 | }
259 | }
260 |
261 | protected void startVpn() {
262 | try {
263 | OpenVpnApi.startVpn(this, selectedCountry.getOvpn(), selectedCountry.getCountry(), selectedCountry.getOvpnUserName(), selectedCountry.getOvpnUserPassword());
264 |
265 | } catch (RemoteException e) {
266 | e.printStackTrace();
267 | }
268 | }
269 |
270 | BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
271 | @Override
272 | public void onReceive(Context context, Intent intent) {
273 | try {
274 | updateUI(intent.getStringExtra("state"));
275 | } catch (Exception e) {
276 | e.printStackTrace();
277 | }
278 |
279 | try {
280 |
281 | String duration = intent.getStringExtra("duration");
282 | String lastPacketReceive = intent.getStringExtra("lastPacketReceive");
283 | String byteIn = intent.getStringExtra("byteIn");
284 | String byteOut = intent.getStringExtra("byteOut");
285 |
286 | if (duration == null) duration = "00:00:00";
287 | if (lastPacketReceive == null) lastPacketReceive = "0";
288 | if (byteIn == null) byteIn = " ";
289 | if (byteOut == null) byteOut = " ";
290 |
291 | updateConnectionStatus(duration, lastPacketReceive, byteIn, byteOut);
292 | } catch (Exception e) {
293 | e.printStackTrace();
294 | }
295 |
296 | }
297 | };
298 |
299 |
300 | @Override
301 | protected void disconnectFromVnp() {
302 | try {
303 | vpnThread.stop();
304 | updateUI("DISCONNECTED");
305 | } catch (Exception e) {
306 | e.printStackTrace();
307 | }
308 | }
309 |
310 | @Override
311 | public void onRegionSelected(Countries item) {
312 |
313 | selectedCountry = item;
314 | }
315 |
316 | @Override
317 | protected int getLayoutRes() {
318 | return R.layout.oneconnect_main;
319 | }
320 |
321 | private void inAppUpdate() {
322 | AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(MainActivity.this);
323 | Task appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
324 | appUpdateInfoTask.addOnSuccessListener(new OnSuccessListener() {
325 | @Override
326 | public void onSuccess(AppUpdateInfo result) {
327 | if (result.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
328 | && result.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
329 | try {
330 | appUpdateManager.startUpdateFlowForResult(result, AppUpdateType.IMMEDIATE, MainActivity.this, 11);
331 | } catch (IntentSender.SendIntentException e) {
332 | e.printStackTrace();
333 | }
334 | }
335 | }
336 | });
337 |
338 | }
339 |
340 | @Override
341 | protected void onActivityResult(int requestCode, int resultCode, @Nullable @org.jetbrains.annotations.Nullable Intent data) {
342 | super.onActivityResult(requestCode, resultCode, data);
343 | if (requestCode == 11) {
344 | showMessage("Start Download", "");
345 | if (resultCode != RESULT_OK) {
346 | Log.d("Update", "Update failed" + resultCode);
347 | }
348 | }
349 |
350 | if (resultCode == RESULT_OK) {
351 | startVpn();
352 | } else {
353 | showMessage("Permission Denied", "error");
354 | }
355 | }
356 |
357 | private void createNotificationChannel() {
358 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
359 | CharSequence name = "VPN";
360 | String description = "VPN notification";
361 | int importance = NotificationManager.IMPORTANCE_DEFAULT;
362 | NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
363 | channel.setDescription(description);
364 |
365 | NotificationManager notificationManager = getSystemService(NotificationManager.class);
366 | notificationManager.createNotificationChannel(channel);
367 | }
368 | }
369 |
370 | public void updateCurrentVipServerIcon(String serverIcon) {
371 | Glide.with(this)
372 | .load(serverIcon)
373 | .into(imgFlag);
374 | }
375 |
376 | public void checkSelectedCountry() {
377 | if (selectedCountry == null) {
378 | updateUI("DISCONNECT");
379 | showMessage("Please select a server first", "");
380 | } else {
381 | showInterstitialAndConnect();
382 | updateUI("LOAD");
383 | }
384 | }
385 | }
386 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectActivities/OneConnectPolicy.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectActivities;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 | import android.content.Intent;
12 | import android.content.SharedPreferences;
13 | import android.content.res.Resources;
14 | import android.graphics.Typeface;
15 | import android.os.Bundle;
16 | import android.preference.PreferenceManager;
17 | import android.text.SpannableString;
18 | import android.text.Spanned;
19 | import android.text.TextPaint;
20 | import android.text.method.LinkMovementMethod;
21 | import android.text.style.ClickableSpan;
22 | import android.view.View;
23 | import android.widget.TextView;
24 | import androidx.appcompat.app.AppCompatActivity;
25 | import com.oneconnect.demoapp.R;
26 |
27 | public class OneConnectPolicy extends AppCompatActivity {
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.oneconnect_policy);
33 |
34 | TextView wc_msg = findViewById(R.id.welcome_msg);
35 | TextView accept_pp = findViewById(R.id.tv_accept_privacy_policy);
36 | TextView btnAccept = findViewById(R.id.btnAccept);
37 |
38 | Resources res = getResources();
39 | String msg = String.format(res.getString(R.string.welcome_message), getResources().getString(R.string.app_name));
40 | wc_msg.setText(msg);
41 |
42 | SpannableString myString = new SpannableString(getResources().getString(R.string.privacy_policy_msg));
43 |
44 | ClickableSpan clickableSpan = new ClickableSpan() {
45 | @Override
46 | public void updateDrawState(TextPaint ds) {
47 | ds.setColor(getResources().getColor(R.color.tab_background_selected));
48 | ds.setUnderlineText(false);
49 | ds.setTypeface(Typeface.DEFAULT_BOLD);
50 | }
51 |
52 | @Override
53 | public void onClick(View textView) {
54 |
55 | Intent intent = new Intent(OneConnectPolicy.this, OneConnectPolicyDetails.class);
56 | startActivity(intent);
57 | }
58 | };
59 |
60 | myString.setSpan(clickableSpan,43,67, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
61 |
62 | accept_pp.setMovementMethod(LinkMovementMethod.getInstance());
63 | accept_pp.setText(myString);
64 |
65 | btnAccept.setOnClickListener(view -> {
66 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
67 | startActivity(new Intent(getApplicationContext(), MainActivity.class));
68 | SharedPreferences.Editor editor = prefs.edit();
69 | editor.putBoolean("firstTime", false);
70 | editor.apply();
71 | finish();
72 | });
73 | }
74 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectActivities/OneConnectPolicyDetails.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectActivities;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 |
12 | import android.net.http.SslError;
13 | import android.os.Bundle;
14 | import android.view.View;
15 | import android.webkit.SslErrorHandler;
16 | import android.webkit.WebView;
17 | import android.webkit.WebViewClient;
18 | import androidx.appcompat.app.AlertDialog;
19 | import androidx.appcompat.app.AppCompatActivity;
20 | import com.airbnb.lottie.LottieAnimationView;
21 | import com.oneconnect.demoapp.R;
22 |
23 | public class OneConnectPolicyDetails extends AppCompatActivity {
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.privacy_policy);
29 |
30 | WebView webView = findViewById(R.id.wvPrivacyPolicy);
31 | webView.getSettings().setLoadsImagesAutomatically(true);
32 | webView.getSettings().setJavaScriptEnabled(true);
33 | webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
34 | webView.setWebViewClient(new WebViewClient(){
35 | @Override
36 | public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {
37 | final AlertDialog.Builder builder = new AlertDialog.Builder(OneConnectPolicyDetails.this);
38 | String message = "SSL Certificate error.";
39 | switch (error.getPrimaryError()) {
40 | case SslError.SSL_UNTRUSTED:
41 | message = "The certificate authority is not trusted.";
42 | break;
43 | case SslError.SSL_EXPIRED:
44 | message = "The certificate has expired.";
45 | break;
46 | case SslError.SSL_IDMISMATCH:
47 | message = "The certificate Hostname mismatch.";
48 | break;
49 | case SslError.SSL_NOTYETVALID:
50 | message = "The certificate is not yet valid.";
51 | break;
52 | case SslError.SSL_DATE_INVALID:
53 | message = "The certificate date is invalid.";
54 | break;
55 | case SslError.SSL_INVALID:
56 | message = "The certificate is invalid.";
57 | break;
58 | }
59 | message += " Do you want to continue anyway?";
60 |
61 | builder.setTitle("SSL Certificate Error");
62 | builder.setMessage(message);
63 | builder.setPositiveButton("continue", (dialog, which) -> handler.proceed());
64 | builder.setNegativeButton("cancel", (dialog, which) -> handler.cancel());
65 | final AlertDialog dialog = builder.create();
66 | dialog.show();
67 | }
68 |
69 | public void onPageFinished(WebView view, String url) {
70 | LottieAnimationView loading = findViewById(R.id.loading_view);
71 | loading.setVisibility(View.GONE);
72 | }
73 | });
74 | webView.loadUrl(getResources().getString(R.string.policy_url));
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectActivities/Servers.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectActivities;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 | import android.os.Bundle;
12 | import androidx.appcompat.app.AppCompatActivity;
13 | import androidx.appcompat.widget.Toolbar;
14 | import androidx.viewpager.widget.ViewPager;
15 | import com.oneconnect.demoapp.OneConnectFragments.OneConnectFree;
16 | import com.oneconnect.demoapp.R;
17 | import com.google.android.material.tabs.TabLayout;
18 | import com.oneconnect.demoapp.OneConnectAdapter.ServerAdapter;
19 | import com.oneconnect.demoapp.OneConnectFragments.OneConnectPro;
20 |
21 | public class Servers extends AppCompatActivity {
22 |
23 | private ServerAdapter adapter;
24 | private TabLayout tabLayout;
25 | private ViewPager viewPager;
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.oneconnect_tab);
31 |
32 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbarold);
33 | toolbar.setTitle("Servers List");
34 | setSupportActionBar(toolbar);
35 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
36 | getSupportActionBar().setDisplayShowHomeEnabled(true);
37 | viewPager = (ViewPager) findViewById(R.id.viewPager);
38 | tabLayout = (TabLayout) findViewById(R.id.tabLayout);
39 | adapter = new ServerAdapter(getSupportFragmentManager());
40 |
41 | adapter.addFragment(new OneConnectPro(), "Pro Server");
42 | adapter.addFragment(new OneConnectFree(), "Free Server");
43 | viewPager.setAdapter(adapter);
44 | tabLayout.setupWithViewPager(viewPager);
45 |
46 |
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectActivities/SplashScreen.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectActivities;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 | import android.content.Intent;
12 | import androidx.coordinatorlayout.widget.CoordinatorLayout;
13 | import com.google.android.material.snackbar.Snackbar;
14 | import androidx.appcompat.app.AppCompatActivity;
15 | import android.content.IntentSender;
16 | import android.content.SharedPreferences;
17 | import android.os.Bundle;
18 | import android.os.Handler;
19 | import android.preference.PreferenceManager;
20 | import android.widget.Toast;
21 | import com.google.android.play.core.appupdate.AppUpdateInfo;
22 | import com.google.android.play.core.appupdate.AppUpdateManager;
23 | import com.google.android.play.core.appupdate.AppUpdateManagerFactory;
24 | import com.google.android.play.core.install.InstallStateUpdatedListener;
25 | import com.google.android.play.core.install.model.AppUpdateType;
26 | import com.google.android.play.core.install.model.InstallStatus;
27 | import com.google.android.play.core.install.model.UpdateAvailability;
28 | import com.google.android.play.core.tasks.OnFailureListener;
29 | import com.google.android.play.core.tasks.OnSuccessListener;
30 | import com.oneconnect.demoapp.R;
31 | import com.oneconnect.demoapp.Utils.Constants;
32 | import java.io.IOException;
33 | import top.oneconnectapi.app.api.OneConnect;
34 |
35 | public class SplashScreen extends AppCompatActivity {
36 |
37 | CoordinatorLayout coordinatorLayout;
38 | private AppUpdateManager mAppUpdateManager;
39 | private final int RC_APP_UPDATE = 999;
40 | private int inAppUpdateType;
41 | private com.google.android.play.core.tasks.Task appUpdateInfoTask;
42 | private InstallStateUpdatedListener installStateUpdatedListener;
43 |
44 | @Override
45 | protected void onCreate(Bundle savedInstanceState) {
46 |
47 | Thread thread = new Thread(new Runnable() {
48 |
49 | @Override
50 | public void run() {
51 | try {
52 | OneConnect oneConnect = new OneConnect();
53 | oneConnect.initialize(SplashScreen.this, "oTUDEq.susHlRkDDSSmGd1ODH0QihV0ZWnq96t1cTkYTSYcsG."); // Put Your OneConnect API Key for Work Server
54 | try {
55 | Constants.FREE_SERVERS = oneConnect.fetch(true);
56 | Constants.PREMIUM_SERVERS = oneConnect.fetch(false);
57 | } catch (IOException e) {
58 | e.printStackTrace();
59 | }
60 |
61 | } catch (Exception e) {
62 | e.printStackTrace();
63 | }
64 | }
65 | });
66 |
67 | thread.start();
68 |
69 |
70 |
71 |
72 | String TAG = "Firebase";
73 |
74 |
75 |
76 | super.onCreate(savedInstanceState);
77 | setContentView(R.layout.splash);
78 | coordinatorLayout = findViewById(R.id.cordi);
79 |
80 | mAppUpdateManager = AppUpdateManagerFactory.create(this);
81 | appUpdateInfoTask = mAppUpdateManager.getAppUpdateInfo();
82 | installStateUpdatedListener = installState -> {
83 | if (installState.installStatus() == InstallStatus.DOWNLOADED) {
84 | popupSnackbarForCompleteUpdate();
85 | }
86 | };
87 | mAppUpdateManager.registerListener(installStateUpdatedListener);
88 |
89 | inAppUpdateType = AppUpdateType.IMMEDIATE; //1
90 | inAppUpdate();
91 |
92 |
93 | }
94 |
95 | private void inAppUpdate() {
96 |
97 | try {
98 | appUpdateInfoTask.addOnSuccessListener(new OnSuccessListener() {
99 | @Override
100 | public void onSuccess(AppUpdateInfo appUpdateInfo) {
101 | if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
102 | && appUpdateInfo.isUpdateTypeAllowed(inAppUpdateType)) {
103 |
104 | try {
105 | mAppUpdateManager.startUpdateFlowForResult(
106 | appUpdateInfo,
107 | inAppUpdateType,
108 | SplashScreen.this,
109 | RC_APP_UPDATE);
110 | } catch (IntentSender.SendIntentException ignored) {
111 |
112 | }
113 | } else {
114 | proceed();
115 | }
116 | }
117 | });
118 | } catch (Exception e) {
119 | e.printStackTrace();
120 | }
121 |
122 | appUpdateInfoTask.addOnFailureListener(new OnFailureListener() {
123 | @Override
124 | public void onFailure(Exception e) {
125 | proceed();
126 | }
127 | });
128 | }
129 |
130 | private void popupSnackbarForCompleteUpdate() {
131 |
132 | Snackbar snackbar =
133 | Snackbar.make(
134 | coordinatorLayout,
135 | "New app is ready!",
136 | Snackbar.LENGTH_INDEFINITE);
137 |
138 | snackbar.setAction("Install", view -> {
139 | if (mAppUpdateManager != null) {
140 | mAppUpdateManager.completeUpdate();
141 | }
142 | });
143 |
144 |
145 | snackbar.setActionTextColor(getResources().getColor(R.color.gnt_ad_green));
146 | snackbar.show();
147 | }
148 |
149 | @Override
150 | protected void onDestroy() {
151 | mAppUpdateManager.unregisterListener(installStateUpdatedListener);
152 | super.onDestroy();
153 | }
154 |
155 | @Override
156 | protected void onResume() {
157 | try {
158 | mAppUpdateManager.getAppUpdateInfo().addOnSuccessListener(appUpdateInfo -> {
159 | if (appUpdateInfo.updateAvailability() ==
160 | UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS) {
161 | try {
162 | mAppUpdateManager.startUpdateFlowForResult(
163 | appUpdateInfo,
164 | inAppUpdateType,
165 | this,
166 | RC_APP_UPDATE);
167 | } catch (IntentSender.SendIntentException e) {
168 | e.printStackTrace();
169 | }
170 | }
171 | });
172 |
173 |
174 | mAppUpdateManager.getAppUpdateInfo().addOnSuccessListener(appUpdateInfo -> {
175 |
176 | if (appUpdateInfo.installStatus() == InstallStatus.DOWNLOADED) {
177 | popupSnackbarForCompleteUpdate();
178 | }
179 | });
180 | } catch (Exception e) {
181 | e.printStackTrace();
182 | }
183 |
184 | super.onResume();
185 | }
186 |
187 | @Override
188 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
189 | super.onActivityResult(requestCode, resultCode, data);
190 | if (requestCode == RC_APP_UPDATE) {
191 | if (resultCode == RESULT_OK) {
192 | Toast.makeText(SplashScreen.this, "Downloading...", Toast.LENGTH_LONG).show();
193 | } else if (resultCode != RESULT_CANCELED) {
194 | Toast.makeText(SplashScreen.this, "Download Canceled.", Toast.LENGTH_LONG).show();
195 | } else {
196 | proceed();
197 | }
198 | }
199 | }
200 |
201 | private void proceed() {
202 | if (!Utility.isOnline(getApplicationContext())) {
203 |
204 | Snackbar snackbar = Snackbar
205 | .make(coordinatorLayout, "Check internet connection", Snackbar.LENGTH_LONG);
206 | snackbar.show();
207 |
208 | } else {
209 | new Handler().postDelayed(new Runnable() {
210 | @Override
211 | public void run() {
212 |
213 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SplashScreen.this);
214 |
215 | if (prefs.getBoolean("firstTime", true)) {
216 | startActivity(new Intent(SplashScreen.this, OneConnectPolicy.class));
217 | } else {
218 | startActivity(new Intent(SplashScreen.this, MainActivity.class));
219 | }
220 |
221 | finish();
222 | }
223 | }, 2000);
224 | }
225 | }
226 | }
227 |
228 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectActivities/SubscriptionsActivity.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectActivities;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 |
12 | import android.os.Bundle;
13 | import android.widget.TextView;
14 | import androidx.annotation.NonNull;
15 | import androidx.annotation.Nullable;
16 | import androidx.appcompat.app.AppCompatActivity;
17 | import com.android.billingclient.api.BillingClient;
18 | import com.android.billingclient.api.BillingClientStateListener;
19 | import com.android.billingclient.api.BillingFlowParams;
20 | import com.android.billingclient.api.BillingResult;
21 | import com.android.billingclient.api.Purchase;
22 | import com.android.billingclient.api.PurchasesUpdatedListener;
23 | import com.android.billingclient.api.SkuDetails;
24 | import com.android.billingclient.api.SkuDetailsParams;
25 | import com.jama.carouselview.CarouselView;
26 | import com.jama.carouselview.enums.IndicatorAnimationType;
27 | import com.jama.carouselview.enums.OffsetType;
28 | import com.oneconnect.demoapp.R;
29 | import com.oneconnect.demoapp.SubscriptionId;
30 | import java.util.ArrayList;
31 | import java.util.Arrays;
32 | import java.util.HashMap;
33 | import java.util.List;
34 | import java.util.Map;
35 |
36 | public class SubscriptionsActivity extends AppCompatActivity implements PurchasesUpdatedListener, BillingClientStateListener {
37 |
38 | private BillingClient billingClient;
39 | private final Map skusWithSkuDetails = new HashMap<>();
40 | private final List allSubs = new ArrayList<>(Arrays.asList(
41 | SubscriptionId.ALL_MONTH,
42 | SubscriptionId.THREE_MONTH,
43 | SubscriptionId.SIX_MONTH,
44 | SubscriptionId.TWELVE_MONTH));
45 |
46 | private final int[] images = {
47 | R.drawable.logo,
48 | R.drawable.logo,
49 | R.drawable.logo,
50 | R.drawable.logo};
51 |
52 | private final int[] prices = {
53 | R.string.one_month,
54 | R.string.three_months,
55 | R.string.six_months,
56 | R.string.twelve_months};
57 |
58 | private final int[] month = {
59 | R.string.one_month_txt,
60 | R.string.three_months_txt,
61 | R.string.six_months_txt,
62 | R.string.twelve_months_txt};
63 |
64 | @Override
65 | protected void onCreate(Bundle savedInstanceState) {
66 | super.onCreate(savedInstanceState);
67 | setContentView(R.layout.subscription);
68 |
69 | CarouselView carouselView = findViewById(R.id.carouselView);
70 |
71 | carouselView.setSize(images.length);
72 | carouselView.setResource(R.layout.subscription_item);
73 | carouselView.setAutoPlay(false);
74 | carouselView.enableSnapping(true);
75 | carouselView.setIndicatorUnselectedColor(getResources().getColor(R.color.lighterprimary));
76 | carouselView.setIndicatorAnimationType(IndicatorAnimationType.THIN_WORM);
77 | carouselView.setCarouselOffset(OffsetType.CENTER);
78 | carouselView.setCarouselViewListener((view, position) -> {
79 |
80 |
81 | TextView tvPrice = view.findViewById(R.id.tvPrice);
82 | TextView tvMonth = view.findViewById(R.id.tvMonth);
83 | TextView btnBuyNow = view.findViewById(R.id.btnBuyNow);
84 |
85 |
86 | tvPrice.setText(getResources().getString(prices[position]));
87 | tvMonth.setText(getResources().getString(month[position]));
88 |
89 | btnBuyNow.setOnClickListener(view1 -> {
90 |
91 | SkuDetails skuDetails = null;
92 |
93 | switch (position) {
94 | case 0:
95 | skuDetails = skusWithSkuDetails.get(SubscriptionId.ALL_MONTH);
96 | break;
97 | case 1:
98 | skuDetails = skusWithSkuDetails.get(SubscriptionId.THREE_MONTH);
99 | break;
100 | case 2:
101 | skuDetails = skusWithSkuDetails.get(SubscriptionId.SIX_MONTH);
102 | break;
103 | case 3:
104 | skuDetails = skusWithSkuDetails.get(SubscriptionId.TWELVE_MONTH);
105 | break;
106 | }
107 |
108 | if (skuDetails != null) purchase(skuDetails);
109 | });
110 | });
111 |
112 | carouselView.show();
113 |
114 | billingClient = BillingClient
115 | .newBuilder(this)
116 | .setListener(this)
117 | .enablePendingPurchases()
118 | .build();
119 |
120 | connectToBillingService();
121 | }
122 |
123 | private void connectToBillingService() {
124 | if (!billingClient.isReady()) {
125 | billingClient.startConnection(this);
126 | }
127 | }
128 |
129 | @Override
130 | public void onBillingSetupFinished(@NonNull BillingResult billingResult) {
131 | if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
132 | querySkuDetailsAsync(
133 | BillingClient.SkuType.SUBS,
134 | new ArrayList<>(allSubs)
135 | );
136 | }
137 | }
138 |
139 | @Override
140 | public void onBillingServiceDisconnected() {
141 | connectToBillingService();
142 | }
143 |
144 | @Override
145 | public void onPurchasesUpdated(@NonNull BillingResult billingResult, @Nullable List purchases) {
146 |
147 | }
148 |
149 | private void querySkuDetailsAsync(@BillingClient.SkuType String skuType, List skuList) {
150 | SkuDetailsParams params = SkuDetailsParams
151 | .newBuilder()
152 | .setSkusList(skuList)
153 | .setType(skuType)
154 | .build();
155 |
156 | billingClient.querySkuDetailsAsync(
157 | params, (billingResult, skuDetailsList) -> {
158 | if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK && skuDetailsList != null) {
159 | for (SkuDetails details : skuDetailsList) {
160 | skusWithSkuDetails.put(details.getSku(), details);
161 | }
162 | }
163 | }
164 | );
165 | }
166 |
167 | private void purchase(SkuDetails skuDetails) {
168 | BillingFlowParams params = BillingFlowParams
169 | .newBuilder()
170 | .setSkuDetails(skuDetails)
171 | .build();
172 |
173 | billingClient.launchBillingFlow(this, params);
174 | }
175 | }
176 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectActivities/Utility.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectActivities;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 |
12 | import android.content.Context;
13 | import android.net.ConnectivityManager;
14 | import android.net.NetworkInfo;
15 |
16 |
17 | public class Utility {
18 |
19 | private static final String TAG = "Utility";
20 |
21 | public static boolean isOnline(Context context) {
22 | try {
23 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
24 | NetworkInfo nInfo = cm.getActiveNetworkInfo();
25 | return nInfo != null && nInfo.isConnected();
26 | } catch (Exception e) {
27 | e.printStackTrace();
28 | return false;
29 | }
30 | }
31 |
32 | }
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectAdapter/FBNativeAdapter.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectAdapter;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 |
12 | import android.content.Context;
13 | import android.view.LayoutInflater;
14 | import android.view.View;
15 | import android.view.ViewGroup;
16 | import android.widget.Button;
17 | import android.widget.LinearLayout;
18 | import android.widget.RelativeLayout;
19 | import android.widget.TextView;
20 | import androidx.annotation.IdRes;
21 | import androidx.annotation.LayoutRes;
22 | import androidx.recyclerview.widget.GridLayoutManager;
23 | import androidx.recyclerview.widget.RecyclerView;
24 | import com.oneconnect.demoapp.R;
25 | import com.facebook.ads.MediaView;
26 | import com.facebook.ads.NativeAdLayout;
27 |
28 |
29 | public class FBNativeAdapter extends RecyclerViewAdapterWrapper {
30 |
31 | private static final int TYPE_FB_NATIVE_ADS = 900;
32 | private static final int DEFAULT_AD_ITEM_INTERVAL = 10;
33 |
34 | private final Param mParam;
35 |
36 | private FBNativeAdapter(Param param) {
37 | super(param.adapter);
38 | this.mParam = param;
39 |
40 | assertConfig();
41 | setSpanAds();
42 | }
43 |
44 | private void assertConfig() {
45 | if (mParam.gridLayoutManager != null) {
46 | int nCol = mParam.gridLayoutManager.getSpanCount();
47 | if (mParam.adItemInterval % nCol != 0) {
48 | throw new IllegalArgumentException(String.format("The adItemInterval (%d) is not divisible by number of columns in GridLayoutManager (%d)", mParam.adItemInterval, nCol));
49 | }
50 | }
51 | }
52 |
53 | private int convertAdPosition2OrgPosition(int position) {
54 | return position - (position + 1) / (mParam.adItemInterval + 1);
55 | }
56 |
57 | @Override
58 | public int getItemCount() {
59 | int realCount = super.getItemCount();
60 | return realCount + realCount / mParam.adItemInterval;
61 | }
62 |
63 | @Override
64 | public int getItemViewType(int position) {
65 | if (isAdPosition(position)) {
66 | return TYPE_FB_NATIVE_ADS;
67 | }
68 | return super.getItemViewType(convertAdPosition2OrgPosition(position));
69 | }
70 |
71 | private boolean isAdPosition(int position) {
72 | return (position + 1) % (mParam.adItemInterval + 1) == 0;
73 | }
74 |
75 | private void onBindAdViewHolder(final RecyclerView.ViewHolder holder) {
76 | final AdViewHolder adHolder = (AdViewHolder) holder;
77 | if (mParam.forceReloadAdOnBind || !adHolder.loaded) {
78 |
79 | final com.facebook.ads.NativeAd nativeAd = new com.facebook.ads.NativeAd(adHolder.getContext(), mParam.facebookPlacementId);
80 |
81 | }
82 | }
83 |
84 | @Override
85 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
86 | if (getItemViewType(position) == TYPE_FB_NATIVE_ADS) {
87 | onBindAdViewHolder(holder);
88 | } else {
89 | super.onBindViewHolder(holder, convertAdPosition2OrgPosition(position));
90 | }
91 | }
92 |
93 | private RecyclerView.ViewHolder onCreateAdViewHolder(ViewGroup parent) {
94 | LayoutInflater inflater = LayoutInflater.from(parent.getContext());
95 | View adLayoutOutline = inflater
96 | .inflate(mParam.itemContainerLayoutRes, parent, false);
97 | ViewGroup vg = adLayoutOutline.findViewById(mParam.itemContainerId);
98 |
99 | LinearLayout adLayoutContent = (LinearLayout) inflater
100 | .inflate(R.layout.item_facebook_native_ad, parent, false);
101 | vg.addView(adLayoutContent);
102 | return new AdViewHolder(adLayoutOutline);
103 | }
104 |
105 | @Override
106 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
107 | if (viewType == TYPE_FB_NATIVE_ADS) {
108 | return onCreateAdViewHolder(parent);
109 | }
110 | return super.onCreateViewHolder(parent, viewType);
111 | }
112 |
113 | private void setSpanAds() {
114 | if (mParam.gridLayoutManager == null) {
115 | return;
116 | }
117 | final GridLayoutManager.SpanSizeLookup spl = mParam.gridLayoutManager.getSpanSizeLookup();
118 | mParam.gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
119 | @Override
120 | public int getSpanSize(int position) {
121 | if (isAdPosition(position)) {
122 | return spl.getSpanSize(position);
123 | }
124 | return 1;
125 | }
126 | });
127 | }
128 |
129 | private static class Param {
130 | String facebookPlacementId;
131 | RecyclerView.Adapter adapter;
132 | int adItemInterval;
133 | boolean forceReloadAdOnBind;
134 |
135 | @LayoutRes
136 | int itemContainerLayoutRes;
137 |
138 | @IdRes
139 | int itemContainerId;
140 |
141 | GridLayoutManager gridLayoutManager;
142 | }
143 |
144 | public static class Builder {
145 | private final Param mParam;
146 |
147 | private Builder(Param param) {
148 | mParam = param;
149 | }
150 |
151 | public static Builder with(String placementId, RecyclerView.Adapter wrapped) {
152 | Param param = new Param();
153 | param.facebookPlacementId = placementId;
154 | param.adapter = wrapped;
155 |
156 | param.adItemInterval = DEFAULT_AD_ITEM_INTERVAL;
157 | param.itemContainerLayoutRes = R.layout.item_facebook_native_ad_outline;
158 | param.itemContainerId = R.id.native_banner_ad_container;
159 | param.forceReloadAdOnBind = true;
160 | return new Builder(param);
161 | }
162 |
163 | public Builder adItemInterval(int interval) {
164 | mParam.adItemInterval = interval;
165 | return this;
166 | }
167 |
168 | public Builder adLayout(@LayoutRes int layoutContainerRes, @IdRes int itemContainerId) {
169 | mParam.itemContainerLayoutRes = layoutContainerRes;
170 | mParam.itemContainerId = itemContainerId;
171 | return this;
172 | }
173 |
174 | public FBNativeAdapter build() {
175 | return new FBNativeAdapter(mParam);
176 | }
177 |
178 | public Builder enableSpanRow(GridLayoutManager layoutManager) {
179 | mParam.gridLayoutManager = layoutManager;
180 | return this;
181 | }
182 |
183 | public Builder forceReloadAdOnBind(boolean forced) {
184 | mParam.forceReloadAdOnBind = forced;
185 | return this;
186 | }
187 | }
188 |
189 | private static class AdViewHolder extends RecyclerView.ViewHolder {
190 |
191 | TextView nativeAdTitle;
192 | MediaView nativeAdMedia;
193 | TextView nativeAdSocialContext;
194 | TextView nativeAdBody;
195 | Button nativeAdCallToAction;
196 | RelativeLayout adChoicesContainer;
197 | NativeAdLayout nativeAdContainer;
198 | TextView nativeSponserLable;
199 | boolean loaded;
200 |
201 | AdViewHolder(View view) {
202 | super(view);
203 | nativeAdContainer = view.findViewById(R.id.native_banner_ad_container);
204 | nativeAdTitle = view.findViewById(R.id.native_ad_title);
205 | nativeAdSocialContext = view.findViewById(R.id.native_ad_social_context);
206 | nativeAdCallToAction = view.findViewById(R.id.native_ad_call_to_action);
207 | adChoicesContainer = view.findViewById(R.id.ad_choices_container);
208 | nativeSponserLable = view.findViewById(R.id.native_ad_sponsored_label);
209 | loaded = false;
210 | }
211 |
212 | Context getContext() {
213 | return nativeAdContainer.getContext();
214 | }
215 | }
216 | }
217 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectAdapter/RecyclerViewAdapterWrapper.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectAdapter;
2 |
3 |
4 |
5 | /**
6 | * https://developer.oneconnect.top/
7 | * @package Oneconnect SDK Project
8 | * @author oneconnect.top
9 | * @copyright May 2022
10 | */
11 |
12 | import android.view.ViewGroup;
13 | import androidx.recyclerview.widget.RecyclerView;
14 |
15 | public class RecyclerViewAdapterWrapper extends RecyclerView.Adapter {
16 |
17 | private final RecyclerView.Adapter wrapped;
18 |
19 | public RecyclerViewAdapterWrapper(RecyclerView.Adapter wrapped) {
20 | super();
21 | this.wrapped = wrapped;
22 | this.wrapped.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
23 | public void onChanged() {
24 | notifyDataSetChanged();
25 | }
26 |
27 | public void onItemRangeChanged(int positionStart, int itemCount) {
28 | notifyItemRangeChanged(positionStart, itemCount);
29 | }
30 |
31 | public void onItemRangeInserted(int positionStart, int itemCount) {
32 | notifyItemRangeInserted(positionStart, itemCount);
33 | }
34 |
35 | public void onItemRangeRemoved(int positionStart, int itemCount) {
36 | notifyItemRangeRemoved(positionStart, itemCount);
37 | }
38 |
39 | public void onItemRangeMoved(int fromPosition, int toPosition, int itemCount) {
40 | notifyItemMoved(fromPosition, toPosition);
41 | }
42 | });
43 | }
44 |
45 | @Override
46 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
47 | return wrapped.onCreateViewHolder(parent, viewType);
48 | }
49 |
50 | @Override
51 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
52 | wrapped.onBindViewHolder(holder, position);
53 | }
54 |
55 | @Override
56 | public int getItemCount() {
57 | return wrapped.getItemCount();
58 | }
59 |
60 | @Override
61 | public int getItemViewType(int position) {
62 | return wrapped.getItemViewType(position);
63 | }
64 |
65 | @Override
66 | public void setHasStableIds(boolean hasStableIds) {
67 | wrapped.setHasStableIds(hasStableIds);
68 | }
69 |
70 | @Override
71 | public long getItemId(int position) {
72 | return wrapped.getItemId(position);
73 | }
74 |
75 | @Override
76 | public void onViewRecycled(RecyclerView.ViewHolder holder) {
77 | wrapped.onViewRecycled(holder);
78 | }
79 |
80 | @Override
81 | public boolean onFailedToRecycleView(RecyclerView.ViewHolder holder) {
82 | return wrapped.onFailedToRecycleView(holder);
83 | }
84 |
85 | @Override
86 | public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
87 | wrapped.onViewAttachedToWindow(holder);
88 | }
89 |
90 | @Override
91 | public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
92 | wrapped.onViewDetachedFromWindow(holder);
93 | }
94 |
95 | @Override
96 | public void registerAdapterDataObserver(RecyclerView.AdapterDataObserver observer) {
97 | wrapped.registerAdapterDataObserver(observer);
98 | }
99 |
100 | @Override
101 | public void unregisterAdapterDataObserver(RecyclerView.AdapterDataObserver observer) {
102 | wrapped.unregisterAdapterDataObserver(observer);
103 | }
104 |
105 | @Override
106 | public void onAttachedToRecyclerView(RecyclerView recyclerView) {
107 | wrapped.onAttachedToRecyclerView(recyclerView);
108 | }
109 |
110 | @Override
111 | public void onDetachedFromRecyclerView(RecyclerView recyclerView) {
112 | wrapped.onDetachedFromRecyclerView(recyclerView);
113 | }
114 |
115 | public RecyclerView.Adapter getWrappedAdapter() {
116 | return wrapped;
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectAdapter/ServerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectAdapter;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 |
12 | import androidx.annotation.Nullable;
13 | import androidx.fragment.app.Fragment;
14 | import androidx.fragment.app.FragmentManager;
15 | import androidx.fragment.app.FragmentStatePagerAdapter;
16 | import java.util.ArrayList;
17 | import java.util.List;
18 |
19 | public class ServerAdapter extends FragmentStatePagerAdapter {
20 | private final List mFragmentList = new ArrayList<>();
21 | private final List mFragmentTitleList = new ArrayList<>();
22 | public ServerAdapter(FragmentManager fm) {
23 | super(fm);
24 | }
25 | @Override
26 | public Fragment getItem(int position) {
27 | return mFragmentList.get(position);
28 | }
29 | public void addFragment(Fragment fragment, String title) {
30 | mFragmentList.add(fragment);
31 | mFragmentTitleList.add(title);
32 | }
33 | @Nullable
34 | @Override
35 | public CharSequence getPageTitle(int position) {
36 | return mFragmentTitleList.get(position);
37 | }
38 | @Override
39 | public int getCount() {
40 | return mFragmentList.size();
41 | }
42 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectAdapter/ServerFreeAdapter.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectAdapter;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 |
12 | import android.content.Context;
13 | import android.content.Intent;
14 | import android.util.Log;
15 | import android.view.LayoutInflater;
16 | import android.view.View;
17 | import android.view.ViewGroup;
18 | import android.widget.AbsListView;
19 | import android.widget.Button;
20 | import android.widget.ImageView;
21 | import android.widget.LinearLayout;
22 | import android.widget.RelativeLayout;
23 | import android.widget.TextView;
24 | import androidx.annotation.NonNull;
25 | import androidx.recyclerview.widget.RecyclerView;
26 | import com.bumptech.glide.Glide;
27 | import com.facebook.ads.Ad;
28 | import com.facebook.ads.AdError;
29 | import com.facebook.ads.AdOptionsView;
30 | import com.facebook.ads.NativeAd;
31 | import com.facebook.ads.NativeAdListener;
32 | import com.google.android.gms.ads.AdRequest;
33 | import com.google.android.gms.ads.AdSize;
34 | import com.google.android.gms.ads.AdView;
35 | import com.oneconnect.demoapp.SubscriptionId;
36 | import com.oneconnect.demoapp.R;
37 | import com.oneconnect.demoapp.OneConnectActivities.MainActivity;
38 | import com.oneconnect.demoapp.OneConnectModel.Countries;
39 |
40 |
41 | import java.util.ArrayList;
42 | import java.util.List;
43 |
44 | public class ServerFreeAdapter extends RecyclerView.Adapter {
45 |
46 | ArrayList datalist = new ArrayList<>();
47 | com.facebook.ads.AdView facebookAdview;
48 |
49 | private final Context context;
50 | private final int AD_TYPE = 0;
51 | private final int CONTENT_TYPE = 1;
52 | public ServerFreeAdapter(Context ctx) {
53 | this.context=ctx;
54 | }
55 |
56 | @NonNull
57 | @Override
58 | public mViewhoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
59 | {
60 | AdView adview;
61 |
62 | if (viewType == AD_TYPE) {
63 | if(MainActivity.type.equals("ad")) {
64 | adview = new AdView(context);
65 | adview.setAdSize(AdSize.BANNER);
66 | adview.setAdUnitId(MainActivity.admob_banner_id);
67 | float density = context.getResources().getDisplayMetrics().density;
68 | int height = Math.round(AdSize.BANNER.getHeight() * density);
69 | AbsListView.LayoutParams params = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, height);
70 | adview.setLayoutParams(params);
71 | AdRequest request = new AdRequest.Builder().build();
72 | adview.loadAd(request);
73 | return new mViewhoder(adview);
74 |
75 | } else if(MainActivity.type.equals("start")){
76 |
77 | RelativeLayout mainLayout = new RelativeLayout(context);
78 |
79 |
80 | RelativeLayout.LayoutParams bannerParameters =
81 | new RelativeLayout.LayoutParams(
82 | RelativeLayout.LayoutParams.MATCH_PARENT,
83 | RelativeLayout.LayoutParams.WRAP_CONTENT);
84 | bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL);
85 | bannerParameters.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
86 | return new mViewhoder(mainLayout);
87 |
88 | } else {
89 |
90 |
91 | com.facebook.ads.NativeAdLayout nativeAdLayout = new com.facebook.ads.NativeAdLayout(context);
92 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
93 | params.setMargins(20, 0, 20, 10);
94 | nativeAdLayout.setLayoutParams(params);
95 |
96 | NativeAd nativeAd = new NativeAd(context, MainActivity.fb_banner_id);
97 | NativeAdListener nativeAdListener = new NativeAdListener() {
98 | @Override
99 | public void onMediaDownloaded(Ad ad)
100 | {
101 | }
102 |
103 | @Override
104 | public void onError(Ad ad, AdError adError)
105 | {
106 | Log.w("AdLoader", "onAdFailedToLoad" + adError.getErrorMessage());
107 | }
108 |
109 | @Override
110 | public void onAdLoaded(Ad ad) {
111 | if (nativeAd == null || nativeAd != ad) {
112 | return;
113 | }
114 | nativeAd.unregisterView();
115 |
116 | if ((!SubscriptionId.OneConnectSubTwo && !SubscriptionId.OneConnectSubThree))
117 | {
118 | nativeAdLayout.setVisibility(View.VISIBLE);
119 | }
120 | LayoutInflater inflater = LayoutInflater.from(context);
121 | LinearLayout adView = (LinearLayout) inflater.inflate(R.layout.native_banner_ad_layout, nativeAdLayout, false);
122 | nativeAdLayout.addView(adView);
123 |
124 | LinearLayout adChoicesContainer = nativeAdLayout.findViewById(R.id.ad_choices_container);
125 | AdOptionsView adOptionsView = new AdOptionsView(context, nativeAd, nativeAdLayout);
126 | adChoicesContainer.removeAllViews();
127 | adChoicesContainer.addView(adOptionsView, 0);
128 |
129 | com.facebook.ads.MediaView nativeAdIcon = adView.findViewById(R.id.native_ad_icon);
130 | TextView nativeAdTitle = adView.findViewById(R.id.native_ad_title);
131 | com.facebook.ads.MediaView nativeAdMedia = adView.findViewById(R.id.native_ad_media);
132 | TextView nativeAdSocialContext = adView.findViewById(R.id.native_ad_social_context);
133 | TextView nativeAdBody = adView.findViewById(R.id.native_ad_body);
134 | TextView sponsoredLabel = adView.findViewById(R.id.native_ad_sponsored_label);
135 | Button nativeAdCallToAction = adView.findViewById(R.id.native_ad_call_to_action);
136 |
137 | nativeAdTitle.setText(nativeAd.getAdvertiserName());
138 | nativeAdBody.setText(nativeAd.getAdBodyText());
139 | nativeAdSocialContext.setText(nativeAd.getAdSocialContext());
140 | nativeAdCallToAction.setVisibility(nativeAd.hasCallToAction() ? View.VISIBLE : View.INVISIBLE);
141 | nativeAdCallToAction.setText(nativeAd.getAdCallToAction());
142 | sponsoredLabel.setText(nativeAd.getSponsoredTranslation());
143 |
144 | List clickableViews = new ArrayList<>();
145 | clickableViews.add(nativeAdTitle);
146 | clickableViews.add(nativeAdCallToAction);
147 |
148 | nativeAd.registerViewForInteraction(
149 | adView, nativeAdMedia, nativeAdIcon, clickableViews);
150 | }
151 |
152 | @Override
153 | public void onAdClicked(Ad ad)
154 | {
155 |
156 | }
157 |
158 | @Override
159 | public void onLoggingImpression(Ad ad)
160 | {
161 |
162 | }
163 | };
164 | nativeAd.loadAd(
165 | nativeAd.buildLoadAdConfig()
166 | .withAdListener(nativeAdListener)
167 | .build());
168 |
169 |
170 | return new mViewhoder(nativeAdLayout);
171 | }
172 | } else {
173 | View view = LayoutInflater.from(context).inflate(R.layout.free_item, parent, false);
174 | return new mViewhoder(view);
175 | }
176 | }
177 |
178 | @Override
179 | public void onBindViewHolder(@NonNull final mViewhoder holder, int position) {
180 | if(getItemViewType(position) == CONTENT_TYPE){
181 |
182 | Countries data = datalist.get(position);
183 | holder.app_name.setText(data.getCountry());
184 |
185 | Glide.with(context)
186 | .load(data.getFlagUrl())
187 | .into(holder.flag);
188 |
189 | holder.itemView.setOnClickListener(new View.OnClickListener() {
190 | @Override
191 | public void onClick(View view) {
192 |
193 | Intent intent=new Intent(context, MainActivity.class);
194 | intent.putExtra("c", data);
195 | intent.putExtra("type",MainActivity.type);
196 | intent.putExtra("admob_banner",MainActivity.admob_banner_id);
197 | intent.putExtra("admob_interstitial",MainActivity.admob_interstitial_id);
198 | intent.putExtra("fb_banner",MainActivity.fb_banner_id);
199 | intent.putExtra("fb_interstitial",MainActivity.fb_interstitial_id);
200 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
201 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
202 | context.startActivity(intent);
203 |
204 | }
205 | });
206 | }
207 | }
208 |
209 | @Override
210 | public int getItemCount() {
211 | return datalist.size();
212 | }
213 | @Override
214 | public int getItemViewType(int position) {
215 | return datalist.get(position) ==null? AD_TYPE:CONTENT_TYPE;
216 | }
217 |
218 | public static class mViewhoder extends RecyclerView.ViewHolder
219 | {
220 | TextView app_name;
221 | ImageView flag;
222 |
223 | public mViewhoder(View itemView) {
224 | super(itemView);
225 | app_name = itemView.findViewById(R.id.region_title);
226 | flag = itemView.findViewById(R.id.country_flag);
227 | }
228 | }
229 |
230 | public interface RegionListAdapterInterface {
231 | void onCountrySelected(Countries item);
232 | }
233 | public void setData(List servers) {
234 | datalist.clear();
235 | datalist.addAll(servers);
236 | notifyDataSetChanged();
237 | }
238 | }
239 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectAdapter/ServerProAdapter.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectAdapter;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 |
12 | import android.content.Context;
13 | import android.view.LayoutInflater;
14 | import android.view.View;
15 | import android.view.ViewGroup;
16 | import android.widget.ImageView;
17 | import android.widget.TextView;
18 | import androidx.annotation.NonNull;
19 | import androidx.recyclerview.widget.RecyclerView;
20 | import com.bumptech.glide.Glide;
21 | import com.oneconnect.demoapp.OneConnectFragments.OneConnectPro;
22 | import com.oneconnect.demoapp.R;
23 | import com.oneconnect.demoapp.OneConnectModel.Countries;
24 | import java.util.ArrayList;
25 | import java.util.List;
26 |
27 | public class ServerProAdapter extends RecyclerView.Adapter {
28 |
29 | ArrayList datalist = new ArrayList<>();
30 |
31 | private final Context context;
32 | private final int AD_TYPE = 0;
33 | private final int CONTENT_TYPE = 1;
34 | public ServerProAdapter(Context ctx) {
35 | this.context=ctx;
36 | }
37 |
38 | @NonNull
39 | @Override
40 | public ServerProAdapter.mViewhoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
41 | {
42 | View view = LayoutInflater.from(context).inflate(R.layout.pro_item, parent, false);
43 | return new ServerProAdapter.mViewhoder(view);
44 | }
45 |
46 | @Override
47 | public void onBindViewHolder(@NonNull final ServerProAdapter.mViewhoder holder, int position) {
48 | if(getItemViewType(position) == CONTENT_TYPE){
49 | Countries data = datalist.get(position);
50 | holder.app_name.setText(data.getCountry());
51 |
52 | Glide.with(context)
53 | .load(data.getFlagUrl())
54 | .into(holder.flag);
55 |
56 | holder.itemView.setOnClickListener(new View.OnClickListener() {
57 | @Override
58 | public void onClick(View view) {
59 | OneConnectPro.onItemClick(data);
60 | }
61 | });
62 | }
63 | }
64 |
65 | @Override
66 | public int getItemCount() {
67 | return datalist.size();
68 | }
69 | @Override
70 | public int getItemViewType(int position) {
71 | return CONTENT_TYPE;
72 | }
73 |
74 | public static class mViewhoder extends RecyclerView.ViewHolder
75 | {
76 | TextView app_name;
77 | ImageView flag;
78 |
79 | public mViewhoder(View itemView) {
80 | super(itemView);
81 | app_name = itemView.findViewById(R.id.region_title);
82 | flag = itemView.findViewById(R.id.country_flag);
83 | }
84 | }
85 |
86 | public interface RegionListAdapterInterface {
87 | void onCountrySelected(Countries item);
88 | }
89 | public void setData(List servers) {
90 | datalist.clear();
91 | datalist.addAll(servers);
92 | notifyDataSetChanged();
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectFragments/OneConnectFree.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectFragments;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 | import android.content.Context;
12 | import android.os.Bundle;
13 | import android.util.Log;
14 | import android.view.LayoutInflater;
15 | import android.view.View;
16 | import android.view.ViewGroup;
17 | import android.widget.RelativeLayout;
18 | import androidx.annotation.NonNull;
19 | import androidx.annotation.Nullable;
20 | import androidx.fragment.app.Fragment;
21 | import androidx.recyclerview.widget.LinearLayoutManager;
22 | import androidx.recyclerview.widget.RecyclerView;
23 | import com.facebook.ads.Ad;
24 | import com.facebook.ads.AdError;
25 | import com.facebook.ads.InterstitialAdListener;
26 | import com.google.android.gms.ads.interstitial.InterstitialAd;
27 | import com.oneconnect.demoapp.OneConnectActivities.MainActivity;
28 | import com.oneconnect.demoapp.R;
29 | import com.oneconnect.demoapp.OneConnectAdapter.ServerFreeAdapter;
30 | import com.oneconnect.demoapp.SubscriptionId;
31 | import com.oneconnect.demoapp.Utils.Constants;
32 | import com.oneconnect.demoapp.OneConnectModel.Countries;
33 | import org.json.JSONArray;
34 | import org.json.JSONException;
35 | import org.json.JSONObject;
36 | import java.util.ArrayList;
37 |
38 | public class OneConnectFree extends Fragment implements ServerFreeAdapter.RegionListAdapterInterface {
39 | private RecyclerView recyclerView;
40 | private ServerFreeAdapter adapter;
41 | private ArrayList countryArrayList;
42 | private OneConnectPro.RegionChooserInterface regionChooserInterface;
43 | int server;
44 | InterstitialAd mInterstitialAd;
45 | public com.facebook.ads.InterstitialAd facebookInterstitialAd;
46 |
47 | boolean isAds;
48 | private RelativeLayout animationHolder;
49 |
50 |
51 | @Override
52 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
53 | View view = inflater.inflate(R.layout.pro_server, container, false);
54 | recyclerView = view.findViewById(R.id.region_recycler_view);
55 | recyclerView.setHasFixedSize(true);
56 | recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
57 | countryArrayList = new ArrayList<>();
58 | animationHolder = view.findViewById(R.id.animation_layout);
59 |
60 | adapter = new ServerFreeAdapter(getActivity());
61 | recyclerView.setAdapter(adapter);
62 |
63 | if (MainActivity.all_ads_on_off && getResources().getBoolean(R.bool.fb_list) && (!SubscriptionId.OneConnectSubOne && !SubscriptionId.OneConnectSubThree&& !SubscriptionId.OneConnectSubTwo)) {
64 | isAds = true;
65 | } else if (MainActivity.all_ads_on_off && getResources().getBoolean(R.bool.ad_list) && (!SubscriptionId.OneConnectSubOne && !SubscriptionId.OneConnectSubThree && !SubscriptionId.OneConnectSubTwo)) {
66 |
67 | isAds = true;
68 | } else {
69 |
70 | isAds = false;
71 |
72 | }
73 | return view;
74 | }
75 |
76 | @Override
77 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
78 | super.onViewCreated(view, savedInstanceState);
79 | loadServers();
80 | }
81 |
82 | private void loadServers() {
83 |
84 | ArrayList servers = new ArrayList<>();
85 |
86 | try {
87 | JSONArray jsonArray = new JSONArray(Constants.FREE_SERVERS);
88 | for (int i=0; i < jsonArray.length();i++){
89 | JSONObject object = (JSONObject) jsonArray.get(i);
90 | servers.add(new Countries(object.getString("serverName"),
91 | object.getString("flag_url"),
92 | object.getString("ovpnConfiguration"),
93 | object.getString("vpnUserName"),
94 | object.getString("vpnPassword")
95 | ));
96 |
97 | if((i % 2 == 0)&&(i > 0)){
98 | if (!SubscriptionId.OneConnectSubTwo && !SubscriptionId.OneConnectSubThree) {
99 | servers.add(null);
100 | }
101 | }
102 | }
103 | } catch (JSONException e) {
104 | e.printStackTrace();
105 | }
106 |
107 | animationHolder.setVisibility(View.GONE);
108 | adapter.setData(servers);
109 | }
110 |
111 | @Override
112 | public void onCountrySelected(Countries item) {
113 | if(isAds) {
114 | if (MainActivity.type.equals("ad")) {
115 | if (mInterstitialAd != null) {
116 | mInterstitialAd.show(getActivity());
117 | }
118 | } else if (MainActivity.type.equals("start")) {
119 |
120 |
121 |
122 | } else {
123 | if (facebookInterstitialAd != null) {
124 | if (facebookInterstitialAd.isAdLoaded()) {
125 | facebookInterstitialAd.show();
126 |
127 | } else {
128 | com.facebook.ads.InterstitialAdListener interstitialAdListener = new InterstitialAdListener() {
129 | @Override
130 | public void onInterstitialDisplayed(Ad ad) {
131 |
132 | }
133 |
134 | @Override
135 | public void onInterstitialDismissed(Ad ad) {
136 |
137 | }
138 |
139 | @Override
140 | public void onError(Ad ad, AdError adError) {
141 | Log.d("ADerror", adError.getErrorMessage());
142 | }
143 |
144 | @Override
145 | public void onAdLoaded(Ad ad) {
146 | facebookInterstitialAd.show();
147 | }
148 |
149 | @Override
150 | public void onAdClicked(Ad ad) {
151 |
152 | }
153 |
154 | @Override
155 | public void onLoggingImpression(Ad ad) {
156 |
157 | }
158 | };
159 | facebookInterstitialAd = new com.facebook.ads.InterstitialAd(OneConnectFree.this.getContext(), MainActivity.fb_interstitial_id);
160 | facebookInterstitialAd.loadAd(facebookInterstitialAd.buildLoadAdConfig().withAdListener(interstitialAdListener).build());
161 | }
162 | }
163 | }
164 | }
165 |
166 | regionChooserInterface.onRegionSelected(item);
167 | }
168 |
169 | @Override
170 | public void onAttach(Context ctx) {
171 | super.onAttach(ctx);
172 | if (ctx instanceof OneConnectPro.RegionChooserInterface) {
173 | regionChooserInterface = (OneConnectPro.RegionChooserInterface) ctx;
174 | }
175 | }
176 | }
177 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectFragments/OneConnectPro.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectFragments;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 | import android.app.ProgressDialog;
12 | import android.content.Context;
13 | import android.content.Intent;
14 | import android.content.SharedPreferences;
15 | import android.os.Bundle;
16 | import android.util.Log;
17 | import android.view.Gravity;
18 | import android.view.LayoutInflater;
19 | import android.view.View;
20 | import android.view.ViewGroup;
21 | import android.widget.FrameLayout;
22 | import android.widget.ImageButton;
23 | import android.widget.PopupWindow;
24 | import android.widget.RelativeLayout;
25 | import android.widget.TextView;
26 | import androidx.annotation.NonNull;
27 | import androidx.annotation.Nullable;
28 | import androidx.fragment.app.Fragment;
29 | import androidx.recyclerview.widget.LinearLayoutManager;
30 | import androidx.recyclerview.widget.RecyclerView;
31 | import com.google.android.gms.ads.AdRequest;
32 | import com.google.android.gms.ads.FullScreenContentCallback;
33 | import com.google.android.gms.ads.LoadAdError;
34 | import com.google.android.gms.ads.MobileAds;
35 | import com.google.android.gms.ads.initialization.InitializationStatus;
36 | import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
37 | import com.google.android.gms.ads.rewarded.RewardedAd;
38 | import com.google.android.gms.ads.rewarded.RewardedAdLoadCallback;
39 | import com.oneconnect.demoapp.OneConnectActivities.MainActivity;
40 | import com.oneconnect.demoapp.R;
41 | import com.oneconnect.demoapp.OneConnectActivities.SubscriptionsActivity;
42 | import com.oneconnect.demoapp.OneConnectAdapter.ServerProAdapter;
43 | import com.oneconnect.demoapp.SubscriptionId;
44 | import com.facebook.ads.*;
45 | import com.oneconnect.demoapp.Utils.Constants;
46 | import com.oneconnect.demoapp.OneConnectModel.Countries;
47 | import org.json.JSONArray;
48 | import org.json.JSONException;
49 | import org.json.JSONObject;
50 | import java.util.ArrayList;
51 |
52 | public class OneConnectPro extends Fragment implements ServerProAdapter.RegionListAdapterInterface {
53 |
54 | private RecyclerView recyclerView;
55 | private ServerProAdapter adapter;
56 | private RegionChooserInterface regionChooserInterface;
57 | private static RewardedAd rewardedAd;
58 | private RelativeLayout animationHolder;
59 | private static final String TAG = "Facebok Ads";
60 | private RelativeLayout mPurchaseLayout;
61 | private ImageButton mUnblockButton;
62 | private RewardedAd mRewardedAd;
63 | private RewardedVideoAd rewardedVideoAd;
64 | private static SharedPreferences sharedPreferences;
65 | static Countries countryy;
66 | public static Context context;
67 | public static boolean viewSet = false;
68 | static View view;
69 | public static boolean fbAdIsLoading = true;
70 | public static boolean googleAdIsLoading = true;
71 | public static boolean googleAdResune = false;
72 | public static boolean fbAdResume = false;
73 | public static ProgressDialog progressdialog;
74 | private static PopupWindow pw;
75 | private static View popupView;
76 |
77 | @Override
78 | public void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
79 | super.onCreate(savedInstanceState);
80 | AdSettings.addTestDevice("4cbd7f01-b2fb-4d12-ac35-f399d9f30351");
81 | AdSettings.addTestDevice("ad883e4f-8d84-4631-afdb-12104e62f4b8");
82 | AdSettings.addTestDevice("bd62c248-68dd-486b-9f83-efbe4a5d5db3");
83 | context = getActivity();
84 | }
85 |
86 | @Override
87 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
88 |
89 | view = inflater.inflate(R.layout.free_server, container, false);
90 |
91 | progressdialog = new ProgressDialog(context);
92 | progressdialog.setMessage("! Just a moment finding best video for you !");
93 | progressdialog.setCancelable(false);
94 |
95 | recyclerView = view.findViewById(R.id.region_recycler_view);
96 | recyclerView.setHasFixedSize(true);
97 | recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
98 | animationHolder = view.findViewById(R.id.animation_layout);
99 | sharedPreferences = getContext().getSharedPreferences("userRewarded",Context.MODE_PRIVATE);
100 |
101 | mPurchaseLayout = view.findViewById(R.id.purchase_layout);
102 | mUnblockButton = view.findViewById(R.id.vip_unblock);
103 | mPurchaseLayout.setVisibility(View.GONE);
104 |
105 |
106 | LayoutInflater pInflater = (LayoutInflater) view.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
107 | popupView = pInflater.inflate(R.layout.layout_bottom_sheet, (ViewGroup) view, false);
108 | pw = new PopupWindow(popupView,ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT, true);
109 | pw.setAnimationStyle(R.style.Animation);
110 | initOnClick();
111 |
112 | adapter = new ServerProAdapter(getActivity());
113 | recyclerView.setAdapter(adapter);
114 | return view;
115 | }
116 |
117 | @Override
118 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
119 | super.onViewCreated(view, savedInstanceState);
120 |
121 | loadServers();
122 | }
123 |
124 | private void loadServers() {
125 |
126 | ArrayList servers = new ArrayList<>();
127 |
128 | try {
129 | JSONArray jsonArray = new JSONArray(Constants.PREMIUM_SERVERS);
130 |
131 | for (int i=0; i < jsonArray.length();i++){
132 | JSONObject object = (JSONObject) jsonArray.get(i);
133 | servers.add(new Countries(object.getString("serverName"),
134 | object.getString("flag_url"),
135 | object.getString("ovpnConfiguration"),
136 | object.getString("vpnUserName"),
137 | object.getString("vpnPassword")
138 | ));
139 | }
140 | } catch (JSONException e) {
141 | e.printStackTrace();
142 | }
143 |
144 | adapter.setData(servers);
145 | animationHolder.setVisibility(View.GONE);
146 | }
147 |
148 | @Override
149 | public void onCountrySelected(Countries item) {
150 |
151 | regionChooserInterface.onRegionSelected(item);
152 | }
153 |
154 | @Override
155 | public void onAttach(Context ctx) {
156 | super.onAttach(ctx);
157 | if (ctx instanceof RegionChooserInterface) {
158 | regionChooserInterface = (RegionChooserInterface) ctx;
159 | }
160 | }
161 |
162 | @Override
163 | public void onDetach() {
164 | super.onDetach();
165 | regionChooserInterface = null;
166 | }
167 |
168 | public interface RegionChooserInterface {
169 | void onRegionSelected(Countries item);
170 | }
171 |
172 | public static void unblockServer()
173 | {
174 |
175 | TextView title = popupView.findViewById(R.id.title);
176 | if (!MainActivity.remove_all_video_ads_button) {
177 | title.setVisibility(View.GONE);
178 | view.setVisibility(View.GONE);
179 | }
180 |
181 | FrameLayout mainLayout = popupView.findViewById(R.id.mainLayout);
182 | mainLayout.setOnClickListener(v -> {
183 | pw.dismiss();
184 | });
185 |
186 | popupView.findViewById(R.id.but_subs).setOnClickListener(new View.OnClickListener() {
187 | @Override
188 | public void onClick(View v) {
189 | context.startActivity(new Intent(context, SubscriptionsActivity.class));
190 | pw.dismiss();
191 | }
192 | });
193 |
194 | pw.showAtLocation(popupView, Gravity.CENTER, 0, 0);
195 | }
196 |
197 | public static void onItemClick(Countries country)
198 | {
199 | countryy = country;
200 | if (SubscriptionId.OneConnectSubTwo || SubscriptionId.OneConnectSubThree || !MainActivity.remove_premium) {
201 | Intent intent=new Intent(context, MainActivity.class);
202 | intent.putExtra("c", country);
203 | intent.putExtra("type",MainActivity.type);
204 | intent.putExtra("admob_banner",MainActivity.admob_banner_id);
205 | intent.putExtra("admob_interstitial",MainActivity.admob_interstitial_id);
206 | intent.putExtra("fb_banner",MainActivity.fb_banner_id);
207 | intent.putExtra("fb_interstitial",MainActivity.fb_interstitial_id);
208 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
209 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
210 | context.startActivity(intent);
211 | }
212 | else
213 | {
214 | unblockServer();
215 | }
216 | }
217 |
218 | @Override
219 | public void onResume() {
220 | super.onResume();
221 | googleAdIsLoading = true;
222 | fbAdIsLoading = true;
223 | googleAdResune = false;
224 | fbAdResume = false;
225 | }
226 |
227 |
228 | private void initOnClick() {
229 |
230 | }
231 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/OneConnectModel/Countries.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.OneConnectModel;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 |
12 | import android.os.Parcel;
13 | import android.os.Parcelable;
14 |
15 | public class Countries implements Parcelable {
16 | private String country;
17 | private String flagUrl;
18 | private String ovpn;
19 | private String ovpnUserName;
20 | private String ovpnUserPassword;
21 |
22 |
23 | public Countries() {
24 | }
25 |
26 | public Countries(String country, String flagUrl, String ovpn) {
27 | this.country = country;
28 | this.flagUrl = flagUrl;
29 | this.ovpn = ovpn;
30 | }
31 |
32 | public Countries(String country, String flagUrl, String ovpn, String ovpnUserName, String ovpnUserPassword) {
33 | this.country = country;
34 | this.flagUrl = flagUrl;
35 | this.ovpn = ovpn;
36 | this.ovpnUserName = ovpnUserName;
37 | this.ovpnUserPassword = ovpnUserPassword;
38 | }
39 |
40 | public String getCountry() {
41 | return country;
42 | }
43 |
44 | public void setCountry(String country) {
45 | this.country = country;
46 | }
47 |
48 | public String getFlagUrl() {
49 | return flagUrl;
50 | }
51 |
52 | public void setFlagUrl(String flagUrl) {
53 | this.flagUrl = flagUrl;
54 | }
55 |
56 | public String getOvpn() {
57 | return ovpn;
58 | }
59 |
60 | public void setOvpn(String ovpn) {
61 | this.ovpn = ovpn;
62 | }
63 |
64 | public String getOvpnUserName() {
65 | return ovpnUserName;
66 | }
67 |
68 | public void setOvpnUserName(String ovpnUserName) {
69 | this.ovpnUserName = ovpnUserName;
70 | }
71 |
72 | public String getOvpnUserPassword() {
73 | return ovpnUserPassword;
74 | }
75 |
76 | public void setOvpnUserPassword(String ovpnUserPassword) {
77 | this.ovpnUserPassword = ovpnUserPassword;
78 | }
79 |
80 | public static final Creator CREATOR
81 | = new Creator() {
82 | public Countries createFromParcel(Parcel in) {
83 | return new Countries(in);
84 | }
85 |
86 | public Countries[] newArray(int size) {
87 | return new Countries[size];
88 | }
89 | };
90 |
91 | public int describeContents() {
92 | return 0;
93 | }
94 |
95 | @Override
96 | public void writeToParcel(Parcel dest, int flags) {
97 | dest.writeString(country);
98 | dest.writeString(flagUrl);
99 | dest.writeString(ovpn);
100 | dest.writeString(ovpnUserName);
101 | dest.writeString(ovpnUserPassword);
102 | }
103 |
104 | private Countries(Parcel in ) {
105 | country = in.readString();
106 | flagUrl = in.readString();
107 | ovpn = in.readString();
108 | ovpnUserName = in.readString();
109 | ovpnUserPassword = in.readString();
110 | }
111 | }
112 |
113 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/SubscriptionId.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 | public class SubscriptionId {
12 |
13 |
14 | public static final String ALL_MONTH = "one"; // Here will Subscription Id
15 | public static final String THREE_MONTH = "two"; // Here will Subscription Id
16 | public static final String SIX_MONTH = "three"; // Here will Subscription Id
17 | public static final String TWELVE_MONTH = "four"; // Here will Subscription Id
18 |
19 | public static boolean OneConnectSubOne = false;
20 | public static boolean OneConnectSubTwo = false;
21 | public static boolean OneConnectSubThree = false;
22 |
23 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/Utils/Constants.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.Utils;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 |
12 | public class Constants {
13 | public static String FREE_SERVERS = "";
14 | public static String PREMIUM_SERVERS = "";
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/Utils/CustomTxTRegular.java:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.Utils;
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 | import android.content.Context;
12 | import android.graphics.Typeface;
13 | import android.util.AttributeSet;
14 |
15 |
16 |
17 | public class CustomTxTRegular extends androidx.appcompat.widget.AppCompatTextView {
18 |
19 | public CustomTxTRegular(Context context, AttributeSet attributeSet, int defstyle)
20 | {
21 | super(context,attributeSet,defstyle);
22 | init();
23 | }
24 |
25 | public CustomTxTRegular(Context context, AttributeSet attributeSet)
26 | {
27 | super(context,attributeSet);
28 | init();
29 | }
30 |
31 | public CustomTxTRegular(Context context)
32 | {
33 | super(context);
34 | init();
35 | }
36 |
37 | private void init() {
38 | if (!isInEditMode()){
39 | Typeface normalTypeface = Typeface.createFromAsset(getContext().getAssets(), "Montserrat-Regular.ttf");
40 | setTypeface(normalTypeface);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/oneconnect/demoapp/ui/SideBarActivity.kt:
--------------------------------------------------------------------------------
1 | package com.oneconnect.demoapp.ui
2 |
3 |
4 | /**
5 | * https://developer.oneconnect.top/
6 | * @package Oneconnect SDK Project
7 | * @author oneconnect.top
8 | * @copyright May 2022
9 | */
10 |
11 |
12 | import android.os.Bundle
13 | import androidx.annotation.LayoutRes
14 | import androidx.appcompat.app.AppCompatActivity
15 | import androidx.appcompat.widget.Toolbar
16 | import androidx.core.view.GravityCompat
17 | import com.google.android.material.navigation.NavigationView
18 | import com.google.android.play.core.review.ReviewManager
19 | import com.infideap.drawerbehavior.AdvanceDrawerLayout
20 | import com.oneconnect.demoapp.R
21 |
22 |
23 | abstract class SideBarActivity : AppCompatActivity() {
24 |
25 | private lateinit var manager : ReviewManager
26 | protected var toolbar: Toolbar? = null
27 | private set
28 |
29 | @get:LayoutRes
30 | protected abstract val layoutRes: Int
31 |
32 | private var mDrawerLayout: AdvanceDrawerLayout? = null
33 | private var navigationView: NavigationView? = null
34 |
35 |
36 | override fun onCreate(savedInstanceState: Bundle?) {
37 | super.onCreate(savedInstanceState)
38 | setContentView(layoutRes)
39 |
40 | toolbar = findViewById(R.id.toolbar)
41 | if (toolbar != null) {
42 | setSupportActionBar(toolbar)
43 | }
44 |
45 | mDrawerLayout = findViewById(R.id.drawer_layout)
46 |
47 | }
48 |
49 |
50 | override fun onBackPressed() {
51 | if (mDrawerLayout!!.isDrawerOpen(GravityCompat.START)) {
52 | mDrawerLayout?.closeDrawer(GravityCompat.START)
53 | } else {
54 | super.onBackPressed()
55 | }
56 | }
57 |
58 |
59 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/flag_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-hdpi/flag_default.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/flag_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-hdpi/flag_image.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_drop_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-hdpi/ic_drop_down.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-hdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-ldpi/flag_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-ldpi/flag_default.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-ldpi/flag_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-ldpi/flag_image.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-ldpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-ldpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/flag_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-mdpi/flag_default.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/flag_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-mdpi/flag_image.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_drop_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-mdpi/ic_drop_down.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-mdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/flag_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-xhdpi/flag_default.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/flag_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-xhdpi/flag_image.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_drop_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-xhdpi/ic_drop_down.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-xhdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/trans.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-xhdpi/trans.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/flag_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-xxhdpi/flag_default.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_drop_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-xxhdpi/ic_drop_down.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-xxhdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/flag_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-xxxhdpi/flag_default.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_drop_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-xxxhdpi/ic_drop_down.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable-xxxhdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/button_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/button_bg2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/connect_btn1.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/connect_btn2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
6 |
9 |
14 |
15 |
16 | -
17 |
19 |
22 |
23 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/connect_btn2_on.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
6 |
9 |
10 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/connect_btn3.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
10 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/connect_btn3_on.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
10 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_arrow_back_ios_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_location_on_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_power_settings_new_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_signal_cellular_alt_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_signal_cellular_alt_24_off.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/main_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/main_bg2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/one_month.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/premium_server.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/drawable/premium_server.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/white_round_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/white_rounded_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/free_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
22 |
23 |
27 |
28 |
29 |
39 |
40 |
46 |
47 |
48 |
49 |
61 |
62 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
86 |
87 |
94 |
95 |
104 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/free_server.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
15 |
16 |
28 |
29 |
30 |
31 |
41 |
42 |
43 |
51 |
52 |
60 |
61 |
62 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_facebook_native_ad.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
15 |
16 |
23 |
24 |
32 |
33 |
41 |
42 |
55 |
56 |
67 |
68 |
69 |
70 |
80 |
81 |
82 |
83 |
99 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_facebook_native_ad_outline.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_bottom_sheet.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
19 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/main_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
17 |
18 |
25 |
26 |
27 |
28 |
38 |
39 |
40 |
41 |
50 |
51 |
60 |
61 |
74 |
75 |
85 |
86 |
87 |
88 |
89 |
90 |
96 |
97 |
106 |
107 |
116 |
117 |
125 |
126 |
143 |
144 |
154 |
155 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
177 |
178 |
187 |
188 |
200 |
201 |
212 |
213 |
227 |
228 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
263 |
264 |
265 |
271 |
272 |
280 |
281 |
289 |
290 |
291 |
292 |
293 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/native_banner_ad_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
21 |
22 |
28 |
29 |
37 |
38 |
46 |
47 |
48 |
49 |
55 |
56 |
57 |
58 |
63 |
64 |
69 |
70 |
75 |
76 |
84 |
85 |
94 |
95 |
96 |
97 |
109 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/native_layout.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
14 |
21 |
22 |
23 |
30 |
31 |
35 |
36 |
44 |
45 |
49 |
50 |
57 |
58 |
61 |
62 |
69 |
70 |
78 |
79 |
80 |
81 |
82 |
83 |
87 |
88 |
95 |
96 |
102 |
103 |
110 |
111 |
120 |
121 |
130 |
131 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/oneconnect_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
18 |
19 |
24 |
25 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/oneconnect_policy.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
23 |
24 |
35 |
36 |
41 |
42 |
52 |
53 |
60 |
61 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/oneconnect_tab.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
23 |
24 |
25 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/privacy_policy.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/pro_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
22 |
23 |
27 |
28 |
29 |
39 |
40 |
46 |
47 |
48 |
49 |
61 |
62 |
73 |
74 |
75 |
85 |
86 |
87 |
88 |
89 |
96 |
97 |
104 |
105 |
114 |
115 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/pro_server.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
29 |
30 |
31 |
32 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
16 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/subscription.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
22 |
23 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/subscription_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
24 |
25 |
35 |
36 |
45 |
46 |
47 |
62 |
63 |
64 |
65 |
78 |
79 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/mipmap-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/raw/homel.json:
--------------------------------------------------------------------------------
1 | {"assets":[],"layers":[{"ddd":0,"ind":0,"ty":4,"nm":"形状图层 5","ks":{"o":{"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"n":["0p833_0p833_0p333_0"],"t":8,"s":[100],"e":[30]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"n":["0p833_0p833_0p333_0"],"t":24,"s":[30],"e":[100]},{"t":40}]},"r":{"k":0},"p":{"k":[187.875,77.125,0]},"a":{"k":[-76.375,-2.875,0]},"s":{"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0.333]},"n":["0p833_0p833_0p333_0","0p833_0p833_0p333_0","0p833_0p833_0p333_0p333"],"t":8,"s":[100,100,100],"e":[200,200,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0.333]},"n":["0p833_0p833_0p333_0","0p833_0p833_0p333_0","0p833_0p833_0p333_0p333"],"t":24,"s":[200,200,100],"e":[100,100,100]},{"t":40}]}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"k":[18,18]},"p":{"k":[0,0]},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse"},{"ty":"st","c":{"k":[1,1,1,1]},"o":{"k":100},"w":{"k":0},"lc":1,"lj":1,"ml":4,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke"},{"ty":"fl","c":{"k":[0.87,0.42,0.56,1]},"o":{"k":100},"nm":"填充 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"k":[-76.482,-3.482],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆 1","np":3,"mn":"ADBE Vector Group"}],"ip":0,"op":40,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":1,"ty":4,"nm":"形状图层 4","ks":{"o":{"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"n":["0p833_0p833_0p333_0"],"t":6,"s":[100],"e":[30]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"n":["0p833_0p833_0p333_0"],"t":22,"s":[30],"e":[100]},{"t":36}]},"r":{"k":0},"p":{"k":[162.125,76.625,0]},"a":{"k":[-76.375,-2.875,0]},"s":{"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0.333]},"n":["0p833_0p833_0p333_0","0p833_0p833_0p333_0","0p833_0p833_0p333_0p333"],"t":6,"s":[100,100,100],"e":[200,200,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0.333]},"n":["0p833_0p833_0p333_0","0p833_0p833_0p333_0","0p833_0p833_0p333_0p333"],"t":22,"s":[200,200,100],"e":[100,100,100]},{"t":36}]}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"k":[18,18]},"p":{"k":[0,0]},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse"},{"ty":"st","c":{"k":[1,1,1,1]},"o":{"k":100},"w":{"k":0},"lc":1,"lj":1,"ml":4,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke"},{"ty":"fl","c":{"k":[0.81,0.55,0.82,1]},"o":{"k":100},"nm":"填充 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"k":[-76.482,-3.482],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆 1","np":3,"mn":"ADBE Vector Group"}],"ip":0,"op":40,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":2,"ty":4,"nm":"形状图层 3","ks":{"o":{"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"n":["0p833_0p833_0p333_0"],"t":4,"s":[100],"e":[30]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"n":["0p833_0p833_0p333_0"],"t":20,"s":[30],"e":[100]},{"t":32}]},"r":{"k":0},"p":{"k":[135.625,76.625,0]},"a":{"k":[-76.375,-2.875,0]},"s":{"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0.333]},"n":["0p833_0p833_0p333_0","0p833_0p833_0p333_0","0p833_0p833_0p333_0p333"],"t":4,"s":[100,100,100],"e":[200,200,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0.333]},"n":["0p833_0p833_0p333_0","0p833_0p833_0p333_0","0p833_0p833_0p333_0p333"],"t":20,"s":[200,200,100],"e":[100,100,100]},{"t":32}]}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"k":[18,18]},"p":{"k":[0,0]},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse"},{"ty":"st","c":{"k":[1,1,1,1]},"o":{"k":100},"w":{"k":0},"lc":1,"lj":1,"ml":4,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke"},{"ty":"fl","c":{"k":[0.47,0.31,0.62,1]},"o":{"k":100},"nm":"填充 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"k":[-76.482,-3.482],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆 1","np":3,"mn":"ADBE Vector Group"}],"ip":0,"op":40,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":3,"ty":4,"nm":"形状图层 2","ks":{"o":{"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"n":["0p833_0p833_0p333_0"],"t":2,"s":[100],"e":[30]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"n":["0p833_0p833_0p333_0"],"t":16,"s":[30],"e":[100]},{"t":28}]},"r":{"k":0},"p":{"k":[109.375,76.625,0]},"a":{"k":[-76.625,-3.125,0]},"s":{"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0.333]},"n":["0p833_0p833_0p333_0","0p833_0p833_0p333_0","0p833_0p833_0p333_0p333"],"t":2,"s":[100,100,100],"e":[200,200,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0.333]},"n":["0p833_0p833_0p333_0","0p833_0p833_0p333_0","0p833_0p833_0p333_0p333"],"t":16,"s":[200,200,100],"e":[100,100,100]},{"t":28}]}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"k":[18,18]},"p":{"k":[0,0]},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse"},{"ty":"st","c":{"k":[1,1,1,1]},"o":{"k":100},"w":{"k":0},"lc":1,"lj":1,"ml":4,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke"},{"ty":"fl","c":{"k":[0.54,0.81,0.89,1]},"o":{"k":100},"nm":"填充 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"k":[-76.482,-3.482],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆 1","np":3,"mn":"ADBE Vector Group"}],"ip":0,"op":40,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":4,"ty":4,"nm":"形状图层 1","ks":{"o":{"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"n":["0p833_0p833_0p333_0"],"t":0,"s":[100],"e":[30]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"n":["0p833_0p833_0p333_0"],"t":12,"s":[30],"e":[100]},{"t":24}]},"r":{"k":0},"p":{"k":[82.625,76.625,0]},"a":{"k":[-76.625,-3.375,0]},"s":{"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0.333]},"n":["0p833_0p833_0p333_0","0p833_0p833_0p333_0","0p833_0p833_0p333_0p333"],"t":0,"s":[100,100,100],"e":[200,200,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0.333]},"n":["0p833_0p833_0p333_0","0p833_0p833_0p333_0","0p833_0p833_0p333_0p333"],"t":12,"s":[200,200,100],"e":[100,100,100]},{"t":24}]}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"k":[18,18]},"p":{"k":[0,0]},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse"},{"ty":"st","c":{"k":[1,1,1,1]},"o":{"k":100},"w":{"k":0},"lc":1,"lj":1,"ml":4,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke"},{"ty":"fl","c":{"k":[0.34,0.45,0.78,1]},"o":{"k":100},"nm":"填充 1","mn":"ADBE Vector Graphic - Fill"},{"ty":"tr","p":{"k":[-76.482,-3.482],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆 1","np":3,"mn":"ADBE Vector Group"}],"ip":0,"op":40,"st":0,"bm":0,"sr":1}],"v":"4.5.4","ddd":0,"ip":0,"op":40,"fr":24,"w":280,"h":160}
--------------------------------------------------------------------------------
/app/src/main/res/raw/main_load.json:
--------------------------------------------------------------------------------
1 | {"v":"4.10.1","fr":30,"ip":0,"op":41,"w":300,"h":300,"nm":"合成 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"形状图层 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[180,156.5,0],"e":[100,156.5,0],"to":[-13.3333330154419,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":19,"s":[100,156.5,0],"e":[180,156.5,0],"to":[0,0,0],"ti":[-13.3333330154419,0,0]},{"t":40}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[40.916,40.916],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.184,0.482,0.906,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[4.534,-3.114],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":900,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"形状图层 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[100,156.5,0],"e":[180,156.5,0],"to":[13.3333330154419,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":19,"s":[180,156.5,0],"e":[100,156.5,0],"to":[0,0,0],"ti":[13.3333330154419,0,0]},{"t":40}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[40.916,40.916],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.145097994337,0.847059003045,0.654901960784,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[4.534,-3.114],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":900,"st":0,"bm":0}]}
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
18 |
19 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #2B3942
4 | #2B3942
5 | #FFFFFF
6 | #FFFFFF
7 |
8 | #2B3942
9 | @color/primary
10 | #1d89e4
11 | #0d1543
12 | #ffffff
13 | #2499E0
14 |
15 | #4e5457
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | OneConnect App
3 | Connected
4 | Not Connected
5 | false
6 | true
7 | https://developer.oneconnect.top/privacy/
8 | $1.00
9 | $2.00
10 | $3.00
11 | $4.00
12 | Monthly
13 | 3 Months
14 | 6 Months
15 | 12 Months
16 | Welcome to %1$s!
17 | By Using this OneConnect App, you agree to developer.oneconnect.top Privacy Policy.
18 | ACCEPT & CONTINUE
19 | Subscription Activity
20 | Subscription Titles
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
15 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
29 |
30 |
34 |
35 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | developer.oneconnect.top
6 |
7 |
8 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.0'
3 |
4 | repositories {
5 | jcenter()
6 | maven { url 'https://maven.google.com' }
7 | maven { url 'https://plugins.gradle.org/m2/'}
8 | maven { url 'https://jitpack.io' }
9 | google()
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:4.1.3'
13 | classpath 'com.google.gms:google-services:4.3.15'
14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15 | classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.14.0'
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | google()
22 | jcenter()
23 | mavenCentral()
24 | maven { url "https://www.jitpack.io" }
25 | maven { url 'https://maven.google.com' }
26 | }
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | android.enableJetifier=true
13 | android.useAndroidX=true
14 | org.gradle.jvmargs=-Xmx1024m
15 | android.bundle.enableUncompressedNativeLibs=false
16 |
17 | # When configured, Gradle will run in incubating parallel mode.
18 | # This option should only be used with decoupled projects. More details, visit
19 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
20 | # org.gradle.parallel=true
21 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oneconnectapi/OneConnectSdk-demo-android/c05661f544b095fe6939e7ddc329f470079e8b66/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Feb 15 11:52:53 AZT 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------