Back to project page SeeKampf.
The source code is released under:
GNU General Public License
If you think the Android project SeeKampf listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.avedo.seekampf.fragments; /*from ww w . j av a2 s . c o m*/ import android.os.Bundle; import android.text.Html; import android.text.format.DateFormat; import android.text.format.DateUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import net.avedo.seekampf.R; import net.avedo.seekampf.models.Message; import net.avedo.seekampf.utils.Constants; import java.text.SimpleDateFormat; public class MessageDetailsFragment extends RestDetailsFragment<Message> { public static final String TAG = "MessageDetails"; @Override protected String fetchServiceUrl() { return Constants.API_URL + "?server=" + settings.getString(res.getString(R.string.prefs_server_key), "1") + "&typ=nachrichten&id=" + serviceObjectId; } @Override protected String fetchServiceTag() { return MessageDetailsFragment.TAG; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Load the message details layout. return inflater.inflate(R.layout.message_details, container, false); } @Override protected void createView() { // Fetch the main layout. View mainView = this.getView(); // Fetch the ImageView ... ImageView messageState = (ImageView) mainView.findViewById(R.id.messageState); // ... and initialize it. if(this.serviceObject.getGelesen() != 1) { messageState.setImageResource(R.drawable.message_new); } // Fetch the message sender field ... TextView messageSender = (TextView) mainView.findViewById(R.id.messageSender); // ... and initialize it. messageSender.setText(Html.fromHtml(this.serviceObject.getVon())); // Fetch the message subject field ... TextView messageSubject = (TextView) mainView.findViewById(R.id.messageSubject); // ... and initialize it. messageSubject.setText(this.serviceObject.getBetreff() == null ? "" : Html.fromHtml(this.serviceObject.getBetreff())); // Fetch the message receiving Date field ... TextView receivingDate = (TextView) mainView.findViewById(R.id.receivingDate); // ... and initialize it. if(DateUtils.isToday(this.serviceObject.getTime() * 1000)) { SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); receivingDate.setText(sdf.format(this.serviceObject.getTime() * 1000).toString()); } else { SimpleDateFormat sdf = new SimpleDateFormat("d. MMM"); receivingDate.setText(sdf.format(this.serviceObject.getTime() * 1000).toString()); } // Fetch the message body field ... TextView messageBody = (TextView) mainView.findViewById(R.id.messageBody); // ... and assign the message body. messageBody.setText(Html.fromHtml(this.serviceObject.getText())); } }