Skip to content

Instantly share code, notes, and snippets.

#include<stdio.h>
int main(int argc, char** argv) {
int n, c;
int retVal;
if((retVal = scanf("%d %d", &n, &c)) != 2) {
printf("only scan in %d items\n", retVal);
return 1;
}
//on the backend object you can call
void createUser(String userName);
void createRoom(User user, LatLng latLng, int accuracy, String roomName, int roomRadius);
void listRooms(User user, LatLng latLng, int accuracy);
void sendMessage(User user, Room room, String message);
//need to implement these to get information from the backend
@Override
public void onConnected() {
}
/*Add these to MainActivity on create*/
final DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
final ListView drawerList = (ListView) drawerLayout.findViewById(R.id.list_drawer);
drawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, new String[]{"Rooms"}));
drawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int pos, long id) {
/*you need to write this function, depends on what you want it to do when you click an item on the drawer*/
@Jackyjjc
Jackyjjc / gist:9707dab983dd1d403bf5
Created December 24, 2014 09:53
scene2d List with keyboard navigation
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.List;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
@Jackyjjc
Jackyjjc / balance.kt
Created March 1, 2017 11:43
FB question
import java.util.*
fun main(args : Array<String>) {
val numBalances = readLine()!!.toInt()
val balances = (1 .. numBalances).map {
val leftLine = readLine()!!.split(' ')
val rightLine = readLine()!!.split(' ')
Balance(leftLine[0].toInt(), if (leftLine.size == 2) leftLine[1].toInt() else -1,
rightLine[0].toInt(), if (rightLine.size == 2) rightLine[1].toInt() else -1)