Fixes issue #346 - Adds application name in toots
This commit is contained in:
parent
b13fa0dc2a
commit
a31ec0eb9c
|
@ -1680,12 +1680,13 @@ public class API {
|
|||
//Retrieve Application
|
||||
Application application = new Application();
|
||||
try {
|
||||
JSONObject arrayApplication = resobj.getJSONObject("application");
|
||||
if( arrayApplication != null){
|
||||
application.setName(arrayApplication.get("name").toString());
|
||||
application.setWebsite(arrayApplication.get("website").toString());
|
||||
if(resobj.getJSONObject("application") != null){
|
||||
application.setName(resobj.getJSONObject("application").getString("name"));
|
||||
application.setWebsite(resobj.getJSONObject("application").getString("website"));
|
||||
}
|
||||
}catch (Exception ignored){}
|
||||
}catch (Exception e){
|
||||
application = new Application();
|
||||
}
|
||||
status.setApplication(application);
|
||||
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@ import fr.gouv.etalab.mastodon.asynctasks.RetrieveRepliesAsyncTask;
|
|||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Application;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Attachment;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Card;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Emojis;
|
||||
|
@ -1523,6 +1524,18 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
if( status.getApplication() != null && getItemViewType(position) == FOCUSED_STATUS){
|
||||
Application application = status.getApplication();
|
||||
holder.status_toot_app.setText(application.getName());
|
||||
if( application.getWebsite() != null && !application.getWebsite().trim().equals("null"))
|
||||
holder.status_toot_app.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Helper.openBrowser(context, application.getWebsite());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -424,8 +424,8 @@
|
|||
android:textStyle="italic"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:id="@+id/status_toot_app"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -434,6 +434,8 @@
|
|||
android:gravity="end"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textStyle="italic"
|
||||
android:textSize="16sp"
|
||||
android:textColor="?attr/colorAccent"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:id="@+id/status_action_container"
|
||||
|
|
Loading…
Reference in New Issue