Android Open Source - NXTControl Client Activity






From Project

Back to project page NXTControl.

License

The source code is released under:

GNU General Public License

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

Java Source Code

//
// FPlayAndroid is distributed under the FreeBSD License
///*w w  w .ja v  a  2 s. c om*/
// Copyright (c) 2013, Carlos Rafael Gimenes das Neves
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
//    list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The views and conclusions contained in the software and documentation are those
// of the authors and should not be interpreted as representing official policies,
// either expressed or implied, of the FreeBSD Project.
//
// https://github.com/carlosrafaelgn/FPlayAndroid
//
package br.com.bandtec.nxtcontrol.activity;

import android.app.Activity;
import android.app.Application;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnCreateContextMenuListener;
import br.com.bandtec.nxtcontrol.ui.CustomContextMenu;
import br.com.bandtec.nxtcontrol.ui.UI;

public abstract class ClientActivity implements MenuItem.OnMenuItemClickListener, OnCreateContextMenuListener {
  ActivityHost activity;
  ClientActivity previousActivity;
  int requestCode;
  boolean finished;
  
  public final int getDecorViewWidth() {
    final int w = activity.getWindow().getDecorView().getWidth();
    return ((w > 0) ? w : UI.usableScreenWidth);
  }
  
  public final int getDecorViewHeight() {
    final int h = activity.getWindow().getDecorView().getHeight();
    return ((h > 0) ? h : UI.usableScreenHeight);
  }
  
  public final void addWindowFlags(int flags) {
    activity.getWindow().addFlags(flags);
  }
  
  public final void setWindowFlags(int flags, int mask) {
    activity.getWindow().setFlags(flags, mask);
  }
  
  public final void clearWindowFlags(int flags) {
    activity.getWindow().clearFlags(flags);
  }
  
  public final Application getApplication() {
    return activity.getApplication();
  }
  
  public final Activity getHostActivity() {
    return activity;
  }
  
  public final void setContentView(int layoutResID) {
    activity.setContentView(layoutResID);
  }
  
  public final void setContentView(View view) {
    activity.setContentView(view);
  }
  
  public final View findViewById(int id) {
    return activity.findViewById(id);
  }
  
  public final boolean isTopActivity() {
    return (activity.getTopActivity() == this);
  }
  
  public final ClientActivity getTopActivity() {
    return activity.getTopActivity();
  }
  
  public final ClientActivity getPreviousActivity() {
    return previousActivity;
  }
  
  public final void startActivity(ClientActivity activity) {
    this.activity.startActivity(activity);
  }
  
  public final void startActivity(ClientActivity activity, int requestCode) {
    activity.requestCode = requestCode;
    this.activity.startActivity(activity);
  }
  
  public final void finish(int resultCode, Intent data) {
    activity.finishActivity(this, resultCode, data);
  }
  
  public final void finish() {
    activity.finishActivity(this, 0, null);
  }
  
  public final void openContextMenu(View view) {
    CustomContextMenu.openContextMenu(view, this);
  }
  
  public void setExitOnDestroy(boolean exitOnDestroy) {
    activity.setExitOnDestroy(exitOnDestroy);
  }
  
  public CharSequence getText(int resId) {
    return activity.getText(resId);
  }
  
  public Resources getResources() {
    return activity.getResources();
  }
  
  public Drawable getDrawable(int resId) {
    return activity.getResources().getDrawable(resId);
  }
  
  public void activityFinished(ClientActivity activity, int requestCode, int resultCode, Intent data) {
  }
  
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
  }
  
  public View getNullContextMenuView() {
    return null;
  }
  
  @Override
  public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
  }
  
  @Override
  public boolean onMenuItemClick(MenuItem item) {
    return false;
  }
  
  protected boolean onBackPressed() {
    return false;
  }
  
  protected void onCreate() {
  }
  
  protected void onCreateLayout(boolean firstCreation) {
  }
  
  protected void onResume() {
  }
  
  protected void onOrientationChanged() {
  }
  
  protected void onPause() {
  }
  
  protected void onCleanupLayout() {
  }
  
  protected void onDestroy() {
  }
}




Java Source Code List

br.com.bandtec.nxtcontrol.ActivityAbout.java
br.com.bandtec.nxtcontrol.ActivityDeviceList.java
br.com.bandtec.nxtcontrol.ActivityMain.java
br.com.bandtec.nxtcontrol.BTCommunicator.java
br.com.bandtec.nxtcontrol.BTConnectable.java
br.com.bandtec.nxtcontrol.LCPMessage.java
br.com.bandtec.nxtcontrol.activity.ActivityHost.java
br.com.bandtec.nxtcontrol.activity.ClientActivity.java
br.com.bandtec.nxtcontrol.activity.MainHandler.java
br.com.bandtec.nxtcontrol.list.BaseItem.java
br.com.bandtec.nxtcontrol.list.BaseList.java
br.com.bandtec.nxtcontrol.list.DeviceItem.java
br.com.bandtec.nxtcontrol.ui.BaseItemView.java
br.com.bandtec.nxtcontrol.ui.BgButton.java
br.com.bandtec.nxtcontrol.ui.BgCheckBox.java
br.com.bandtec.nxtcontrol.ui.BgDirControl.java
br.com.bandtec.nxtcontrol.ui.BgImageButton.java
br.com.bandtec.nxtcontrol.ui.BgListView.java
br.com.bandtec.nxtcontrol.ui.BgTextView.java
br.com.bandtec.nxtcontrol.ui.CustomContextMenu.java
br.com.bandtec.nxtcontrol.ui.UI.java
br.com.bandtec.nxtcontrol.ui.drawable.BorderDrawable.java
br.com.bandtec.nxtcontrol.ui.drawable.ColorDrawable.java
br.com.bandtec.nxtcontrol.ui.drawable.NullDrawable.java
br.com.bandtec.nxtcontrol.ui.drawable.StateDrawable.java
br.com.bandtec.nxtcontrol.ui.drawable.TextIconDrawable.java
br.com.bandtec.nxtcontrol.util.ArraySorter.java
br.com.bandtec.nxtcontrol.util.SerializableMap.java
br.com.bandtec.nxtcontrol.util.Serializer.java
br.com.bandtec.nxtcontrol.util.Timer.java