Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e9fbb28
Initial Commit empty project
KyleCole01 Mar 22, 2019
776fb33
added new class and worked on layouts
KyleCole01 Mar 22, 2019
034201b
added needed save and delete button as well as the watched switch.
KyleCole01 Mar 22, 2019
d134ccd
attached the boolean from switch to intent for "viewed" status
KyleCole01 Mar 22, 2019
a6b0d67
11 am update
KyleCole01 Mar 22, 2019
59c99d0
got app working cleaning up now
KyleCole01 Mar 22, 2019
915e925
working on passing the object through
KyleCole01 Mar 22, 2019
d7b0e1b
added repo and context for classes to it. working on pointing now.
KyleCole01 Mar 22, 2019
7881967
trying to figure out where the repo isnt accessing to create a new te…
KyleCole01 Mar 22, 2019
faf2ce6
repo class set me back timewise (will still commit tonight)
KyleCole01 Mar 23, 2019
a9b3ae5
Rebuilt alot of app overnight functioning atm just need to add delete…
KyleCole01 Mar 23, 2019
c8a4a71
fixed a bug with last commit
KyleCole01 Mar 23, 2019
1e71805
made clicking name return to addnewmovie activity with the correct in…
KyleCole01 Mar 23, 2019
8af3281
tweeks on delete button
KyleCole01 Mar 23, 2019
6a01002
adding a repo and referencing it.
KyleCole01 Mar 24, 2019
231a3d4
repo fully functional, few issues with reaccessing the views (having …
KyleCole01 Mar 24, 2019
9c7e553
complete rebuild fully functional (whole issue was that autoimport wa…
KyleCole01 Mar 24, 2019
523ffef
Reached a few "aha moments", which made this project much easier to do.
KyleCole01 Mar 24, 2019
17be3f9
fixed bug and changed the envelope to a pretty plus sign
KyleCole01 Mar 24, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
29 changes: 29 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.android_sprint1_challenge;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.example.android_sprint1_challenge", appContext.getPackageName());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package com.example.android_sprint1_challenge;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Movie;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Switch;
import android.widget.TextView;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class AddNewMovie extends AppCompatActivity implements Serializable {
private MovieEntry movie;
private EditText movieTitleEntry;
private Switch watchedSwitch;
private Button saveButton;
private Button deleteButton;

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

movieTitleEntry = findViewById(R.id.movie_edit_text);
watchedSwitch = findViewById(R.id.watched_switch);
saveButton = findViewById(R.id.button_save);
deleteButton = findViewById(R.id.button_delete);

}

@Override
protected void onResume() {
super.onResume();

Intent intent = getIntent();
if (intent.hasExtra(MovieEntry.MOVIE_TAG)) {
movie = (MovieEntry) intent.getSerializableExtra(MovieEntry.MOVIE_TAG);
movieTitleEntry.setText(movie.getMovieName());
watchedSwitch.setChecked(movie.isWatched());
} else {
movie = new MovieEntry();
}

movieTitleEntry.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {

}

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {

}

@Override
public void afterTextChanged(Editable s) {
String name = s.toString();
movie.setMovieName(name);
}
});


saveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onSavePressed(movie);
}
});

deleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent saveIntent = new Intent();
saveIntent.putExtra(MovieEntry.MOVIE_TAG, movie);
setResult(Activity.RESULT_CANCELED, saveIntent);
finish();
}
});
}

protected void onSavePressed(MovieEntry movie) {
if (movie != null) {
movie.setWatched(watchedSwitch.isChecked());
Intent saveIntent = new Intent();
saveIntent.putExtra(MovieEntry.MOVIE_TAG, movie);
setResult(Activity.RESULT_OK, saveIntent);
finish();
} else { onBackPressed(); }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.example.android_sprint1_challenge;

import java.io.Serializable;

public class MovieEntry implements Serializable {
public static final String MOVIE_TAG = "tagThis";

private String movieName;
private int movieId;
private boolean isWatched;


public MovieEntry(String movieName, int movieId, boolean isWatched) {
this.movieName = movieName;
this.movieId = movieId;
this.isWatched = isWatched;
}


public String getMovieName() {
return movieName;
}

public int getMovieId() {
return movieId;
}



public void setMovieName(String movieName) {
this.movieName = movieName;
}


public void setMovieId(int movieId) {
this.movieId = movieId;
}

public boolean isWatched() {
return isWatched;
}

public void setWatched(boolean watched) {
isWatched = watched;
}

public MovieEntry() {

}

}
Loading