Be comfortable with
– making a simple mobile application
– basic command line
– calling a web or cloud API
FriendlyChat
APP, DB, FILE
package com.google.firebase.xxxx.friendlychat; public class FriendlyMessage { private String text; private String name; private String photoUrl; public FriendlyMessage(){ } public FriendlyMessage(String text, String name, String photoUrl){ this.text = text; this.name = name; this.photoUrl = photoUrl; } public String getText(){ return text; } public void setText(string text){ this.text = text; } public String getName(){ return name; } public void setName(String name){ this.name = name; } public String getPhotoUrl{ return photoUrl; } public void setPhotoUrl(String photoUrl){ this.photoUrl = photoUrl; } }
package com.google.firebase.xxxx.friendlychat; import android.os.Bundle; import android.support.v7.app.AppCompactActivity; import android.text.Editable; import android.text.TextWatcher; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ListView; import android.widget.ProgressBar; import java.util.ArrayList; import java.util.List; public class MainActivity extends(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mUsername = ANONYMOUS; mProgressBar = (ProgressBar) findViewById(R.id.progressBar); mMessageListView = (ListView) findViewById(R.id.messageListView); mPhotoPickerButton = (ImageButton) findViewById(R.id.photoPickerButton); mMessageEditText = (EditText) findViewById(R.id.messageEditText); mSendButton = (Button) findViewById(R.id.sendButton); List<FriendlyMessage> friendlyMessages = new ArrayList<>(); mMessageAdapter = new MessageAdapter(this, R.layout.item_message, friendlyMessages); mMessageListView.setAdapter(mMessageAdapter); mProgressBar.setVisibility(ProgressBar.INVISIBLE); mPhotoPickerButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view){ } }); mMessageEditText.addTextChangedListener(new TextWatcher(){ @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2){ } @Override public void onTestChanged(CharSequence charSequence, int i, int i1, int i2){ if (charSequence.toString().trim().length() > 0){ mSendButton.setEnable(true); } else { mSendButton.setEnabled(false); } } @Override public void afterTextChanged(Editable editable){ } }); mMessageEditText.setFilter(new InputFilter[]{new InputFilter.LengthFilter(DEFALT_MSG_LENGTH_LIMIT)}); mSendButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view){ mMessageEditText.setText(""); } }); @Override public boolean onCreateOptionsMenu(Menu menu){ MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item){ return super.onOptionsItemSelected(item); } }