Skip to content

Commit

Permalink
tunnel: save list commands (fixes #318) (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcouture27 authored and dogi committed Jun 17, 2019
1 parent ac884f3 commit 7a42f59
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.ArrayList;

import io.treehouses.remote.Constants;
import io.treehouses.remote.MainApplication;
import io.treehouses.remote.Network.BluetoothChatService;
import io.treehouses.remote.R;
import io.treehouses.remote.bases.BaseFragment;
Expand Down Expand Up @@ -107,7 +108,8 @@ public void handleMessage(Message msg) {
//make it so text doesn't show on chat (need a better way to check multiple strings since mConversationArrayAdapter only takes messages line by line)
if (!readMessage.contains("1 packets") && !readMessage.contains("64 bytes") && !readMessage.contains("google.com") &&
!readMessage.contains("rtt") && !readMessage.trim().isEmpty()) {
mConversationArrayAdapter.add(readMessage);
MainApplication.getTunnelList().add(readMessage);
mConversationArrayAdapter.notifyDataSetChanged();
}
}
break;
Expand Down Expand Up @@ -179,7 +181,7 @@ public void setupChat() {
Log.e("tag", "LOG setupChat()");
LayoutInflater inflater = getLayoutInflater();
// Initialize the array adapter for the conversation thread
mConversationArrayAdapter = new ArrayAdapter<String>(getActivity(), R.layout.message) {
mConversationArrayAdapter = new ArrayAdapter<String>(getActivity(), R.layout.message, MainApplication.getTunnelList()) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = super.getView(position, convertView, parent);
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/io/treehouses/remote/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@
public class MainApplication extends Application {

private static ArrayList terminalList;
private static ArrayList tunnelList;

@Override
public void onCreate() {
super.onCreate();
terminalList = new ArrayList();
tunnelList = new ArrayList();
}

public static ArrayList getTerminalList() {
return terminalList;
}

public static ArrayList getTunnelList() {
return tunnelList;
}
}

0 comments on commit 7a42f59

Please sign in to comment.