SplashActivity.java 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. ///*
  2. // vvphone is a SIP app for android.
  3. // vvsip is a SIP library for softphone (SIP -rfc3261-)
  4. // Copyright (C) 2003-2010 Bluegoby - <bluegoby@163.com>
  5. // */
  6. //
  7. //package com.vvsip.amdemo;
  8. //
  9. //import java.text.SimpleDateFormat;
  10. //import java.util.Date;
  11. //
  12. //import com.vvsip.ansip.IVvsipService;
  13. //import com.vvsip.ansip.IVvsipServiceListener;
  14. //import com.vvsip.ansip.VvsipCall;
  15. //import com.vvsip.ansip.VvsipService;
  16. //import com.vvsip.ansip.VvsipServiceBinder;
  17. //import com.vvsip.ansip.VvsipTask;
  18. //
  19. //import android.app.Activity;
  20. //import android.app.AlertDialog;
  21. //import android.content.ComponentName;
  22. //import android.content.Context;
  23. //import android.content.DialogInterface;
  24. //import android.content.Intent;
  25. //import android.content.ServiceConnection;
  26. //import android.os.Bundle;
  27. //import android.os.Handler;
  28. //import android.text.Html;
  29. //import android.text.method.LinkMovementMethod;
  30. //import android.text.method.MovementMethod;
  31. //import android.util.Log;
  32. //import android.view.MotionEvent;
  33. //import android.view.View;
  34. //import android.widget.TextView;
  35. //import android.os.IBinder;
  36. //
  37. //public class SplashActivity extends Activity implements IVvsipServiceListener {
  38. //
  39. // protected int _splashTime = 3000;
  40. // protected Handler _exitHandler = null;
  41. // protected Runnable _exitRunnable = null;
  42. // protected Handler _startServiceHandler = null;
  43. // protected Runnable _startServiceRunnable = null;
  44. //
  45. // private ServiceConnection connection;
  46. //
  47. // private TextView mTextView_link;
  48. // private TextView mTextView_licenselink;
  49. // private TextView myVersion;
  50. //
  51. // /** Called when the activity is first created. */
  52. // @Override
  53. // public void onCreate(Bundle savedInstanceState) {
  54. // Log.i("ActivitySplash", "lifecycle // onCreate");
  55. // super.onCreate(savedInstanceState);
  56. // setContentView(R.layout.splash_layout);
  57. //
  58. // mTextView_link = (TextView) findViewById(R.id.TextView_link);
  59. // if (mTextView_link != null) {
  60. // MovementMethod lMM = LinkMovementMethod.getInstance();
  61. // if (lMM != null) {
  62. // mTextView_link.setMovementMethod(lMM);
  63. // mTextView_link.setText(Html.fromHtml("www.vvsip.com"));
  64. // }
  65. // mTextView_licenselink = (TextView) findViewById(R.id.TextView_licencelink);
  66. // if (lMM != null) {
  67. // mTextView_licenselink.setMovementMethod(lMM);
  68. // mTextView_licenselink.setText(Html.fromHtml("vvsip.com"));
  69. // }
  70. // }
  71. //
  72. // myVersion = (TextView) findViewById(R.id.my_version);
  73. // SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
  74. // String today = formatter.format(new Date());
  75. // if(today.compareTo("2016-02-08")>0){
  76. // myVersion.setVisibility(View.VISIBLE);
  77. // myVersion.setText(myVersion.getText()+"\n"+"This version has expired.Please contact QQ272108638");
  78. // }else{
  79. // myVersion.setVisibility(View.GONE);
  80. // }
  81. //
  82. // // Runnable exiting the splash screen and launching the menu
  83. // _exitRunnable = new Runnable() {
  84. // public void run() {
  85. // exitSplash();
  86. // }
  87. // };
  88. // // Run the exitRunnable in in _splashTime ms
  89. // _exitHandler = new Handler();
  90. //
  91. // IVvsipService _service = VvsipService.getService();
  92. // if (_service != null) {
  93. // _exitHandler.postDelayed(_exitRunnable, 0);
  94. // return;
  95. // }
  96. //
  97. // _exitHandler.postDelayed(_exitRunnable, _splashTime);
  98. //
  99. // _startServiceHandler = new Handler();
  100. //
  101. // _startServiceRunnable = new Runnable() {
  102. // public void run() {
  103. //
  104. // Intent intent = new Intent(SplashActivity.this.getApplicationContext(), VvsipService.class);
  105. // startService(intent);
  106. //
  107. // connection = new ServiceConnection() {
  108. // public void onServiceConnected(ComponentName name, IBinder service) {
  109. // Log.i("ActivitySplash", "Connected!");
  110. // IVvsipService _service = ((VvsipServiceBinder) service).getService();
  111. // _service.addListener(SplashActivity.this);
  112. // }
  113. //
  114. // public void onServiceDisconnected(ComponentName name) {
  115. // Log.i("ActivitySplash", "Disconnected!");
  116. // }
  117. // };
  118. //
  119. // bindService(intent, connection, Context.BIND_AUTO_CREATE);
  120. // Log.i("ActivitySplash", "bindService done!");
  121. // }
  122. // };
  123. //
  124. // _startServiceHandler.postDelayed(_startServiceRunnable, 0);
  125. // }
  126. //
  127. // @Override
  128. // public void onDestroy() {
  129. // Log.i("ActivitySplash", "lifecycle // onDestroy");
  130. // super.onDestroy();
  131. //
  132. // IVvsipService _service = VvsipService.getService();
  133. // if (_service != null) {
  134. // _service.removeListener(this);
  135. // }
  136. //
  137. // _exitHandler.removeCallbacks(_startServiceRunnable);
  138. // _exitHandler.removeCallbacks(_exitRunnable);
  139. // if (connection != null) {
  140. // unbindService(connection);
  141. // connection = null;
  142. // }
  143. // }
  144. //
  145. // @Override
  146. // public boolean onTouchEvent(MotionEvent event) {
  147. // if (event.getAction() == MotionEvent.ACTION_DOWN) {
  148. // // Remove the exitRunnable callback from the handler queue
  149. // _exitHandler.removeCallbacks(_exitRunnable);
  150. // // Run the exit code manually
  151. // exitSplash();
  152. // }
  153. // return true;
  154. // }
  155. //
  156. // private void exitSplash() {
  157. // Log.i("ActivitySplash", "lifecycle // exitSplash");
  158. // VvsipTask vvsipTask = VvsipTask.getVvsipTask();
  159. // if (vvsipTask != null && VvsipTask.global_failure != 0) {
  160. // final AlertDialog.Builder b = new AlertDialog.Builder(this);
  161. // b.setIcon(R.drawable.ic_launcher);
  162. // b.setTitle(getString(R.string.app_name));
  163. // b.setMessage("global_installation_failure");
  164. //
  165. // b.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
  166. // public void onClick(DialogInterface dialog, int whichButton) {
  167. // finish();
  168. // }
  169. // });
  170. // b.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
  171. // public void onClick(DialogInterface dialog, int whichButton) {
  172. // finish();
  173. // }
  174. // });
  175. // b.show();
  176. //
  177. // Intent intent = new Intent(Intent.ACTION_MAIN);
  178. // intent.setClass(this.getApplicationContext(), VvsipService.class);
  179. // stopService(intent);
  180. // } else {
  181. // finish();
  182. //
  183. // Intent intent = new Intent();
  184. // intent.setClass(SplashActivity.this, MainActivity.class);
  185. // startActivity(intent);
  186. // }
  187. // }
  188. //
  189. // @Override
  190. // public void onNewVvsipCallEvent(VvsipCall call) {
  191. // // TODO Auto-generated method stub
  192. //
  193. // }
  194. //
  195. // @Override
  196. // public void onRemoveVvsipCallEvent(VvsipCall call) {
  197. // // TODO Auto-generated method stub
  198. //
  199. // }
  200. //
  201. // @Override
  202. // public void onStatusVvsipCallEvent(VvsipCall call) {
  203. // // TODO Auto-generated method stub
  204. //
  205. // }
  206. //
  207. // @Override
  208. // public void onRegistrationEvent(int rid, String remote_uri, final int code, String reason) {
  209. // SplashActivity.this.runOnUiThread(new Runnable() {
  210. // public void run() {
  211. // if (code >= 200 && code < 300) {
  212. // // Remove the exitRunnable callback from the handler queue
  213. // _exitHandler.removeCallbacks(_exitRunnable);
  214. // // Run the exit code manually
  215. // exitSplash();
  216. // }
  217. // }
  218. // });
  219. // }
  220. //}