Android Open Source - geocamMemoForAndroid U I Utils






From Project

Back to project page geocamMemoForAndroid.

License

The source code is released under:

NASA OPEN SOURCE AGREEMENT VERSION 1.3 THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE, REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN COMPUTER SOFTWARE ORI...

If you think the Android project geocamMemoForAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package gov.nasa.arc.geocam.memo;
//w  w  w.  j  av  a  2s.com
import gov.nasa.arc.geocam.memo.activity.GeoCamMemoCreateActivity;
import gov.nasa.arc.geocam.memo.activity.GeoCamMemoHomeActivity;
import gov.nasa.arc.geocam.memo.activity.GeoCamMemoMapActivity;
import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;


/**
 * The UIUtils helper class. Provides static access functions that create activity intents.
 */
public class UIUtils {
   
  /**
   * Invoke "home" action, returning to {@link GeoCamMemoHomeActivity}.
   *
   * @param context the context
   */
    public static void goHome(Context context) {
        final Intent intent = new Intent(context, GeoCamMemoHomeActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        context.startActivity(intent);
    }
    
    /**
     * Creates the memo.
     *
     * @param context the context
     */
    public static void createMemo(Context context){
        final Intent intent = new Intent(context, GeoCamMemoCreateActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        context.startActivity(intent);
    }
    
    /**
     * Show map view.
     *
     * @param context the context
     * @param memoMessage the memo message
     */
    public static void showMapView(Context context, GeoCamMemoMessage memoMessage) {
      final Intent intent = new Intent(context, GeoCamMemoMapActivity.class);
      intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      intent.putExtra(context.getString(R.string.latitude), memoMessage.getLatitude());
      intent.putExtra(context.getString(R.string.longitude), memoMessage.getLongitude());
      intent.putExtra(context.getString(R.string.accuracy), memoMessage.getAccuracy());
      context.startActivity(intent);      
    }
    
    
    /**
     * Display an exception to the user.
     *
     * @param context the context
     * @param e the e
     * @param additionalMessage the additional message
     */
    public static void displayException(Context context, Exception e, String additionalMessage)
    {
      StringBuilder sb = new StringBuilder();
      if(additionalMessage != null)
      {
        sb.append(additionalMessage + ": ");
      }
      if(e.getLocalizedMessage() != null){
          sb.append(e.getLocalizedMessage());        
      }
      Toast.makeText(context, sb.toString(), Toast.LENGTH_LONG).show();
    }
}




Java Source Code List

gov.nasa.arc.geocam.memo.GeoCamMemoModule.java
gov.nasa.arc.geocam.memo.GeoCamMemoRoboApplication.java
gov.nasa.arc.geocam.memo.UIUtils.java
gov.nasa.arc.geocam.memo.activity.GeoCamMemoCreateActivity.java
gov.nasa.arc.geocam.memo.activity.GeoCamMemoHomeActivity.java
gov.nasa.arc.geocam.memo.activity.GeoCamMemoMapActivity.java
gov.nasa.arc.geocam.memo.activity.GeoCamMemoMessageArrayAdapter.java
gov.nasa.arc.geocam.memo.activity.GeoCamMemoSettings.java
gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage.java
gov.nasa.arc.geocam.memo.exception.AuthenticationFailedException.java
gov.nasa.arc.geocam.memo.service.DjangoMemoImplementation.java
gov.nasa.arc.geocam.memo.service.DjangoMemoInterface.java
gov.nasa.arc.geocam.memo.service.DjangoMemoJsonConverterImplementation.java
gov.nasa.arc.geocam.memo.service.DjangoMemoJsonConverterInterface.java
gov.nasa.arc.geocam.memo.service.GeoLocationListener.java
gov.nasa.arc.geocam.memo.service.MemoMapOverlay.java
gov.nasa.arc.geocam.memo.service.SiteAuthCookieImplementation.java
gov.nasa.arc.geocam.memo.service.SiteAuthInterface.java