Commit 35873f48 authored by Suphon Thanakornpakapong's avatar Suphon Thanakornpakapong
Browse files

Declare weather widget component name in the provider

parent 9de1eb81
Pipeline #177695 passed with stage
in 8 minutes and 46 seconds
......@@ -3,7 +3,6 @@ package foundation.e.blisslauncher.core.customviews;
import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.Context;
import foundation.e.blisslauncher.features.weather.WeatherAppWidgetProvider;
......@@ -11,16 +10,13 @@ import foundation.e.blisslauncher.features.weather.WeatherWidgetHostView;
public class WidgetHost extends AppWidgetHost {
private ComponentName mWeatherWidgetProvider;
public WidgetHost(Context context, int hostId) {
super(context, hostId);
mWeatherWidgetProvider = new ComponentName(context, WeatherAppWidgetProvider.class);
}
@Override
protected AppWidgetHostView onCreateView(Context context, int appWidgetId, AppWidgetProviderInfo appWidget) {
if (appWidget.provider.equals(mWeatherWidgetProvider)) {
if (appWidget.provider.equals(WeatherAppWidgetProvider.COMPONENT_NAME)) {
return new WeatherWidgetHostView(context);
}
return new RoundedWidgetView(context);
......
......@@ -397,8 +397,7 @@ public class LauncherActivity extends AppCompatActivity implements
}
if (!Preferences.getAddedWeatherWidget(this)) {
final ComponentName provider = new ComponentName(this, WeatherAppWidgetProvider.class);
if (allocateAndBindWidget(provider)) {
if (allocateAndBindWidget(WeatherAppWidgetProvider.COMPONENT_NAME)) {
Preferences.setAddedWeatherWidget(this);
}
}
......
package foundation.e.blisslauncher.features.weather;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import foundation.e.blisslauncher.BuildConfig;
public class WeatherAppWidgetProvider extends AppWidgetProvider {
public static final ComponentName COMPONENT_NAME = new ComponentName(
BuildConfig.APPLICATION_ID, WeatherAppWidgetProvider.class.getName());
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment