diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png index 360272042..80acd0de8 100644 Binary files a/app/src/main/ic_launcher-web.png and b/app/src/main/ic_launcher-web.png differ diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java index 1509c9b66..a99f722cf 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java @@ -55,14 +55,15 @@ import mastodon.etalab.gouv.fr.mastodon.R; * About activity */ -public class AboutActivity extends AppCompatActivity implements OnRetrieveRemoteAccountInterface, OnRetrieveSearchDevelopersAccountshInterface, OnRetrieveRelationshipInterface { +public class AboutActivity extends AppCompatActivity implements OnRetrieveRemoteAccountInterface, OnRetrieveRelationshipInterface { private List developers = new ArrayList<>(); private List contributors = new ArrayList<>(); + private List designers = new ArrayList<>(); private AccountSearchDevAdapter accountSearchWebAdapterDeveloper; + private AccountSearchDevAdapter accountSearchWebAdapterDesigner; private AccountSearchDevAdapter accountSearchWebAdapterContributors; - @SuppressWarnings("FieldCanBeLocal") - private int DEV_COUNT = 1, CONTRIBUTOR_COUNT = 2; + @Override protected void onCreate(Bundle savedInstanceState) { @@ -85,7 +86,9 @@ public class AboutActivity extends AppCompatActivity implements OnRetrieveRemote } catch (PackageManager.NameNotFoundException ignored) {} ExpandableHeightListView lv_developers = (ExpandableHeightListView) findViewById(R.id.lv_developers); + ExpandableHeightListView lv_designers = (ExpandableHeightListView) findViewById(R.id.lv_designers); ExpandableHeightListView lv_contributors = (ExpandableHeightListView) findViewById(R.id.lv_contributors); + Button about_code = (Button) findViewById(R.id.about_code); Button about_license = (Button) findViewById(R.id.about_license); Button about_thekinrar = (Button) findViewById(R.id.about_thekinrar); @@ -138,14 +141,22 @@ public class AboutActivity extends AppCompatActivity implements OnRetrieveRemote startActivity(browserIntent); } }); - + setTitle(R.string.action_about); lv_contributors.setExpanded(true); lv_developers.setExpanded(true); + lv_designers.setExpanded(true); + accountSearchWebAdapterContributors = new AccountSearchDevAdapter(AboutActivity.this, contributors); lv_contributors.setAdapter(accountSearchWebAdapterContributors); + accountSearchWebAdapterDesigner = new AccountSearchDevAdapter(AboutActivity.this, designers); + lv_designers.setAdapter(accountSearchWebAdapterDesigner); accountSearchWebAdapterDeveloper = new AccountSearchDevAdapter(AboutActivity.this, developers); lv_developers.setAdapter(accountSearchWebAdapterDeveloper); - new RetrieveDeveloperAccountsAsyncTask(getApplicationContext(), AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + + new RetrieveRemoteAccountsAsyncTask(getApplicationContext(), "tschneider", "mastodon.etalab.gouv.fr", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + new RetrieveRemoteAccountsAsyncTask(getApplicationContext(), "daycode", "mastodon.social", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + new RetrieveRemoteAccountsAsyncTask(getApplicationContext(), "PhotonQyv", "mastodon.xyz", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + new RetrieveRemoteAccountsAsyncTask(getApplicationContext(), "angrytux", "social.tchncs.de", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } @@ -174,78 +185,46 @@ public class AboutActivity extends AppCompatActivity implements OnRetrieveRemote Account account; if( accounts != null && accounts.size() > 0){ account = accounts.get(0); - account.setFollowing(false); - account.setRemote(true); - if( account.getUsername().equals("@tschneider")) { - developers.add(account); - accountSearchWebAdapterDeveloper.notifyDataSetChanged(); - }else { - contributors.add(account); - accountSearchWebAdapterContributors.notifyDataSetChanged(); + account.setFollowing(true); + switch (account.getUsername()) { + case "tschneider": + developers.add(account); + accountSearchWebAdapterDeveloper.notifyDataSetChanged(); + break; + case "daycode": + designers.add(account); + accountSearchWebAdapterDesigner.notifyDataSetChanged(); + break; + default: + contributors.add(account); + accountSearchWebAdapterContributors.notifyDataSetChanged(); + break; } + new RetrieveRelationshipAsyncTask(getApplicationContext(), account.getId(),AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } - @Override - public void onRetrieveSearchDevelopersAccounts(ArrayList accounts) { - if( accounts == null || accounts.size() == 0) { - new RetrieveRemoteAccountsAsyncTask(getApplicationContext(), "tschneider", "mastodon.etalab.gouv.fr", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - new RetrieveRemoteAccountsAsyncTask(getApplicationContext(),"PhotonQyv", "mastodon.xyz", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - new RetrieveRemoteAccountsAsyncTask(getApplicationContext(),"angrytux", "social.tchncs.de", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - return; - } - boolean tschneider = false; - boolean PhotonQyv = false; - boolean angrytux = false; - - for(Account account: accounts){ - if( account.getUsername().equals("tschneider")){ - account.setFollowing(false); - account.setRemote(false); - developers.add(account); - accountSearchWebAdapterDeveloper.notifyDataSetChanged(); - tschneider = true; - new RetrieveRelationshipAsyncTask(getApplicationContext(), account.getId(),AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } - if( account.getUsername().equals("PhotonQyv")){ - account.setFollowing(false); - account.setRemote(false); - contributors.add(account); - accountSearchWebAdapterContributors.notifyDataSetChanged(); - PhotonQyv = true; - new RetrieveRelationshipAsyncTask(getApplicationContext(), account.getId(),AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } - if( account.getUsername().equals("angrytux")){ - account.setFollowing(false); - account.setRemote(false); - contributors.add(account); - accountSearchWebAdapterContributors.notifyDataSetChanged(); - angrytux = true; - new RetrieveRelationshipAsyncTask(getApplicationContext(), account.getId(),AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } - } - if( !tschneider) - new RetrieveRemoteAccountsAsyncTask(getApplicationContext(), "tschneider", "mastodon.etalab.gouv.fr", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - if( !PhotonQyv) - new RetrieveRemoteAccountsAsyncTask(getApplicationContext(), "PhotonQyv", "mastodon.xyz", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - if( !angrytux) - new RetrieveRemoteAccountsAsyncTask(getApplicationContext(), "angrytux", "social.tchncs.de", AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } @Override public void onResume(){ super.onResume(); - if( developers != null && developers.size() == DEV_COUNT){ + if( developers != null){ for(Account account: developers){ new RetrieveRelationshipAsyncTask(getApplicationContext(), account.getId(),AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } - if( contributors != null && contributors.size() == CONTRIBUTOR_COUNT){ + if( designers != null){ + for(Account account: designers){ + new RetrieveRelationshipAsyncTask(getApplicationContext(), account.getId(),AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } + } + if( contributors != null){ for(Account account: contributors){ new RetrieveRelationshipAsyncTask(getApplicationContext(), account.getId(),AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } } + @Override public void onRetrieveRelationship(Relationship relationship, Error error) { SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); @@ -254,14 +233,24 @@ public class AboutActivity extends AppCompatActivity implements OnRetrieveRemote return; } for( int i = 0 ; i < developers.size() ; i++){ - if( contributors.get(i).getId() != null && developers.get(i).getId().equals(relationship.getId())){ + if( developers.get(i).getId() != null && developers.get(i).getId().equals(relationship.getId())){ + Log.v(Helper.TAG,developers.get(i).getUsername() + " -> " + (relationship.isFollowing() || userId.trim().equals(relationship.getId()))); developers.get(i).setFollowing(relationship.isFollowing() || userId.trim().equals(relationship.getId())); accountSearchWebAdapterDeveloper.notifyDataSetChanged(); break; } } + for( int i = 0 ; i < designers.size() ; i++){ + if( designers.get(i).getId() != null && designers.get(i).getId().equals(relationship.getId())){ + Log.v(Helper.TAG,designers.get(i).getUsername() + " -> " + (relationship.isFollowing() || userId.trim().equals(relationship.getId()))); + designers.get(i).setFollowing(relationship.isFollowing() || userId.trim().equals(relationship.getId())); + accountSearchWebAdapterDesigner.notifyDataSetChanged(); + break; + } + } for( int i = 0 ; i < contributors.size() ; i++){ if( contributors.get(i).getId() != null && contributors.get(i).getId().equals(relationship.getId())){ + Log.v(Helper.TAG,contributors.get(i).getUsername() + " -> " + (relationship.isFollowing() || userId.trim().equals(relationship.getId()))); contributors.get(i).setFollowing(relationship.isFollowing() || userId.trim().equals(relationship.getId())); accountSearchWebAdapterContributors.notifyDataSetChanged(); break; diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveDeveloperAccountsAsyncTask.java b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveDeveloperAccountsAsyncTask.java index 63afa5432..af8ad4044 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveDeveloperAccountsAsyncTask.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveDeveloperAccountsAsyncTask.java @@ -46,6 +46,9 @@ public class RetrieveDeveloperAccountsAsyncTask extends AsyncTask(); APIResponse apiResponse = api.searchAccounts("@tschneider@mastodon.etalab.gouv.fr", 1); + if( apiResponse.getAccounts() != null && apiResponse.getAccounts().size() > 0) + accounts.add(apiResponse.getAccounts().get(0)); + apiResponse = api.searchAccounts("@daycode@mastodon.social",1); if( apiResponse.getAccounts() != null && apiResponse.getAccounts().size() > 0) accounts.add(apiResponse.getAccounts().get(0)); apiResponse = api.searchAccounts("@PhotonQyv@mastodon.xyz",1); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveRemoteAccountsAsyncTask.java b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveRemoteAccountsAsyncTask.java index df066529e..2ace2fee3 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveRemoteAccountsAsyncTask.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveRemoteAccountsAsyncTask.java @@ -17,7 +17,6 @@ package fr.gouv.etalab.mastodon.asynctasks; import android.content.Context; import android.os.AsyncTask; import fr.gouv.etalab.mastodon.client.API; -import fr.gouv.etalab.mastodon.client.APIResponse; import fr.gouv.etalab.mastodon.client.Entities.Results; import fr.gouv.etalab.mastodon.interfaces.OnRetrieveRemoteAccountInterface; diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Account.java b/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Account.java index 6468f7df3..afe8a8b04 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Account.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Account.java @@ -47,7 +47,6 @@ public class Account implements Parcelable { private String token; private String instance; private boolean isFollowing; - private boolean isRemote; private followAction followType = followAction.NOTHING; private boolean isMakingAction = false; @@ -279,14 +278,6 @@ public class Account implements Parcelable { isFollowing = following; } - public boolean isRemote() { - return isRemote; - } - - public void setRemote(boolean remote) { - isRemote = remote; - } - public String getFollowers_count_str() { return followers_count_str; } diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountSearchDevAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountSearchDevAdapter.java index 993a445b4..41d1e7fc4 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountSearchDevAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountSearchDevAdapter.java @@ -132,12 +132,11 @@ public class AccountSearchDevAdapter extends BaseAdapter implements OnPostAction if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - holder.account_dn.setText(Html.fromHtml(Helper.shortnameToUnicode(account.getDisplay_name(), true), Html.FROM_HTML_MODE_LEGACY)); - holder.account_un.setText(Html.fromHtml(Helper.shortnameToUnicode(account.getUsername(), true), Html.FROM_HTML_MODE_LEGACY)); + holder.account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(), true)); + holder.account_un.setText(String.format("@%s",account.getAcct())); }else { - //noinspection deprecation - holder.account_dn.setText(Html.fromHtml(Helper.shortnameToUnicode(account.getDisplay_name(), true))); - holder.account_un.setText(Html.fromHtml(Helper.shortnameToUnicode(account.getUsername(), true))); + holder.account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(), true)); + holder.account_un.setText(String.format("@%s",account.getAcct())); } changeDrawableColor(context, R.drawable.ic_action_lock_closed,R.color.mastodonC4); //Profile picture @@ -149,33 +148,23 @@ public class AccountSearchDevAdapter extends BaseAdapter implements OnPostAction holder.account_follow.setVisibility(View.VISIBLE); } - if( account.isRemote()) { - holder.account_follow.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - holder.account_follow.setEnabled(false); - new PostActionAsyncTask(context, API.StatusAction.REMOTE_FOLLOW, account.getAcct(), AccountSearchDevAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } - }); - }else { - holder.account_follow.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - holder.account_follow.setEnabled(false); - new PostActionAsyncTask(context, API.StatusAction.FOLLOW, account.getId(), AccountSearchDevAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } - }); - holder.acccount_container.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(context, ShowAccountActivity.class); - Bundle b = new Bundle(); - b.putString("accountId", account.getId()); - intent.putExtras(b); - context.startActivity(intent); - } - }); - } + holder.account_follow.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + holder.account_follow.setEnabled(false); + new PostActionAsyncTask(context, API.StatusAction.FOLLOW, account.getId(), AccountSearchDevAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } + }); + holder.acccount_container.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(context, ShowAccountActivity.class); + Bundle b = new Bundle(); + b.putString("accountId", account.getId()); + intent.putExtras(b); + context.startActivity(intent); + } + }); return convertView; } diff --git a/app/src/main/res/drawable/mastodonlogo.png b/app/src/main/res/drawable/mastodonlogo.png index 9f81bb9ad..5fa7591c2 100644 Binary files a/app/src/main/res/drawable/mastodonlogo.png and b/app/src/main/res/drawable/mastodonlogo.png differ diff --git a/app/src/main/res/layout-sw600dp/activity_about.xml b/app/src/main/res/layout-sw600dp/activity_about.xml index 9250c4695..ee266a4f7 100644 --- a/app/src/main/res/layout-sw600dp/activity_about.xml +++ b/app/src/main/res/layout-sw600dp/activity_about.xml @@ -80,6 +80,28 @@ android:layout_height="wrap_content" tools:ignore="HardcodedText" /> + + + + + + + + + + + + + + - - - - diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png index 769ed62bd..ea18547ad 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png index 34fed4eef..419820ae9 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 1b0ebf9ed..24a422903 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 42dbcbc76..246d8fdf4 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index f5722618f..8c87e3525 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 8ec89a1fd..a6fa51615 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -198,7 +198,7 @@ Übersetzen von toots: Instanzensuche: instances.social - + Icon designer: Unterhaltung diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 131732b27..e9731e752 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -196,6 +196,8 @@ Traduction des pouets : Recherche d\'instances : instances.social + Concepteur de l\'icône : + Conversation diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 287c97563..30a6d7e9a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -197,7 +197,7 @@ Powered by Yandex.Translate Search instances: instances.social - + Icon designer: Conversation