Android Open Source - HomeSwipeManager Action






From Project

Back to project page HomeSwipeManager.

License

The source code is released under:

Apache License

If you think the Android project HomeSwipeManager 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

/* Copyright 2013 Andrea De Cesare
*/*w  w  w . j a  v  a2 s.c om*/
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.andreadec.homeswipemanager;

import java.util.*;

import android.content.*;
import android.content.res.*;

public class Action {
  public final static int ACTION_DO_NOTHING = 0;
  public final static int ACTION_LAST_TASK = 1;
  public final static int ACTION_OPEN_APP = 2;
  
  public String name;
  public int action;
  
  public Action(String name, int action) {
    this.name = name;
    this.action = action;
  }
  
  @Override
  public String toString() { // Necessary for the spinner
    return name;
  }
  
  /**
   * Builds a list of available actions
   * @param context The application context
   * @return List of available actions
   */
  public static ArrayList<Action> getAvailableActions(Context context) {
    Resources resources = context.getResources();
    ArrayList<Action> actions = new ArrayList<Action>();
    actions.add(new Action(resources.getString(R.string.actionDoNothing), ACTION_DO_NOTHING));
    actions.add(new Action(resources.getString(R.string.actionLastTask), ACTION_LAST_TASK));
    actions.add(new Action(resources.getString(R.string.actionOpenApp), ACTION_OPEN_APP));
    return actions;
  }
}




Java Source Code List

com.andreadec.homeswipemanager.Action.java
com.andreadec.homeswipemanager.App.java
com.andreadec.homeswipemanager.AppsArrayAdapter.java
com.andreadec.homeswipemanager.HomeSwipeManagerApp.java
com.andreadec.homeswipemanager.MainActivity.java
com.andreadec.homeswipemanager.SettingsActivity.java