diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0601958f2e8bbfa87f66d5a0b5123251df12f921..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 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 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 68f7cc5aee4a17bfd9a7cb166b69cfaf4fec89a8..e3ec824a01ad6d8b3b3cd763b224d414e38474af 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)); - } - } + if (intent.resolveActivity(getPackageManager()) == null) { + weatherLayout.setVisibility(View.GONE); } else { - startService(new Intent(this, WeatherUpdateService.class) - .setAction(WeatherUpdateService.ACTION_FORCE_UPDATE)); + 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 cd4b3abb93c37c543b70721e97cbb1f70c95629a..0b2a7405ddb50cbe42ff54fdb11e75f842e09257 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 +