use of ingage.ingage20.managers.SessionManager in project iNGAGE by davis123123.
the class PostThreadActivity method onCreate.
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
session = new SessionManager(getApplicationContext());
setContentView(R.layout.activity_post_thread);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
categorySpinner = (Spinner) findViewById(R.id.category_spinner);
adapter = ArrayAdapter.createFromResource(this, R.array.thread_categories, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
categorySpinner.setAdapter(adapter);
categorySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long l) {
Toast.makeText(getBaseContext(), parent.getItemAtPosition(position) + "selected", Toast.LENGTH_LONG).show();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
mInsertThreadContent = (EditText) findViewById(R.id.insert_thread_content_text_view);
mInsertThreadTitle = (EditText) findViewById(R.id.insert_thread_title_text_view);
imageToUpload = (ImageView) findViewById(R.id.uploadImageView);
llUploadImage = (LinearLayout) findViewById(R.id.llUploadImage);
imageToUpload.setVisibility(View.INVISIBLE);
setUploadImageLayout();
addListenerOnSpinnerItemSelection();
// bUploadImage = (Button) findViewById(R.id.upload_image_button);
llUploadImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
goUploadImage();
}
});
imageToUpload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
goUploadImage();
}
});
}
use of ingage.ingage20.managers.SessionManager in project iNGAGE by davis123123.
the class ChatArrayAdapter method onCreateViewHolder.
@Override
public ChatViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
// Get the RecyclerView item layout
Context context = viewGroup.getContext();
LayoutInflater inflater = LayoutInflater.from(context);
boolean shouldAttachToParentImmediately = false;
View view = inflater.inflate(R.layout.chat_layout, viewGroup, shouldAttachToParentImmediately);
Log.d("STATE", "viewType: " + viewType);
session = new SessionManager(viewGroup.getContext());
HashMap<String, String> user = session.getUserDetails();
username = user.get(SessionManager.KEY_NAME);
if (viewType == 0)
view = inflater.inflate(R.layout.chat_layout_own, viewGroup, shouldAttachToParentImmediately);
else if (viewType == 1)
view = inflater.inflate(R.layout.chat_layout, viewGroup, shouldAttachToParentImmediately);
if (viewType == 2)
view = inflater.inflate(R.layout.chat_layout_own_right, viewGroup, shouldAttachToParentImmediately);
else if (viewType == 3)
view = inflater.inflate(R.layout.chat_layout_right, viewGroup, shouldAttachToParentImmediately);
ChatViewHolder viewHolder = new ChatViewHolder(view);
return viewHolder;
}
use of ingage.ingage20.managers.SessionManager in project iNGAGE by davis123123.
the class CategoriesPageFragment method getThreadsJSON.
public void getThreadsJSON(int rowCount) {
queryThreadsHandler = new QueryThreadsHandler();
session = new SessionManager(getActivity().getApplicationContext());
HashMap<String, String> user = session.getUserDetails();
String type = user.get(SessionManager.PAGE_TYPE);
String categoryType = user.get(SessionManager.CATEGORY_TYPE);
Log.d("CategoryType", " result : " + categoryType);
Log.d("PageType", " result : " + rowCount);
try {
json_string = queryThreadsHandler.execute(type, categoryType, String.valueOf(rowCount)).get();
Log.d("STATE", "query result : " + json_string);
threadListAdapter.setLoaded(false);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
use of ingage.ingage20.managers.SessionManager in project iNGAGE by davis123123.
the class FragmentBase method spectate.
public void spectate(int p) {
ThreadsHelper threadsHelper = (ThreadsHelper) threadListAdapter.getItem(p);
String thread_id = threadsHelper.getThread_id();
String type = "spectate";
session = new SessionManager(getActivity().getApplicationContext());
HashMap<String, String> user = session.getUserDetails();
String username = user.get(SessionManager.KEY_NAME);
SpectateRoomHandler spectateRoomHandler = new SpectateRoomHandler(getActivity().getApplicationContext());
try {
// Log.d("JOINSPECTATE", "yes");
result = spectateRoomHandler.execute(type, thread_id, username).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
if (result.equals("Spectate room failed")) {
Toast.makeText(getActivity(), "spectate room failed!", Toast.LENGTH_LONG).show();
} else {
chatRoomManager = new ChatRoomManager(getActivity().getApplicationContext());
chatRoomManager.updateUserRoomSession(thread_id, null, "true");
goToChat(result);
}
}
use of ingage.ingage20.managers.SessionManager in project iNGAGE by davis123123.
the class FragmentBase method joinRoom.
public String joinRoom(Context context, String type, String thread_id, String userJSON) {
session = new SessionManager(getActivity().getApplicationContext());
HashMap<String, String> user = session.getUserDetails();
String username = user.get(SessionManager.KEY_NAME);
String token = MainActivity.appToken;
String result = null;
ChatRoomHandler chatRoomHandler = new ChatRoomHandler(context);
try {
result = chatRoomHandler.execute(type, thread_id, username, token, side).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
chatRoomManager = new ChatRoomManager(getActivity().getApplicationContext());
chatRoomManager.updateUserRoomSession(thread_id, side, "false");
return result;
}
Aggregations