Skip to content

Commit

Permalink
Merge pull request spaceapi-community#48 from spaceapi-community/cleanup
Browse files Browse the repository at this point in the history
Some cleanup
  • Loading branch information
dbrgn authored Sep 3, 2023
2 parents 42a57a2 + c1bfc7d commit d9b82c6
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 34 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ Possible tags:
- [i18n] Internationalization / translation


# Unreleased

- Remove old autolinking-workaround for HTC devices ([#48])

[#48]: https://github.com/spaceapi-community/my-hackerspace/pull/48


## v2.1.1 (2023-04-27)

- [bug] Fix a bug when parsing v14 endpoints that contain a SpaceFED key
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012-2020 Aubort Jean-Baptiste (Rorist)
Copyright (C) 2020-2022 Danilo Bargen (dbrgn)
Copyright (C) 2020-2023 Danilo Bargen (dbrgn)
Licensed under GNU's GPL 3, see README
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
Expand Down
33 changes: 7 additions & 26 deletions app/src/main/java/io/spaceapi/community/myhackerspace/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ public void onCreate(Bundle savedInstanceState) {
getHsList();
showHsInfo(getIntent(), true);
} else {
showError(getString(R.string.error_title) + getString(R.string.error_network_title),
getString(R.string.error_network_msg));
showNetworkError();
}
}

Expand Down Expand Up @@ -171,8 +170,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
if (hasNetwork()) {
showHsInfo(getIntent(), true);
} else {
showError(getString(R.string.error_title) + getString(R.string.error_network_title),
getString(R.string.error_network_msg));
showNetworkError();
}
return true;
} else if (id == R.id.menu_choose) {
Expand Down Expand Up @@ -231,27 +229,6 @@ protected Dialog onCreateDialog(int id) {
return dialog;
}

@Override
@UiThread
public void startActivity(Intent intent) {
// http://stackoverflow.com/questions/13691241/autolink-not-working-on-htc-htclinkifydispatcher
try {
/* First attempt at fixing an HTC broken by evil Apple patents. */
if (intent.getComponent() != null
&& ".HtcLinkifyDispatcherActivity".equals(intent
.getComponent().getShortClassName()))
intent.setComponent(null);
super.startActivity(intent);
} catch (ActivityNotFoundException e) {
/*
* Probably an HTC broken by evil Apple patents. This is not
* perfect, but better than crashing the whole application.
*/
Log.e(Main.TAG, e.getMessage());
super.startActivity(Intent.createChooser(intent, null));
}
}

private void setViewVisibility(boolean show) {
int visibility1 = View.GONE;
int visibility2 = View.VISIBLE;
Expand Down Expand Up @@ -415,7 +392,7 @@ private void showError(String title, String msg) {
private AlertDialog showError(String title, String msg, boolean ret) {
if (title != null && msg != null) {
AlertDialog dialog = new AlertDialog.Builder(Main.this)
.setTitle(getString(R.string.error_title) + title)
.setTitle(getString(R.string.error_title) + " " + title)
.setMessage(msg)
.setNeutralButton(getString(R.string.ok), null).create();
if (ret) {
Expand All @@ -427,6 +404,10 @@ private AlertDialog showError(String title, String msg, boolean ret) {
return null;
}

private void showNetworkError() {
showError(getString(R.string.error_network_title), getString(R.string.error_network_msg));
}

private void dismissLoading() {
if (finishApi && finishDir) {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2012-2017 Aubort Jean-Baptiste (Rorist)
* Copyright (C) 2020-2022 Danilo Bargen (dbrgn)
* Copyright (C) 2020-2023 Danilo Bargen (dbrgn)
* Licensed under GNU's GPL 3, see README
*/
package io.spaceapi.community.myhackerspace;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2012-2017 Aubort Jean-Baptiste (Rorist)
* Copyright (C) 2020-2022 Danilo Bargen (dbrgn)
* Copyright (C) 2020-2023 Danilo Bargen (dbrgn)
* Licensed under GNU's GPL 3, see README
*/
package io.spaceapi.community.myhackerspace;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2012-2017 Aubort Jean-Baptiste (Rorist)
* Copyright (C) 2020-2022 Danilo Bargen (dbrgn)
* Copyright (C) 2020-2023 Danilo Bargen (dbrgn)
* Licensed under GNU's GPL 3, see README
*/
package io.spaceapi.community.myhackerspace;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Danilo Bargen (dbrgn)
* Copyright (C) 2020-2023 Danilo Bargen (dbrgn)
* Licensed under GNU's GPL 3, see README
*/
package io.spaceapi.community.myhackerspace;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2012-2017 Aubort Jean-Baptiste (Rorist)
* Copyright (C) 2020-2022 Danilo Bargen (dbrgn)
* Copyright (C) 2020-2023 Danilo Bargen (dbrgn)
* Licensed under GNU's GPL 3, see README
*/
package io.spaceapi.community.myhackerspace;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2012-2017 Aubort Jean-Baptiste (Rorist)
* Copyright (C) 2020-2022 Danilo Bargen (dbrgn)
* Copyright (C) 2020-2023 Danilo Bargen (dbrgn)
* Licensed under GNU's GPL 3, see README
*/
package io.spaceapi.community.myhackerspace;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/entry_sensor.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2020-2022 Danilo Bargen
Copyright (C) 2020-2023 Danilo Bargen
Licensed under GNU's GPL 3, see README
-->
<RelativeLayout
Expand Down

0 comments on commit d9b82c6

Please sign in to comment.