@@ -0,0 +1,2255 @@
+/**%0A * This file is part of the Android DependencyManager project hosted at%0A * http://code.google.com/p/android-dependencymanager/%0A *%0A * Copyright (C) 2009 Jens Finkhaeuser %3Cjens@finkhaeuser.de%3E%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A **/%0A%0Apackage de.finkhaeuser.dm.client;%0A%0Aimport android.app.Activity;%0A%0Aimport android.os.Bundle;%0A%0Aimport android.util.Log;%0A%0A/**%0A * Helper class - simplifies setting up a connection to DependencyManager, etc.%0A **/%0Apublic class DMActivity extends Activity implements DependencyManager.BindListener%0A%7B%0A  /***************************************************************************%0A   * Private constants%0A   **/%0A  private static final String LTAG = %22DMActivity%22;%0A%0A%0A%0A  /***************************************************************************%0A   * Private data%0A   **/%0A  // Result of the bind operation - can be queried from users of the class%0A  private boolean mBindResult;%0A%0A  // Dependency manager instance%0A  private DependencyManager mDependencyManager;%0A%0A%0A%0A  /***************************************************************************%0A   * Implementation%0A   **/%0A  @Override%0A  public void onCreate(Bundle savedInstanceState)%0A  %7B%0A    super.onCreate(savedInstanceState);%0A    mBindResult = DependencyManager.bindService(this, this);%0A  %7D%0A%0A%0A%0A  public void onBound(DependencyManager dm)%0A  %7B%0A    mDependencyManager = dm;%0A    mDependencyManager.resolveDependencies(getPackageName());%0A  %7D%0A%0A%0A%0A  @Override%0A  public void onStop()%0A  %7B%0A    super.onStop();%0A    if (null != mDependencyManager) %7B%0A      mDependencyManager.unbindService();%0A      mDependencyManager = null;%0A    %7D%0A  %7D%0A%0A%0A%0A  /**%0A   * Returns true if binding succeeded, false otherwise.%0A   **/%0A  public boolean bindResult()%0A  %7B%0A    return mBindResult;%0A  %7D%0A%7D%0A

Add DMActivity abstraction for dealing with DM