use of wangdaye.com.geometricweather.ui.widget.weatherView.materialWeatherView.MaterialWeatherView in project GeometricWeather by WangDaYeeeeee.
the class MainActivity method initWidget.
private void initWidget() {
this.handler = new SafeHandler<>(this);
this.statusBar = findViewById(R.id.activity_main_statusBar);
this.weatherView = findViewById(R.id.activity_main_weatherView);
if (weatherView instanceof MaterialWeatherView) {
int kind;
if (locationNow.weather == null) {
kind = WeatherView.WEATHER_KIND_CLEAR_DAY;
} else {
kind = WeatherViewController.getWeatherViewWeatherKind(locationNow.weather.realTime.weatherKind, TimeManager.getInstance(this).isDayTime());
}
weatherView.setWeather(kind);
((MaterialWeatherView) weatherView).setOpenGravitySensor(PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getString(R.string.key_gravity_sensor_switch), true));
}
this.appBar = findViewById(R.id.activity_main_appBar);
this.toolbar = findViewById(R.id.activity_main_toolbar);
toolbar.inflateMenu(R.menu.activity_main);
toolbar.setNavigationOnClickListener(this);
toolbar.setOnClickListener(this);
toolbar.setOnMenuItemClickListener(this);
this.switchLayout = findViewById(R.id.activity_main_switchView);
switchLayout.setData(locationList, locationNow);
switchLayout.setOnSwitchListener(this);
switchLayout.setOnTouchListener(indicatorStateListener);
this.refreshLayout = findViewById(R.id.activity_main_refreshView);
int startPosition = (int) (DisplayUtils.getStatusBarHeight(getResources()) + DisplayUtils.dpToPx(this, 16));
refreshLayout.setProgressViewOffset(false, startPosition, startPosition + refreshLayout.getProgressViewEndOffset());
refreshLayout.setOnRefreshListener(this);
if (weatherView instanceof MaterialWeatherView) {
refreshLayout.setColorSchemeColors(weatherView.getThemeColors()[0]);
}
this.scrollView = findViewById(R.id.activity_main_scrollView);
scrollView.setOnScrollChangeListener(new OnScrollListener(weatherView.getFirstCardMarginTop()));
scrollView.setOnTouchListener(indicatorStateListener);
this.cardContainer = findViewById(R.id.activity_main_cardContainer);
RelativeLayout baseView = findViewById(R.id.container_main_base_view);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) baseView.getLayoutParams();
params.height = weatherView.getFirstCardMarginTop();
baseView.setLayoutParams(params);
baseView.setOnClickListener(this);
this.realtimeTemp = findViewById(R.id.container_main_base_view_tempTxt);
this.realtimeWeather = findViewById(R.id.container_main_base_view_weatherTxt);
this.realtimeSendibleTemp = findViewById(R.id.container_main_base_view_sendibleTempTxt);
this.aqiOrWind = findViewById(R.id.container_main_base_view_aqiOrWindTxt);
findViewById(R.id.container_main_trend_first_card_timeContainer).setOnClickListener(this);
this.timeIcon = findViewById(R.id.container_main_trend_first_card_timeIcon);
timeIcon.setOnClickListener(this);
this.refreshTime = findViewById(R.id.container_main_trend_first_card_timeText);
this.firstTitle = findViewById(R.id.container_main_trend_first_card_title);
this.firstTrendRecyclerView = findViewById(R.id.container_main_trend_first_card_trendRecyclerView);
this.secondTitle = findViewById(R.id.container_main_trend_second_card_title);
this.secondTrendRecyclerView = findViewById(R.id.container_main_trend_second_card_trendRecyclerView);
this.detailsTitle = findViewById(R.id.container_main_details_card_title);
this.detailRecyclerView = findViewById(R.id.container_main_details_card_recyclerView);
this.indicator = findViewById(R.id.activity_main_indicator);
}
Aggregations