diff --git a/vangogh-sample/src/androidTest/java/com/example/vangogh/ExampleInstrumentedTest.java b/vangogh-sample/src/androidTest/java/com/example/vangogh/ExampleInstrumentedTest.java
deleted file mode 100644
index 5ad4a84..0000000
--- a/vangogh-sample/src/androidTest/java/com/example/vangogh/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.example.vangogh;
-
-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 Testing documentation
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() throws Exception {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- assertEquals("com.example.vangogh", appContext.getPackageName());
- }
-}
diff --git a/vangogh-sample/src/main/java/com/example/vangogh/MainActivity.java b/vangogh-sample/src/main/java/com/example/vangogh/MainActivity.java
index bbaa013..d7af6a5 100644
--- a/vangogh-sample/src/main/java/com/example/vangogh/MainActivity.java
+++ b/vangogh-sample/src/main/java/com/example/vangogh/MainActivity.java
@@ -8,7 +8,6 @@
import com.example.vangogh.menu.MainMenuAdapter;
import com.example.vangogh.menu.MainMenuItem;
-import com.example.vangogh.samples.SingleAnimationActivity;
import com.example.vangogh.samples.SingleFadeAnimationActivity;
import com.example.vangogh.samples.SingleRotateAnimationActivity;
@@ -17,14 +16,12 @@
public class MainActivity extends AppCompatActivity implements MainMenuAdapter.OnMainMenuItemClickListener {
- private ListView mainMenuList;
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- mainMenuList = findViewById(R.id.mainMenu);
+ ListView mainMenuList = findViewById(R.id.mainMenu);
MainMenuAdapter adapter = new MainMenuAdapter(this, getMainMenuItems());
adapter.setOnMainMenuItemClickListener(this);
@@ -33,14 +30,14 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public void onMainMenuItemClicked(@NonNull MainMenuItem item) {
- startActivity(new Intent(this, item.getActivity().getClass()));
+ startActivity(new Intent(this, item.getActivityClass()));
}
@NonNull
public List getMainMenuItems() {
List items = new ArrayList<>();
- items.add(new MainMenuItem("Fade animation", "Showcases the fade in/out animation", new SingleFadeAnimationActivity()));
- items.add(new MainMenuItem("Rotate animation", "Showcases the rotation animation", new SingleRotateAnimationActivity()));
+ items.add(new MainMenuItem("Fade animation", "Showcases the fade in/out animation", SingleFadeAnimationActivity.class));
+ items.add(new MainMenuItem("Rotate animation", "Showcases the rotation animation", SingleRotateAnimationActivity.class));
return items;
}
diff --git a/vangogh-sample/src/main/java/com/example/vangogh/menu/MainMenuAdapter.java b/vangogh-sample/src/main/java/com/example/vangogh/menu/MainMenuAdapter.java
index a7bfadd..e1348ab 100644
--- a/vangogh-sample/src/main/java/com/example/vangogh/menu/MainMenuAdapter.java
+++ b/vangogh-sample/src/main/java/com/example/vangogh/menu/MainMenuAdapter.java
@@ -16,6 +16,7 @@
public class MainMenuAdapter extends ArrayAdapter {
+ @Nullable
private OnMainMenuItemClickListener listener;
public MainMenuAdapter(@NonNull Context context, List items) {
@@ -33,13 +34,13 @@ public View getView(int position, @Nullable View convertView, @NonNull ViewGroup
R.layout.layout_main_menu_item, parent, false);
}
- TextView itemTitle = convertView.findViewById(R.id.itemTitle);
- TextView itemDesc = convertView.findViewById(R.id.itemDesc);
+ final TextView itemTitle = convertView.findViewById(R.id.itemTitle);
+ final TextView itemDesc = convertView.findViewById(R.id.itemDesc);
itemTitle.setText(item.getTitle());
itemDesc.setText(item.getDesc());
- LinearLayout itemLayout = convertView.findViewById(R.id.itemLayout);
+ final LinearLayout itemLayout = convertView.findViewById(R.id.itemLayout);
itemLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/vangogh-sample/src/main/java/com/example/vangogh/menu/MainMenuItem.java b/vangogh-sample/src/main/java/com/example/vangogh/menu/MainMenuItem.java
index 9257792..5e51ed3 100644
--- a/vangogh-sample/src/main/java/com/example/vangogh/menu/MainMenuItem.java
+++ b/vangogh-sample/src/main/java/com/example/vangogh/menu/MainMenuItem.java
@@ -3,7 +3,7 @@
import android.app.Activity;
import android.support.annotation.NonNull;
-public class MainMenuItem {
+public class MainMenuItem {
@NonNull
private final String title;
@@ -12,12 +12,12 @@ public class MainMenuItem {
private final String desc;
@NonNull
- private final Activity activity;
+ private final Class activityClass;
- public MainMenuItem(@NonNull String title, @NonNull String desc, @NonNull Activity activity) {
+ public MainMenuItem(@NonNull String title, @NonNull String desc, @NonNull Class activityClass) {
this.title = title;
this.desc = desc;
- this.activity = activity;
+ this.activityClass = activityClass;
}
@NonNull
@@ -31,8 +31,8 @@ String getDesc() {
}
@NonNull
- public Activity getActivity() {
- return activity;
+ public Class getActivityClass() {
+ return activityClass;
}
}
diff --git a/vangogh-sample/src/test/java/com/example/vangogh/ExampleUnitTest.java b/vangogh-sample/src/test/java/com/example/vangogh/ExampleUnitTest.java
deleted file mode 100644
index 00b7cba..0000000
--- a/vangogh-sample/src/test/java/com/example/vangogh/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.example.vangogh;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see Testing documentation
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file