Skip to content
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".SignupActivity"></activity>
<activity android:name=".LoginActivity" />
<activity android:name=".ComposePostActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
128 changes: 128 additions & 0 deletions app/src/main/java/com/example/kpj/ComposePostActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
package com.example.kpj;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.kpj.model.Post;
import com.parse.ParseUser;

import java.io.File;

public class ComposePostActivity extends AppCompatActivity {


EditText etComposePostTitle;
EditText etComposeBody;

TextView tvComposeTitleLabel;
TextView tvComposeUsername;
TextView tvComposeBodyLabel;

ImageView ivComposeProfile;
ImageView ivComposeImage;

ImageButton ibAddPdf;
ImageButton ibCamera;
ImageButton ibExitCompose;
ImageButton ibAddImage;

Button bLaunch;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_compose_post);

etComposePostTitle = findViewById(R.id.etComposePostTitle);
etComposeBody = findViewById(R.id.etComposeBody);

tvComposeUsername = findViewById(R.id.tvComposeUsername);
ivComposeProfile = findViewById(R.id.ivComposeProfile);
setUserInfo();

ibExitCompose = findViewById(R.id.ibExitCompose);
setIBtnExitListener();
ibAddImage = findViewById(R.id.ibAddImage);
setIBtnAddImageListener();
ibCamera = findViewById(R.id.ibCamera);
setIBtnCameraListener();
ibAddPdf = findViewById(R.id.ibAddPdf);
setIBtnPdfListener();

bLaunch = findViewById(R.id.bLaunch);
setBtnLaunchListener();
}

public void setIBtnExitListener() {
//send back to feed fragment
}

private void setIBtnPdfListener() {
//grab pdf into image files
}

private void setIBtnCameraListener() {
// do if there is time left
}

private void setIBtnAddImageListener() {
//grab images from gallary?
}

public void setBtnLaunchListener() {
bLaunch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
savePost();
//TODO -- notify adapter
//TODO -- Send back to feed fragment
Toast.makeText(ComposePostActivity.this, "Save successful", Toast.LENGTH_LONG).show();
}
});
}

private void setUserInfo() {
//get image and usernamme
}

private void savePost() {
// Create new post instance
Post newPost = new Post();
// Grab content from the compose activity
String newTitle = etComposePostTitle.getText().toString();
String newBody = etComposeBody.getText().toString();
// TODO - grab photo/pdf file

// Set user of post
newPost.setUser(ParseUser.getCurrentUser());
// Set content of post
if (newTitle.length() != 0) { newPost.setTitle(newTitle); }
if (newBody.length() != 0) { newPost.setDescription(newBody); }
// TODO - send photo/pdf files

// Setup vote count
newPost.setUpVotes(0);
newPost.setDownVotes(0);
}













}
43 changes: 0 additions & 43 deletions app/src/main/java/com/example/kpj/CourseFeedFragment.java

This file was deleted.

5 changes: 5 additions & 0 deletions app/src/main/java/com/example/kpj/FragmentPageAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.example.kpj.fragments.CourseFeedFragment;
import com.example.kpj.fragments.CourseListFragment;
import com.example.kpj.fragments.MessageFragment;
import com.example.kpj.fragments.ProfileFragment;


public class FragmentPageAdapter extends FragmentStatePagerAdapter {

Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/com/example/kpj/LoginActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.example.kpj;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class LoginActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
}
13 changes: 13 additions & 0 deletions app/src/main/java/com/example/kpj/SignupActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.example.kpj;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class SignupActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
}
}
104 changes: 104 additions & 0 deletions app/src/main/java/com/example/kpj/fragments/CourseFeedFragment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package com.example.kpj.fragments;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;

import com.example.kpj.ComposePostActivity;
import com.example.kpj.R;


public class CourseFeedFragment extends Fragment {
private static final String ARG_PAGE = "ARG_PAGE";
private int mPage;

RecyclerView rvCourseFeed;
SearchView svSearch;
ImageButton ibCompose;

public CourseFeedFragment() {
// Required empty public constructor
}

public static CourseFeedFragment newInstance(int page) {
CourseFeedFragment fragment = new CourseFeedFragment();
Bundle args = new Bundle();
args.putInt(ARG_PAGE, page);
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mPage = getArguments().getInt(ARG_PAGE);
}
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_course_feed, container, false);

// Find views from xml
rvCourseFeed = view.findViewById(R.id.rvCourseFeed);
ibCompose = view.findViewById(R.id.ibCompose);
// TODO -- Figure out how to set up a search view
//svSearch = view.findViewById(R.id.svSearch);

setComposeButtonListener();
return view;
}

public void setComposeButtonListener() {
ibCompose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), ComposePostActivity.class);
startActivity(intent);
}
});
}

}

































Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.example.kpj;
package com.example.kpj.fragments;

import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.kpj.R;

public class CourseListFragment extends Fragment {

private static final String ARG_PAGE = "ARG_PAGE";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.example.kpj;
package com.example.kpj.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.kpj.R;


public class MessageFragment extends Fragment {
private static final String ARG_PAGE = "ARG_PAGE";
Expand Down Expand Up @@ -34,7 +36,7 @@ public void onCreate(Bundle savedInstanceState) {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_course_list, container, false);
return inflater.inflate(R.layout.fragment_message, container, false);
}
// comment

Expand Down
Loading