Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double lat=0;
- double lng=0;
- double fajr;
- double sunrise;
- double dhuhr;
- double sunset;
- double maghrib;
- double midnight;
- boolean one=false;
- boolean one1=false;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.show_time);
- final LocationManager locationManager;
- String context = Context.LOCATION_SERVICE;
- locationManager = (LocationManager)getSystemService(context);
- final String provider = LocationManager.GPS_PROVIDER;
- final Location location =
- locationManager.getLastKnownLocation(provider);
- final String provider2 = LocationManager.NETWORK_PROVIDER;
- final Location location2 =
- locationManager.getLastKnownLocation(provider2);
- Intent in= getIntent();
- Integer data2 =in.getIntExtra("key2", 0);
- TextView fajr_time=(TextView) findViewById(R.id.textView9);
- TextView sunrise_time=(TextView) findViewById(R.id.textView10);
- TextView dhuhr_time=(TextView) findViewById(R.id.textView11);
- TextView sunset_time=(TextView) findViewById(R.id.textView13);
- TextView maghrib_time=(TextView) findViewById(R.id.textView14);
- TextView midnight_time=(TextView) findViewById(R.id.textView16);
- String[] latitude=getResources().getStringArray(R.array.Latitude);
- String[] longetude=getResources().getStringArray(R.array.Longtude);
- lat=Float.valueOf(latitude[data2]);
- lng=Float.valueOf(longetude[data2]);
- Time today = new Time(Time.getCurrentTimezone());
- today.setToNow();
- int year=today.year;
- int month=today.month+1;
- int day=today.monthDay;
- final pray_time pt=new pray_time() ;
- int JD=pt.julianDate(year, month, day);
- pt.pray_time(JD);
- dhuhr=12+3.50-(lng/15)-pt.get_Eqt();
- sunrise=dhuhr-pt.cal_time(0.833f,lat);
- sunset=dhuhr+pt.cal_time(0.833f,lat);
- fajr=dhuhr-pt.cal_time(17.7f,lat);
- maghrib=dhuhr+pt.cal_time(4f,lat);
- midnight=(sunset+fajr)/2+12;
- fajr_time.setText(pt.floatToTime24(fajr));
- sunrise_time.setText(pt.floatToTime24(sunrise));
- dhuhr_time.setText(pt.floatToTime24(dhuhr));
- sunset_time.setText(pt.floatToTime24(sunset));
- maghrib_time.setText(pt.floatToTime24(maghrib));
- midnight_time.setText(pt.floatToTime24(midnight));
- Button show_gheble =(Button) findViewById(R.id.button1);
- show_gheble.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View arg0) {
- // TODO Auto-generated method stub
- Intent intent1 = new Intent(ShowTimeActivity.this,Show_gheble.class);
- if(!one)
- {
- if (locationManager.isProviderEnabled(provider))
- {
- startActivity(intent1);
- }
- else
- {
- showSettingsAlert("GPS");
- }
- one=true;
- }
- else if(!one1)
- {
- if(locationManager.isProviderEnabled(provider2))
- {
- startActivity(intent1);
- }
- else
- {
- showSettingsAlert("NETWORK");
- }
- one1=true;
- }
- else {
- startActivity(intent1);
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement