summaryrefslogtreecommitdiffstats
path: root/app/src/main/java
diff options
context:
space:
mode:
authorstom79 <tschneider.ac@gmail.com>2018-11-06 18:35:45 +0100
committerstom79 <tschneider.ac@gmail.com>2018-11-06 18:35:45 +0100
commit204e2fc69d89c403f24f2a5238e9b1439651d9b8 (patch)
tree64df9a2c303f6645b06b376ddbdb1c667d62f9d4 /app/src/main/java
parent8e43786def4472a3c485d071e5884590e2ff716b (diff)
Fix follow instance issue from peertube + picker for theme
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java12
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java11
2 files changed, 21 insertions, 2 deletions
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java
index f05c9cc67..c0312d7d2 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java
@@ -325,10 +325,18 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
@Override
public void run() {
try {
- if( !peertubeAccount)
- new HttpsConnection(ShowAccountActivity.this).get("https://" + finalInstanceName + "/api/v1/timelines/public?local=true", 10, null, null);
+ if( !peertubeAccount) {
+ //Here we can't know if the instance is a Mastodon one or not
+ try { //Testing Mastodon
+ new HttpsConnection(ShowAccountActivity.this).get("https://" + finalInstanceName + "/api/v1/timelines/public?local=true", 10, null, null);
+ }catch (Exception ignored){
+ new HttpsConnection(ShowAccountActivity.this).get("https://" + finalInstanceName + "/api/v1/videos/", 10, null, null);
+ peertubeAccount = true;
+ }
+ }
else
new HttpsConnection(ShowAccountActivity.this).get("https://" + finalInstanceName + "/api/v1/videos/", 10, null, null);
+
runOnUiThread(new Runnable() {
public void run() {
final SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java
index 24ccbf47d..f9a238667 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java
@@ -87,6 +87,7 @@ import android.util.Log;
import android.util.Patterns;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.MotionEvent;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
@@ -1416,6 +1417,16 @@ public class Helper {
if( actionButton != null) {
actionButton.setFocusableInTouchMode(true);
actionButton.setFocusable(true);
+ actionButton.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if(actionMenu.isOpen())
+ actionMenu.close(true);
+ else
+ actionMenu.open(true);
+ return false;
+ }
+ });
actionButton.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {