Java Code Examples for android.os.Looper

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project beintoo-android-sdk, under directory /BeintooSDK/src/com/beintoo/beintoosdkutility/.

Source file: ErrorDisplayer.java

  18 
vote

public static void showConnectionErrorOnThread(String Message,final Context ctx,Exception e){
  Looper.prepare();
  final Looper tLoop=Looper.myLooper();
  showConnectionError(Message,ctx,e);
  final Timer t=new Timer();
  t.schedule(new TimerTask(){
    @Override public void run(){
      tLoop.quit();
      t.cancel();
    }
  }
,6000);
  Looper.loop();
}
 

Example 2

From project Syncpoint-Android, under directory /src/com/couchbase/syncpoint/impl/.

Source file: SyncpointClientImpl.java

  18 
vote

void controlDatabaseChanged(){
  if (session.isControlDbSynced()) {
    Log.v(TAG,"Control DB changed");
    Looper l=Looper.getMainLooper();
    Handler h=new Handler(l);
    h.postDelayed(new Runnable(){
      @Override public void run(){
        getUpToDateWithSubscriptions();
      }
    }
,1000);
  }
}
 

Example 3

From project titanium_modules, under directory /beintoosdk/mobile/android/src/com/beintoo/beintoosdkutility/.

Source file: ErrorDisplayer.java

  18 
vote

public static void showConnectionErrorOnThread(String Message,final Context ctx,Exception e){
  Looper.prepare();
  final Looper tLoop=Looper.myLooper();
  showConnectionError(Message,ctx,e);
  final Timer t=new Timer();
  t.schedule(new TimerTask(){
    @Override public void run(){
      tLoop.quit();
      t.cancel();
    }
  }
,6000);
  Looper.loop();
}
 

Example 4

From project TouchDB-Android, under directory /TouchDB-Android/src/com/couchbase/touchdb/.

Source file: TDDatabase.java

  18 
vote

public TDDatabase(String path){
  assert(path.startsWith("/"));
  this.path=path;
  this.name=FileDirUtils.getDatabaseNameFromPath(path);
  handlerThread=new HandlerThread("HandlerThread for " + toString());
  handlerThread.start();
  Looper looper=handlerThread.getLooper();
  handler=new Handler(looper);
}
 

Example 5

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  17 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 6

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 7

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 8

From project agit, under directory /agit-integration-tests/src/main/java/com/madgag/agit/.

Source file: GitAsyncTaskTest.java

  15 
vote

private Repository executeAndWaitFor(final GitOperation operation) throws InterruptedException, IOException {
  final CountDownLatch latch=new CountDownLatch(1);
  Log.d(TAG,"About to start " + operation);
  new Thread(){
    public void run(){
      Looper.prepare();
      Log.d(TAG,"In run method for " + operation);
      GitAsyncTask task=injector.getInstance(GitAsyncTaskFactory.class).createTaskFor(operation,new OperationLifecycleSupport(){
        public void startedWith(        OpNotification ongoingNotification){
          Log.i(TAG,"Started " + operation + " with "+ ongoingNotification);
        }
        public void publish(        Progress progress){
        }
        public void error(        OpNotification notification){
          Log.i(TAG,"Errored " + operation + " with "+ notification);
        }
        public void success(        OpNotification completionNotification){
        }
        public void completed(        OpNotification completionNotification){
          Log.i(TAG,"Completed " + operation + " with "+ completionNotification);
          latch.countDown();
        }
      }
);
      task.execute();
      Log.d(TAG,"Called execute() on task for " + operation);
      Looper.loop();
    }
  }
.start();
  long startTime=currentTimeMillis();
  Log.i(TAG,"Waiting for " + operation + " to complete - currentThread="+ currentThread());
  boolean timeout=!latch.await(7 * 60,SECONDS);
  long duration=currentTimeMillis() - startTime;
  Log.i(TAG,"Finished waiting - timeout=" + timeout + " duration="+ duration);
  assertThat("Timeout for " + operation,timeout,is(false));
  return new FileRepository(operation.getGitDir());
}
 

Example 9

From project AlarmApp-Android, under directory /src/org/alarmapp/util/.

Source file: LooperThread.java

  15 
vote

public void run(){
  try {
    Looper.prepare();
    handler=new Handler();
    latch.countDown();
    Looper.loop();
  }
 catch (  Throwable t) {
    LogEx.exception("halted due to an error",t);
  }
}
 

Example 10

From project alljoyn_java, under directory /samples/android/signal/client/src/org/alljoyn/bus/samples/signalclient/.

Source file: Client.java

  15 
vote

public BusHandler(Looper looper){
  super(looper);
  mIsInASession=false;
  mIsConnected=false;
  mIsStoppingDiscovery=false;
}
 

Example 11

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 12

From project andlytics, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 13

From project android-animation-backport, under directory /animation-backport/src/backports/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 14

From project android-async-http, under directory /src/com/loopj/android/http/.

Source file: AsyncHttpResponseHandler.java

  15 
vote

/** 
 * Creates a new AsyncHttpResponseHandler
 */
public AsyncHttpResponseHandler(){
  if (Looper.myLooper() != null) {
    handler=new Handler(){
      public void handleMessage(      Message msg){
        AsyncHttpResponseHandler.this.handleMessage(msg);
      }
    }
;
  }
}
 

Example 15

From project android-ocr, under directory /android/src/edu/sfsu/cs/orange/ocr/.

Source file: DecodeHandler.java

  15 
vote

@Override public void handleMessage(Message message){
  if (!running) {
    return;
  }
switch (message.what) {
case R.id.ocr_continuous_decode:
    if (!isDecodePending) {
      isDecodePending=true;
      ocrContinuousDecode((byte[])message.obj,message.arg1,message.arg2);
    }
  break;
case R.id.ocr_decode:
ocrDecode((byte[])message.obj,message.arg1,message.arg2);
break;
case R.id.quit:
running=false;
Looper.myLooper().quit();
break;
}
}
 

Example 16

From project android-tether, under directory /src/og/android/tether/.

Source file: AccessControlActivity.java

  15 
vote

private void saveWhiteList(){
  Log.d(MSG_TAG,"Saving whitelist ...");
  new Thread(new Runnable(){
    public void run(){
      Looper.prepare();
      if (whitelist.exists()) {
        whitelist.whitelist.clear();
        for (        ClientData tmpClientData : AccessControlActivity.this.clientAdapter.getClientData()) {
          if (tmpClientData.isAccessAllowed()) {
            whitelist.whitelist.add(tmpClientData.getMacAddress());
          }
        }
        try {
          whitelist.save();
          if (application.coretask.isNatEnabled() && application.coretask.isProcessRunning("bin/dnsmasq")) {
            if (TetherService.singleton != null)             TetherService.singleton.restartSecuredWifi();
          }
        }
 catch (        Exception ex) {
          application.displayToastMessage(getString(R.string.accesscontrol_activity_error_save_whitelistfile));
        }
      }
 else {
        if (whitelist.exists()) {
          if (!whitelist.remove()) {
            application.displayToastMessage(getString(R.string.accesscontrol_activity_error_remove_whitelistfile));
          }
        }
      }
      application.displayToastMessage(getString(R.string.accesscontrol_activity_config_saved));
      Looper.loop();
    }
  }
).start();
}
 

Example 17

From project android-voip-service, under directory /src/main/java/net/chrislehmann/sipservice/service/.

Source file: SipService.java

  15 
vote

public void run(){
  Looper.prepare();
  mHandler=new Handler(){
    public void handleMessage(    Message msg){
      Intent intent=(Intent)msg.obj;
      handleIntent(intent);
    }
  }
;
  Looper.loop();
}
 

Example 18

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/business/.

Source file: ManagerThread.java

  15 
vote

public void run(){
  Looper.prepare();
  mHandler=new Handler();
  mInfoManager.setHandler(mHandler);
  mControlManager.setHandler(mHandler);
  mMusicManager.setHandler(mHandler);
  mVideoManager.setHandler(mHandler);
  mTvShowManager.setHandler(mHandler);
  Looper.loop();
}
 

Example 19

From project androidquery, under directory /beta/com/androidquery/callback/.

Source file: LocationAjaxCallback.java

  15 
vote

private void work(){
  Location loc=getBestLocation();
  Timer timer=new Timer(false);
  if (networkEnabled) {
    AQUtility.debug("register net");
    networkListener=new Listener();
    lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,interval,0,networkListener,Looper.getMainLooper());
    timer.schedule(networkListener,timeout);
  }
  if (gpsEnabled) {
    AQUtility.debug("register gps");
    gpsListener=new Listener();
    lm.requestLocationUpdates(LocationManager.GPS_PROVIDER,interval,0,gpsListener,Looper.getMainLooper());
    timer.schedule(gpsListener,timeout);
  }
  if (iteration > 1 && loc != null) {
    n++;
    callback(loc);
  }
  initTime=System.currentTimeMillis();
}
 

Example 20

From project androidZenWriter, under directory /library/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 21

From project android_packages_apps_Gallery2, under directory /tests/src/com/android/gallery3d/data/.

Source file: LocalDataTest.java

  15 
vote

public void run() throws Exception {
  SQLiteDatabase db=SQLiteDatabase.create(null);
  prepareData(db);
  mApp=newGalleryContext(db,Looper.getMainLooper());
  Path.clearAll();
  Path path=Path.fromString(mIsImage ? "/local/image" : "/local/video");
  mAlbumSet=new LocalAlbumSet(path,mApp);
  mAlbumSet.reload();
  verifyResult();
}
 

Example 22

From project android_packages_apps_Gallery3D, under directory /src/com/cooliris/app/.

Source file: App.java

  15 
vote

public App(Context context){
  mMap.put(context,this);
  mContext=context;
  if (PIXEL_DENSITY == 0.0f) {
    DisplayMetrics metrics=new DisplayMetrics();
    ((Activity)mContext).getWindowManager().getDefaultDisplay().getMetrics(metrics);
    PIXEL_DENSITY=metrics.density;
    PIXEL_DENSITY_DPI=metrics.densityDpi;
  }
  if (RESPATCH_FACTOR == 0) {
    RESPATCH_FACTOR=(int)(Runtime.getRuntime().maxMemory() / 1048576) / RESPATCH_DIVISOR;
  }
  mHandler=new Handler(Looper.getMainLooper());
  mReverseGeocoder=new ReverseGeocoder(mContext);
}
 

Example 23

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: EmergencyCallbackModeExitDialog.java

  15 
vote

public void run(){
  Looper.prepare();
  bindService(new Intent(EmergencyCallbackModeExitDialog.this,EmergencyCallbackModeService.class),mConnection,Context.BIND_AUTO_CREATE);
synchronized (EmergencyCallbackModeExitDialog.this) {
    try {
      if (mService == null) {
        EmergencyCallbackModeExitDialog.this.wait();
      }
    }
 catch (    InterruptedException e) {
      Log.d("ECM","EmergencyCallbackModeExitDialog InterruptedException: " + e.getMessage());
      e.printStackTrace();
    }
  }
  if (mService != null) {
    mEcmTimeout=mService.getEmergencyCallbackModeTimeout();
    mInEmergencyCall=mService.getEmergencyCallbackModeCallState();
  }
  unbindService(mConnection);
  mHandler.post(new Runnable(){
    public void run(){
      showEmergencyCallbackModeExitDialog();
    }
  }
);
}
 

Example 24

From project android_packages_apps_QuickSearchBox, under directory /src/com/android/quicksearchbox/.

Source file: QsbApplication.java

  15 
vote

public synchronized Handler getMainThreadHandler(){
  if (mUiThreadHandler == null) {
    mUiThreadHandler=new Handler(Looper.getMainLooper());
  }
  return mUiThreadHandler;
}
 

Example 25

From project AutobahnAndroid, under directory /Autobahn/src/de/tavendo/autobahn/.

Source file: WampWriter.java

  15 
vote

/** 
 * A writer object is created in AutobahnConnection.
 * @param looper     The message looper associated with the thread running this object.
 * @param master     The message handler associated with the master thread (running AutobahnConnection).
 * @param socket     The TCP socket (channel) the WebSocket connection runs over.
 * @param options    WebSockets options for the underlying WebSockets connection.
 */
public WampWriter(Looper looper,Handler master,SocketChannel socket,WebSocketOptions options){
  super(looper,master,socket,options);
  mJsonFactory=new MappingJsonFactory();
  mPayload=new NoCopyByteArrayOutputStream();
  if (DEBUG)   Log.d(TAG,"created");
}
 

Example 26

From project Common-Sense-Net-2, under directory /AndroidBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 27

From project cornerstone, under directory /frameworks/base/core/java/android/view/.

Source file: ViewRootImpl.java

  15 
vote

public static IWindowSession getWindowSession(Looper mainLooper){
synchronized (mStaticInit) {
    if (!mInitialized) {
      try {
        InputMethodManager imm=InputMethodManager.getInstance(mainLooper);
        sWindowSession=Display.getWindowManager().openSession(imm.getClient(),imm.getInputContext());
        mInitialized=true;
      }
 catch (      RemoteException e) {
      }
    }
    return sWindowSession;
  }
}
 

Example 28

From project cow, under directory /libs/ActionBarSherlock/library/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 29

From project cw-omnibus, under directory /external/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 30

From project DeskSMS, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 31

From project dmix, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 32

From project dreamDroid, under directory /libraries/ABS/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 33

From project droidgiro-android, under directory /src/se/droidgiro/scanner/.

Source file: DecodeHandler.java

  15 
vote

@Override public void handleMessage(Message message){
switch (message.what) {
case R.id.decode:
    decode((byte[])message.obj,message.arg1,message.arg2);
  break;
case R.id.new_invoice:
invoice=new Invoice();
decode((byte[])message.obj,message.arg1,message.arg2);
break;
case R.id.quit:
Looper.myLooper().quit();
break;
}
}
 

Example 34

From project droidparts, under directory /extra/src/org/droidparts/util/.

Source file: ImageAttacher.java

  15 
vote

public ImageAttacher(BitmapCacher bitmapCacher,ExecutorService executorService,RESTClient restClient){
  this.bitmapCacher=bitmapCacher;
  this.executorService=executorService;
  this.restClient=restClient;
  handler=new Handler(Looper.getMainLooper());
}
 

Example 35

From project evodroid, under directory /src/com/sonorth/evodroid/.

Source file: Comments.java

  15 
vote

@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (data != null) {
    Bundle extras=data.getExtras();
switch (requestCode) {
case 0:
      final String returnText=extras.getString("replyText");
    if (!returnText.equals("CANCEL")) {
      final String postID=extras.getString("postID");
      final int commentID=extras.getInt("commentID");
      showDialog(ID_DIALOG_REPLYING);
      new Thread(new Runnable(){
        public void run(){
          Looper.prepare();
          pd=new ProgressDialog(Comments.this);
          replyToComment(postID,commentID,returnText);
        }
      }
).start();
    }
  break;
}
}
}
 

Example 36

From project examples_2, under directory /SearchView/actionbarsherlock-lib/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 37

From project farebot, under directory /libs/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 38

From project Faye-Android, under directory /src/com/b3rwynmobile/fayeclient/autobahn/.

Source file: WampWriter.java

  15 
vote

/** 
 * A writer object is created in AutobahnConnection.
 * @param looper     The message looper associated with the thread running this object.
 * @param master     The message handler associated with the master thread (running AutobahnConnection).
 * @param socket     The TCP socket (channel) the WebSocket connection runs over.
 * @param options    WebSockets options for the underlying WebSockets connection.
 */
public WampWriter(Looper looper,Handler master,SocketChannel socket,WebSocketOptions options){
  super(looper,master,socket,options);
  mJsonFactory=new MappingJsonFactory();
  mPayload=new NoCopyByteArrayOutputStream();
  if (DEBUG)   Log.d(TAG,"created");
}
 

Example 39

From project finch, under directory /libs/JakeWharton-ActionBarSherlock-2eabf25/library/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 40

From project FlipDroid, under directory /app/src/com/goal98/flipdroid2/view/.

Source file: ThumbnailArticleView.java

  15 
vote

public void buildView(){
  LayoutInflater inflater=LayoutInflater.from(this.getContext());
  inflater.inflate(R.layout.thumbnail,this,true);
  setDisplayedChild(1);
  this.thumbnailViewWrapper=(LinearLayout)findViewById(R.id.loadedView);
  loadedThumbnail=inflater.inflate(R.layout.loadedthumbnail,thumbnailViewWrapper,true);
  String localeStr=this.getContext().getString(R.string.locale);
  String time=PrettyTimeUtil.getPrettyTime(localeStr,article.getCreatedDate());
  this.titleView=(TextView)loadedThumbnail.findViewById(R.id.title);
  this.authorView=(TextView)loadedThumbnail.findViewById(R.id.author);
  this.createDateView=(TextView)loadedThumbnail.findViewById(R.id.createDate);
  this.contentViewWrapper=(LinearLayout)loadedThumbnail.findViewById(R.id.contentll);
  this.portraitView=(WebImageView)loadedThumbnail.findViewById(R.id.portrait2);
  authorView.setText(article.getAuthor());
  createDateView.setText(time);
  if (article.getPortraitImageUrl() != null) {
    portraitView.setAutoSize(true);
    portraitView.setImageUrl(article.getPortraitImageUrl().toString());
  }
 else {
    portraitView.setVisibility(GONE);
  }
  addOnClickListener(contentViewWrapper);
  if (titleView != null)   ThumbnailContentRender.setTitleText(titleView,article,deviceInfo);
  if (handler == null) {
    handler=new Handler(Looper.getMainLooper());
  }
  buildImageAndContent();
  reloadOriginalView();
  handler.post(new Runnable(){
    @Override public void run(){
      if (!article.getSourceType().equals(TikaConstants.TYPE_RSS) && portraitViewWeiboContent != null)       portraitViewWeiboContent.loadImage();
 else       portraitView.loadImage();
    }
  }
);
}
 

Example 41

From project Gaggle, under directory /src/com/geeksville/gaggle/.

Source file: AudioVario.java

  15 
vote

/** 
 * @see com.geeksville.info.InfoField#onCreate(android.app.Activity)
 */
public void onCreate(Context context,Looper looper){
  this.context=context;
  if (context != null) {
    handler=new Handler(looper);
    PreferenceManager.getDefaultSharedPreferences(context).registerOnSharedPreferenceChangeListener(this);
    createFromPreferences();
  }
}
 

Example 42

From project Gibberbot, under directory /src/info/guardianproject/otr/app/im/app/.

Source file: SimpleAlertHandler.java

  15 
vote

public void showAlert(final CharSequence title,final CharSequence message){
  if (Looper.myLooper() == getLooper()) {
    new AlertDialog.Builder(mActivity).setTitle(title).setMessage(message).setPositiveButton(R.string.ok,null).show();
  }
 else {
    post(new Runnable(){
      public void run(){
        new AlertDialog.Builder(mActivity).setTitle(title).setMessage(message).setPositiveButton(R.string.ok,null).show();
      }
    }
);
  }
}
 

Example 43

From project GnucashMobile, under directory /com_actionbarsherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 44

From project Google-Tasks-Client, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 45

From project greenDAO, under directory /DaoCore/src/de/greenrobot/dao/async/.

Source file: AsyncOperationExecutor.java

  15 
vote

private void handleOperationCompleted(AsyncOperation operation){
  operation.setCompleted();
  AsyncOperationListener listenerToCall=listener;
  if (listenerToCall != null) {
    listenerToCall.onAsyncOperationCompleted(operation);
  }
  if (listenerMainThread != null) {
    if (handlerMainThread == null) {
      handlerMainThread=new Handler(Looper.getMainLooper(),this);
    }
    Message msg=handlerMainThread.obtainMessage(1,operation);
    handlerMainThread.sendMessage(msg);
  }
synchronized (this) {
    countOperationsCompleted++;
    if (countOperationsCompleted == countOperationsEnqueued) {
      notifyAll();
    }
  }
}
 

Example 46

From project GSM-Signal-Tracking-, under directory /gpstracker/src/nl/sogeti/android/gpstracker/logger/.

Source file: GPSLoggerService.java

  15 
vote

public void run(){
  Looper.prepare();
  mHandler=new Handler(){
    public void handleMessage(    Message msg){
      _handleMessage(msg);
    }
  }
;
  ready.release();
  Looper.loop();
}
 

Example 47

From project Hawksword, under directory /src/com/bw/hawksword/ocr/.

Source file: DecodeHandler.java

  15 
vote

@Override public void handleMessage(Message message){
  if (!running) {
    return;
  }
switch (message.what) {
case R.id.ocr_continuous_decode:
case R.id.ocr_decode:
    ocrDecode((byte[])message.obj,message.arg2,message.arg1);
  break;
case R.id.quit:
running=false;
Looper.myLooper().quit();
break;
}
}
 

Example 48

From project hsDroid, under directory /src/de/nware/app/hsDroid/ui/.

Source file: Preferences.java

  15 
vote

private void clearDB(){
  Thread clrDB=new Thread(){
    public void run(){
      try {
        Looper.prepare();
        final ContentResolver resolver=getContentResolver();
        resolver.delete(ExamsCol.CONTENT_URI,null,null);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
;
  clrDB.start();
}
 

Example 49

From project HSR-Timetable, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 50

From project huiswerk, under directory /print/zxing-1.6/android/src/com/google/zxing/client/android/.

Source file: DecodeHandler.java

  15 
vote

@Override public void handleMessage(Message message){
switch (message.what) {
case R.id.decode:
    decode((byte[])message.obj,message.arg1,message.arg2);
  break;
case R.id.quit:
Looper.myLooper().quit();
break;
}
}
 

Example 51

From project iJetty, under directory /console/webapp/src/main/java/org/mortbay/ijetty/console/.

Source file: FinderServlet.java

  15 
vote

public void run(){
  Looper.prepare();
  looper=Looper.myLooper();
  listener=new AsyncLocationListener(provider);
  locationManager.requestLocationUpdates(provider,60000L,0F,listener,looper);
  Log.d(TAG,"Requested location updates for " + provider);
  Looper.loop();
}
 

Example 52

From project incubator-cordova-android, under directory /framework/src/org/apache/cordova/.

Source file: AccelListener.java

  15 
vote

/** 
 * Start listening for acceleration sensor.
 * @return          status of listener
 */
private int start(){
  if ((this.status == AccelListener.RUNNING) || (this.status == AccelListener.STARTING)) {
    return this.status;
  }
  this.setStatus(AccelListener.STARTING);
  List<Sensor> list=this.sensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER);
  if ((list != null) && (list.size() > 0)) {
    this.mSensor=list.get(0);
    this.sensorManager.registerListener(this,this.mSensor,SensorManager.SENSOR_DELAY_UI);
    this.setStatus(AccelListener.STARTING);
  }
 else {
    this.setStatus(AccelListener.ERROR_FAILED_TO_START);
    this.fail(AccelListener.ERROR_FAILED_TO_START,"No sensors found to register accelerometer listening to.");
    return this.status;
  }
  Handler handler=new Handler(Looper.getMainLooper());
  handler.postDelayed(new Runnable(){
    public void run(){
      AccelListener.this.timeout();
    }
  }
,2000);
  return this.status;
}
 

Example 53

From project iosched_3, under directory /libprojects/abs/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 54

From project IRC-Client, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 55

From project k-9, under directory /src/com/fsck/k9/.

Source file: K9.java

  15 
vote

/** 
 * Register BroadcastReceivers programmaticaly because doing it from manifest would make K-9 auto-start. We don't want auto-start because the initialization sequence isn't safe while some events occur (SD card unmount).
 */
protected void registerReceivers(){
  final StorageGoneReceiver receiver=new StorageGoneReceiver();
  final IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_MEDIA_EJECT);
  filter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
  filter.addDataScheme("file");
  final BlockingQueue<Handler> queue=new SynchronousQueue<Handler>();
  new Thread(new Runnable(){
    @Override public void run(){
      Looper.prepare();
      try {
        queue.put(new Handler());
      }
 catch (      InterruptedException e) {
        Log.e(K9.LOG_TAG,"",e);
      }
      Looper.loop();
    }
  }
,"Unmount-thread").start();
  try {
    final Handler storageGoneHandler=queue.take();
    registerReceiver(receiver,filter,null,storageGoneHandler);
    Log.i(K9.LOG_TAG,"Registered: unmount receiver");
  }
 catch (  InterruptedException e) {
    Log.e(K9.LOG_TAG,"Unable to register unmount receiver",e);
  }
  registerReceiver(new ShutdownReceiver(),new IntentFilter(Intent.ACTION_SHUTDOWN));
  Log.i(K9.LOG_TAG,"Registered: shutdown receiver");
}
 

Example 56

From project lastfm-android, under directory /app/src/fm/last/android/player/.

Source file: RadioPlayerService.java

  15 
vote

public void startRadio() throws RemoteException {
  if (Looper.myLooper() == null)   Looper.prepare();
  if (mState == STATE_STOPPED)   mState=STATE_TUNING;
  currentTrack=null;
  RadioWidgetProvider.updateAppWidget(RadioPlayerService.this);
  new NextTrackTask().execute((Void)null);
}
 

Example 57

From project LEGO-MINDSTORMS-MINDdroid, under directory /android/src/com/lego/minddroid/.

Source file: UploadThread.java

  15 
vote

/** 
 * Prepares and starts the looper of the thread
 */
@Override public void run(){
  try {
    Looper.prepare();
    handler=new Handler();
    Looper.loop();
  }
 catch (  Throwable t) {
  }
}
 

Example 58

From project Locast-Android, under directory /src/android/support/v4_map/app/.

Source file: FragmentManager.java

  15 
vote

/** 
 * Only call from main thread!
 */
public boolean execPendingActions(){
  if (mExecutingActions) {
    throw new IllegalStateException("Recursive entry to executePendingTransactions");
  }
  if (Looper.myLooper() != mActivity.mHandler.getLooper()) {
    throw new IllegalStateException("Must be called from main thread of process");
  }
  boolean didSomething=false;
  while (true) {
    int numActions;
synchronized (this) {
      if (mPendingActions == null || mPendingActions.size() == 0) {
        return didSomething;
      }
      numActions=mPendingActions.size();
      if (mTmpActions == null || mTmpActions.length < numActions) {
        mTmpActions=new Runnable[numActions];
      }
      mPendingActions.toArray(mTmpActions);
      mPendingActions.clear();
      mActivity.mHandler.removeCallbacks(mExecCommit);
    }
    mExecutingActions=true;
    for (int i=0; i < numActions; i++) {
      mTmpActions[i].run();
    }
    mExecutingActions=false;
    didSomething=true;
  }
}
 

Example 59

From project mapdroid, under directory /src/au/id/tedp/mapdroid/.

Source file: TileServer.java

  15 
vote

public void run(){
  Looper.prepare();
  mHandler=new Handler(){
    public void handleMessage(    Message msg){
      if (msg.obj == null)       return;
    }
  }
;
  Looper.loop();
}
 

Example 60

From project MensaUPB, under directory /libs/ActionbarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 61

From project MIT-Mobile-for-Android, under directory /src/com/google/zxing/client/android/.

Source file: DecodeHandler.java

  15 
vote

@Override public void handleMessage(Message message){
switch (message.what) {
case R.id.decode:
    decode((byte[])message.obj,message.arg1,message.arg2);
  break;
case R.id.quit:
Looper.myLooper().quit();
break;
}
}
 

Example 62

From project Mobile-Tour-Guide, under directory /zxing-2.0/android/src/com/google/zxing/client/android/.

Source file: DecodeHandler.java

  15 
vote

@Override public void handleMessage(Message message){
  if (!running) {
    return;
  }
switch (message.what) {
case R.id.decode:
    decode((byte[])message.obj,message.arg1,message.arg2);
  break;
case R.id.quit:
running=false;
Looper.myLooper().quit();
break;
}
}
 

Example 63

From project mobilis, under directory /MXA/src/de/tudresden/inf/rn/mobilis/mxa/services/sessionmobility/.

Source file: SessionMobilityService.java

  15 
vote

@Override public void run(){
  super.run();
  Looper.prepare();
  try {
    mServiceDiscoveryHandler=new Handler(){
      public void handleMessage(      Message msg){
        if (msg.what == ConstMXA.MSG_DISCOVER_ITEMS && msg.arg1 == ConstMXA.MSG_STATUS_SUCCESS && msg.getData() != null) {
          try {
            ArrayList<DiscoverItem> items=msg.getData().getParcelableArrayList("DISCOVER_ITEMS");
            String username=mXMPPService.getXMPPService().getUsername();
            ArrayList<String> resourcesList=new ArrayList<String>();
            for (            DiscoverItem di : items) {
              if ((di.node == null) && !(di.jid.equals(username))) {
                resourcesList.add(StringUtils.parseResource(di.jid));
              }
            }
            mCallback.onResourcesResult(resourcesList);
            ResourcesQueryThread.this.interrupt();
          }
 catch (          RemoteException e) {
            Log.e(TAG,e.getLocalizedMessage());
          }
        }
      }
    }
;
    Messenger m=new Messenger(mServiceDiscoveryHandler);
    mXMPPService.getXMPPService().getServiceDiscoveryService().discoverItem(m,m,0,StringUtils.parseBareAddress(mUsername),null);
  }
 catch (  RemoteException e) {
    e.printStackTrace();
  }
  Looper.loop();
}
 

Example 64

From project mp3tunes-android, under directory /src/com/mp3tunes/android/util/.

Source file: Worker.java

  15 
vote

public void run(){
synchronized (mLock) {
    Looper.prepare();
    mLooper=Looper.myLooper();
    mLock.notifyAll();
  }
  Looper.loop();
}
 

Example 65

From project mWater-Android-App, under directory /android/actionbarsherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 66

From project MWM-for-Android, under directory /src/org/metawatch/manager/.

Source file: MetaWatchService.java

  15 
vote

void start(){
  Thread thread=new Thread(){
    public void run(){
      boolean run=true;
      Looper.prepare();
      while (run) {
switch (connectionState) {
case ConnectionState.DISCONNECTED:
          Log.d(MetaWatch.TAG,"state: disconnected");
        break;
case ConnectionState.CONNECTING:
      Log.d(MetaWatch.TAG,"state: connecting");
    updateNotification(false);
  connect(context);
nap(2000);
break;
case ConnectionState.CONNECTED:
Log.d(MetaWatch.TAG,"state: connected");
readFromDevice();
break;
case ConnectionState.DISCONNECTING:
Log.d(MetaWatch.TAG,"state: disconnecting");
run=false;
break;
}
}
}
}
;
thread.start();
}
 

Example 67

From project MyHeath-Android, under directory /actionbarlib/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 68

From project netlib, under directory /src/com/cafbit/netlib/.

Source file: AbstractDatagramManagerThread.java

  15 
vote

public void onCommand(Command command){
  if (command instanceof QuitCommand) {
    Looper.myLooper().quit();
  }
 else   if (command instanceof DatagramCommand) {
    DatagramCommand datagramCommand=(DatagramCommand)command;
    handleIncoming(datagramCommand.getSocket(),datagramCommand.getDatagramPacket());
  }
 else   if (command instanceof ErrorCommand) {
    ErrorCommand errorCommand=(ErrorCommand)command;
    if (errorCommand.getMessage() == null) {
      upstreamHandler.error(errorCommand.getThrowable());
    }
 else {
      upstreamHandler.error(errorCommand.getMessage(),errorCommand.getThrowable());
    }
  }
}
 

Example 69

From project NFCShopping, under directory /nfc updater client/NFCUpdater/src/scut/bgooo/updater/decoding/.

Source file: DecodeHandler.java

  15 
vote

@Override public void handleMessage(Message message){
switch (message.what) {
case R.id.decode:
    decode((byte[])message.obj,message.arg1,message.arg2);
  break;
case R.id.quit:
Looper.myLooper().quit();
break;
}
}
 

Example 70

From project NineOldAndroids, under directory /library/src/com/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 71

From project onebusaway-android, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 72

From project open311-android, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 73

From project OpenAndroidWeather, under directory /OpenAndroidWeather/src/no/firestorm/wsklima/.

Source file: GetWeather.java

  15 
vote

private void updateLocation() throws NoLocationException {
  Location loc=getLastLocation();
  if (loc != null && isAccurateEnough(loc)) {
    mLocation=loc;
    return;
  }
  final LocationManager locMan=(LocationManager)mContext.getSystemService(Service.LOCATION_SERVICE);
  final Criteria criteria=new Criteria();
  criteria.setPowerRequirement(Criteria.POWER_LOW);
  final String provider=locMan.getBestProvider(criteria,true);
  if (provider != null) {
    UpdateLocation getLocation=new UpdateLocation(this,mContext);
    locMan.requestLocationUpdates(provider,0,0,getLocation,Looper.getMainLooper());
synchronized (this) {
      try {
        this.wait(2 * 60 * 1000);
      }
 catch (      final InterruptedException e) {
        getLocation.stop();
        loc=getLocation.getLocation();
        if (loc == null) {
          throw new NoLocationException(null);
        }
 else {
          mLocation=loc;
        }
      }
    }
  }
 else   throw new NoLocationException(null);
}
 

Example 74

From project packages_apps_Camera_1, under directory /src/com/android/camera/.

Source file: Camera.java

  15 
vote

private void addIdleHandler(){
  MessageQueue queue=Looper.myQueue();
  queue.addIdleHandler(new MessageQueue.IdleHandler(){
    public boolean queueIdle(){
      Storage.ensureOSXCompatible();
      return false;
    }
  }
);
}
 

Example 75

From project packages_apps_Camera_2, under directory /src/com/android/camera/.

Source file: Camera.java

  15 
vote

private void addIdleHandler(){
  MessageQueue queue=Looper.myQueue();
  queue.addIdleHandler(new MessageQueue.IdleHandler(){
    public boolean queueIdle(){
      Storage.ensureOSXCompatible();
      return false;
    }
  }
);
}
 

Example 76

From project packages_apps_Phone_1, under directory /src/com/android/phone/.

Source file: EmergencyCallbackModeExitDialog.java

  15 
vote

public void run(){
  Looper.prepare();
  bindService(new Intent(EmergencyCallbackModeExitDialog.this,EmergencyCallbackModeService.class),mConnection,Context.BIND_AUTO_CREATE);
synchronized (EmergencyCallbackModeExitDialog.this) {
    try {
      if (mService == null) {
        EmergencyCallbackModeExitDialog.this.wait();
      }
    }
 catch (    InterruptedException e) {
      Log.d("ECM","EmergencyCallbackModeExitDialog InterruptedException: " + e.getMessage());
      e.printStackTrace();
    }
  }
  if (mService != null) {
    mEcmTimeout=mService.getEmergencyCallbackModeTimeout();
    mInEmergencyCall=mService.getEmergencyCallbackModeCallState();
  }
  unbindService(mConnection);
  mHandler.post(new Runnable(){
    public void run(){
      showEmergencyCallbackModeExitDialog();
    }
  }
);
}
 

Example 77

From project packages_apps_ROMControl, under directory /src/com/aokp/romcontrol/fragments/.

Source file: LEDControl.java

  15 
vote

public void startLed(){
  new Thread(){
    @Override public void run(){
      Looper.prepare();
      while (!stopLed) {
        mHandler.sendEmptyMessage(0);
        int delay=blinkOn ? onBlink : offBlink;
        try {
          Thread.sleep(delay);
        }
 catch (        InterruptedException e) {
        }
        blinkOn=!blinkOn;
      }
    }
  }
.start();
}
 

Example 78

From project PartyWare, under directory /android/src/com/google/zxing/client/android/.

Source file: DecodeHandler.java

  15 
vote

@Override public void handleMessage(Message message){
switch (message.what) {
case R.id.decode:
    decode((byte[])message.obj,message.arg1,message.arg2);
  break;
case R.id.quit:
Looper.myLooper().quit();
break;
}
}
 

Example 79

From project path_scroller, under directory /src/com/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 80

From project platform_frameworks_support, under directory /volley/src/com/android/volley/.

Source file: Request.java

  15 
vote

/** 
 * Notifies the request queue that this request has finished (successfully or with error). <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag){
  if (mRequestQueue != null) {
    mRequestQueue.finish(this);
  }
  if (MarkerLog.ENABLED) {
    final long threadId=Thread.currentThread().getId();
    if (Looper.myLooper() != Looper.getMainLooper()) {
      Handler mainThread=new Handler(Looper.getMainLooper());
      mainThread.post(new Runnable(){
        @Override public void run(){
          mEventLog.add(tag,threadId);
          mEventLog.finish(this.toString());
        }
      }
);
      return;
    }
    mEventLog.add(tag,threadId);
    mEventLog.finish(this.toString());
  }
 else {
    long requestTime=SystemClock.elapsedRealtime() - mRequestBirthTime;
    if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
      VolleyLog.d("%d ms: %s",requestTime,this.toString());
    }
  }
}
 

Example 81

From project platform_packages_apps_browser, under directory /src/com/android/browser/.

Source file: Preloader.java

  15 
vote

private Preloader(Context context){
  mContext=context.getApplicationContext();
  mHandler=new Handler(Looper.getMainLooper());
  mSession=null;
  mFactory=new BrowserWebViewFactory(context);
}
 

Example 82

From project platform_packages_apps_camera, under directory /src/com/android/camera/.

Source file: Camera.java

  15 
vote

private void addIdleHandler(){
  MessageQueue queue=Looper.myQueue();
  queue.addIdleHandler(new MessageQueue.IdleHandler(){
    @Override public boolean queueIdle(){
      Storage.ensureOSXCompatible();
      return false;
    }
  }
);
}
 

Example 83

From project platform_packages_apps_contacts, under directory /src/com/android/contacts/.

Source file: SpecialCharSequenceMgr.java

  15 
vote

/** 
 * Cleanup everything around this class. Must be run inside the main thread. This should be called when the screen becomes background.
 */
public static void cleanup(){
  if (Looper.myLooper() != Looper.getMainLooper()) {
    Log.wtf(TAG,"cleanup() is called outside the main thread");
    return;
  }
  if (sPreviousAdnQueryHandler != null) {
    sPreviousAdnQueryHandler.cancel();
    sPreviousAdnQueryHandler=null;
  }
}
 

Example 84

From project platform_packages_apps_CytownPhone, under directory /src/com/android/phone/.

Source file: EmergencyCallbackModeExitDialog.java

  15 
vote

public void run(){
  Looper.prepare();
  bindService(new Intent(EmergencyCallbackModeExitDialog.this,EmergencyCallbackModeService.class),mConnection,Context.BIND_AUTO_CREATE);
synchronized (EmergencyCallbackModeExitDialog.this) {
    try {
      if (mService == null) {
        EmergencyCallbackModeExitDialog.this.wait();
      }
    }
 catch (    InterruptedException e) {
      Log.d("ECM","EmergencyCallbackModeExitDialog InterruptedException: " + e.getMessage());
      e.printStackTrace();
    }
  }
  if (mService != null) {
    mEcmTimeout=mService.getEmergencyCallbackModeTimeout();
    mInEmergencyCall=mService.getEmergencyCallbackModeCallState();
  }
  unbindService(mConnection);
  mHandler.post(new Runnable(){
    public void run(){
      showEmergencyCallbackModeExitDialog();
    }
  }
);
}
 

Example 85

From project platform_packages_apps_Gallery2_1, under directory /tests/src/com/android/gallery3d/data/.

Source file: LocalDataTest.java

  15 
vote

public void run() throws Exception {
  SQLiteDatabase db=SQLiteDatabase.create(null);
  prepareData(db);
  mApp=newGalleryContext(db,Looper.getMainLooper());
  Path.clearAll();
  Path path=Path.fromString(mIsImage ? "/local/image" : "/local/video");
  mAlbumSet=new LocalAlbumSet(path,mApp);
  mAlbumSet.reload();
  verifyResult();
}
 

Example 86

From project platform_packages_apps_im, under directory /src/com/android/im/app/.

Source file: SimpleAlertHandler.java

  15 
vote

public void showAlert(final CharSequence title,final CharSequence message){
  if (Looper.myLooper() == getLooper()) {
    new AlertDialog.Builder(mActivity).setTitle(title).setMessage(message).setPositiveButton(R.string.ok,null).show();
  }
 else {
    post(new Runnable(){
      public void run(){
        new AlertDialog.Builder(mActivity).setTitle(title).setMessage(message).setPositiveButton(R.string.ok,null).show();
      }
    }
);
  }
}
 

Example 87

From project platform_packages_apps_mms, under directory /src/com/android/mms/transaction/.

Source file: NotificationPlayer.java

  15 
vote

@Override public void run(){
  Looper.prepare();
  mLooper=Looper.myLooper();
synchronized (this) {
    AudioManager audioManager=(AudioManager)mCmd.context.getSystemService(Context.AUDIO_SERVICE);
    try {
      MediaPlayer player=new MediaPlayer();
      player.setAudioStreamType(mCmd.stream);
      player.setDataSource(mCmd.context,mCmd.uri);
      player.setLooping(mCmd.looping);
      player.setVolume(mCmd.volume,mCmd.volume);
      player.prepare();
      if ((mCmd.uri != null) && (mCmd.uri.getEncodedPath() != null) && (mCmd.uri.getEncodedPath().length() > 0)) {
        if (mCmd.looping) {
          audioManager.requestAudioFocus(null,mCmd.stream,AudioManager.AUDIOFOCUS_GAIN);
        }
 else {
          audioManager.requestAudioFocus(null,mCmd.stream,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK);
        }
      }
      player.setOnCompletionListener(NotificationPlayer.this);
      player.start();
      if (mPlayer != null) {
        mPlayer.release();
      }
      mPlayer=player;
    }
 catch (    Exception e) {
      Log.w(mTag,"error loading sound for " + mCmd.uri,e);
    }
    mAudioManager=audioManager;
    this.notify();
  }
  Looper.loop();
}
 

Example 88

From project platform_packages_apps_music, under directory /src/com/android/music/.

Source file: MediaPlaybackActivity.java

  15 
vote

public void run(){
synchronized (mLock) {
    Looper.prepare();
    mLooper=Looper.myLooper();
    mLock.notifyAll();
  }
  Looper.loop();
}
 

Example 89

From project platform_packages_apps_phone, under directory /src/com/android/phone/.

Source file: EmergencyCallbackModeExitDialog.java

  15 
vote

public void run(){
  Looper.prepare();
  bindService(new Intent(EmergencyCallbackModeExitDialog.this,EmergencyCallbackModeService.class),mConnection,Context.BIND_AUTO_CREATE);
synchronized (EmergencyCallbackModeExitDialog.this) {
    try {
      if (mService == null) {
        EmergencyCallbackModeExitDialog.this.wait();
      }
    }
 catch (    InterruptedException e) {
      Log.d("ECM","EmergencyCallbackModeExitDialog InterruptedException: " + e.getMessage());
      e.printStackTrace();
    }
  }
  if (mService != null) {
    mEcmTimeout=mService.getEmergencyCallbackModeTimeout();
    mInEmergencyCall=mService.getEmergencyCallbackModeCallState();
  }
  unbindService(mConnection);
  mHandler.post(new Runnable(){
    public void run(){
      showEmergencyCallbackModeExitDialog();
    }
  }
);
}
 

Example 90

From project platform_packages_apps_stk, under directory /src/com/android/stk/.

Source file: StkAppService.java

  15 
vote

public void run(){
  Looper.prepare();
  mServiceLooper=Looper.myLooper();
  mServiceHandler=new ServiceHandler();
  Looper.loop();
}
 

Example 91

From project platform_packages_apps_VideoEditor, under directory /src/com/android/videoeditor/service/.

Source file: ApiService.java

  15 
vote

@Override public void onCreate(){
  super.onCreate();
  mHandler=new Handler(Looper.getMainLooper());
  mVideoThread=new IntentProcessor("VideoServiceThread");
  mVideoThread.start();
  mAudioThread=new IntentProcessor("AudioServiceThread");
  mAudioThread.start();
  mThumbnailThread=new IntentProcessor("ThumbnailServiceThread");
  mThumbnailThread.start();
}
 

Example 92

From project platform_packages_providers_contactsprovider, under directory /src/com/android/providers/contacts/.

Source file: CountryMonitor.java

  15 
vote

/** 
 * Get the current country code
 * @return the ISO 3166-1 two letters country code of current country.
 */
public synchronized String getCountryIso(){
  if (mCurrentCountryIso == null) {
    final CountryDetector countryDetector=(CountryDetector)mContext.getSystemService(Context.COUNTRY_DETECTOR);
    mCurrentCountryIso=countryDetector.detectCountry().getCountryIso();
    countryDetector.addCountryListener(new CountryListener(){
      public void onCountryDetected(      Country country){
        mCurrentCountryIso=country.getCountryIso();
      }
    }
,Looper.getMainLooper());
  }
  return mCurrentCountryIso;
}
 

Example 93

From project Playlist, under directory /src/com/google/zxing/client/android/.

Source file: DecodeHandler.java

  15 
vote

@Override public void handleMessage(Message message){
switch (message.what) {
case R.id.decode:
    decode((byte[])message.obj,message.arg1,message.arg2);
  break;
case R.id.quit:
Looper.myLooper().quit();
break;
}
}
 

Example 94

From project QuickSnap, under directory /Camera/src/com/lightbox/android/camera/activities/.

Source file: Camera.java

  15 
vote

private void addIdleHandler(){
  MessageQueue queue=Looper.myQueue();
  queue.addIdleHandler(new MessageQueue.IdleHandler(){
    public boolean queueIdle(){
      ImageManager.ensureOSXCompatibleFolder();
      return false;
    }
  }
);
}
 

Example 95

From project ratebeer-for-Android, under directory /JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/.

Source file: FragmentManager.java

  15 
vote

/** 
 * Only call from main thread!
 */
public boolean execPendingActions(){
  if (mExecutingActions) {
    throw new IllegalStateException("Recursive entry to executePendingTransactions");
  }
  if (Looper.myLooper() != mActivity.mHandler.getLooper()) {
    throw new IllegalStateException("Must be called from main thread of process");
  }
  boolean didSomething=false;
  while (true) {
    int numActions;
synchronized (this) {
      if (mPendingActions == null || mPendingActions.size() == 0) {
        return didSomething;
      }
      numActions=mPendingActions.size();
      if (mTmpActions == null || mTmpActions.length < numActions) {
        mTmpActions=new Runnable[numActions];
      }
      mPendingActions.toArray(mTmpActions);
      mPendingActions.clear();
      mActivity.mHandler.removeCallbacks(mExecCommit);
    }
    mExecutingActions=true;
    for (int i=0; i < numActions; i++) {
      mTmpActions[i].run();
    }
    mExecutingActions=false;
    didSomething=true;
  }
}
 

Example 96

From project ratebeerforandroid, under directory /JakeWharton-ActionBarSherlock/library/src/android/support/v4/app/.

Source file: FragmentManager.java

  15 
vote

/** 
 * Only call from main thread!
 */
public boolean execPendingActions(){
  if (mExecutingActions) {
    throw new IllegalStateException("Recursive entry to executePendingTransactions");
  }
  if (Looper.myLooper() != mActivity.mHandler.getLooper()) {
    throw new IllegalStateException("Must be called from main thread of process");
  }
  boolean didSomething=false;
  while (true) {
    int numActions;
synchronized (this) {
      if (mPendingActions == null || mPendingActions.size() == 0) {
        return didSomething;
      }
      numActions=mPendingActions.size();
      if (mTmpActions == null || mTmpActions.length < numActions) {
        mTmpActions=new Runnable[numActions];
      }
      mPendingActions.toArray(mTmpActions);
      mPendingActions.clear();
      mActivity.mHandler.removeCallbacks(mExecCommit);
    }
    mExecutingActions=true;
    for (int i=0; i < numActions; i++) {
      mTmpActions[i].run();
    }
    mExecutingActions=false;
    didSomething=true;
  }
}
 

Example 97

From project roboguice, under directory /roboguice/src/main/java/roboguice/util/.

Source file: RoboLooperThread.java

  15 
vote

@Override public void start(){
  new RoboThread(){
    public void run(){
      Looper.prepare();
      RoboLooperThread.this.run();
      Looper.loop();
    }
  }
.start();
}
 

Example 98

From project SASAbus, under directory /src/it/sasabz/android/sasabus/classes/.

Source file: FileRetriever.java

  15 
vote

private int download(String dbZIPFileName,String md5FileName){
  SasabusFTP ftp=new SasabusFTP();
  Looper.prepare();
  try {
    try {
      ftp.connect(res.getString(R.string.repository_url),Integer.parseInt(res.getString(R.string.repository_port)));
      ftp.login(res.getString(R.string.ftp_user),res.getString(R.string.ftp_passwd));
    }
 catch (    Exception e) {
      e.printStackTrace();
      return CheckDatabaseActivity.DOWNLOAD_RETRY;
    }
    while (downloadFile(ftp,dbZIPFileName,md5FileName) != CheckDatabaseActivity.DB_OK && downloadcounter < MAX_DOWNLOAD) {
      ++downloadcounter;
    }
    while (downloadMD5File(ftp,dbZIPFileName,md5FileName) != CheckDatabaseActivity.DB_OK && downloadcounter < MAX_DOWNLOAD) {
      ++downloadcounter;
    }
    try {
      ftp.disconnect();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    if (downloadcounter >= MAX_DOWNLOAD) {
      return CheckDatabaseActivity.DOWNLOAD_RETRY;
    }
    unzip();
  }
 catch (  Exception e) {
    e.printStackTrace();
    if (downloadcounter < MAX_DOWNLOAD) {
      ++downloadcounter;
      return download(dbZIPFileName,md5FileName);
    }
    return CheckDatabaseActivity.DOWNLOAD_ERROR_DIALOG;
  }
  return CheckDatabaseActivity.DB_OK;
}
 

Example 99

From project Schedule, under directory /libs/android/sherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 100

From project SeriesGuide, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 101

From project simplefacebook, under directory /src/com/androidquery/simplefeed/util/.

Source file: ErrorReporter.java

  15 
vote

private void showToast(final String message){
  new Thread(){
    @Override public void run(){
      Looper.prepare();
      Toast.makeText(context,message,Toast.LENGTH_LONG).show();
      Looper.loop();
    }
  }
.start();
}
 

Example 102

From project SimpleMoney-Android, under directory /Zxing/bin/src/com/google/zxing/client/android/.

Source file: DecodeHandler.java

  15 
vote

@Override public void handleMessage(Message message){
  if (!running) {
    return;
  }
switch (message.what) {
case R.id.decode:
    decode((byte[])message.obj,message.arg1,message.arg2);
  break;
case R.id.quit:
running=false;
Looper.myLooper().quit();
break;
}
}
 

Example 103

From project SMSSync, under directory /abslib/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 104

From project SocialKit, under directory /src/main/java/mobisocial/socialkit/musubi/.

Source file: Musubi.java

  15 
vote

public void run(){
  Looper.prepare();
  mHandler=new Handler(){
    public void handleMessage(    Message msg){
      Insertion i=(Insertion)msg.obj;
      mContext.getContentResolver().insert(i.uri,i.cv);
    }
  }
;
  Looper.loop();
}
 

Example 105

From project Something-Awful-Android, under directory /libraries/Sherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 106

From project SVQCOM, under directory /Core/src/com/ushahidi/android/app/.

Source file: MapUserLocation.java

  15 
vote

@Override protected Void doInBackground(Void... params){
  Looper.prepare();
  countDownTimer=new AsyncTimer(gpsTimeout * 1000L,1000L);
  countDownTimer.start();
  return null;
}
 

Example 107

From project SWADroid, under directory /SWADroid/src/com/google/zxing/client/android/.

Source file: DecodeHandler.java

  15 
vote

@Override public void handleMessage(Message message){
  if (!running) {
    return;
  }
  if (message.what == R.id.decode) {
    decode((byte[])message.obj,message.arg1,message.arg2);
  }
 else   if (message.what == R.id.quit) {
    running=false;
    Looper.myLooper().quit();
  }
}
 

Example 108

From project The-Reverse-Recipe-Book, under directory /actionbarsherlock4.0/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 109

From project titanium-barcode, under directory /src/com/mwaysolutions/barcode/zxing/.

Source file: DecodeThread.java

  15 
vote

@Override public void run(){
  Looper.prepare();
  handler=new Handler(){
    @Override public void handleMessage(    Message message){
switch (message.what) {
case Id.DECODE:
        decode((byte[])message.obj,message.arg1,message.arg2);
      break;
case Id.QUIT:
    Looper.myLooper().quit();
  break;
}
}
}
;
Looper.loop();
}
 

Example 110

From project ToolkitForAndroid, under directory /src/main/java/com/apkits/android/system/.

Source file: SplashActivity.java

  15 
vote

/** 
 * ??????????????????
 */
private void onSplash(){
  beforeProcess();
  new Thread(new Runnable(){
    @Override public void run(){
      Looper.prepare();
      onProcess();
      sendProcessed();
    }
  }
).start();
}
 

Example 111

From project Unibeer, under directory /libs/sherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 112

From project valence, under directory /src/com/cafbit/valence/.

Source file: RFBThread.java

  15 
vote

@Override public void run(){
  Looper.prepare();
  this.myHandler=new RFBThreadHandler();
  try {
    conn.connect();
  }
 catch (  Exception e) {
    e.printStackTrace();
    parentHandler.error(e);
    return;
  }
  recvThread=new RFBRecvThread(myHandler,conn.getSocket());
  recvThread.start();
  parentHandler.onConnect();
  connected=true;
  Looper.loop();
  connected=false;
  recvThread.invalidate();
  recvThread=null;
  try {
    conn.disconnect();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
 

Example 113

From project vanilla, under directory /src/org/kreed/vanilla/.

Source file: LibraryPagerAdapter.java

  15 
vote

/** 
 * Create the LibraryPager.
 * @param activity The LibraryActivity that will own this adapter. The activitywill receive callbacks from the ListViews.
 * @param workerLooper A Looper running on a worker thread.
 */
public LibraryPagerAdapter(LibraryActivity activity,Looper workerLooper){
  mActivity=activity;
  mUiHandler=new Handler(this);
  mWorkerHandler=new Handler(workerLooper,this);
  mCurrentPage=-1;
  activity.getContentResolver().registerContentObserver(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,true,mPlaylistObserver);
}
 

Example 114

From project Wifileaks, under directory /WifiLeaks/ABS/library/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 115

From project Wordpress-Android-App, under directory /src/org/wordpress/android/.

Source file: Comments.java

  15 
vote

@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (data != null) {
    Bundle extras=data.getExtras();
switch (requestCode) {
case 0:
      final String returnText=extras.getString("replyText");
    if (!returnText.equals("CANCEL")) {
      final String postID=extras.getString("postID");
      final int commentID=extras.getInt("commentID");
      showDialog(ID_DIALOG_REPLYING);
      new Thread(new Runnable(){
        public void run(){
          Looper.prepare();
          pd=new ProgressDialog(Comments.this);
          replyToComment(postID,commentID,returnText);
        }
      }
).start();
    }
  break;
}
}
}
 

Example 116

From project XTrade, under directory /sherlock-bar/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 117

From project Yaaic, under directory /libs/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: ValueAnimator.java

  15 
vote

/** 
 * Start the animation playing. This version of start() takes a boolean flag that indicates whether the animation should play in reverse. The flag is usually false, but may be set to true if called from the reverse() method. <p>The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.</p>
 * @param playBackwards Whether the ValueAnimator should start playing in reverse.
 */
private void start(boolean playBackwards){
  if (Looper.myLooper() == null) {
    throw new AndroidRuntimeException("Animators may only be run on Looper threads");
  }
  mPlayingBackwards=playBackwards;
  mCurrentIteration=0;
  mPlayingState=STOPPED;
  mStarted=true;
  mStartedDelay=false;
  sPendingAnimations.get().add(this);
  if (mStartDelay == 0) {
    setCurrentPlayTime(getCurrentPlayTime());
    mPlayingState=STOPPED;
    mRunning=true;
    if (mListeners != null) {
      ArrayList<AnimatorListener> tmpListeners=(ArrayList<AnimatorListener>)mListeners.clone();
      int numListeners=tmpListeners.size();
      for (int i=0; i < numListeners; ++i) {
        tmpListeners.get(i).onAnimationStart(this);
      }
    }
  }
  AnimationHandler animationHandler=sAnimationHandler.get();
  if (animationHandler == null) {
    animationHandler=new AnimationHandler();
    sAnimationHandler.set(animationHandler);
  }
  animationHandler.sendEmptyMessage(ANIMATION_START);
}
 

Example 118

From project ZebroGaMQ, under directory /game/aMazing-application/src/de/rwth/aMazing/.

Source file: GameActivity.java

  15 
vote

public void run(){
  Looper.prepare();
  locationHandler=new Handler(){
    public void handleMessage(    Message msg){
      if (msg.what == 0) {
        Location loc=(Location)msg.obj;
        if (loc.getAccuracy() < 25) {
          playerTask.locationIsAccurate(loc,loc.getAccuracy());
        }
        controller.animateTo(new GeoPoint((int)(loc.getLatitude() * 1000000),(int)(loc.getLongitude() * 1000000)));
      }
 else {
        addToMaze((Location)msg.obj);
      }
    }
  }
;
  Looper.loop();
}
 

Example 119

From project zeitgeist-android, under directory /src/li/zeitgeist/android/worker/.

Source file: ItemWorker.java

  15 
vote

/** 
 * Stop the thread if alive.
 */
public synchronized void stopThread(){
  loading=false;
  if (isAlive()) {
    handler.post(new Runnable(){
      public void run(){
        Log.i(TAG,"stopping thread");
        Looper.myLooper().quit();
      }
    }
);
  }
}
 

Example 120

From project zxing, under directory /android/src/com/google/zxing/client/android/.

Source file: DecodeHandler.java

  15 
vote

@Override public void handleMessage(Message message){
  if (!running) {
    return;
  }
switch (message.what) {
case R.id.decode:
    decode((byte[])message.obj,message.arg1,message.arg2);
  break;
case R.id.quit:
running=false;
Looper.myLooper().quit();
break;
}
}
 

Example 121

From project zxing-android, under directory /src/com/laundrylocker/barcodescanner/.

Source file: DecodeHandler.java

  15 
vote

@Override public void handleMessage(Message message){
  if (!running) {
    return;
  }
switch (message.what) {
case R.id.decode:
    decode((byte[])message.obj,message.arg1,message.arg2);
  break;
case R.id.quit:
running=false;
Looper.myLooper().quit();
break;
}
}