2021-03-16 23:23:42 +01:00
|
|
|
package com.jens.automation2;
|
|
|
|
|
|
|
|
import android.app.Activity;
|
2021-03-18 23:37:21 +01:00
|
|
|
import android.content.Intent;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.Build;
|
2021-03-16 23:23:42 +01:00
|
|
|
import android.os.Bundle;
|
2021-03-18 23:37:21 +01:00
|
|
|
import android.text.Html;
|
|
|
|
import android.view.View;
|
|
|
|
import android.widget.QuickContactBadge;
|
2021-03-16 23:23:42 +01:00
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
import androidx.annotation.Nullable;
|
2021-03-18 23:37:21 +01:00
|
|
|
import androidx.core.text.HtmlCompat;
|
2021-03-16 23:23:42 +01:00
|
|
|
|
|
|
|
public class ActivityDisplayLongMessage extends Activity
|
|
|
|
{
|
2021-03-18 23:37:21 +01:00
|
|
|
TextView tvMessageTitle, tvLongMessage, tvMessageLink;
|
2021-03-16 23:23:42 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState)
|
|
|
|
{
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
setContentView(R.layout.activity_display_long_message);
|
|
|
|
|
2021-03-18 23:37:21 +01:00
|
|
|
tvMessageTitle = (TextView)findViewById(R.id.tvMessageTitle);
|
2021-03-16 23:23:42 +01:00
|
|
|
tvLongMessage = (TextView)findViewById(R.id.tvLongMessage);
|
2021-03-18 23:37:21 +01:00
|
|
|
tvMessageLink = (TextView)findViewById(R.id.tvMessageLink);
|
2021-03-16 23:23:42 +01:00
|
|
|
|
2021-03-18 23:37:21 +01:00
|
|
|
String title = getIntent().getStringExtra("messageTitle");
|
|
|
|
String message = getIntent().getStringExtra("longMessage").replace("\\n", Miscellaneous.lineSeparator);
|
|
|
|
|
|
|
|
String link = null;
|
|
|
|
if(getIntent().hasExtra("messageLink"))
|
|
|
|
link = getIntent().getStringExtra("messageLink");
|
|
|
|
|
|
|
|
tvMessageTitle.setText(HtmlCompat.fromHtml(title, HtmlCompat.FROM_HTML_MODE_LEGACY));
|
|
|
|
tvLongMessage.setText(message);
|
|
|
|
|
|
|
|
if(link != null && link.length() > 0)
|
|
|
|
{
|
|
|
|
tvMessageLink.setText(HtmlCompat.fromHtml("<u>" + link + "</u>", HtmlCompat.FROM_HTML_MODE_LEGACY));
|
|
|
|
String finalLink = link;
|
|
|
|
tvMessageLink.setOnClickListener(new View.OnClickListener()
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public void onClick(View view)
|
|
|
|
{
|
|
|
|
Uri uriUrl = Uri.parse(finalLink);
|
|
|
|
Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
|
|
|
|
startActivity(launchBrowser);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2021-03-16 23:23:42 +01:00
|
|
|
}
|
2021-03-18 23:37:21 +01:00
|
|
|
}
|