Changeset 17658
- Timestamp:
- 04/07/14 12:06:29 (11 years ago)
- Location:
- issm/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ISSM.java
r17423 r17658 4 4 import java.nio.ByteOrder; 5 5 import java.nio.DoubleBuffer; 6 7 import android.app.ProgressDialog;8 import android.content.Intent;9 6 import android.opengl.GLSurfaceView; 10 7 import android.os.AsyncTask; 11 import android.os.Build;12 8 import android.os.Bundle; 9 import android.app.Activity; 10 import android.app.ProgressDialog; 13 11 import android.util.DisplayMetrics; 14 12 import android.view.GestureDetector; 15 import android.view.GestureDetector.OnDoubleTapListener;16 import android.view.GestureDetector.OnGestureListener;17 13 import android.view.Gravity; 18 14 import android.view.KeyEvent; 19 15 import android.view.Menu; 20 16 import android.view.MenuInflater; 21 import android.view.MotionEvent;22 17 import android.view.View; 23 18 import android.view.View.OnClickListener; 19 import android.view.GestureDetector.OnDoubleTapListener; 20 import android.view.GestureDetector.OnGestureListener; 21 import android.view.MotionEvent; 24 22 import android.view.animation.AccelerateInterpolator; 25 23 import android.view.animation.Animation; … … 35 33 import android.widget.Spinner; 36 34 import android.widget.ViewFlipper; 37 // private static final int INVISIBLE = 0; 38 // Loading the ISSM library locally 39 // private IssmJni issmNative; 40 // ,sealevel; 41 42 public class ISSM extends BaseActivity implements OnClickListener, 35 import android.os.Build; 36 37 public class ISSM extends Activity implements OnClickListener, 43 38 OnGestureListener, OnDoubleTapListener { 44 39 // private static final int INVISIBLE = 0; … … 46 41 private int screenHeight; 47 42 private DoubleBuffer buff; 48 // Loading the ISSM library locally 49 // private IssmJni issmNative; 43 private IssmJni issmNative; 50 44 private String mapName; 51 45 private String issmFolder; … … 66 60 private Spinner spinner; 67 61 private boolean onSimulationScreen = false; 68 private String url = "http://blackhawk2.jpl.nasa.gov/issm/solve?callback=?";69 62 70 63 // ------------------------------------------------------------------------------------------------ … … 73 66 super.onCreate(savedInstanceState); 74 67 setContentView(R.layout.main_issm); 75 transition();76 68 77 69 // Set up a listener for double tap. … … 90 82 } 91 83 } 92 Button homeTab = (Button) findViewById(R.id.play_tab);93 homeTab.setOnClickListener(new View.OnClickListener() {94 95 @Override96 public void onClick(View v) {97 Intent i = new Intent(ISSM.this, MenuPage.class);98 startActivity(i);99 finish();100 }101 });102 103 Button galleryTab = (Button) findViewById(R.id.gallery_tab);104 galleryTab.setOnClickListener(new View.OnClickListener() {105 106 @Override107 public void onClick(View v) {108 Intent i = new Intent(ISSM.this, GalleryImage.class);109 startActivity(i);110 finish();111 }112 });113 Button videoTab = (Button) findViewById(R.id.video_tab);114 videoTab.setOnClickListener(new View.OnClickListener() {115 116 @Override117 public void onClick(View v) {118 // String url = "http://www.youtube.com/watch?v=KlDO0C8r_ws";119 // Intent i = new Intent(Intent.ACTION_VIEW);120 // i.setData(Uri.parse(url));121 Intent i = new Intent(ISSM.this, VideoActivity.class);122 startActivity(i);123 finish();124 }125 });126 Button aboutTab = (Button) findViewById(R.id.about_tab);127 aboutTab.setOnClickListener(new View.OnClickListener() {128 129 @Override130 public void onClick(View v) {131 Intent i = new Intent(ISSM.this, AboutActivity.class);132 startActivity(i);133 finish();134 }135 });136 Button teamTab = (Button) findViewById(R.id.team_tab);137 teamTab.setOnClickListener(new View.OnClickListener() {138 139 @Override140 public void onClick(View v) {141 // String url = "http://issm.jpl.nasa.gov/";142 // Intent i = new Intent(Intent.ACTION_VIEW);143 // i.setData(Uri.parse(url));144 // startActivity(i);145 146 Intent i = new Intent(ISSM.this, TeamActivity.class);147 startActivity(i);148 finish();149 }150 });151 152 84 friction = MINIMUM + OFFSET; 153 85 // temperature = MINIMUM + OFFSET; … … 169 101 defaultMap = (ImageView) findViewById(R.id.defaultMap); 170 102 dialog = new ProgressDialog(this); 171 colorBar = (ColorBar) findViewById(R.id.colorbar);103 // colorBar = (ColorBar) findViewById(R.id.colorbar); 172 104 // load up the ISSM library and create double buffer in java 173 105 // which later on will be pass for native for allocation. 174 //issmNative = new IssmJni();106 issmNative = new IssmJni(); 175 107 velocity = new Velocity(); 176 108 … … 188 120 colorMap.setColor(color); 189 121 colorBar.setColorMap(colorMap); 190 //drawFigure();122 drawFigure(); 191 123 } 192 124 } … … 213 145 } 214 146 215 // size = issmNative.createISSMModel(solution_type,issmFolder,file);147 size = issmNative.createISSMModel(solution_type, issmFolder, file); 216 148 buff = ByteBuffer.allocateDirect(size * 12 * 8) 217 149 .order(ByteOrder.nativeOrder()).asDoubleBuffer(); … … 307 239 defaultMap.setImageResource(R.drawable.greenland_button); 308 240 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { 309 defaultMap.setScaleX(1.12f);310 defaultMap.setScaleY(0.92f);311 defaultMap.setAlpha(1.0f);241 // defaultMap.setScaleX(1.12f); 242 // defaultMap.setScaleY(0.92f); 243 // defaultMap.setAlpha(1.0f); 312 244 } else { 313 245 defaultMap.setAlpha(1); … … 327 259 defaultMap.setImageResource(R.drawable.antarctica_button); 328 260 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { 329 defaultMap.setAlpha(1.0f);261 // defaultMap.setAlpha(1.0f); 330 262 } else { 331 263 defaultMap.setAlpha(1); … … 367 299 popupWindow.dismiss(); 368 300 System.out.println("Friction = " + friction); 369 // new CalculationTask().execute(friction,temperature);301 new CalculationTask().execute(friction, temperature); 370 302 } 371 303 }); … … 403 335 }; 404 336 thread.start(); 405 // issmNative.solveISSMModel(target[0],buff);337 issmNative.solveISSMModel(target[0], buff); 406 338 // System.out.println("temperature = " + target[1]); 407 339 // issmNative.solveISSMModel(target[0],target[1],buff); … … 445 377 } 446 378 447 // -------------------------------------------------------------------------------------448 449 @Override450 public void onBackPressed() {451 Intent i = new Intent(ISSM.this, MenuPage.class);452 startActivity(i);453 finish();454 }455 456 379 // ----------------------------------------------------------------------------------- 457 380 private void fadeImage() { -
issm/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ISSMWebActivity.java
r17620 r17658 14 14 import android.view.View; 15 15 import android.view.View.OnClickListener; 16 import android.view.Window; 16 17 import android.webkit.WebResourceResponse; 17 18 import android.webkit.WebView; … … 21 22 22 23 // URL of the index page of the ISSM web application 23 private String srcPath = "++"; 24 // private String srcPath = 25 // "http://issm.jpl.nasa.gov/externalicelab/index.html"; 24 26 private String offPath = "file:///android_asset/externalicelab/index.html"; 25 27 private final String KEY = "mode"; 26 28 private String issmFolder = ""; 27 29 private int MODE; 28 // private String srcPath = 29 // "http://www.csupomona.edu/~tqnguyen/CIS311/Project3/index.html"; 30 private String srcPath = "http://www.csupomona.edu/~lannguyen/ISSM_WEB/html/index.html"; 30 31 private WebView myWebView; 31 32 … … 33 34 protected void onCreate(Bundle savedInstanceState) { 34 35 super.onCreate(savedInstanceState); 36 requestWindowFeature(Window.FEATURE_NO_TITLE); 35 37 setContentView(R.layout.activity_issmweb_online); 36 getActionBar().setCustomView(R.layout.actionbar_top_web);37 getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);38 // getActionBar().setCustomView(R.layout.actionbar_top_web); 39 // getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); 38 40 MODE = getIntent().getExtras().getInt(KEY); 39 41 40 Button webHome = (Button) findViewById(R.id.web_home);41 webHome.setOnClickListener(new OnClickListener() {42 43 44 45 46 47 48 49 50 51 52 });53 54 Button webRefresh = (Button) findViewById(R.id.web_refresh);55 webRefresh.setOnClickListener(new OnClickListener() {56 57 58 59 60 61 62 63 64 });42 // Button webHome = (Button) findViewById(R.id.web_home); 43 // webHome.setOnClickListener(new OnClickListener() { 44 // 45 // @Override 46 // public void onClick(View v) { 47 // if (MODE == 0) { 48 // myWebView.loadUrl(srcPath); 49 // } else { 50 // myWebView.loadUrl(offPath); 51 // } 52 // } 53 // 54 // }); 55 // 56 // Button webRefresh = (Button) findViewById(R.id.web_refresh); 57 // webRefresh.setOnClickListener(new OnClickListener() { 58 // 59 // @Override 60 // public void onClick(View v) { 61 // myWebView.loadUrl(myWebView.getOriginalUrl()); 62 // // Log.i("srcUrl: ", srcPath); 63 // // Log.i("newUrl: ", myWebView.getOriginalUrl()); 64 // } 65 // 66 // }); 65 67 66 68 // final ProgressDialog loading = new ProgressDialog(this); … … 77 79 if (url.startsWith("http") 78 80 && !url.contains("http://thwaites.jpl.nasa.gov/fastcgi/visl-solve.py?callbacks")) { 79 myWebView.setVisibility(View.INVISIBLE); 81 // myWebView.setVisibility(View.INVISIBLE); 82 myWebView.stopLoading(); 80 83 new AlertDialog.Builder(ISSMWebActivity.this) 81 84 .setTitle("Error!") 82 85 .setMessage( 83 "Option requires online mode. Please exit and enable connection to access the option.")86 "Option requires online mode. Exit and enable connection to access the option.") 84 87 .setCancelable(false) 85 88 .setPositiveButton("Okay", … … 88 91 DialogInterface dialog, 89 92 int id) { 90 myWebView.loadUrl(offPath); 91 new Handler().postDelayed( 92 new Runnable() { 93 @Override 94 public void run() { 95 // This method 96 // will be 97 // executed once 98 // the timer is 99 // over 100 myWebView 101 .setVisibility(View.VISIBLE); 102 } 103 }, 700); 93 if (!myWebView.getOriginalUrl() 94 .equals(offPath)) { 95 myWebView.loadUrl(offPath); 96 } 104 97 } 105 98 }).show(); … … 131 124 return null; 132 125 133 // URI uri = URI.create(url);134 // String scheme = uri.getScheme();135 // // If scheme not http(s), let the default webview manage it136 // if (!"http".equals(scheme) && !"https".equals(scheme)) {137 // return null;138 // }139 140 // URL url = uri.toURL();141 //142 // if(doCancelRequest(url)) {143 // // Empty response144 // Log.d(TAG, "URL filtered: " + url);145 // return new WebResourceResponse("text/plain", "UTF-8", new146 // EmptyInputStream());147 //148 // } else {149 // Log.d(TAG, "URL: " + url);150 //151 // HttpURLConnection conn = (HttpURLConnection)152 // url.openConnection();153 // conn.setRequestProperty("User-Agent",154 // mSettings.getUserAgentString());155 //156 // // Configure connections157 // configureConnection(conn);158 //159 // String mimeType = conn.getContentType();160 // String encoding = conn.getContentEncoding();161 //162 // if(mimeType != null && mimeType.contains(CONTENT_TYPE_SPLIT))163 // {164 // String[] split = mimeType.split(CONTENT_TYPE_SPLIT);165 // mimeType = split[0];166 //167 // Matcher matcher = CONTENT_TYPE_PATTERN.matcher(split[1]);168 // if(matcher.find()) {169 // encoding = matcher.group(1);170 // }171 // }172 //173 // InputStream is = conn.getInputStream();174 // return new WebResourceResponse(mimeType, encoding, is);175 // return null;176 // }177 126 } 178 127 }); … … 180 129 myWebView.getSettings().setLoadWithOverviewMode(true); 181 130 myWebView.getSettings().setUseWideViewPort(true); 182 // myWebView.getSettings().setBuiltInZoomControls(true);183 131 if (MODE == 0) { 184 132 myWebView.loadUrl(srcPath);
Note:
See TracChangeset
for help on using the changeset viewer.