Skip to content

Commit

Permalink
back from add location
Browse files Browse the repository at this point in the history
  • Loading branch information
pnemonic78 committed Oct 11, 2023
1 parent 7ef3f2a commit a05ecc6
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 21 deletions.
3 changes: 2 additions & 1 deletion Halachic Times/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@
<activity
android:name="com.github.times.location.ZmanimAddLocationActivity"
android:exported="false"
android:label="@string/title_activity_add_location">
android:label="@string/title_activity_add_location"
android:parentActivityName="com.github.times.location.LocationActivity">
<intent-filter android:label="@string/title_activity_add_location">
<action android:name="android.intent.action.INSERT" />
</intent-filter>
Expand Down
18 changes: 9 additions & 9 deletions Halachic Times/locations/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- For android.support.v4.app.JobIntentService -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />

<!-- The application uses one or more features on the device for determining location, such as GPS location, network location, or cell location. -->
<uses-feature
android:name="android.hardware.location"
android:required="false"/>
android:required="false" />

<application android:name="com.github.times.location.DefaultLocationApplication">
<activity
android:name="com.github.times.location.AddLocationActivity"
android:exported="false"
android:label="@string/title_activity_add_location">
<intent-filter android:label="@string/title_activity_add_location">
<action android:name="android.intent.action.INSERT"/>
<action android:name="android.intent.action.INSERT" />
</intent-filter>
<intent-filter android:label="@string/title_activity_add_location">
<action android:name="android.intent.action.INSERT_OR_EDIT"/>
<action android:name="android.intent.action.INSERT_OR_EDIT" />
</intent-filter>
</activity>

<service
android:name="com.github.times.location.AddressService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE"/>
android:permission="android.permission.BIND_JOB_SERVICE" />

<provider
android:name="com.github.times.location.provider.LocationContentProvider"
android:authorities="${applicationId}.locations"
android:exported="false"/>
android:exported="false" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package com.github.times.location;

import android.app.ActionBar;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
Expand All @@ -33,6 +32,7 @@
import android.widget.TextView;
import android.widget.ViewSwitcher;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;

import java.text.NumberFormat;
Expand Down Expand Up @@ -140,7 +140,7 @@ public void onCreate(Bundle savedInstanceState) {
LocationApplication app = (LocationApplication) getApplication();
locations = app.getLocations();

ActionBar actionBar = getActionBar();
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,7 @@ protected void onCreate(Bundle savedInstanceState) {
tabHistory.setContent(R.id.list_history);
tabs.addTab(tabHistory);

Intent intent = getIntent();
String query = intent.getStringExtra(SearchManager.QUERY);

populateLists();
search(query);
}

@Override
Expand Down Expand Up @@ -184,6 +180,8 @@ protected ThemeCallbacks<P> createThemeCallbacks(Context context) {
protected void onStart() {
super.onStart();
locations.start(this);

onNewIntent(getIntent());
}

@Override
Expand All @@ -192,6 +190,13 @@ protected void onStop() {
locations.stop(this);
}

@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
String query = intent.getStringExtra(SearchManager.QUERY);
search(query);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.clear();
Expand Down Expand Up @@ -401,7 +406,7 @@ private void addLocation(Location location) {
fetchAddress(location);

LocationFormatter formatter = getLocations();
CharSequence query = formatter.formatCoordinates(location);
CharSequence query = formatter.formatLatitude(location.getLatitude());
search(query);
}

Expand Down Expand Up @@ -493,7 +498,8 @@ public void handleMessage(@NonNull Message msg) {
address = (ZmanimAddress) msg.obj;
activity.populateLists();

String query = address.getFormatted();
LocationFormatter formatter = activity.getLocations();
CharSequence query = formatter.formatLatitude(address.getLatitude());
activity.search(query);
break;
case WHAT_DELETE:
Expand Down
6 changes: 3 additions & 3 deletions Halachic Times/locations/src/main/res/menu/add_location.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
<item
android:id="@+id/menu_location_cancel"
android:icon="@android:drawable/ic_menu_close_clear_cancel"
android:orderInCategory="1"
android:orderInCategory="3"
android:title="@string/menu_location_cancel"
app:showAsAction="ifRoom" />
<item
android:id="@+id/menu_location_add"
android:icon="@android:drawable/ic_menu_save"
android:orderInCategory="2"
android:orderInCategory="1"
android:title="@string/menu_location_save"
app:showAsAction="always" />
<item
android:id="@+id/menu_location_show"
android:icon="@android:drawable/ic_menu_view"
android:orderInCategory="3"
android:orderInCategory="2"
android:title="@string/menu_location_fetch"
app:showAsAction="always" />

Expand Down

0 comments on commit a05ecc6

Please sign in to comment.