mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-02-06 05:53:25 +01:00
fixed crash, removed unused resources
Signed-off-by: nuclearfog <hatespirit666@gmail.com>
This commit is contained in:
parent
c88c065348
commit
dd21dbb9d9
@ -145,10 +145,10 @@ public abstract class MediaActivity extends AppCompatActivity implements Locatio
|
||||
}
|
||||
// location permission granted
|
||||
else if (PERMISSIONS[1][0].equals(permissions[0])) {
|
||||
getLocation();
|
||||
getLocation(false);
|
||||
}
|
||||
// Write storage permissions granted
|
||||
else if ((PERMISSIONS[2][0].equals(permissions[0]))) {
|
||||
else if (PERMISSIONS[2][0].equals(permissions[0])) {
|
||||
if (grantResults[0] == PERMISSION_GRANTED) {
|
||||
saveImage();
|
||||
}
|
||||
@ -256,19 +256,22 @@ public abstract class MediaActivity extends AppCompatActivity implements Locatio
|
||||
|
||||
/**
|
||||
* Ask for GPS location
|
||||
*
|
||||
* @param ask set true to ask for permission
|
||||
*/
|
||||
protected void getLocation() {
|
||||
protected void getLocation(boolean ask) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || checkSelfPermission(PERMISSIONS[1][0]) == PERMISSION_GRANTED) {
|
||||
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||
if (locationManager != null && locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
||||
locationManager.requestSingleUpdate(LocationManager.GPS_PROVIDER, this, null);
|
||||
locationPending = true;
|
||||
} else {
|
||||
onAttachLocation(null);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
} else if (ask) {
|
||||
requestPermissions(PERMISSIONS[1], REQ_CHECK_PERM);
|
||||
return;
|
||||
}
|
||||
onAttachLocation(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -347,6 +350,7 @@ public abstract class MediaActivity extends AppCompatActivity implements Locatio
|
||||
|
||||
/**
|
||||
* called when location information was successfully fetched
|
||||
* it isn't safe to update views over this method
|
||||
*
|
||||
* @param location location information
|
||||
*/
|
||||
|
@ -133,6 +133,19 @@ public class TweetEditor extends MediaActivity implements OnClickListener, OnPro
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (isLocating()) {
|
||||
locationPending.setVisibility(VISIBLE);
|
||||
locationBtn.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
locationPending.setVisibility(INVISIBLE);
|
||||
locationBtn.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (uploaderAsync != null && uploaderAsync.getStatus() == RUNNING)
|
||||
@ -197,7 +210,7 @@ public class TweetEditor extends MediaActivity implements OnClickListener, OnPro
|
||||
else if (v.getId() == R.id.tweet_add_location) {
|
||||
locationPending.setVisibility(VISIBLE);
|
||||
locationBtn.setVisibility(INVISIBLE);
|
||||
getLocation();
|
||||
getLocation(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,8 +222,6 @@ public class TweetEditor extends MediaActivity implements OnClickListener, OnPro
|
||||
} else {
|
||||
Toast.makeText(this, R.string.error_gps, LENGTH_LONG).show();
|
||||
}
|
||||
locationPending.setVisibility(INVISIBLE);
|
||||
locationBtn.setVisibility(VISIBLE);
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,4 @@
|
||||
<color name="half_transparent">#40000000</color>
|
||||
<color name="background">#80000000</color>
|
||||
<color name="bright_transparent">#afffffff</color>
|
||||
<color name="positive_button">#ffff4000</color>
|
||||
<color name="negative_button">#ff0040ff</color>
|
||||
</resources>
|
@ -118,6 +118,10 @@
|
||||
<string name="settings_fv_icon_color">Favorite</string>
|
||||
<string name="settings_follow_req_color">Request icon</string>
|
||||
<string name="settings_follow_color">Follow icon</string>
|
||||
<string name="account_page" translatable="false">Accounts</string>
|
||||
<string name="confirm_remove_account">Remove account from list?</string>
|
||||
<string name="account_user_id_prefix" translatable="false">User ID:</string>
|
||||
<string name="account_user_unnamed">\'unnamed\'</string>
|
||||
|
||||
<!-- toast messages to inform user -->
|
||||
<string name="info_user_removed">User removed from list</string>
|
||||
@ -227,6 +231,8 @@
|
||||
<string name="menu_hint_mute_user">enter @name to mute</string>
|
||||
<string name="menu_hint_block_user">enter @name to block</string>
|
||||
<string name="menu_refresh_exclude">refresh exclude list</string>
|
||||
<string name="menu_select_account">select account</string>
|
||||
<string name="menu_add_account">add account</string>
|
||||
|
||||
<!--dialog strings-->
|
||||
<string name="dialog_button_yes">Yes</string>
|
||||
@ -235,11 +241,5 @@
|
||||
<string name="dialog_button_ok">OK</string>
|
||||
<string name="dialog_link_image_preview">Link preview image</string>
|
||||
<string name="dialog_link_close">close link preview</string>
|
||||
<string name="account_page" translatable="false">Accounts</string>
|
||||
<string name="confirm_remove_account">Remove account from list?</string>
|
||||
<string name="menu_select_account">select account</string>
|
||||
<string name="menu_add_account">add account</string>
|
||||
<string name="account_user_id_prefix" translatable="false">User ID:</string>
|
||||
<string name="account_user_unnamed">\'unnamed\'</string>
|
||||
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user