From 6de3e711dfb2b056e1c2e2830bd2636be85307af Mon Sep 17 00:00:00 2001 From: jibbo Date: Sat, 17 Oct 2020 13:52:18 +0200 Subject: [PATCH 1/6] made the weather widget hide if the weather provider of cynogenmod is not available. --- .../features/launcher/LauncherActivity.java | 89 +++++++++++-------- app/src/main/res/layout/widgets_page.xml | 6 +- 2 files changed, 54 insertions(+), 41 deletions(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java index d97c275890..3fc2633064 100755 --- a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java +++ b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java @@ -1401,45 +1401,13 @@ public class LauncherActivity extends AppCompatActivity implements v -> startActivity(new Intent(this, WeatherPreferences.class))); mWeatherSetupTextView = findViewById(R.id.weather_setup_textview); - mWeatherPanel = findViewById(R.id.weather_panel); - mWeatherPanel.setOnClickListener(v -> { - Intent launchIntent = getPackageManager().getLaunchIntentForPackage( - "foundation.e.weather"); - if (launchIntent != null) { - launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(launchIntent); - } - }); - updateWeatherPanel(); + View weatherLayout = findViewById(R.id.weather_info_layout); + Intent intent = new Intent("cyanogenmod.intent.action.MANAGE_WEATHER_PROVIDER_SERVICES"); - if (WeatherUtils.isWeatherServiceAvailable( - this)) { - startService(new Intent(this, WeatherSourceListenerService.class)); - startService(new Intent(this, DeviceStatusService.class)); - } - - LocalBroadcastManager.getInstance(this).registerReceiver(mWeatherReceiver, new IntentFilter( - WeatherUpdateService.ACTION_UPDATE_FINISHED)); - - if (!Preferences.useCustomWeatherLocation(this)) { - if (!WeatherPreferences.hasLocationPermission(this)) { - String[] permissions = new String[]{Manifest.permission.ACCESS_FINE_LOCATION}; - requestPermissions(permissions, - WeatherPreferences.LOCATION_PERMISSION_REQUEST_CODE); - } else { - LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); - if (!lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER) - && Preferences.getEnableLocation(this)) { - showLocationEnableDialog(); - Preferences.setEnableLocation(this); - } else { - startService(new Intent(this, WeatherUpdateService.class) - .setAction(WeatherUpdateService.ACTION_FORCE_UPDATE)); - } - } - } else { - startService(new Intent(this, WeatherUpdateService.class) - .setAction(WeatherUpdateService.ACTION_FORCE_UPDATE)); + if (intent.resolveActivity(getPackageManager()) == null) { + weatherLayout.setVisibility(View.GONE); + }else{ + initWeatherPanel(); } // [[END]] @@ -1495,6 +1463,49 @@ public class LauncherActivity extends AppCompatActivity implements } } + private void initWeatherPanel() { + mWeatherPanel = findViewById(R.id.weather_panel); + mWeatherPanel.setOnClickListener(v -> { + Intent launchIntent = getPackageManager().getLaunchIntentForPackage( + "foundation.e.weather"); + if (launchIntent != null) { + launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(launchIntent); + } + }); + updateWeatherPanel(); + + if (WeatherUtils.isWeatherServiceAvailable( + this)) { + startService(new Intent(this, WeatherSourceListenerService.class)); + startService(new Intent(this, DeviceStatusService.class)); + } + + LocalBroadcastManager.getInstance(this).registerReceiver(mWeatherReceiver, new IntentFilter( + WeatherUpdateService.ACTION_UPDATE_FINISHED)); + + if (!Preferences.useCustomWeatherLocation(this)) { + if (!WeatherPreferences.hasLocationPermission(this)) { + String[] permissions = new String[]{Manifest.permission.ACCESS_FINE_LOCATION}; + requestPermissions(permissions, + WeatherPreferences.LOCATION_PERMISSION_REQUEST_CODE); + } else { + LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); + if (!lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER) + && Preferences.getEnableLocation(this)) { + showLocationEnableDialog(); + Preferences.setEnableLocation(this); + } else { + startService(new Intent(this, WeatherUpdateService.class) + .setAction(WeatherUpdateService.ACTION_FORCE_UPDATE)); + } + } + } else { + startService(new Intent(this, WeatherUpdateService.class) + .setAction(WeatherUpdateService.ACTION_FORCE_UPDATE)); + } + } + private void updateWeatherPanel() { if (Preferences.getCachedWeatherInfo(this) == null) { mWeatherSetupTextView.setVisibility(VISIBLE); @@ -3463,4 +3474,4 @@ public class LauncherActivity extends AppCompatActivity implements } } -} \ No newline at end of file +} diff --git a/app/src/main/res/layout/widgets_page.xml b/app/src/main/res/layout/widgets_page.xml index cd4b3abb93..0b2a7405dd 100755 --- a/app/src/main/res/layout/widgets_page.xml +++ b/app/src/main/res/layout/widgets_page.xml @@ -25,7 +25,9 @@ + layout="@layout/layout_weather_info" + android:visibility="gone" + tools:visibility="visible" /> - \ No newline at end of file + -- GitLab From db355ab8c95629342ff508940f4d15a6ac87a231 Mon Sep 17 00:00:00 2001 From: jibbo Date: Fri, 20 Nov 2020 10:58:31 +0100 Subject: [PATCH 2/6] fixed crash when trying to access weather widget on AOSP roms --- .../e/blisslauncher/features/launcher/LauncherActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java index 3fc2633064..6efa790eb6 100755 --- a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java +++ b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java @@ -1406,7 +1406,7 @@ public class LauncherActivity extends AppCompatActivity implements if (intent.resolveActivity(getPackageManager()) == null) { weatherLayout.setVisibility(View.GONE); - }else{ + } else { initWeatherPanel(); } // [[END]] -- GitLab From 26aab8b99ac38d45ae3b8a392e317c4e0f0eb653 Mon Sep 17 00:00:00 2001 From: Giovanni <13595-jibbo@users.noreply.gitlab.e.foundation> Date: Sat, 12 Dec 2020 14:36:04 +0000 Subject: [PATCH 3/6] Delete .gitlab-ci.yml --- .gitlab-ci.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 0601958f2e..0000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,21 +0,0 @@ -image: "registry.gitlab.e.foundation:5000/e/apps/docker-android-apps-cicd:latest" - -stages: -- build - -before_script: -- export GRADLE_USER_HOME=$(pwd)/.gradle -- chmod +x ./gradlew - -cache: - key: ${CI_PROJECT_ID} - paths: - - .gradle/ - -build: - stage: build - script: - - ./gradlew build - artifacts: - paths: - - app/build/outputs/apk -- GitLab From 570ad06340893caca95050f4e78892348f9116c5 Mon Sep 17 00:00:00 2001 From: Giovanni <13595-jibbo@users.noreply.gitlab.e.foundation> Date: Sat, 12 Dec 2020 14:36:18 +0000 Subject: [PATCH 4/6] Delete .gitlab-ci.yml --- .gitlab-ci.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 0601958f2e..0000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,21 +0,0 @@ -image: "registry.gitlab.e.foundation:5000/e/apps/docker-android-apps-cicd:latest" - -stages: -- build - -before_script: -- export GRADLE_USER_HOME=$(pwd)/.gradle -- chmod +x ./gradlew - -cache: - key: ${CI_PROJECT_ID} - paths: - - .gradle/ - -build: - stage: build - script: - - ./gradlew build - artifacts: - paths: - - app/build/outputs/apk -- GitLab From 40e6775b3a28d20b72ff4298920430c36627b552 Mon Sep 17 00:00:00 2001 From: jibbo Date: Sat, 12 Dec 2020 15:55:08 +0100 Subject: [PATCH 5/6] restored gitlab ci file --- .gitlab-ci.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000..0601958f2e --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,21 @@ +image: "registry.gitlab.e.foundation:5000/e/apps/docker-android-apps-cicd:latest" + +stages: +- build + +before_script: +- export GRADLE_USER_HOME=$(pwd)/.gradle +- chmod +x ./gradlew + +cache: + key: ${CI_PROJECT_ID} + paths: + - .gradle/ + +build: + stage: build + script: + - ./gradlew build + artifacts: + paths: + - app/build/outputs/apk -- GitLab From c0af792bf294de387510299d44ae33688e952991 Mon Sep 17 00:00:00 2001 From: jibbo Date: Sat, 12 Dec 2020 15:57:38 +0100 Subject: [PATCH 6/6] blank ci --- .gitlab-ci.yml | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0601958f2e..e69de29bb2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,21 +0,0 @@ -image: "registry.gitlab.e.foundation:5000/e/apps/docker-android-apps-cicd:latest" - -stages: -- build - -before_script: -- export GRADLE_USER_HOME=$(pwd)/.gradle -- chmod +x ./gradlew - -cache: - key: ${CI_PROJECT_ID} - paths: - - .gradle/ - -build: - stage: build - script: - - ./gradlew build - artifacts: - paths: - - app/build/outputs/apk -- GitLab