Android Open Source - Stack-Chat Room Fragment






From Project

Back to project page Stack-Chat.

License

The source code is released under:

MIT License

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

package com.noahhuppert.stackchat.fragments;
/*  www . ja va2  s . co  m*/
import android.app.Fragment;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.noahhuppert.stackchat.MainActivity;
import com.noahhuppert.stackchat.MessagesRecyclerViewAdapter;
import com.noahhuppert.stackchat.R;
import com.noahhuppert.stackchat.models.Message;
import com.noahhuppert.stackchat.models.Room;
import com.noahhuppert.stackchat.tasks.UpdateRoomMessagesTask;

import java.util.ArrayList;

/**
 * Created by Noah Huppert on 11/18/2014.
 */
public class RoomFragment extends Fragment {
    RecyclerView messagesRecyclerView;
    RecyclerView.LayoutManager messagesLayoutManager;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){

        View view = inflater.inflate(R.layout.messages_fragment, container, false);

        Room room15 = new Room(15);

        /*room15.addMessage(new Message(0, "message1", 10, 1));
        room15.addMessage(new Message(1, "message2", 10, 1));
        room15.addMessage(new Message(2, "message3", 10, 1));*/

        messagesRecyclerView = (RecyclerView) view.findViewById(R.id.messages_recycler_view);
        messagesRecyclerView.setHasFixedSize(true);

        messagesLayoutManager = new LinearLayoutManager(getActivity());
        messagesRecyclerView.setLayoutManager(messagesLayoutManager);

        MessagesRecyclerViewAdapter messagesRecyclerViewAdapter = new MessagesRecyclerViewAdapter(room15.getMessages());
        messagesRecyclerView.setAdapter(messagesRecyclerViewAdapter);

        new UpdateRoomMessagesTask().setArgs(room15, messagesRecyclerViewAdapter).execute();

        return view;
    }
}




Java Source Code List

com.noahhuppert.stackchat.ApplicationTest.java
com.noahhuppert.stackchat.MainActivity.java
com.noahhuppert.stackchat.MessagesRecyclerViewAdapter.java
com.noahhuppert.stackchat.controllers.HeaderBuilder.java
com.noahhuppert.stackchat.controllers.JellyKitNotificationController.java
com.noahhuppert.stackchat.controllers.NotificationController.java
com.noahhuppert.stackchat.controllers.PopNotificationController.java
com.noahhuppert.stackchat.fragments.RoomFragment.java
com.noahhuppert.stackchat.models.KVPair.java
com.noahhuppert.stackchat.models.Message.java
com.noahhuppert.stackchat.models.Room.java
com.noahhuppert.stackchat.models.User.java
com.noahhuppert.stackchat.modules.BaseStackChatModule.java
com.noahhuppert.stackchat.modules.StackChatModule.java
com.noahhuppert.stackchat.modules.StackChatModule.java
com.noahhuppert.stackchat.tasks.GetMessagesTask.java
com.noahhuppert.stackchat.tasks.UpdateRoomMessagesTask.java