public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { in_ogl_anim = false; if (pos == 0 || pos > 2) { rid1 = MyApplication.space.split(rid_arr_loc[pos])[0]; tdwr_s = UtilityNexrad.GetTDWRFromRID(rid1); if (tdwr_s.equals("")) tdwr.setVisible(false); else tdwr.setVisible(true); if (tilt_option) tilt_menu.setVisible(true); else tilt_menu.setVisible(false); old_state = state; old_sector = sector; old_onek = onek; state = MyApplication.comma.split(MyApplication.preferences.getString("RID_LOC_" + rid1, ""))[0]; sector = MyApplication.preferences.getString("COD_SECTOR_" + state, ""); state = MyApplication.preferences.getString("STATE_CODE_" + state, ""); onek = MyApplication.preferences.getString("COD_1KM_" + rid1, ""); if (prod.equals("2k")) { img_url = img_url.replace(old_sector, sector); img_url = img_url.replace(old_state, state); img_url = img_url.replace(old_onek, onek); } if (!restarted && !(MyApplication.wxogl_remember_location && first_run)) { img.resetZoom(); img.setZoom(init_zoom); OGLR.setZoom(((float) MyApplication.wxogl_size) / 10.0f); glview.mScaleFactor = ((float) MyApplication.wxogl_size / 10.0f); OGLR.mPositionX = 0.0f; OGLR.mPositionY = 0.0f; } restarted = false; rid_changed = true; new GetContent().execute(); } else if (pos == 1) { Intent dtx_srm = new Intent(getApplicationContext(), RIDAddFavActivity.class); startActivity(dtx_srm); } else if (pos == 2) { Intent dtx_srm2 = new Intent(getApplicationContext(), RIDRemoveFavActivity.class); startActivity(dtx_srm2); } if (first_time) { UtilityToolbar.FullScreenMode(toolbar, toolbar_bottom); first_time = false; } }
@Override public void onCreate(Bundle savedInstanceState) { setTheme(MyApplication.theme_int); super.onCreate(savedInstanceState); setContentView(R.layout.activity_uswxoglv2); loc_x_current = MyApplication.preferences.getString("LOC" + MyApplication.current_loc_fragment + "_X", ""); loc_y_current = MyApplication.preferences.getString("LOC" + MyApplication.current_loc_fragment + "_Y", ""); turl = getIntent().getStringArrayExtra(RID); // for L2 archive called from storm reports if (turl.length > 5) { url_str = turl[3]; loc_x_current = turl[4]; loc_y_current = turl[5]; archive_mode = true; } toolbar = (Toolbar) findViewById(R.id.toolbar_top); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_36px)); // toolbar.setNavigationIcon(android.R.drawable.); toolbar_bottom = (Toolbar) findViewById(R.id.toolbar_bottom); if (MyApplication.icons_even_spaced) UtilityToolbar.setupEvenlyDistributedToolbar(this, toolbar_bottom, R.menu.uswxoglradar); else toolbar_bottom.inflateMenu(R.menu.uswxoglradar); toolbar_bottom.setOnMenuItemClickListener(this); if (archive_mode) toolbar_bottom.setVisibility(View.GONE); Menu menu = toolbar_bottom.getMenu(); star_icon = R.drawable.star; star_outline_icon = R.drawable.star_outline; map_icon = R.drawable.map; star = menu.findItem(R.id.action_fav); map = menu.findItem(R.id.action_ridmap); map.setIcon(map_icon); tv0 = menu.findItem(R.id.action_tv0); tdwr = menu.findItem(R.id.action_tdwr); anim = menu.findItem(R.id.action_a6); tilt_menu = menu.findItem(R.id.action_tilt); // if ( ! MyApplication.loaded ) // MyApplication.Init(this); mImageMap = (ImageMap) findViewById(R.id.map); mImageMap.setVisibility(View.GONE); delay = UtilityImg.GetAnimInterval(); img = (TouchImageView2) findViewById(R.id.iv); img.setMaxZoom(max_zoom); prod = "N0Q"; glview = (WXGLSurfaceView) findViewById(R.id.glsurfaceview); InitGLVIEW(); ogl_in_view = true; rid1 = turl[0]; state = turl[1]; if (turl.length > 2) { prod = turl[2]; if (prod.equals("N0R")) { prod = "N0Q"; } } if (MyApplication.wxogl_remember_location && !archive_mode) { OGLR.setZoom(MyApplication.wxogl_zoom); glview.mScaleFactor = (MyApplication.wxogl_zoom); if (!MyApplication.wxogl_rid.equals("")) rid1 = MyApplication.wxogl_rid; prod = MyApplication.wxogl_prod; OGLR.mPositionX = MyApplication.wxogl_x; OGLR.mPositionY = MyApplication.wxogl_y; } setTitle(prod); rid_arr_loc = UtilityFavorites.SetupFavMenu(MyApplication.rid_fav, rid1, pref_token_location); spinner1 = (Spinner) findViewById(R.id.spinner1); dataAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, rid_arr_loc); dataAdapter.setDropDownViewResource(MyApplication.spinner_layout); spinner1.setAdapter(dataAdapter); spinner1.setOnItemSelectedListener(this); if (MyApplication.wxogl_radar_autorefresh) { // 180000 is 3 min mInterval = 60000 * MyApplication.preferences.getInt("RADAR_REFRESH_INTERVAL", 3); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); mHandler = new Handler(); startRepeatingTask(); } }