From e8d79db43fbd57bc05febb1a06985bae75f80913 Mon Sep 17 00:00:00 2001 From: stom79 Date: Sat, 1 Sep 2018 09:46:10 +0200 Subject: [PATCH] Improve follow instance in profile --- app/build.gradle | 2 +- .../mastodon/activities/ShowAccountActivity.java | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index b2c9e5ebd..f12cd6fc6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,7 +42,7 @@ allprojects { } } ext.supportLibraryVersion = '27.1.1' -ext.glideLibraryVersion = '4.6.1' +ext.glideLibraryVersion = '4.8.0' ext.conscryptLibraryVersion = '1.2.0' ext.evernoteLibraryVersion = '1.3.0-alpha06' ext.gsonLibraryVersion = '2.8.2' 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 03d08b071..ed356177a 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 @@ -98,6 +98,9 @@ import fr.gouv.etalab.mastodon.sqlite.InstancesDAO; import fr.gouv.etalab.mastodon.sqlite.Sqlite; import fr.gouv.etalab.mastodon.sqlite.TempMuteDAO; +import static fr.gouv.etalab.mastodon.helper.Helper.INSTANCE_NAME; +import static fr.gouv.etalab.mastodon.helper.Helper.INTENT_ACTION; +import static fr.gouv.etalab.mastodon.helper.Helper.SEARCH_INSTANCE; import static fr.gouv.etalab.mastodon.helper.Helper.THEME_BLACK; import static fr.gouv.etalab.mastodon.helper.Helper.THEME_DARK; import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor; @@ -334,6 +337,12 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt List instance = new InstancesDAO(ShowAccountActivity.this, db).getInstanceByName(finalInstanceName); if( instance != null && instance.size() > 0 ){ Toast.makeText(getApplicationContext(), R.string.toast_instance_already_added,Toast.LENGTH_LONG).show(); + Intent intent = new Intent(getApplicationContext(), InstanceFederatedActivity.class); + Bundle bundle = new Bundle(); + bundle.putInt(INTENT_ACTION, SEARCH_INSTANCE); + bundle.putString(INSTANCE_NAME,finalInstanceName); + intent.putExtras(bundle); + startActivity(intent); return true; } new Thread(new Runnable(){ @@ -346,6 +355,12 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt final SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); new InstancesDAO(ShowAccountActivity.this, db).insertInstance(finalInstanceName); Toast.makeText(getApplicationContext(), R.string.toast_instance_followed,Toast.LENGTH_LONG).show(); + Intent intent = new Intent(getApplicationContext(), InstanceFederatedActivity.class); + Bundle bundle = new Bundle(); + bundle.putInt(INTENT_ACTION, SEARCH_INSTANCE); + bundle.putString(INSTANCE_NAME,finalInstanceName); + intent.putExtras(bundle); + startActivity(intent); } }); } catch (final Exception e) {