commit bf7473cf133b3b9abe19d6420c67aa03f290fc3e Author: Sultan Mustafijul Hoque Date: Thu Nov 30 16:49:14 2023 +0530 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..f7331be --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Youth Kalakshetra \ No newline at end of file diff --git a/.idea/ChatGPTCopilotChannelManager.xml b/.idea/ChatGPTCopilotChannelManager.xml new file mode 100644 index 0000000..e80a86c --- /dev/null +++ b/.idea/ChatGPTCopilotChannelManager.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..6d89050 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0ad17cb --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/other.xml b/.idea/other.xml new file mode 100644 index 0000000..f3d4a2e --- /dev/null +++ b/.idea/other.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..3091c9a --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,43 @@ +plugins { + id 'com.android.application' + id 'com.google.gms.google-services' +} + +android { + namespace 'org.Kalakshetra.Youth' + compileSdk 34 + + defaultConfig { + applicationId "org.Kalakshetra.Youth" + minSdk 24 + targetSdk 34 + versionCode 1556746188 + versionName "2.1.1" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.10.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'com.airbnb.android:lottie:6.2.0' + implementation 'com.google.firebase:firebase-messaging:23.3.1' + implementation 'com.onesignal:OneSignal:[5.0.0, 5.99.99]' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' +} \ No newline at end of file diff --git a/app/google-services.json b/app/google-services.json new file mode 100644 index 0000000..9fafb4a --- /dev/null +++ b/app/google-services.json @@ -0,0 +1,48 @@ +{ + "project_info": { + "project_number": "55761509604", + "project_id": "default-webview-app", + "storage_bucket": "default-webview-app.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:55761509604:android:b17141d40bfb07c55620f1", + "android_client_info": { + "package_name": "com.FreestylePost" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "AIzaSyCgbzlYkj7WWfoYVEP1L-NtqsZViJJX1gU" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:55761509604:android:6c36f073db701a7d5620f1", + "android_client_info": { + "package_name": "org.Kalakshetra.Youth" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "AIzaSyCgbzlYkj7WWfoYVEP1L-NtqsZViJJX1gU" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/release/app-release.aab b/app/release/app-release.aab new file mode 100644 index 0000000..403e24b Binary files /dev/null and b/app/release/app-release.aab differ diff --git a/app/src/androidTest/java/org/Kalakshetra/Youth/ExampleInstrumentedTest.java b/app/src/androidTest/java/org/Kalakshetra/Youth/ExampleInstrumentedTest.java new file mode 100644 index 0000000..8a9a34b --- /dev/null +++ b/app/src/androidTest/java/org/Kalakshetra/Youth/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package org.Kalakshetra.Youth; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("org.Kalakshetra.Youth", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..44a21a6 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 0000000..61e7733 Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ diff --git a/app/src/main/java/org/Kalakshetra/Youth/ApplicationClass.java b/app/src/main/java/org/Kalakshetra/Youth/ApplicationClass.java new file mode 100644 index 0000000..49cab21 --- /dev/null +++ b/app/src/main/java/org/Kalakshetra/Youth/ApplicationClass.java @@ -0,0 +1,39 @@ +package org.Kalakshetra.Youth; + +import android.app.Application; +import com.onesignal.OneSignal; +import com.onesignal.debug.LogLevel; +import com.onesignal.Continue; + +public class ApplicationClass extends Application { + + // NOTE: Replace the below with your own ONESIGNAL_APP_ID + private static final String ONESIGNAL_APP_ID = "d76cae65-fc61-4f1c-9d04-25f7e329c2dc"; + + @Override + public void onCreate() { + super.onCreate(); + + // Verbose Logging set to help debug issues, remove before releasing your app. + OneSignal.getDebug().setLogLevel(LogLevel.VERBOSE); + + // OneSignal Initialization + OneSignal.initWithContext(this, ONESIGNAL_APP_ID); + + // requestPermission will show the native Android notification permission prompt. + // NOTE: It's recommended to use a OneSignal In-App Message to prompt instead. + OneSignal.getNotifications().requestPermission(true, Continue.with(r -> { + if (r.isSuccess()) { + if (r.getData()) { + // `requestPermission` completed successfully and the user has accepted permission + } + else { + // `requestPermission` completed successfully but the user has rejected permission + } + } + else { + // `requestPermission` completed unsuccessfully, check `r.getThrowable()` for more info on the failure reason + } + })); + } +} diff --git a/app/src/main/java/org/Kalakshetra/Youth/MainActivity.java b/app/src/main/java/org/Kalakshetra/Youth/MainActivity.java new file mode 100644 index 0000000..9131f3a --- /dev/null +++ b/app/src/main/java/org/Kalakshetra/Youth/MainActivity.java @@ -0,0 +1,196 @@ +package org.Kalakshetra.Youth; + +import androidx.appcompat.app.AppCompatActivity; + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.DownloadManager; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.IntentFilter; +import android.graphics.Bitmap; +import android.net.Uri; +import android.os.Bundle; +import android.os.Environment; +import android.view.View; +import android.webkit.DownloadListener; +import android.webkit.URLUtil; +import android.webkit.ValueCallback; +import android.webkit.WebChromeClient; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.Button; +import android.widget.ProgressBar; +import android.webkit.WebSettings; +import android.widget.Toast; + +import org.Kalakshetra.Youth.R; + +public class MainActivity extends AppCompatActivity { + + WebView webView; + ProgressBar pgBar; + Button btnBack; + + private static final int FILE_CHOOSER_RESULT_CODE = 1; + private ValueCallback filePathCallback; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Button btnHome; + + webView = findViewById(R.id.webView); + pgBar = findViewById(R.id.pgBar); + btnBack = findViewById(R.id.btnBack); + btnHome = findViewById(R.id.btnHome); + + pgBar.setVisibility(View.VISIBLE); + + btnHome.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + webView.loadUrl("https://youthkalakshetra.org/"); //Navigate to home URL/New Url on Home button click. + } + }); + + //Navigate to the new Activity + /*btnHome.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent btnHome; + + btnHome = new Intent(MainActivity.this, NextActivity.class); + startActivity(btnHome); + } + });*/ + + // Configure WebView settings + WebSettings webSettings = webView.getSettings(); + webSettings.setJavaScriptEnabled(true); // Enable JavaScript + + webView.loadUrl("https://youthkalakshetra.org/"); + webView.setWebViewClient(new WebViewClient() { + + @Override + public void onPageStarted(WebView view, String url, Bitmap favicon) { + pgBar.setVisibility(View.VISIBLE); + pgBar.setProgress(0); + super.onPageStarted(view, url, favicon); + } + + @Override + public void onPageFinished(WebView view, String url) { + pgBar.setVisibility(View.GONE); + super.onPageFinished(view, url); + } + }); + + webView.setDownloadListener(new DownloadListener() { + @SuppressLint("UnspecifiedRegisterReceiverFlag") + @Override + public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { + DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); + request.setTitle(URLUtil.guessFileName(url, contentDisposition, mimetype)); + request.setDescription("Downloading File..."); + request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); + request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, URLUtil.guessFileName(url, contentDisposition, mimetype)); + URLUtil.guessFileName(url, contentDisposition, mimetype); + DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); + downloadManager.enqueue(request); + Toast.makeText(getApplicationContext(), "Downloading...", Toast.LENGTH_SHORT).show(); + registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); + } + + BroadcastReceiver onComplete = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + Toast.makeText(getApplicationContext(), "Download Completed!", Toast.LENGTH_SHORT).show(); + + // Open Downloads folder + Intent downloadsIntent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS); + downloadsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(downloadsIntent); + } + }; + }); + + // Set up WebChromeClient for file upload support + webView.setWebChromeClient(new WebChromeClient() { + + // For Android 5.0+ + @Override + public boolean onShowFileChooser(WebView webView, ValueCallback filePathCallback, FileChooserParams fileChooserParams) { + MainActivity.this.filePathCallback = filePathCallback; + openFileChooser(); + return true; + } + }); + + // Set up back button click listener + btnBack.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + onBackPressed(); + } + }); + } + + private void openFileChooser() { + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.addCategory(Intent.CATEGORY_OPENABLE); + intent.setType("*/*"); + + startActivityForResult(Intent.createChooser(intent, "File Chooser"), FILE_CHOOSER_RESULT_CODE); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + + if (requestCode == FILE_CHOOSER_RESULT_CODE) { + if (filePathCallback == null) + return; + + Uri result = (data == null || resultCode != RESULT_OK) ? null : data.getData(); + if (result != null) { + Uri[] results = new Uri[]{result}; + filePathCallback.onReceiveValue(results); + } else { + filePathCallback.onReceiveValue(null); + } + + filePathCallback = null; + } + } + + @Override + public void onBackPressed() { + if (webView.canGoBack()) { + webView.goBack(); + } else { + showExitConfirmationDialog(); + } + } + + private void showExitConfirmationDialog() { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setMessage(R.string.exit_confirmation_message) + .setPositiveButton("Exit", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + finish(); // Close the app + } + }) + .setNegativeButton("Stay", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + // User clicked "Stay," do nothing + dialog.dismiss(); + } + }); + builder.create().show(); + } +} diff --git a/app/src/main/java/org/Kalakshetra/Youth/SplashActivity.java b/app/src/main/java/org/Kalakshetra/Youth/SplashActivity.java new file mode 100644 index 0000000..a6064de --- /dev/null +++ b/app/src/main/java/org/Kalakshetra/Youth/SplashActivity.java @@ -0,0 +1,39 @@ +package org.Kalakshetra.Youth; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.widget.ImageView; + +import org.Kalakshetra.Youth.R; + +public class SplashActivity extends AppCompatActivity { + + ImageView animLogo; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_splash); + + animLogo = findViewById(R.id.animLogo); + + Animation logo = AnimationUtils.loadAnimation(this, R.anim.logo_splash); + + animLogo.setAnimation(logo); + + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + Intent iHome = new Intent(SplashActivity.this, MainActivity.class); + startActivity(iHome); + finish(); + } + }, 4000); + + } +} \ No newline at end of file diff --git a/app/src/main/res/anim/logo_splash.xml b/app/src/main/res/anim/logo_splash.xml new file mode 100644 index 0000000..340a888 --- /dev/null +++ b/app/src/main/res/anim/logo_splash.xml @@ -0,0 +1,21 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/ic_stat_onesignal_default.png b/app/src/main/res/drawable-hdpi/ic_stat_onesignal_default.png new file mode 100644 index 0000000..a13f819 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_stat_onesignal_default.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_stat_onesignal_default.png b/app/src/main/res/drawable-mdpi/ic_stat_onesignal_default.png new file mode 100644 index 0000000..2e8df1a Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_stat_onesignal_default.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_stat_onesignal_default.png b/app/src/main/res/drawable-xhdpi/ic_stat_onesignal_default.png new file mode 100644 index 0000000..f0ec5e0 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_stat_onesignal_default.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_stat_onesignal_default.png b/app/src/main/res/drawable-xxhdpi/ic_stat_onesignal_default.png new file mode 100644 index 0000000..ca4e801 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_stat_onesignal_default.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_stat_onesignal_default.png b/app/src/main/res/drawable-xxxhdpi/ic_stat_onesignal_default.png new file mode 100644 index 0000000..364fedb Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_stat_onesignal_default.png differ diff --git a/app/src/main/res/drawable/app_logo.png b/app/src/main/res/drawable/app_logo.png new file mode 100644 index 0000000..b4bf306 Binary files /dev/null and b/app/src/main/res/drawable/app_logo.png differ diff --git a/app/src/main/res/drawable/ic_arrow_back_24.xml b/app/src/main/res/drawable/ic_arrow_back_24.xml new file mode 100644 index 0000000..3cd2577 --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_back_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_arrow_back_ios_new_24.xml b/app/src/main/res/drawable/ic_arrow_back_ios_new_24.xml new file mode 100644 index 0000000..5f0c51c --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_back_ios_new_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_home_24.xml b/app/src/main/res/drawable/ic_home_24.xml new file mode 100644 index 0000000..1238bb9 --- /dev/null +++ b/app/src/main/res/drawable/ic_home_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_keyboard_backspace_24_grey.xml b/app/src/main/res/drawable/ic_keyboard_backspace_24_grey.xml new file mode 100644 index 0000000..c6f0aeb --- /dev/null +++ b/app/src/main/res/drawable/ic_keyboard_backspace_24_grey.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_keyboard_backspace_24_long.xml b/app/src/main/res/drawable/ic_keyboard_backspace_24_long.xml new file mode 100644 index 0000000..c6f0aeb --- /dev/null +++ b/app/src/main/res/drawable/ic_keyboard_backspace_24_long.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_color.xml b/app/src/main/res/drawable/ic_launcher_color.xml new file mode 100644 index 0000000..303fed6 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_color.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..76ae19c --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,58 @@ + + + + + + + + + + +