mirror of
https://github.com/PranshulGG/WeatherMaster.git
synced 2026-10-23 03:24:11 -05:00
1.1.3 updated
This commit is contained in:
1 parent
01d42ee5e2
commit
2e89f154cf
42 files changed
+2912
-4352
No files matched your search
@@ -0,0 +1,226 @@
|
||||
package com.example.weathermaster;
|
||||
|
||||
|
||||
import android.animation.ArgbEvaluator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class AboutPage extends AppCompatActivity {
|
||||
|
||||
private WebView webview;
|
||||
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
|
||||
|
||||
// Webview stuff
|
||||
webview = findViewById(R.id.webView);
|
||||
WebSettings webSettings = webview.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setAllowFileAccessFromFileURLs(true);
|
||||
webSettings.setAllowUniversalAccessFromFileURLs(true);
|
||||
webSettings.setAllowContentAccess(true);
|
||||
webview.setVerticalScrollBarEnabled(true);
|
||||
webview.setHorizontalScrollBarEnabled(false);
|
||||
webview.setOverScrollMode(WebView.OVER_SCROLL_NEVER);
|
||||
webview.setWebViewClient(new WebViewClientDemo());
|
||||
AndroidInterface androidInterface = new AndroidInterface(this);
|
||||
webview.addJavascriptInterface(androidInterface, "AndroidInterface");
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.mainBG));
|
||||
|
||||
webview.loadUrl("file:///android_asset/pages/AboutPage.html");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public class AndroidInterface {
|
||||
private AboutPage aActivity;
|
||||
|
||||
AndroidInterface(AboutPage activity) {
|
||||
aActivity = activity;
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void updateStatusBarColor(final String color) {
|
||||
aActivity.runOnUiThread(new Runnable() {
|
||||
@SuppressLint("ResourceType")
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void run() {
|
||||
int statusBarColor;
|
||||
int navigationBarColor;
|
||||
int systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
|
||||
|
||||
if(color.equals("Scrolled")){
|
||||
statusBarColor = 0xFF1e2024;
|
||||
navigationBarColor = 0xFF121317;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("ScrollFalse")) {
|
||||
statusBarColor = 0xFF121317;
|
||||
navigationBarColor = 0xFF121317;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("GoBack")){
|
||||
back();
|
||||
return;
|
||||
} else if (color.equals("OpenTermsConditions")){
|
||||
openTermsConditions();
|
||||
return;
|
||||
} else if (color.equals("OpenPrivacyPolicy")){
|
||||
openPrivacyPolicy();
|
||||
return;
|
||||
} else if (color.equals("OpenLicenses")){
|
||||
openThirdParty();
|
||||
return;
|
||||
|
||||
} else if (color.equals("bluesetDef")) {
|
||||
|
||||
return;
|
||||
} else if (color.equals("keepiton")) {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
return;
|
||||
} else if (color.equals("keepitoff")) {
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
return;
|
||||
} else if (color.equals("itsOn")) {
|
||||
Toast.makeText(aActivity, "Your device will stay awake", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else if (color.equals("ItsOff")) {
|
||||
Toast.makeText(aActivity, "Your device will go to sleep at the default time", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
|
||||
} else {
|
||||
Toast.makeText(aActivity, "not found", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int currentStatusBarColor = aActivity.getWindow().getStatusBarColor();
|
||||
int currentNavigationBarColor = aActivity.getWindow().getNavigationBarColor();
|
||||
|
||||
ObjectAnimator statusBarAnimator = ObjectAnimator.ofObject(
|
||||
aActivity.getWindow(),
|
||||
"statusBarColor",
|
||||
new ArgbEvaluator(),
|
||||
currentStatusBarColor,
|
||||
statusBarColor
|
||||
);
|
||||
|
||||
statusBarAnimator.setDuration(200);
|
||||
statusBarAnimator.start();
|
||||
|
||||
ObjectAnimator navBarAnimator = ObjectAnimator.ofObject(
|
||||
aActivity.getWindow(),
|
||||
"navigationBarColor",
|
||||
new ArgbEvaluator(),
|
||||
currentNavigationBarColor,
|
||||
navigationBarColor
|
||||
);
|
||||
|
||||
navBarAnimator.setDuration(200);
|
||||
navBarAnimator.start();
|
||||
|
||||
aActivity.getWindow().setNavigationBarColor(navigationBarColor);
|
||||
|
||||
View decorView = aActivity.getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(systemUiVisibilityFlags);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void openTermsConditions() {
|
||||
Intent intent = new Intent(aActivity, Terms_Conditions.class);
|
||||
aActivity.startActivity(intent);
|
||||
}
|
||||
public void openPrivacyPolicy() {
|
||||
Intent intent = new Intent(aActivity, PrivacyPolicy.class);
|
||||
aActivity.startActivity(intent);
|
||||
}
|
||||
public void openThirdParty() {
|
||||
Intent intent = new Intent(aActivity, ThirdParty.class);
|
||||
aActivity.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void back() {
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class WebViewClientDemo extends WebViewClient {
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (shouldOpenInBrowser(url)) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
view.getContext().startActivity(intent);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private boolean shouldOpenInBrowser(String url) {
|
||||
return url.startsWith("https://fonts.google.com/specimen/Outfit?query=outfit") ||
|
||||
url.startsWith("https://openweathermap.org/") ||
|
||||
url.startsWith("https://fonts.google.com/specimen/Poppins?query=poppins") ||
|
||||
url.startsWith("https://github.com/material-components/material-web") ||
|
||||
url.startsWith("https://app-privacy-policy-generator.nisrulz.com/") ||
|
||||
url.startsWith("https://github.com/PranshulGG/WeatherMaster") ||
|
||||
url.startsWith("mailto:pranshul.devmain@gmail.com")||
|
||||
url.startsWith("https://github.com/PranshulGG/WeatherMaster/releases");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -70,11 +70,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
|
||||
);
|
||||
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
|
||||
@@ -94,7 +89,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
AndroidInterface androidInterface = new AndroidInterface(this);
|
||||
webview.addJavascriptInterface(androidInterface, "AndroidInterface");
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.black));
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.diffDefault));
|
||||
|
||||
|
||||
requestLocationPermissions();
|
||||
@@ -205,691 +200,121 @@ public class MainActivity extends AppCompatActivity {
|
||||
int systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
|
||||
|
||||
if (color.equals("Activitybluedark")) {
|
||||
statusBarColor = 0xFF121318;
|
||||
navigationBarColor = 0xFF121318;
|
||||
if(color.equals("01d")){
|
||||
statusBarColor = 0xFF001d33;
|
||||
navigationBarColor = 0xFF001d33;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C01d));
|
||||
|
||||
} else if (color.equals("Activitybluelight")) {
|
||||
statusBarColor = 0xFFfaf8ff;
|
||||
navigationBarColor = 0xFFfaf8ff;
|
||||
|
||||
|
||||
} else if (color.equals("Activitypurplelight")) {
|
||||
statusBarColor = 0xFFfff7fd;
|
||||
navigationBarColor = 0xFFfff7fd;
|
||||
|
||||
} else if (color.equals("Activitypurpledark")) {
|
||||
statusBarColor = 0xFF161217;
|
||||
navigationBarColor = 0xFF161217;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("Activityyellowlight")) {
|
||||
statusBarColor = 0xFFfdf9ec;
|
||||
navigationBarColor = 0xFFfdf9ec;
|
||||
} else if (color.equals("Activityyellowdark")) {
|
||||
statusBarColor = 0xFF14140c;
|
||||
navigationBarColor = 0xFF14140c;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("Activitygreenlight")) {
|
||||
statusBarColor = 0xFFf8fbf1;
|
||||
navigationBarColor = 0xFFf8fbf1;
|
||||
|
||||
} else if (color.equals("Activitygreendark")) {
|
||||
statusBarColor = 0xFF11140f;
|
||||
navigationBarColor = 0xFF11140f;
|
||||
systemUiVisibilityFlags = 0;
|
||||
} else if (color.equals("Activityredlight")) {
|
||||
statusBarColor = 0xFFfff8f6;
|
||||
navigationBarColor = 0xFFfff8f6;
|
||||
} else if (color.equals("Activityreddark")) {
|
||||
statusBarColor = 0xFF1a1110;
|
||||
navigationBarColor = 0xFF1a1110;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("ActivityPinklight")) {
|
||||
statusBarColor = 0xFFfff8f8;
|
||||
navigationBarColor = 0xFFfff8f8;
|
||||
} else if (color.equals("ActivityPinkdark")) {
|
||||
statusBarColor = 0xFF191113;
|
||||
navigationBarColor = 0xFF191113;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("ActivityCharcollight")) {
|
||||
statusBarColor = 0xFFf9f9f9;
|
||||
navigationBarColor = 0xFFf9f9f9;
|
||||
|
||||
} else if (color.equals("ActivityCharcoldark")) {
|
||||
statusBarColor = 0xFF131313;
|
||||
navigationBarColor = 0xFF131313;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("ActivityOrangelight")) {
|
||||
statusBarColor = 0xFFfff8f4;
|
||||
navigationBarColor = 0xFFfff8f4;
|
||||
|
||||
} else if (color.equals("ActivityOrangedark")) {
|
||||
statusBarColor = 0xFF17130d;
|
||||
navigationBarColor = 0xFF17130d;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
// Main-START
|
||||
} else if (color.equals("blue-light")) {
|
||||
statusBarColor = 0xFFfaf8ff;
|
||||
navigationBarColor = 0xFFfaf8ff;
|
||||
setTheme(R.style.blue_light_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.blue_light));
|
||||
|
||||
|
||||
} else if (color.equals("blue-dark")) {
|
||||
statusBarColor = 0xFF121318;
|
||||
navigationBarColor = 0xFF121318;
|
||||
systemUiVisibilityFlags = 0;
|
||||
setTheme(R.style.blue_dark_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.blue_dark));
|
||||
|
||||
|
||||
} else if (color.equals("purple-light")) {
|
||||
statusBarColor = 0xFFfff7fd;
|
||||
navigationBarColor = 0xFFfff7fd;
|
||||
setTheme(R.style.purple_light_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.purple_light));
|
||||
|
||||
|
||||
} else if (color.equals("purple-dark")) {
|
||||
statusBarColor = 0xFF161217;
|
||||
navigationBarColor = 0xFF161217;
|
||||
systemUiVisibilityFlags = 0;
|
||||
setTheme(R.style.purple_dark_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.purple_dark));
|
||||
|
||||
|
||||
} else if (color.equals("yellow-light")) {
|
||||
statusBarColor = 0xFFfdf9ec;
|
||||
navigationBarColor = 0xFFfdf9ec;
|
||||
setTheme(R.style.yellow_light_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.yellow_light));
|
||||
|
||||
|
||||
} else if (color.equals("yellow-dark")) {
|
||||
statusBarColor = 0xFF14140c;
|
||||
navigationBarColor = 0xFF14140c;
|
||||
systemUiVisibilityFlags = 0;
|
||||
setTheme(R.style.yellow_dark_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.yellow_dark));
|
||||
|
||||
|
||||
} else if (color.equals("green-light")) {
|
||||
statusBarColor = 0xFFf8fbf1;
|
||||
navigationBarColor = 0xFFf8fbf1;
|
||||
setTheme(R.style.green_light_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.green_light));
|
||||
|
||||
|
||||
} else if (color.equals("green-dark")) {
|
||||
statusBarColor = 0xFF11140f;
|
||||
navigationBarColor = 0xFF11140f;
|
||||
systemUiVisibilityFlags = 0;
|
||||
setTheme(R.style.green_dark_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.green_dark));
|
||||
|
||||
|
||||
} else if (color.equals("red-light")) {
|
||||
statusBarColor = 0xFFfff8f6;
|
||||
navigationBarColor = 0xFFfff8f6;
|
||||
setTheme(R.style.red_light_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.red_light));
|
||||
|
||||
|
||||
} else if (color.equals("red-dark")) {
|
||||
statusBarColor = 0xFF1a1110;
|
||||
navigationBarColor = 0xFF1a1110;
|
||||
systemUiVisibilityFlags = 0;
|
||||
setTheme(R.style.red_dark_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.red_dark));
|
||||
|
||||
|
||||
} else if (color.equals("pink-light")) {
|
||||
statusBarColor = 0xFFfff8f8;
|
||||
navigationBarColor = 0xFFfff8f8;
|
||||
setTheme(R.style.pink_light_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.pink_light));
|
||||
|
||||
|
||||
} else if (color.equals("pink-dark")) {
|
||||
statusBarColor = 0xFF191113;
|
||||
navigationBarColor = 0xFF191113;
|
||||
systemUiVisibilityFlags = 0;
|
||||
setTheme(R.style.pink_dark_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.pink_dark));
|
||||
|
||||
|
||||
} else if (color.equals("charcol-light")) {
|
||||
statusBarColor = 0xFFf9f9f9;
|
||||
navigationBarColor = 0xFFf9f9f9;
|
||||
setTheme(R.style.charcol_light_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.charcoal_light));
|
||||
|
||||
|
||||
} else if (color.equals("charcol-dark")) {
|
||||
statusBarColor = 0xFF131313;
|
||||
navigationBarColor = 0xFF131313;
|
||||
systemUiVisibilityFlags = 0;
|
||||
setTheme(R.style.charcol_dark_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.charcoal_dark));
|
||||
|
||||
|
||||
} else if (color.equals("orange-light")) {
|
||||
statusBarColor = 0xFFfff8f4;
|
||||
navigationBarColor = 0xFFfff8f4;
|
||||
setTheme(R.style.orange_light_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.orange_light));
|
||||
|
||||
|
||||
} else if (color.equals("orange-dark")) {
|
||||
statusBarColor = 0xFF17130d;
|
||||
navigationBarColor = 0xFF17130d;
|
||||
} else if (color.equals("01n")) {
|
||||
statusBarColor = 0xFF001d33;
|
||||
navigationBarColor = 0xFF001d33;
|
||||
systemUiVisibilityFlags = 0;
|
||||
setTheme(R.style.orange_dark_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.orange_dark));
|
||||
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C01n));
|
||||
|
||||
} else if (color.equals("blue-bright-light")) {
|
||||
statusBarColor = 0xFFfaf8ff;
|
||||
navigationBarColor = 0xFFfaf8ff;
|
||||
setTheme(R.style.blue_bright_light_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.blue_bright_light));
|
||||
} else if(color.equals("02d")){
|
||||
statusBarColor = 0xFF0e1d2a;
|
||||
navigationBarColor = 0xFF0e1d2a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C02d));
|
||||
|
||||
} else if (color.equals("02n")) {
|
||||
statusBarColor = 0xFF0e1d2a;
|
||||
navigationBarColor = 0xFF0e1d2a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C02n));
|
||||
|
||||
} else if (color.equals("blue-bright-dark")) {
|
||||
statusBarColor = 0xFF11131a;
|
||||
navigationBarColor = 0xFF11131a;
|
||||
} else if(color.equals("03d")){
|
||||
statusBarColor = 0xFF0e1d2a;
|
||||
navigationBarColor = 0xFF0e1d2a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
setTheme(R.style.blue_bright_dark_scheme);
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.blue_bright_dark));
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C03d));
|
||||
|
||||
|
||||
// scroll colors main-window
|
||||
|
||||
} else if (color.equals("scroll-blue-dark")) {
|
||||
statusBarColor = 0xFF1e1f25;
|
||||
navigationBarColor = 0xFF1e1f25;
|
||||
} else if (color.equals("03n")) {
|
||||
statusBarColor = 0xFF0e1d2a;
|
||||
navigationBarColor = 0xFF0e1d2a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C03n));
|
||||
|
||||
} else if (color.equals("scroll-blue-light")) {
|
||||
statusBarColor = 0xFFeeedf4;
|
||||
navigationBarColor = 0xFFeeedf4;
|
||||
|
||||
} else if (color.equals("scroll-purple-dark")) {
|
||||
statusBarColor = 0xFF221e24;
|
||||
navigationBarColor = 0xFF221e24;
|
||||
} else if(color.equals("04d")){
|
||||
statusBarColor = 0xFF0e1d2a;
|
||||
navigationBarColor = 0xFF0e1d2a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C04d));
|
||||
|
||||
} else if (color.equals("scroll-purple-light")) {
|
||||
statusBarColor = 0xFFf4ebf3;
|
||||
navigationBarColor = 0xFFf4ebf3;
|
||||
|
||||
} else if (color.equals("scroll-yellow-dark")) {
|
||||
statusBarColor = 0xFF202018;
|
||||
navigationBarColor = 0xFF202018;
|
||||
} else if (color.equals("04n")) {
|
||||
statusBarColor = 0xFF0e1d2a;
|
||||
navigationBarColor = 0xFF0e1d2a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C04n));
|
||||
|
||||
} else if (color.equals("scroll-yellow-light")) {
|
||||
statusBarColor = 0xFFf1eee0;
|
||||
navigationBarColor = 0xFFf1eee0;
|
||||
|
||||
} else if (color.equals("scroll-green-dark")) {
|
||||
statusBarColor = 0xFF1d211b;
|
||||
navigationBarColor = 0xFF1d211b;
|
||||
} else if(color.equals("09d")){
|
||||
statusBarColor = 0xFF0e1d2a;
|
||||
navigationBarColor = 0xFF0e1d2a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C09d));
|
||||
|
||||
} else if (color.equals("scroll-green-light")) {
|
||||
statusBarColor = 0xFFecefe5;
|
||||
navigationBarColor = 0xFFecefe5;
|
||||
|
||||
} else if (color.equals("scroll-red-dark")) {
|
||||
statusBarColor = 0xFF271d1c;
|
||||
navigationBarColor = 0xFF271d1c;
|
||||
} else if (color.equals("09n")) {
|
||||
statusBarColor = 0xFF0e1d2a;
|
||||
navigationBarColor = 0xFF0e1d2a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C09n));
|
||||
|
||||
} else if (color.equals("scroll-red-light")) {
|
||||
statusBarColor = 0xFFfceae7;
|
||||
navigationBarColor = 0xFFfceae7;
|
||||
|
||||
} else if (color.equals("scroll-pink-dark")) {
|
||||
statusBarColor = 0xFF261d20;
|
||||
navigationBarColor = 0xFF261d20;
|
||||
} else if(color.equals("10d")){
|
||||
statusBarColor = 0xFF0e1d2a;
|
||||
navigationBarColor = 0xFF0e1d2a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C10d));
|
||||
|
||||
} else if (color.equals("scroll-pink-light")) {
|
||||
statusBarColor = 0xFF261d20;
|
||||
navigationBarColor = 0xFF261d20;
|
||||
|
||||
} else if (color.equals("scroll-charcol-dark")) {
|
||||
statusBarColor = 0xFF1f1f1f;
|
||||
navigationBarColor = 0xFF1f1f1f;
|
||||
} else if (color.equals("10n")) {
|
||||
statusBarColor = 0xFF0e1d2a;
|
||||
navigationBarColor = 0xFF0e1d2a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C10n));
|
||||
|
||||
} else if (color.equals("scroll-charcol-light")) {
|
||||
statusBarColor = 0xFFeeeeee;
|
||||
navigationBarColor = 0xFFeeeeee;
|
||||
|
||||
} else if (color.equals("scroll-orange-dark")) {
|
||||
statusBarColor = 0xFF241f19;
|
||||
navigationBarColor = 0xFF241f19;
|
||||
} else if(color.equals("11d")){
|
||||
statusBarColor = 0xFF0e1d2a;
|
||||
navigationBarColor = 0xFF0e1d2a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C11d));
|
||||
|
||||
} else if (color.equals("scroll-orange-light")) {
|
||||
statusBarColor = 0xFFf8ece2;
|
||||
navigationBarColor = 0xFFf8ece2;
|
||||
|
||||
// scroll colors search-window
|
||||
} else if (color.equals("search-blue-dark")) {
|
||||
statusBarColor = 0xFF1e1f25;
|
||||
navigationBarColor = 0xFF121318;
|
||||
} else if (color.equals("11n")) {
|
||||
statusBarColor = 0xFF0e1d2a;
|
||||
navigationBarColor = 0xFF0e1d2a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C11n));
|
||||
|
||||
} else if (color.equals("search-blue-light")) {
|
||||
statusBarColor = 0xFFeeedf4;
|
||||
navigationBarColor = 0xFFfaf8ff;
|
||||
|
||||
} else if (color.equals("search-purple-dark")) {
|
||||
statusBarColor = 0xFF221e24;
|
||||
navigationBarColor = 0xFF161217;
|
||||
} else if(color.equals("13d")){
|
||||
statusBarColor = 0xFF1f1f30;
|
||||
navigationBarColor = 0xFF1f1f30;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C13d));
|
||||
|
||||
} else if (color.equals("search-purple-light")) {
|
||||
statusBarColor = 0xFFf4ebf3;
|
||||
navigationBarColor = 0xFFfff7fd;
|
||||
|
||||
} else if (color.equals("search-yellow-dark")) {
|
||||
statusBarColor = 0xFF202018;
|
||||
navigationBarColor = 0xFF14140c;
|
||||
} else if (color.equals("13n")) {
|
||||
statusBarColor = 0xFF1f1f30;
|
||||
navigationBarColor = 0xFF1f1f30;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C13n));
|
||||
|
||||
} else if (color.equals("search-yellow-light")) {
|
||||
statusBarColor = 0xFFf1eee0;
|
||||
navigationBarColor = 0xFFfdf9ec;
|
||||
|
||||
} else if (color.equals("search-green-dark")) {
|
||||
statusBarColor = 0xFF1d211b;
|
||||
navigationBarColor = 0xFF11140f;
|
||||
} else if(color.equals("50d")){
|
||||
statusBarColor = 0xFF191209;
|
||||
navigationBarColor = 0xFF191209;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C50d));
|
||||
|
||||
} else if (color.equals("search-green-light")) {
|
||||
statusBarColor = 0xFFecefe5;
|
||||
navigationBarColor = 0xFFf8fbf1;
|
||||
|
||||
} else if (color.equals("search-red-dark")) {
|
||||
statusBarColor = 0xFF271d1c;
|
||||
navigationBarColor = 0xFF1a1110;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("search-red-light")) {
|
||||
statusBarColor = 0xFFfceae7;
|
||||
navigationBarColor = 0xFFfff8f6;
|
||||
|
||||
} else if (color.equals("search-pink-dark")) {
|
||||
statusBarColor = 0xFF261d20;
|
||||
navigationBarColor = 0xFF191113;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("search-pink-light")) {
|
||||
statusBarColor = 0xFFfaeaed;
|
||||
navigationBarColor = 0xFFfff8f8;
|
||||
|
||||
} else if (color.equals("search-charcol-dark")) {
|
||||
statusBarColor = 0xFF1f1f1f;
|
||||
navigationBarColor = 0xFF131313;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("search-charcol-light")) {
|
||||
statusBarColor = 0xFFeeeeee;
|
||||
navigationBarColor = 0xFFf9f9f9;
|
||||
|
||||
} else if (color.equals("search-orange-dark")) {
|
||||
statusBarColor = 0xFF241f19;
|
||||
navigationBarColor = 0xFF17130d;
|
||||
} else if (color.equals("50n")) {
|
||||
statusBarColor = 0xFF191209;
|
||||
navigationBarColor = 0xFF191209;
|
||||
systemUiVisibilityFlags = 0;
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.C50n));
|
||||
|
||||
} else if (color.equals("search-orange-light")) {
|
||||
statusBarColor = 0xFFf8ece2;
|
||||
navigationBarColor = 0xFFfff8f4;
|
||||
|
||||
} else if (color.equals("search-blueBright-dark")) {
|
||||
statusBarColor = 0xFF1d1f27;
|
||||
navigationBarColor = 0xFF11131a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("search-blueBright-light")) {
|
||||
statusBarColor = 0xFFededf7;
|
||||
navigationBarColor = 0xFFfaf8ff;
|
||||
|
||||
// other-fuctions-dialog
|
||||
|
||||
} else if (color.equals("dialog-blue-light")) {
|
||||
statusBarColor = 0xFF646366;
|
||||
navigationBarColor = 0xFF5f5f62;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialog-blue-dark")) {
|
||||
statusBarColor = 0xFF07080a;
|
||||
navigationBarColor = 0xFF0c0c0f;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialog-purple-light")) {
|
||||
statusBarColor = 0xFF666365;
|
||||
navigationBarColor = 0xFF625e61;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialog-purple-dark")) {
|
||||
statusBarColor = 0xFF090709;
|
||||
navigationBarColor = 0xFF0e0c0e;
|
||||
systemUiVisibilityFlags = 0;
|
||||
} else if (color.equals("dialog-yellow-light")) {
|
||||
statusBarColor = 0xFF65645e;
|
||||
navigationBarColor = 0xFF605f5a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialog-yellow-dark")) {
|
||||
statusBarColor = 0xFF080805;
|
||||
navigationBarColor = 0xFF0d0d0a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialog-green-light")) {
|
||||
statusBarColor = 0xFF636460;
|
||||
navigationBarColor = 0xFF5e605c;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialog-green-dark")) {
|
||||
statusBarColor = 0xFF070806;
|
||||
navigationBarColor = 0xFF0c0d0b;
|
||||
systemUiVisibilityFlags = 0;
|
||||
} else if (color.equals("dialog-red-light")) {
|
||||
statusBarColor = 0xFF666362;
|
||||
navigationBarColor = 0xFF655e5c;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialog-red-dark")) {
|
||||
statusBarColor = 0xFF0a0706;
|
||||
navigationBarColor = 0xFF100c0b;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialog-pink-light")) {
|
||||
statusBarColor = 0xFF666363;
|
||||
navigationBarColor = 0xFF645e5f;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialog-pink-dark")) {
|
||||
statusBarColor = 0xFF0a0708;
|
||||
navigationBarColor = 0xFF0f0c0d;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialog-charcoal-light")) {
|
||||
statusBarColor = 0xFF646464;
|
||||
navigationBarColor = 0xFF5f5f5f;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialog-charcoal-dark")) {
|
||||
statusBarColor = 0xFF080808;
|
||||
navigationBarColor = 0xFF0c0c0c;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialog-orange-light")) {
|
||||
statusBarColor = 0xFF666362;
|
||||
navigationBarColor = 0xFF635e5a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialog-orange-dark")) {
|
||||
statusBarColor = 0xFF090805;
|
||||
navigationBarColor = 0xFF0e0c0a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
|
||||
// inverted-dialog
|
||||
|
||||
} else if (color.equals("dialogInverted-blue-light")) {
|
||||
navigationBarColor = 0xFF646366;
|
||||
statusBarColor = 0xFF5f5f62;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogInverted-blue-dark")) {
|
||||
navigationBarColor = 0xFF07080a;
|
||||
statusBarColor = 0xFF0c0c0f;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogInverted-purple-light")) {
|
||||
navigationBarColor = 0xFF666365;
|
||||
statusBarColor = 0xFF625e61;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogInverted-purple-dark")) {
|
||||
navigationBarColor = 0xFF090709;
|
||||
statusBarColor = 0xFF0e0c0e;
|
||||
systemUiVisibilityFlags = 0;
|
||||
} else if (color.equals("dialogInverted-yellow-light")) {
|
||||
navigationBarColor = 0xFF65645e;
|
||||
statusBarColor = 0xFF605f5a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogInverted-yellow-dark")) {
|
||||
navigationBarColor = 0xFF080805;
|
||||
statusBarColor = 0xFF0d0d0a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogInverted-green-light")) {
|
||||
navigationBarColor = 0xFF636460;
|
||||
statusBarColor = 0xFF5e605c;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogInverted-green-dark")) {
|
||||
navigationBarColor = 0xFF070806;
|
||||
statusBarColor = 0xFF0c0d0b;
|
||||
systemUiVisibilityFlags = 0;
|
||||
} else if (color.equals("dialogInverted-red-light")) {
|
||||
navigationBarColor = 0xFF666362;
|
||||
statusBarColor = 0xFF655e5c;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogInverted-red-dark")) {
|
||||
navigationBarColor = 0xFF0a0706;
|
||||
statusBarColor = 0xFF100c0b;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogInverted-pink-light")) {
|
||||
navigationBarColor = 0xFF666363;
|
||||
statusBarColor = 0xFF645e5f;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogInverted-pink-dark")) {
|
||||
navigationBarColor = 0xFF0a0708;
|
||||
statusBarColor = 0xFF0f0c0d;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogInverted-charcoal-light")) {
|
||||
navigationBarColor = 0xFF646464;
|
||||
statusBarColor = 0xFF5f5f5f;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogInverted-charcoal-dark")) {
|
||||
navigationBarColor = 0xFF080808;
|
||||
statusBarColor = 0xFF0c0c0c;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogInverted-orange-light")) {
|
||||
navigationBarColor = 0xFF666362;
|
||||
statusBarColor = 0xFF635e5a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogInverted-orange-dark")) {
|
||||
navigationBarColor = 0xFF090805;
|
||||
statusBarColor = 0xFF0e0c0a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
|
||||
// dialog-color activity
|
||||
|
||||
} else if (color.equals("dialogActvity-blue-light")) {
|
||||
statusBarColor = 0xFF646366;
|
||||
navigationBarColor = 0xFF646366;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
|
||||
} else if (color.equals("dialogActvity-blue-dark")) {
|
||||
statusBarColor = 0xFF07080a;
|
||||
navigationBarColor = 0xFF07080a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogActvity-purple-light")) {
|
||||
statusBarColor = 0xFF666365;
|
||||
navigationBarColor = 0xFF666365;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogActvity-purple-dark")) {
|
||||
statusBarColor = 0xFF090709;
|
||||
navigationBarColor = 0xFF090709;
|
||||
systemUiVisibilityFlags = 0;
|
||||
} else if (color.equals("dialogActvity-yellow-light")) {
|
||||
statusBarColor = 0xFF65645e;
|
||||
navigationBarColor = 0xFF65645e;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogActvity-yellow-dark")) {
|
||||
statusBarColor = 0xFF080805;
|
||||
navigationBarColor = 0xFF080805;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogActvity-green-light")) {
|
||||
statusBarColor = 0xFF636460;
|
||||
navigationBarColor = 0xFF636460;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogActvity-green-dark")) {
|
||||
statusBarColor = 0xFF070806;
|
||||
navigationBarColor = 0xFF070806;
|
||||
systemUiVisibilityFlags = 0;
|
||||
} else if (color.equals("dialogActvity-red-light")) {
|
||||
statusBarColor = 0xFF666362;
|
||||
navigationBarColor = 0xFF666362;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogActvity-red-dark")) {
|
||||
statusBarColor = 0xFF0a0706;
|
||||
navigationBarColor = 0xFF0a0706;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogActvity-pink-light")) {
|
||||
statusBarColor = 0xFF666363;
|
||||
navigationBarColor = 0xFF666363;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogActvity-pink-dark")) {
|
||||
statusBarColor = 0xFF0a0708;
|
||||
navigationBarColor = 0xFF0a0708;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogActvity-charcoal-light")) {
|
||||
statusBarColor = 0xFF646464;
|
||||
navigationBarColor = 0xFF646464;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogActvity-charcoal-dark")) {
|
||||
statusBarColor = 0xFF080808;
|
||||
navigationBarColor = 0xFF080808;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogActvity-orange-light")) {
|
||||
statusBarColor = 0xFF666362;
|
||||
navigationBarColor = 0xFF666362;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("dialogActvity-orange-dark")) {
|
||||
statusBarColor = 0xFF090805;
|
||||
navigationBarColor = 0xFF090805;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
|
||||
// sheet in activity
|
||||
|
||||
} else if (color.equals("sheetInverted-blue-light")) {
|
||||
navigationBarColor = 0xFFf4f3fa;
|
||||
statusBarColor = 0xFF5f5f62;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("sheetInverted-blue-dark")) {
|
||||
navigationBarColor = 0xFF1a1b20;
|
||||
statusBarColor = 0xFF0c0c0f;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("sheetInverted-purple-light")) {
|
||||
navigationBarColor = 0xFFfaf1f9;
|
||||
statusBarColor = 0xFF625e61;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("sheetInverted-purple-dark")) {
|
||||
navigationBarColor = 0xFF1e1a20;
|
||||
statusBarColor = 0xFF0e0c0e;
|
||||
systemUiVisibilityFlags = 0;
|
||||
} else if (color.equals("sheetInverted-yellow-light")) {
|
||||
navigationBarColor = 0xFFf7f4e6;
|
||||
statusBarColor = 0xFF605f5a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("sheetInverted-yellow-dark")) {
|
||||
navigationBarColor = 0xFF1c1c14;
|
||||
statusBarColor = 0xFF0d0d0a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("sheetInverted-green-light")) {
|
||||
navigationBarColor = 0xFFf2f5eb;
|
||||
statusBarColor = 0xFF5e605c;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("sheetInverted-green-dark")) {
|
||||
navigationBarColor = 0xFF191d17;
|
||||
statusBarColor = 0xFF0c0d0b;
|
||||
systemUiVisibilityFlags = 0;
|
||||
} else if (color.equals("sheetInverted-red-light")) {
|
||||
navigationBarColor = 0xFFfff0ee;
|
||||
statusBarColor = 0xFF655e5c;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("sheetInverted-red-dark")) {
|
||||
navigationBarColor = 0xFF231918;
|
||||
statusBarColor = 0xFF100c0b;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("sheetInverted-pink-light")) {
|
||||
navigationBarColor = 0xFFfff0f2;
|
||||
statusBarColor = 0xFF645e5f;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("sheetInverted-pink-dark")) {
|
||||
navigationBarColor = 0xFF22191c;
|
||||
statusBarColor = 0xFF0f0c0d;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("sheetInverted-charcoal-light")) {
|
||||
navigationBarColor = 0xFFf3f3f3;
|
||||
statusBarColor = 0xFF5f5f5f;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("sheetInverted-charcoal-dark")) {
|
||||
navigationBarColor = 0xFF1b1b1b;
|
||||
statusBarColor = 0xFF0c0c0c;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("sheetInverted-orange-light")) {
|
||||
navigationBarColor = 0xFFfef2e8;
|
||||
statusBarColor = 0xFF635e5a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("sheetInverted-orange-dark")) {
|
||||
navigationBarColor = 0xFF201b15;
|
||||
statusBarColor = 0xFF0e0c0a;
|
||||
systemUiVisibilityFlags = 0;
|
||||
} else if (color.equals("OpenSettings")){
|
||||
openSettingsActivity();
|
||||
return;
|
||||
|
||||
} else if (color.equals("GoBack")){
|
||||
back();
|
||||
return;
|
||||
|
||||
} else if (color.equals("bluesetDef")) {
|
||||
|
||||
@@ -949,9 +374,17 @@ public class MainActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
public void openSettingsActivity() {
|
||||
Intent intent = new Intent(mActivity, SettingsActivity.class);
|
||||
mActivity.startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void back() {
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
|
||||
private static class WebViewClientDemo extends WebViewClient {
|
||||
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
package com.example.weathermaster;
|
||||
|
||||
|
||||
import android.animation.ArgbEvaluator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class PrivacyPolicy extends AppCompatActivity {
|
||||
|
||||
private WebView webview;
|
||||
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
|
||||
|
||||
// Webview stuff
|
||||
webview = findViewById(R.id.webView);
|
||||
WebSettings webSettings = webview.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setAllowFileAccessFromFileURLs(true);
|
||||
webSettings.setAllowUniversalAccessFromFileURLs(true);
|
||||
webSettings.setAllowContentAccess(true);
|
||||
webview.setVerticalScrollBarEnabled(true);
|
||||
webview.setHorizontalScrollBarEnabled(false);
|
||||
webview.setOverScrollMode(WebView.OVER_SCROLL_NEVER);
|
||||
webview.setWebViewClient(new WebViewClientDemo());
|
||||
AndroidInterface androidInterface = new AndroidInterface(this);
|
||||
webview.addJavascriptInterface(androidInterface, "AndroidInterface");
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.mainBG));
|
||||
|
||||
webview.loadUrl("file:///android_asset/pages/aboutPages/PrivacyPolicy.html");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public class AndroidInterface {
|
||||
private PrivacyPolicy pActivity;
|
||||
|
||||
AndroidInterface(PrivacyPolicy activity) {
|
||||
pActivity = activity;
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void updateStatusBarColor(final String color) {
|
||||
pActivity.runOnUiThread(new Runnable() {
|
||||
@SuppressLint("ResourceType")
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void run() {
|
||||
int statusBarColor;
|
||||
int navigationBarColor;
|
||||
int systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
|
||||
|
||||
if(color.equals("Scrolled")){
|
||||
statusBarColor = 0xFF1e2024;
|
||||
navigationBarColor = 0xFF121317;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("ScrollFalse")) {
|
||||
statusBarColor = 0xFF121317;
|
||||
navigationBarColor = 0xFF121317;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("GoBack")){
|
||||
back();
|
||||
return;
|
||||
|
||||
} else if (color.equals("bluesetDef")) {
|
||||
|
||||
return;
|
||||
} else if (color.equals("keepiton")) {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
return;
|
||||
} else if (color.equals("keepitoff")) {
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
return;
|
||||
} else if (color.equals("itsOn")) {
|
||||
Toast.makeText(pActivity, "Your device will stay awake", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else if (color.equals("ItsOff")) {
|
||||
Toast.makeText(pActivity, "Your device will go to sleep at the default time", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
|
||||
} else {
|
||||
Toast.makeText(pActivity, "not found", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int currentStatusBarColor = pActivity.getWindow().getStatusBarColor();
|
||||
int currentNavigationBarColor = pActivity.getWindow().getNavigationBarColor();
|
||||
|
||||
ObjectAnimator statusBarAnimator = ObjectAnimator.ofObject(
|
||||
pActivity.getWindow(),
|
||||
"statusBarColor",
|
||||
new ArgbEvaluator(),
|
||||
currentStatusBarColor,
|
||||
statusBarColor
|
||||
);
|
||||
|
||||
statusBarAnimator.setDuration(200);
|
||||
statusBarAnimator.start();
|
||||
|
||||
ObjectAnimator navBarAnimator = ObjectAnimator.ofObject(
|
||||
pActivity.getWindow(),
|
||||
"navigationBarColor",
|
||||
new ArgbEvaluator(),
|
||||
currentNavigationBarColor,
|
||||
navigationBarColor
|
||||
);
|
||||
|
||||
navBarAnimator.setDuration(200);
|
||||
navBarAnimator.start();
|
||||
|
||||
pActivity.getWindow().setNavigationBarColor(navigationBarColor);
|
||||
|
||||
View decorView = pActivity.getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(systemUiVisibilityFlags);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void back() {
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class WebViewClientDemo extends WebViewClient {
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (shouldOpenInBrowser(url)) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
view.getContext().startActivity(intent);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private boolean shouldOpenInBrowser(String url) {
|
||||
return url.startsWith("https://fonts.google.com/specimen/Outfit?query=outfit") ||
|
||||
url.startsWith("https://openweathermap.org/") ||
|
||||
url.startsWith("https://fonts.google.com/specimen/Poppins?query=poppins") ||
|
||||
url.startsWith("https://github.com/material-components/material-web") ||
|
||||
url.startsWith("https://app-privacy-policy-generator.nisrulz.com/") ||
|
||||
url.startsWith("https://github.com/PranshulGG/WeatherMaster") ||
|
||||
url.startsWith("mailto:pranshul.devmain@gmail.com")||
|
||||
url.startsWith("https://github.com/PranshulGG/WeatherMaster/releases");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
package com.example.weathermaster;
|
||||
|
||||
import android.animation.ArgbEvaluator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class SettingsActivity extends AppCompatActivity {
|
||||
|
||||
private WebView webview;
|
||||
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
|
||||
|
||||
// Webview stuff
|
||||
webview = findViewById(R.id.webView);
|
||||
WebSettings webSettings = webview.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setAllowFileAccessFromFileURLs(true);
|
||||
webSettings.setAllowUniversalAccessFromFileURLs(true);
|
||||
webSettings.setAllowContentAccess(true);
|
||||
webview.setVerticalScrollBarEnabled(true);
|
||||
webview.setHorizontalScrollBarEnabled(false);
|
||||
webview.setOverScrollMode(WebView.OVER_SCROLL_NEVER);
|
||||
webview.setWebViewClient(new WebViewClientDemo());
|
||||
AndroidInterface androidInterface = new AndroidInterface(this);
|
||||
webview.addJavascriptInterface(androidInterface, "AndroidInterface");
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.mainBG));
|
||||
|
||||
webview.loadUrl("file:///android_asset/pages/settings.html");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public class AndroidInterface {
|
||||
private SettingsActivity sActivity;
|
||||
|
||||
AndroidInterface(SettingsActivity activity) {
|
||||
sActivity = activity;
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void updateStatusBarColor(final String color) {
|
||||
sActivity.runOnUiThread(new Runnable() {
|
||||
@SuppressLint("ResourceType")
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void run() {
|
||||
int statusBarColor;
|
||||
int navigationBarColor;
|
||||
int systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
|
||||
|
||||
if(color.equals("Scrolled")){
|
||||
statusBarColor = 0xFF1e2024;
|
||||
navigationBarColor = 0xFF121317;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("ScrollFalse")) {
|
||||
statusBarColor = 0xFF121317;
|
||||
navigationBarColor = 0xFF121317;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("GoBack")){
|
||||
back();
|
||||
return;
|
||||
} else if (color.equals("OpenAboutPage")){
|
||||
openAboutPage();
|
||||
return;
|
||||
|
||||
} else if (color.equals("bluesetDef")) {
|
||||
|
||||
return;
|
||||
} else if (color.equals("keepiton")) {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
return;
|
||||
} else if (color.equals("keepitoff")) {
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
return;
|
||||
} else if (color.equals("itsOn")) {
|
||||
Toast.makeText(sActivity, "Your device will stay awake", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else if (color.equals("ItsOff")) {
|
||||
Toast.makeText(sActivity, "Your device will go to sleep at the default time", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
|
||||
} else {
|
||||
Toast.makeText(sActivity, "not found", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int currentStatusBarColor = sActivity.getWindow().getStatusBarColor();
|
||||
int currentNavigationBarColor = sActivity.getWindow().getNavigationBarColor();
|
||||
|
||||
ObjectAnimator statusBarAnimator = ObjectAnimator.ofObject(
|
||||
sActivity.getWindow(),
|
||||
"statusBarColor",
|
||||
new ArgbEvaluator(),
|
||||
currentStatusBarColor,
|
||||
statusBarColor
|
||||
);
|
||||
|
||||
statusBarAnimator.setDuration(200);
|
||||
statusBarAnimator.start();
|
||||
|
||||
ObjectAnimator navBarAnimator = ObjectAnimator.ofObject(
|
||||
sActivity.getWindow(),
|
||||
"navigationBarColor",
|
||||
new ArgbEvaluator(),
|
||||
currentNavigationBarColor,
|
||||
navigationBarColor
|
||||
);
|
||||
|
||||
navBarAnimator.setDuration(200);
|
||||
navBarAnimator.start();
|
||||
|
||||
sActivity.getWindow().setNavigationBarColor(navigationBarColor);
|
||||
|
||||
View decorView = sActivity.getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(systemUiVisibilityFlags);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void openAboutPage() {
|
||||
Intent intent = new Intent(sActivity, AboutPage.class);
|
||||
sActivity.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void back() {
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class WebViewClientDemo extends WebViewClient {
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (shouldOpenInBrowser(url)) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
view.getContext().startActivity(intent);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private boolean shouldOpenInBrowser(String url) {
|
||||
return url.startsWith("https://fonts.google.com/specimen/Outfit?query=outfit") ||
|
||||
url.startsWith("https://openweathermap.org/") ||
|
||||
url.startsWith("https://fonts.google.com/specimen/Poppins?query=poppins") ||
|
||||
url.startsWith("https://github.com/material-components/material-web") ||
|
||||
url.startsWith("https://app-privacy-policy-generator.nisrulz.com/") ||
|
||||
url.startsWith("https://github.com/PranshulGG/WeatherMaster") ||
|
||||
url.startsWith("mailto:pranshul.devmain@gmail.com")||
|
||||
url.startsWith("https://github.com/PranshulGG/WeatherMaster/releases");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
package com.example.weathermaster;
|
||||
|
||||
|
||||
import android.animation.ArgbEvaluator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class Terms_Conditions extends AppCompatActivity {
|
||||
|
||||
private WebView webview;
|
||||
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
|
||||
|
||||
// Webview stuff
|
||||
webview = findViewById(R.id.webView);
|
||||
WebSettings webSettings = webview.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setAllowFileAccessFromFileURLs(true);
|
||||
webSettings.setAllowUniversalAccessFromFileURLs(true);
|
||||
webSettings.setAllowContentAccess(true);
|
||||
webview.setVerticalScrollBarEnabled(true);
|
||||
webview.setHorizontalScrollBarEnabled(false);
|
||||
webview.setOverScrollMode(WebView.OVER_SCROLL_NEVER);
|
||||
webview.setWebViewClient(new WebViewClientDemo());
|
||||
AndroidInterface androidInterface = new AndroidInterface(this);
|
||||
webview.addJavascriptInterface(androidInterface, "AndroidInterface");
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.mainBG));
|
||||
|
||||
webview.loadUrl("file:///android_asset/pages/aboutPages/TermsConditions.html");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public class AndroidInterface {
|
||||
private Terms_Conditions tActivity;
|
||||
|
||||
AndroidInterface(Terms_Conditions activity) {
|
||||
tActivity = activity;
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void updateStatusBarColor(final String color) {
|
||||
tActivity.runOnUiThread(new Runnable() {
|
||||
@SuppressLint("ResourceType")
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void run() {
|
||||
int statusBarColor;
|
||||
int navigationBarColor;
|
||||
int systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
|
||||
|
||||
if(color.equals("Scrolled")){
|
||||
statusBarColor = 0xFF1e2024;
|
||||
navigationBarColor = 0xFF121317;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("ScrollFalse")) {
|
||||
statusBarColor = 0xFF121317;
|
||||
navigationBarColor = 0xFF121317;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("GoBack")){
|
||||
back();
|
||||
return;
|
||||
|
||||
} else if (color.equals("bluesetDef")) {
|
||||
|
||||
return;
|
||||
} else if (color.equals("keepiton")) {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
return;
|
||||
} else if (color.equals("keepitoff")) {
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
return;
|
||||
} else if (color.equals("itsOn")) {
|
||||
Toast.makeText(tActivity, "Your device will stay awake", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else if (color.equals("ItsOff")) {
|
||||
Toast.makeText(tActivity, "Your device will go to sleep at the default time", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
|
||||
} else {
|
||||
Toast.makeText(tActivity, "not found", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int currentStatusBarColor = tActivity.getWindow().getStatusBarColor();
|
||||
int currentNavigationBarColor = tActivity.getWindow().getNavigationBarColor();
|
||||
|
||||
ObjectAnimator statusBarAnimator = ObjectAnimator.ofObject(
|
||||
tActivity.getWindow(),
|
||||
"statusBarColor",
|
||||
new ArgbEvaluator(),
|
||||
currentStatusBarColor,
|
||||
statusBarColor
|
||||
);
|
||||
|
||||
statusBarAnimator.setDuration(200);
|
||||
statusBarAnimator.start();
|
||||
|
||||
ObjectAnimator navBarAnimator = ObjectAnimator.ofObject(
|
||||
tActivity.getWindow(),
|
||||
"navigationBarColor",
|
||||
new ArgbEvaluator(),
|
||||
currentNavigationBarColor,
|
||||
navigationBarColor
|
||||
);
|
||||
|
||||
navBarAnimator.setDuration(200);
|
||||
navBarAnimator.start();
|
||||
|
||||
tActivity.getWindow().setNavigationBarColor(navigationBarColor);
|
||||
|
||||
View decorView = tActivity.getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(systemUiVisibilityFlags);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void back() {
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class WebViewClientDemo extends WebViewClient {
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (shouldOpenInBrowser(url)) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
view.getContext().startActivity(intent);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private boolean shouldOpenInBrowser(String url) {
|
||||
return url.startsWith("https://fonts.google.com/specimen/Outfit?query=outfit") ||
|
||||
url.startsWith("https://openweathermap.org/") ||
|
||||
url.startsWith("https://fonts.google.com/specimen/Poppins?query=poppins") ||
|
||||
url.startsWith("https://github.com/material-components/material-web") ||
|
||||
url.startsWith("https://app-privacy-policy-generator.nisrulz.com/") ||
|
||||
url.startsWith("https://github.com/PranshulGG/WeatherMaster") ||
|
||||
url.startsWith("mailto:pranshul.devmain@gmail.com")||
|
||||
url.startsWith("https://github.com/PranshulGG/WeatherMaster/releases");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
package com.example.weathermaster;
|
||||
|
||||
|
||||
import android.animation.ArgbEvaluator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class ThirdParty extends AppCompatActivity {
|
||||
|
||||
private WebView webview;
|
||||
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
|
||||
|
||||
// Webview stuff
|
||||
webview = findViewById(R.id.webView);
|
||||
WebSettings webSettings = webview.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setAllowFileAccessFromFileURLs(true);
|
||||
webSettings.setAllowUniversalAccessFromFileURLs(true);
|
||||
webSettings.setAllowContentAccess(true);
|
||||
webview.setVerticalScrollBarEnabled(true);
|
||||
webview.setHorizontalScrollBarEnabled(false);
|
||||
webview.setOverScrollMode(WebView.OVER_SCROLL_NEVER);
|
||||
webview.setWebViewClient(new WebViewClientDemo());
|
||||
AndroidInterface androidInterface = new AndroidInterface(this);
|
||||
webview.addJavascriptInterface(androidInterface, "AndroidInterface");
|
||||
webview.setBackgroundColor(getResources().getColor(R.color.mainBG));
|
||||
|
||||
webview.loadUrl("file:///android_asset/pages/aboutPages/licenses.html");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public class AndroidInterface {
|
||||
private ThirdParty thActivity;
|
||||
|
||||
AndroidInterface(ThirdParty activity) {
|
||||
thActivity = activity;
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void updateStatusBarColor(final String color) {
|
||||
thActivity.runOnUiThread(new Runnable() {
|
||||
@SuppressLint("ResourceType")
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void run() {
|
||||
int statusBarColor;
|
||||
int navigationBarColor;
|
||||
int systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
|
||||
|
||||
if(color.equals("Scrolled")){
|
||||
statusBarColor = 0xFF1e2024;
|
||||
navigationBarColor = 0xFF121317;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("ScrollFalse")) {
|
||||
statusBarColor = 0xFF121317;
|
||||
navigationBarColor = 0xFF121317;
|
||||
systemUiVisibilityFlags = 0;
|
||||
|
||||
} else if (color.equals("GoBack")){
|
||||
back();
|
||||
return;
|
||||
|
||||
} else if (color.equals("bluesetDef")) {
|
||||
|
||||
return;
|
||||
} else if (color.equals("keepiton")) {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
return;
|
||||
} else if (color.equals("keepitoff")) {
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
return;
|
||||
} else if (color.equals("itsOn")) {
|
||||
Toast.makeText(thActivity, "Your device will stay awake", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else if (color.equals("ItsOff")) {
|
||||
Toast.makeText(thActivity, "Your device will go to sleep at the default time", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
|
||||
} else {
|
||||
Toast.makeText(thActivity, "not found", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int currentStatusBarColor = thActivity.getWindow().getStatusBarColor();
|
||||
int currentNavigationBarColor = thActivity.getWindow().getNavigationBarColor();
|
||||
|
||||
ObjectAnimator statusBarAnimator = ObjectAnimator.ofObject(
|
||||
thActivity.getWindow(),
|
||||
"statusBarColor",
|
||||
new ArgbEvaluator(),
|
||||
currentStatusBarColor,
|
||||
statusBarColor
|
||||
);
|
||||
|
||||
statusBarAnimator.setDuration(200);
|
||||
statusBarAnimator.start();
|
||||
|
||||
ObjectAnimator navBarAnimator = ObjectAnimator.ofObject(
|
||||
thActivity.getWindow(),
|
||||
"navigationBarColor",
|
||||
new ArgbEvaluator(),
|
||||
currentNavigationBarColor,
|
||||
navigationBarColor
|
||||
);
|
||||
|
||||
navBarAnimator.setDuration(200);
|
||||
navBarAnimator.start();
|
||||
|
||||
thActivity.getWindow().setNavigationBarColor(navigationBarColor);
|
||||
|
||||
View decorView = thActivity.getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(systemUiVisibilityFlags);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void back() {
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class WebViewClientDemo extends WebViewClient {
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (shouldOpenInBrowser(url)) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
view.getContext().startActivity(intent);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private boolean shouldOpenInBrowser(String url) {
|
||||
return url.startsWith("https://fonts.google.com/specimen/Outfit?query=outfit") ||
|
||||
url.startsWith("https://openweathermap.org/") ||
|
||||
url.startsWith("https://fonts.google.com/specimen/Poppins?query=poppins") ||
|
||||
url.startsWith("https://github.com/material-components/material-web") ||
|
||||
url.startsWith("https://app-privacy-policy-generator.nisrulz.com/") ||
|
||||
url.startsWith("https://github.com/PranshulGG/WeatherMaster") ||
|
||||
url.startsWith("mailto:pranshul.devmain@gmail.com")||
|
||||
url.startsWith("https://github.com/PranshulGG/WeatherMaster/releases");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user