diff --git a/Assignments/CriminalIntent12/app/src/main/java/asdv/lisset/criminalintent/CrimeListActivity.java b/Assignments/CriminalIntent12/app/src/main/java/asdv/lisset/criminalintent/CrimeListActivity.java index aa1e7ac..111e7b6 100644 --- a/Assignments/CriminalIntent12/app/src/main/java/asdv/lisset/criminalintent/CrimeListActivity.java +++ b/Assignments/CriminalIntent12/app/src/main/java/asdv/lisset/criminalintent/CrimeListActivity.java @@ -27,6 +27,9 @@ public class CrimeListActivity extends SingleFragmentActivity { Bundle bundle = new Bundle(); bundle.putSerializable("CrimeArrayList", (Serializable) crimes); crimeList.setArguments(bundle); + + + return crimeList; } diff --git a/Assignments/CriminalIntent12/app/src/main/java/asdv/lisset/criminalintent/CrimeListFragment.java b/Assignments/CriminalIntent12/app/src/main/java/asdv/lisset/criminalintent/CrimeListFragment.java index 5ffe3fc..4885391 100644 --- a/Assignments/CriminalIntent12/app/src/main/java/asdv/lisset/criminalintent/CrimeListFragment.java +++ b/Assignments/CriminalIntent12/app/src/main/java/asdv/lisset/criminalintent/CrimeListFragment.java @@ -2,13 +2,13 @@ package asdv.lisset.criminalintent; import android.content.Intent; import android.os.Bundle; -import android.text.Layout; import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; -import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -17,7 +17,6 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import java.io.Serializable; -import java.util.ArrayList; import java.util.List; public class CrimeListFragment extends Fragment { @@ -41,6 +40,8 @@ public class CrimeListFragment extends Fragment { @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + Bundle b = getArguments(); this.crimeList = (List) b.getSerializable("CrimeArrayList"); } @@ -49,9 +50,12 @@ public class CrimeListFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view = inflater.inflate(R.layout.fragment_crime_list, container, false); + crimeRecyclerView = (RecyclerView) view .findViewById(R.id.crime_recycler_view); crimeRecyclerView.setLayoutManager( @@ -66,6 +70,12 @@ public class CrimeListFragment extends Fragment { updateUI(); } + @Override + public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { + super.onCreateOptionsMenu(menu, inflater); + inflater.inflate(R.id.crime_menu, menu); + } + //CRIME HOLDER // ... it holds crimes // CRIMES AGAINST PROGRAMMING diff --git a/Assignments/CriminalIntent12/app/src/main/java/asdv/lisset/criminalintent/SingleFragmentActivity.java b/Assignments/CriminalIntent12/app/src/main/java/asdv/lisset/criminalintent/SingleFragmentActivity.java index 7df9526..6d96c09 100644 --- a/Assignments/CriminalIntent12/app/src/main/java/asdv/lisset/criminalintent/SingleFragmentActivity.java +++ b/Assignments/CriminalIntent12/app/src/main/java/asdv/lisset/criminalintent/SingleFragmentActivity.java @@ -4,6 +4,7 @@ import android.os.Bundle; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; @@ -20,6 +21,9 @@ public abstract class SingleFragmentActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fragment); + //init toolbar + Toolbar toolbar = (Toolbar) findViewById(R.id.crime_toolbar); + setSupportActionBar(toolbar); FragmentManager fm = getSupportFragmentManager(); fragment = diff --git a/Assignments/CriminalIntent12/app/src/main/res/drawable-anydpi/ic_menu_add.xml b/Assignments/CriminalIntent12/app/src/main/res/drawable-anydpi/ic_menu_add.xml new file mode 100644 index 0000000..f48ea94 --- /dev/null +++ b/Assignments/CriminalIntent12/app/src/main/res/drawable-anydpi/ic_menu_add.xml @@ -0,0 +1,11 @@ + + + diff --git a/Assignments/CriminalIntent12/app/src/main/res/drawable-hdpi/ic_menu_add.png b/Assignments/CriminalIntent12/app/src/main/res/drawable-hdpi/ic_menu_add.png new file mode 100644 index 0000000..7ff22b7 Binary files /dev/null and b/Assignments/CriminalIntent12/app/src/main/res/drawable-hdpi/ic_menu_add.png differ diff --git a/Assignments/CriminalIntent12/app/src/main/res/drawable-mdpi/ic_menu_add.png b/Assignments/CriminalIntent12/app/src/main/res/drawable-mdpi/ic_menu_add.png new file mode 100644 index 0000000..75c0263 Binary files /dev/null and b/Assignments/CriminalIntent12/app/src/main/res/drawable-mdpi/ic_menu_add.png differ diff --git a/Assignments/CriminalIntent12/app/src/main/res/drawable-xhdpi/ic_menu_add.png b/Assignments/CriminalIntent12/app/src/main/res/drawable-xhdpi/ic_menu_add.png new file mode 100644 index 0000000..344277f Binary files /dev/null and b/Assignments/CriminalIntent12/app/src/main/res/drawable-xhdpi/ic_menu_add.png differ diff --git a/Assignments/CriminalIntent12/app/src/main/res/drawable-xxhdpi/ic_menu_add.png b/Assignments/CriminalIntent12/app/src/main/res/drawable-xxhdpi/ic_menu_add.png new file mode 100644 index 0000000..07ff961 Binary files /dev/null and b/Assignments/CriminalIntent12/app/src/main/res/drawable-xxhdpi/ic_menu_add.png differ diff --git a/Assignments/CriminalIntent12/app/src/main/res/layout/toolbar.xml b/Assignments/CriminalIntent12/app/src/main/res/layout/toolbar.xml new file mode 100644 index 0000000..346926c --- /dev/null +++ b/Assignments/CriminalIntent12/app/src/main/res/layout/toolbar.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/Assignments/CriminalIntent12/app/src/main/res/values/strings.xml b/Assignments/CriminalIntent12/app/src/main/res/values/strings.xml index d1f97d9..4155486 100644 --- a/Assignments/CriminalIntent12/app/src/main/res/values/strings.xml +++ b/Assignments/CriminalIntent12/app/src/main/res/values/strings.xml @@ -6,4 +6,8 @@ DETAILS Solved Date of crime: + New Crime + Show Subtitle + Hide Subtitle + %1$d crimes \ No newline at end of file diff --git a/Assignments/MP1_Ajax.zip b/Assignments/MP1_Ajax.zip new file mode 100644 index 0000000..7fb8466 Binary files /dev/null and b/Assignments/MP1_Ajax.zip differ