@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.line_list); // Setup the list adapter = new IconAdapter<FileWrapper>(this, R.layout.line_list_item); ListView list = (ListView) findViewById(R.id.list); list.setAdapter(adapter); list.setOnItemClickListener(this); // Load Directory if (savedInstanceState != null) { backStack = savedInstanceState.getParcelableArrayList("BACKSTACK"); } if (backStack == null || backStack.size() == 0) { backStack = new ArrayList<BackStackItem>(); String startPath = (startDirectory == null || startDirectory.isEmpty()) ? Environment.getExternalStorageDirectory().getPath() : startDirectory; backStack.add(new BackStackItem(startPath, false)); } wrapFiles(); this.setVolumeControlStream(AudioManager.STREAM_MUSIC); }
public void handleMessage(Message msg) { AddNewShape(); status = PLAY; invalidate(); String title; title = "MemoryPower - " + arShape.size() + " 단계"; mParent.setTitle(title); }
// sets the working start day of every activity to the earliest start day public void resetActivityStartDays() { Iterator<Activity> it = activities.iterator(); while (it.hasNext()) { Activity a = it.next(); a.setStartDay(a.getTimeMin()); } }
private void removeArc(String from, String to) { Activity activityFrom = getActivityByName(from); Activity activityTo = getActivityByName(to); if (activityFrom != null && activityTo != null) { activityFrom.deleteSuccessor(activityTo); activityTo.deletePredecessor(activityFrom); } else view.printDebugln("Cannot delete arc: at least one activity is currently not present."); }
/** Test of addChildActivity method, of class Activity. */ @Test public void testAddChildActivity() { System.out.println("addChildActivity"); Activity childActivity = null; Activity instance = new ChildActivity(); instance.addChildActivity(childActivity); // TODO review the generated test code and remove the default call to fail. fail("The test case is a prototype."); }
/** Test of getParent method, of class Activity. */ @Test public void testGetParent() { System.out.println("getParent"); // Setup Activity parent = new ParentActivity(); Activity child = new ChildActivity(); child.setParent(parent); // Assertion assertEquals(parent, child.getParent()); }
/** Test of getScene method, of class Activity. */ @Test public void testGetScene() { System.out.println("getScene"); // Setup Activity act = new ChildActivity(); VBox vbox = new VBox(); act.setScene(vbox); // Assertion assertEquals(vbox, act.getScene()); }
public Calendar calculateEndDate() { Activity end = this.getActivityByName("END"); if (end != null) { end.setStartDay(maxActivityDuration()); this.length = end.getStartDay(); this.endDate = projectCalendar.calculateEndDate(startDate, this.length); return this.endDate; } return null; }
public Activity getActivityByName(String activityName) { Iterator<Activity> it = activities.iterator(); while (it.hasNext()) { Activity current = it.next(); if (activityName.equals(current.getName())) { return current; } } return null; }
/** Test of getChildActivities method, of class Activity. */ @Test public void testGetChildActivities() { System.out.println("getChildActivities"); Class<? extends Activity> clazz = null; Activity instance = new ChildActivity(); List expResult = null; List result = instance.getChildActivities(clazz); assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. fail("The test case is a prototype."); }
public Project(String name, MainWindow view, int maxResources) { this.name = name; this.view = view; this.resLimits = new int[maxResources]; Arrays.fill(this.resLimits, 999); this.projectCalendar = new ProjectCalendar(this); this.resourceManager = new ResourceManager(this); this.criticalPath = new CriticalPath(this); // add start activity Activity a = addActivity("START", 0, null, null); a.setTimeMin(0); a.setTimeMax(0); }
@Override public StateLRSResponse retrieveState( String id, Activity activity, Agent agent, UUID registration) { HashMap<String, String> queryParams = new HashMap<String, String>(); queryParams.put("stateId", id); queryParams.put("activityId", activity.getId().toString()); queryParams.put("agent", agent.toJSON(this.getVersion(), this.usePrettyJSON())); StateDocument stateDocument = new StateDocument(); stateDocument.setId(id); stateDocument.setActivity(activity); stateDocument.setAgent(agent); LRSResponse lrsResp = getDocument("activities/state", queryParams, stateDocument); StateLRSResponse lrsResponse = new StateLRSResponse(lrsResp.getRequest(), lrsResp.getResponse()); lrsResponse.setSuccess(lrsResp.getSuccess()); if (lrsResponse.getResponse().getStatus() == 200) { lrsResponse.setContent(stateDocument); } return lrsResponse; }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { // We can read and write the media try { url = (String) getIntent().getExtras().get(Intent.EXTRA_TEXT) + "#view:list"; } catch (Exception e) { url = "https://www.dropbox.com/s/8owsfcia59ko76i#view:list"; // Used for testing if it's not opened from the dropox action menu // Obviously what needs to happen here is a message suggesting that the user use the dropbox // app, and a textbox in case they've got the url copied. } showDialog( PROGRESS_DIALOG); // Do the work in a separate thread so we can update the UI // simultaneously. } else { // Can't write files, so show a message and quit. } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); // // this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.main_login); mEtAccount = (EditText) findViewById(R.id.mainLoginEditAccount); mEtPassword = (EditText) findViewById(R.id.mainLoginEditPassword); mBtnLogin = (Button) findViewById(R.id.mainLoginBtn); mBtnRegister = (Button) findViewById(R.id.main_btn_register); /* this is to render the password edittext font to be default */ mEtPassword.setTypeface(Typeface.DEFAULT); mEtPassword.setTransformationMethod(new PasswordTransformationMethod()); mBtnLogin.setOnClickListener( new OnClickListener() { public void onClick(View v) { MainActivity.this.tryLogin(); } }); mBtnRegister.setOnClickListener( new OnClickListener() { public void onClick(View v) { Intent intent0 = new Intent(MainActivity.this, RegisterActivity.class); startActivity(intent0); } }); }
// pressing back button finishes this activity public void onBackPressed() { // writeProgress(completed_downloads,total_files_to_download); downloadThread.requestStop(); super.onBackPressed(); // download_photos.this.finish(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // remove title requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main_game); allDoneLevels = new ArrayList<>(); AssetManager am = getResources().getAssets(); final GameBoard boardView = (GameBoard) this.findViewById(R.id.gameBoard); final HowdyShadeView howdyShadeView = (HowdyShadeView) this.findViewById(R.id.howdyShadeView); final GlowingBoard glowingBoard = (GlowingBoard) this.findViewById(R.id.glowingBoard); final HowdyView howdyView = (HowdyView) this.findViewById(R.id.howdyView); this.game = new Game(); boardView.setHowdyShadeView(howdyShadeView); boardView.setGlowingBoard(glowingBoard); boardView.setHowdyView(howdyView); boardView.setOnTouchListener(new BoardGameTouchListener(this)); }
@Override protected void onStart() { final GameBoard boardView = (GameBoard) this.findViewById(R.id.gameBoard); SharedPreferences prefs = getPreferences(Context.MODE_PRIVATE); this.level = prefs.getInt("level", 0); String mapJson = prefs.getString("map", null); if (mapJson == null) { waitForNext = true; } else { this.game.initGame(mapJson); String howdyPosition = prefs.getString("howdy", null); if (howdyPosition != null) { this.game.setHowdyPosition(howdyPosition); } Toast.makeText(this, this.level + "", Toast.LENGTH_SHORT).show(); } String allDoneLevelsString = prefs.getString("doneLevels", null); if (allDoneLevelsString != null) { allDoneLevels = new ArrayList<String>(Arrays.asList(allDoneLevelsString.split(","))); } super.onStart(); }
/** Called when the activity is first created */ @Override public void onCreate(Bundle savedInstanceState) { Log.d(TAG, "LoaderActivity created"); super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.content); // Instantiate custom adapter mAdapter = new LoaderAdapter(); // Handle listview and assign adapter mListView = (ListView) findViewById(R.id.content_list_view); mListView.setAdapter(mAdapter); mListView.setVisibility(View.GONE); mListView.setOnItemLongClickListener( new AdapterView.OnItemLongClickListener() { public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { selectItem(position); return true; } }); mStatusLabel = (TextView) findViewById(R.id.content_status_label); mStatusLabel.setVisibility(View.VISIBLE); String userHash = NavigineApp.Settings.getString("user_hash", ""); if (userHash.length() == 0) showUserHashDialog(); else refreshMapList(); }
public void deleteActivityByName(String activityName) { Activity current = getActivityByName(activityName); if (current != null) { // delete successor references Iterator<Activity> predIter = current.getPredecessors().iterator(); while (predIter.hasNext()) { predIter.next().getSuccessors().remove(current); } // delete predecessor references Iterator<Activity> succIter = current.getSuccessors().iterator(); while (succIter.hasNext()) { succIter.next().getPredecessors().remove(current); } // delete element activities.remove(current); } }
@Override public void onPause() { Log.d(TAG, "LoaderActivity paused"); super.onPause(); mTimerTask.cancel(); mTimerTask = null; }
@Override public ProfileKeysLRSResponse retrieveActivityProfileIds(Activity activity) { HashMap<String, String> queryParams = new HashMap<String, String>(); queryParams.put("activityId", activity.getId().toString()); return getProfileKeys("activities/profile", queryParams); }
public Activity addActivity( String activityName, int activityDuration, String predecessors[], int activityResources[]) { Activity newActivity = null; if (this.isUnique(activityName)) { newActivity = new Activity( activityName, activityDuration, activityResources, this.getMaxNumOfResources()); // the predecessors of START are NULL if (predecessors != null) { if (predecessors.length == 0) { Activity current = getActivityByName("START"); newActivity.addPredecessor(current); current.addSuccessor(newActivity); } else { for (int i = 0; i < predecessors.length; i++) { Activity current = getActivityByName(predecessors[i]); if (current != null) { newActivity.addPredecessor(current); current.addSuccessor(newActivity); } else { view.printDebugln( "Cannot add predecessor relation to non-exisiting node " + predecessors[i]); } } } } activities.add(newActivity); } else { // activity name is not unique or activity already exists view.printDebugln( "Cannot add activity " + activityName + " because the name already exists."); } return newActivity; }
public String toString() { String plural = courseSelections.size() > 1 ? "es" : ""; String outputString = ("Schedule: " + courseSelections.size() + " class" + plural + "."); SimpleDateFormat date_format = new SimpleDateFormat("HH:mm"); outputString = new String( outputString + System.getProperty("line.separator") + "Statistics:\t\tAvg Start: " + date_format.format(avgStartingTime) + ", Avg End: " + date_format.format(avgEndingTime)) + ", Avg Length: " + (avgLengthOfDay.getTime() / 1000 / 60 / 60) + " hours, Days off: " + numOfDaysOff; outputString = new String( outputString + System.getProperty("line.separator") + "Ignoring DGDs/TUTs:\tAvg Start: " + date_format.format(ignoreExtrasAvgStartingTime) + ", Avg End: " + date_format.format(ignoreExtrasAvgEndingTime)) + ", Avg Length: " + (ignoreExtrasAvgLengthOfDay.getTime() / 1000 / 60 / 60) + " hours, Days off: " + ignoreExtrasNumOfDaysOff + System.getProperty("line.separator"); for (CourseSelection cs : courseSelections) { outputString = new String( outputString + cs.getActivity(0).getSection().getName() + System.getProperty("line.separator")); for (Activity a : cs.getActivities()) { outputString = new String(outputString + a.toString()); } } return outputString; }
@Override public LRSResponse clearState(Activity activity, Agent agent, UUID registration) { HashMap<String, String> queryParams = new HashMap<String, String>(); queryParams.put("activityId", activity.getId().toString()); queryParams.put("agent", agent.toJSON(this.getVersion(), this.usePrettyJSON())); if (registration != null) { queryParams.put("registration", registration.toString()); } return deleteDocument("activities/state", queryParams); }
@Override public ProfileKeysLRSResponse retrieveStateIds( Activity activity, Agent agent, UUID registration) { HashMap<String, String> queryParams = new HashMap<String, String>(); queryParams.put("activityId", activity.getId().toString()); queryParams.put("agent", agent.toJSON(this.getVersion(), this.usePrettyJSON())); if (registration != null) { queryParams.put("registration", registration.toString()); } return getProfileKeys("activities/state", queryParams); }
public boolean hasValidSchedule(Activity start, List<Activity> visitedNodes) { Iterator<Activity> it = start.getSuccessors().iterator(); List<Activity> vNodes; boolean res = true; if (visitedNodes != null) vNodes = new ArrayList<Activity>(visitedNodes); else vNodes = new ArrayList<Activity>(); vNodes.add(start); if ("END".equals(start.getName())) { return true; } // iterate through all successors while (it.hasNext()) { Activity succ = it.next(); int earliestStart = start.getStartDay() + start.getDuration(); if (earliestStart > succ.getStartDay()) { return false; } else if (!(vNodes.contains(succ))) { res = res && hasValidSchedule(succ, vNodes); } } return res; }
public boolean isValidSubGraph(Activity start, List<Activity> visitedNodes) { boolean res = true; Iterator<Activity> it = start.getSuccessors().iterator(); List<Activity> vNodes; if (visitedNodes != null) vNodes = new ArrayList<Activity>(visitedNodes); else vNodes = new ArrayList<Activity>(); vNodes.add(start); // only the end node is allowed to have no successors if (start.getSuccessors().size() == 0) { if ("END".equals(start.getName())) return true; else return false; } // iterate through all successors while (it.hasNext()) { Activity succ = it.next(); if ("END".equals(succ.getName()) && start.getSuccessors().size() != 1) { return false; } if (!(vNodes.contains(succ))) { res = res && isValidSubGraph(succ, vNodes); } else { return false; } } return res; }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.c09_overscroll); for (int i = 1001; i <= 1003; i++) { mItem.add(Integer.toString(i)); } mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mItem); mList = (ListView) findViewById(R.id.list); mList.setAdapter(mAdapter); }
/** * Checks if there is a call in progress. If true then shows a warning toast and finishes the * activity. * * @param activity activity doing a check. * @return <tt>true</tt> if there is call in progress and <tt>Activity</tt> was finished. */ public static boolean checkCallInProgress(Activity activity) { if (CallManager.getActiveCallsCount() > 0) { logger.warn("Call is in progress"); Toast t = Toast.makeText(activity, R.string.service_gui_WARN_CALL_IN_PROGRESS, Toast.LENGTH_SHORT); t.show(); activity.finish(); return true; } else { return false; } }
@Override public void onWindowFocusChanged(boolean hasFocus) { // TODO: Implement this method super.onWindowFocusChanged(hasFocus); if (waitForNext) { this.nextLevel(); waitForNext = false; } ((GameBoard) findViewById(R.id.gameBoard)).setGame(this.game); findViewById(R.id.gameBoard).invalidate(); ((GameBoard) findViewById(R.id.gameBoard)).getHowdyShadeView().invalidate(); }