activityRule =
- new ActivityScenarioRule<>(MainActivity.class);
-
-
- /**
- * This test ensures, that all components are displayed
- */
- @Test
- public void channelOverviewShowsNecessaryComponents() {
- Espresso.onView(withId(R.layout.fragment_channel_list));
- Espresso.onView(withId(R.id.fragment_channel_list_recycler_view));
- Espresso.onView(withId(R.id.fragment_channel_list_add_channel_button)).perform(ViewActions.longClick());
- Espresso.onView(withId(R.menu.menu_channel_list_delete));
- }
-}
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/ExampleInstrumentedTest.java b/app/src/androidTest/java/net/sharksystem/sharknet/ExampleInstrumentedTest.java
deleted file mode 100644
index 639fefc..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package net.sharksystem.sharknet;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see Testing documentation
- */
-public class ExampleInstrumentedTest {
-}
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/TestAddMessageScenarios.java b/app/src/androidTest/java/net/sharksystem/sharknet/TestAddMessageScenarios.java
new file mode 100644
index 0000000..f6fa242
--- /dev/null
+++ b/app/src/androidTest/java/net/sharksystem/sharknet/TestAddMessageScenarios.java
@@ -0,0 +1,417 @@
+package net.sharksystem.sharknet;
+
+import static androidx.test.espresso.action.ViewActions.click;
+import static androidx.test.espresso.action.ViewActions.typeText;
+import static androidx.test.espresso.assertion.ViewAssertions.matches;
+import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant;
+import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
+import static androidx.test.espresso.matcher.ViewMatchers.isNotEnabled;
+import static androidx.test.espresso.matcher.ViewMatchers.withId;
+import static androidx.test.espresso.matcher.ViewMatchers.withText;
+
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.not;
+
+import androidx.test.espresso.Espresso;
+import androidx.test.espresso.contrib.RecyclerViewActions;
+import androidx.test.ext.junit.rules.ActivityScenarioRule;
+import androidx.test.filters.LargeTest;
+
+import net.sharksystem.R;
+import net.sharksystem.sharknet.android.InitActivity;
+import net.sharksystem.sharknet.utils.RecyclerViewItemCountAssertion;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Test specific scenarios for sending messages.
+ * All tests assume, that previously a peer was created at
+ * first app start.
+ *
+ * The naming of scenarios follows this structure:
+ *
+ * scenario{number}_scenarioName_variation
+ *
+ * The scenario name describes what happens in
+ * the scenario.
+ *
+ * The variation signals a already tested scenario
+ * with some minor differences in execution.
+ */
+@LargeTest
+public class TestAddMessageScenarios {
+
+ private static final String CHANNEL_NAME = "TestChannel";
+ private static final String TEST_MESSAGE = "I am Test";
+ private static final String PEER_NAME = "from: unknown";
+ private static final String TO_ANYBODY = "anybody";
+ private static final String TEST_RECIPIENT = "Iris";
+ private static final String SIGNED_TEXT = "signed";
+ private static final String UNSIGNED_TEXT = "unsigned";
+ private static final String ENCRYPTED_TEXT = "encrypted";
+ private static final String UNENCRYPTED_TEXT = "unencrypted";
+
+ // TODO: right now it is not possible to start from SNChannelViewActivity
+ @Rule
+ public ActivityScenarioRule activityRule =
+ new ActivityScenarioRule<>(InitActivity.class);
+
+ @Before
+ public void setUp() {
+ // clear all channels
+ Espresso.onView(withId(R.id.snRemoveAllChannelButton))
+ .perform(click());
+
+ // go to addChannel
+ Espresso.onView(withId(R.id.snAddChannelButton))
+ .perform(click());
+
+ // add channel
+ Espresso.onView(withId(R.id.snChannelAddName))
+ .perform(typeText(CHANNEL_NAME));
+ Espresso.onView(withId(R.id.snChannelAddDoAdd))
+ .perform(click());
+ }
+
+ /**
+ * Validate the contents of a sent message match up.
+ * Make sure the corresponding channel view
+ * is in the hierarchy before calling this method.
+ * @param receiver of the message.
+ * @param encrypted true if message is encrypted, false otherwise.
+ * @param signed true if message is signed, false otherwise.
+ */
+ private void validateSentMessage(String receiver, boolean encrypted, boolean signed) {
+ String encryptedText = encrypted ? ENCRYPTED_TEXT : UNENCRYPTED_TEXT;
+ String signedText = signed ? SIGNED_TEXT : UNSIGNED_TEXT;
+
+ // validate sender name
+ Espresso.onView(withId(R.id.sn_message_sender))
+ .check(matches(withText(containsString(PEER_NAME))));
+
+ // validate message content
+ Espresso.onView(withId(R.id.sn_message_content))
+ .check(matches(withText(TEST_MESSAGE)));
+
+ // validate receiver name or anybody
+ Espresso.onView(withId(R.id.sn_message_receivers))
+ .check(matches(withText(containsString(receiver))));
+
+ // validate if message is encrypted
+ Espresso.onView(withId(R.id.sn_message_encrypted))
+ .check(matches(withText(containsString(encryptedText))));
+
+ // validate if message is signed
+ Espresso.onView(withId(R.id.sn_message_verified))
+ .check(matches(withText(containsString(signedText))));
+ }
+
+ @Test
+ public void scenario1_sendMessageToAnybody() {
+ // go to channel
+ Espresso.onView(withId(R.id.sn_channel_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ // go to addMessage
+ Espresso.onView(withId(R.id.snChannelViewMenuAddMessage))
+ .perform(click());
+
+ // add message
+ Espresso.onView(withId(R.id.snMessage))
+ .perform(typeText(TEST_MESSAGE));
+ Espresso.onView(withId(R.id.removeAllRecipients))
+ .perform(click());
+ // validate, that encryption is not possible
+ Espresso.onView(withId(R.id.snEncrypted))
+ .check(matches(not(isDisplayed())));
+ // validate channel name
+ Espresso.onView(withId(R.id.snChannelName))
+ .check(matches(withText(CHANNEL_NAME)));
+ // validate recipient name
+ Espresso.onView(withId(R.id.snMessageRecipients))
+ .check(matches(withText(TO_ANYBODY)));
+ Espresso.onView(withId(R.id.addButton))
+ .perform(click());
+
+ // go to sent message
+ Espresso.onView(withId(R.id.sn_channel_view_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ validateSentMessage(TO_ANYBODY, false, false);
+ }
+
+ @Test
+ public void scenario2_sendMessageToAnybody_signed() {
+ // go to channel
+ Espresso.onView(withId(R.id.sn_channel_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ // go to addMessage
+ Espresso.onView(withId(R.id.snChannelViewMenuAddMessage))
+ .perform(click());
+
+ // add message
+ Espresso.onView(withId(R.id.snSigned))
+ .perform(click());
+ Espresso.onView(withId(R.id.snMessage))
+ .perform(typeText(TEST_MESSAGE));
+ Espresso.onView(withId(R.id.removeAllRecipients))
+ .perform(click());
+ Espresso.onView(withId(R.id.addButton))
+ .perform(click());
+
+ // go to sent message
+ Espresso.onView(withId(R.id.sn_channel_view_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ validateSentMessage(TO_ANYBODY, false, true);
+ }
+
+ @Test
+ public void scenario3_sendMessageToAnybody_abortContactSelection() {
+ // go to channel
+ Espresso.onView(withId(R.id.sn_channel_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ // go to addMessage
+ Espresso.onView(withId(R.id.snChannelViewMenuAddMessage))
+ .perform(click());
+
+ // add message
+ Espresso.onView(withId(R.id.snMessage))
+ .perform(typeText(TEST_MESSAGE));
+ Espresso.onView(withId(R.id.selectRecipients))
+ .perform(click());
+ Espresso.onView(withId(R.id.person_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItem(hasDescendant(withText(TEST_RECIPIENT)), click())
+ .atPosition(0));
+ // abort selection: send to anybody
+ Espresso.onView(withId(R.id.abortButton))
+ .perform(click());
+ // validate recipient name
+ Espresso.onView(withId(R.id.snMessageRecipients))
+ .check(matches(withText(TO_ANYBODY)));
+ Espresso.onView(withId(R.id.addButton))
+ .perform(click());
+
+ // go to sent message
+ Espresso.onView(withId(R.id.sn_channel_view_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ validateSentMessage(TO_ANYBODY, false, false);
+ }
+
+ @Test
+ public void scenario4_sendMessageToContact() {
+ // go to channel
+ Espresso.onView(withId(R.id.sn_channel_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ // go to addMessage
+ Espresso.onView(withId(R.id.snChannelViewMenuAddMessage))
+ .perform(click());
+
+ // add message with recipient
+ Espresso.onView(withId(R.id.snMessage))
+ .perform(typeText(TEST_MESSAGE));
+ Espresso.onView(withId(R.id.selectRecipients))
+ .perform(click());
+ Espresso.onView(withId(R.id.person_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItem(hasDescendant(withText(TEST_RECIPIENT)), click())
+ .atPosition(0));
+ Espresso.onView(withId(R.id.personListSelectionDoneButton))
+ .perform(click());
+ // validate recipient name
+ Espresso.onView(withId(R.id.snMessageRecipients))
+ .check(matches(withText(TEST_RECIPIENT)));
+ Espresso.onView(withId(R.id.addButton))
+ .perform(click());
+
+ // go to sent message
+ Espresso.onView(withId(R.id.sn_channel_view_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ validateSentMessage(TEST_RECIPIENT, false, false);
+ }
+
+ // TODO: right now no encrypted exchange with contacts possible
+ @Test
+ public void scenario5_sendMessageToContact_encrypted() {
+ // go to channel
+ Espresso.onView(withId(R.id.sn_channel_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ // go to addMessage
+ Espresso.onView(withId(R.id.snChannelViewMenuAddMessage))
+ .perform(click());
+
+ // add message with recipient
+ Espresso.onView(withId(R.id.snMessage))
+ .perform(typeText(TEST_MESSAGE));
+ Espresso.onView(withId(R.id.selectRecipients))
+ .perform(click());
+ Espresso.onView(withId(R.id.person_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItem(hasDescendant(withText(TEST_RECIPIENT)), click())
+ .atPosition(0));
+ Espresso.onView(withId(R.id.personListSelectionDoneButton))
+ .perform(click());
+ // encrypt message
+ Espresso.onView(withId(R.id.snEncrypted))
+ .perform(click());
+ Espresso.onView(withId(R.id.addButton))
+ .perform(click());
+
+ // go to sent message
+ Espresso.onView(withId(R.id.sn_channel_view_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ validateSentMessage(TEST_RECIPIENT, true, false);
+ }
+
+ @Test
+ public void scenario6_sendMessageToContact_signed() {
+ // go to channel
+ Espresso.onView(withId(R.id.sn_channel_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ // go to addMessage
+ Espresso.onView(withId(R.id.snChannelViewMenuAddMessage))
+ .perform(click());
+
+ // add message with recipient
+ Espresso.onView(withId(R.id.snMessage))
+ .perform(typeText(TEST_MESSAGE));
+ Espresso.onView(withId(R.id.selectRecipients))
+ .perform(click());
+ Espresso.onView(withId(R.id.person_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItem(hasDescendant(withText(TEST_RECIPIENT)), click())
+ .atPosition(0));
+ Espresso.onView(withId(R.id.personListSelectionDoneButton))
+ .perform(click());
+ // sign message
+ Espresso.onView(withId(R.id.snSigned))
+ .perform(click());
+ Espresso.onView(withId(R.id.addButton))
+ .perform(click());
+
+ // go to sent message
+ Espresso.onView(withId(R.id.sn_channel_view_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ validateSentMessage(TEST_RECIPIENT, false, true);
+
+ }
+
+ @Test
+ public void scenario7_sendMessageToContact_signedAndEncrypted() {
+ // go to channel
+ Espresso.onView(withId(R.id.sn_channel_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ // go to addMessage
+ Espresso.onView(withId(R.id.snChannelViewMenuAddMessage))
+ .perform(click());
+
+ // add message with recipient
+ Espresso.onView(withId(R.id.snMessage))
+ .perform(typeText(TEST_MESSAGE));
+ Espresso.onView(withId(R.id.selectRecipients))
+ .perform(click());
+ Espresso.onView(withId(R.id.person_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItem(hasDescendant(withText(TEST_RECIPIENT)), click())
+ .atPosition(0));
+ Espresso.onView(withId(R.id.personListSelectionDoneButton))
+ .perform(click());
+ // encrypt and sign message
+ Espresso.onView(withId(R.id.snEncrypted))
+ .perform(click());
+ Espresso.onView(withId(R.id.snSigned))
+ .perform(click());
+ Espresso.onView(withId(R.id.addButton))
+ .perform(click());
+
+ // go to sent message
+ Espresso.onView(withId(R.id.sn_channel_view_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ validateSentMessage(TEST_RECIPIENT, true, true);
+ }
+
+ @Test
+ public void scenario8_abortSendingMessage() {
+ // go to channel
+ Espresso.onView(withId(R.id.sn_channel_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ // go to addMessage
+ Espresso.onView(withId(R.id.snChannelViewMenuAddMessage))
+ .perform(click());
+
+ // add message
+ Espresso.onView(withId(R.id.snMessage))
+ .perform(typeText(TEST_MESSAGE));
+ Espresso.onView(withId(R.id.abortButton))
+ .perform(click());
+
+ // check that no message was sent
+ Espresso.onView(withId(R.id.sn_channel_view_recycler_view))
+ .check(new RecyclerViewItemCountAssertion(0));
+ }
+
+ @Test
+ public void scenario9_sendEmptyMessageIsProhibited_sendButtonDisabled() {
+ // go to channel
+ Espresso.onView(withId(R.id.sn_channel_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ // go to addMessage
+ Espresso.onView(withId(R.id.snChannelViewMenuAddMessage))
+ .perform(click());
+ // send button should be disabled
+ Espresso.onView(withId(R.id.addButton))
+ .check(matches(isNotEnabled()));
+ }
+
+ @Test
+ public void scenario10_sendMultipleMessagesShowsAllMessagesInChannel() {
+ // go to channel
+ Espresso.onView(withId(R.id.sn_channel_list_recycler_view))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
+
+ // go to addMessage
+ Espresso.onView(withId(R.id.snChannelViewMenuAddMessage))
+ .perform(click());
+
+ // add message
+ Espresso.onView(withId(R.id.snMessage))
+ .perform(typeText(TEST_MESSAGE));
+ Espresso.onView(withId(R.id.addButton))
+ .perform(click());
+
+ // go to addMessage
+ Espresso.onView(withId(R.id.snChannelViewMenuAddMessage))
+ .perform(click());
+
+ // add message
+ Espresso.onView(withId(R.id.snMessage))
+ .perform(typeText(TEST_MESSAGE));
+ Espresso.onView(withId(R.id.addButton))
+ .perform(click());
+
+ // go to addMessage
+ Espresso.onView(withId(R.id.snChannelViewMenuAddMessage))
+ .perform(click());
+
+ // add message
+ Espresso.onView(withId(R.id.snMessage))
+ .perform(typeText(TEST_MESSAGE));
+ Espresso.onView(withId(R.id.addButton))
+ .perform(click());
+
+ // check that 3 messages were sent
+ Espresso.onView(withId(R.id.sn_channel_view_recycler_view))
+ .check(new RecyclerViewItemCountAssertion(3));
+ }
+}
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/AddChannelTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/AddChannelTest.kt
deleted file mode 100644
index 3cb1d04..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/AddChannelTest.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import org.junit.jupiter.api.Test
-import net.sharksystem.ui.channels.AddChannelFragment
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4::class)
-class AddChannelTest {
-
- @org.junit.jupiter.api.Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- //Espresso.onView(withId(R.id.fragment_add_channel)).check(matches(isDisplayed()))
- //Espresso.onView(withId(R.id.fragment_add_channel_add_name_explanation)).check(matches(isDisplayed()))
- //Espresso.onView(withId(R.id.fragment_add_channel_add_name_input_field)).check(matches(isDisplayed()))
- //Espresso.onView(withId(R.id.fragment_add_channel_channel_uri_explanation)).check(matches(isDisplayed()))
- //Espresso.onView(withId(R.id.fragment_add_channel_channel_uri)).check(matches(isDisplayed()))
- //Espresso.onView(withId(R.id.fragment_add_channel_add_button)).check(matches(isDisplayed()))
- //Espresso.onView(withId(R.id.fragment_add_channel_exit_button)).check(matches(isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/AddContactTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/AddContactTest.kt
deleted file mode 100644
index 5759b9f..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/AddContactTest.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.ViewMatchers
-import net.sharksystem.R
-import net.sharksystem.ui.channels.AddChannelFragment
-import org.junit.jupiter.api.Test
-
-class AddContactTest {
-
- @Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(ViewMatchers.withId(R.layout.fragment_add_contact)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_contact_abort_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_contact_continue_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_contact_explanation_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_contact_network_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_contact_radar_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/AddMessageTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/AddMessageTest.kt
deleted file mode 100644
index ad42067..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/AddMessageTest.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.ViewMatchers
-import net.sharksystem.R
-import net.sharksystem.ui.channels.massage.AddMessageFragment
-import org.junit.jupiter.api.Test
-
-class AddMessageTest {
-
- @org.junit.jupiter.api.Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(ViewMatchers.withId(R.layout.fragment_add_massage)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_message_message_input)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_message_abort_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_message_message_recipients)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_message_comments)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_message_channel_name)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_message_encrypted_checkbox)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_message_end_to_end_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_message_recipients_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_message_select_anybody_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_message_select_recipients_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_message_send_message_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_add_message_signed_checkbox)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ChannelListTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ChannelListTest.kt
deleted file mode 100644
index adc4a8a..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ChannelListTest.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions.matches
-import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
-import androidx.test.espresso.matcher.ViewMatchers.withId
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import net.sharksystem.ui.channels.ChannelListFragment
-import org.junit.jupiter.api.Test
-import org.junit.runner.RunWith
-import net.sharksystem.R
-
-@RunWith(AndroidJUnit4::class)
-class ChannelListTest {
-
- @Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(withId(R.layout.fragment_channel_list)).check(matches(isDisplayed()))
- Espresso.onView(withId(R.id.fragment_channel_list_add_channel_button)).check(matches(isDisplayed()))
- Espresso.onView(withId(R.id.fragment_channel_list_recycler_view)).check(matches(isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ChannelViewTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ChannelViewTest.kt
deleted file mode 100644
index 99d5a84..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ChannelViewTest.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.ViewMatchers
-import net.sharksystem.R
-import net.sharksystem.ui.channels.massage.ChannelViewFragment
-import org.junit.jupiter.api.Test
-
-class ChannelViewTest {
-
- @org.junit.jupiter.api.Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(ViewMatchers.withId(R.layout.fragment_channel_view)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_channel_view_recycler_view)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_channel_view_add_message_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ContactListTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ContactListTest.kt
deleted file mode 100644
index dbe05dd..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ContactListTest.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.ViewMatchers
-import net.sharksystem.R
-import net.sharksystem.ui.contacts.ContactListFragment
-import org.junit.jupiter.api.Test
-
-class ContactListTest {
-
- @Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(ViewMatchers.withId(R.layout.fragment_contact_list)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_contacts_add_contact_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_contacts_recycler_view)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ContactViewTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ContactViewTest.kt
deleted file mode 100644
index b5c3fc0..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ContactViewTest.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.ViewMatchers
-import net.sharksystem.R
-import net.sharksystem.ui.contacts.ContactViewFragment
-import org.junit.jupiter.api.Test
-
-class ContactViewTest {
-
- @Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(ViewMatchers.withId(R.layout.fragment_contact_view)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_contact_view_userID_description_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_contact_view_identity_assurance_description_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_contact_view_name_description_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_contact_view_signing_failure_description_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/FirstStartTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/FirstStartTest.kt
deleted file mode 100644
index fbc1738..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/FirstStartTest.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.ViewMatchers
-import net.sharksystem.R
-import net.sharksystem.ui.firstLaunch.FirstStartFragment
-import org.junit.jupiter.api.Test
-
-class FirstStartTest {
-
- @org.junit.jupiter.api.Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(ViewMatchers.withId(R.layout.fragment_first_start)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_first_start_enter_name_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_first_start_name_input)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_first_start_save_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_first_start_hint)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/HubListTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/HubListTest.kt
deleted file mode 100644
index 2cef1c5..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/HubListTest.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.ViewMatchers
-import net.sharksystem.R
-import net.sharksystem.ui.network.hub.HubListFragment
-import org.junit.jupiter.api.Test
-
-class HubListTest {
-
- @org.junit.jupiter.api.Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(ViewMatchers.withId(R.layout.fragment_hub_list)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_hub_list_add_hub_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_hub_list_recycler_view)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/HubViewTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/HubViewTest.kt
deleted file mode 100644
index 8c6bc1d..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/HubViewTest.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.ViewMatchers
-import net.sharksystem.R
-import net.sharksystem.ui.network.hub.HubViewFragment
-import org.junit.jupiter.api.Test
-
-class HubViewTest {
-
- @org.junit.jupiter.api.Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(ViewMatchers.withId(R.layout.fragment_hub_view)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_hub_view_abort_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_hub_view_default_values_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- //Espresso.onView(ViewMatchers.withId(R.id.fragment_hub_view_delete_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_hub_view_host_name_input)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_hub_view_host_name_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_hub_view_multi_channel_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_hub_view_multi_channel_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_hub_view_port_input)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_hub_view_port_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_hub_view_save_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/MessageViewTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/MessageViewTest.kt
deleted file mode 100644
index abe439c..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/MessageViewTest.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.ViewMatchers
-import net.sharksystem.R
-import org.junit.jupiter.api.Test
-import net.sharksystem.ui.channels.massage.MessageViewFragment
-
-class MessageViewTest {
-
- @org.junit.jupiter.api.Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(ViewMatchers.withId(R.layout.fragment_message_view)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_message_view_iA)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_message_view_message)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_message_view_hops)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_message_view_encrypted)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_message_view_recipients)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_message_view_sender)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_message_view_time)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/NetworkTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/NetworkTest.kt
deleted file mode 100644
index 79fd8d5..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/NetworkTest.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.ViewMatchers
-import net.sharksystem.R
-import net.sharksystem.ui.network.NetworkFragment
-import org.junit.jupiter.api.Test
-
-class NetworkTest {
-
- @Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(ViewMatchers.withId(R.layout.fragment_network)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_network_bluetooth_configure_hubs_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_network_bluetooth_configure_hubs_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_network_bluetooth_connect_hubs_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_network_bluetooth_connect_hubs_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_network_bluetooth_on_off_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_network_bluetooth_on_off_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_network_bluetooth_scan_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_network_bluetooth_scan_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/RadarFragmentTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/RadarFragmentTest.kt
deleted file mode 100644
index 400c791..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/RadarFragmentTest.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.ViewMatchers
-import net.sharksystem.R
-import net.sharksystem.ui.radar.RadarFragment
-import org.junit.jupiter.api.Test
-
-class RadarFragmentTest {
-
- @Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(ViewMatchers.withId(R.layout.fragment_radar)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_radar_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ReceiveCredentialsTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ReceiveCredentialsTest.kt
deleted file mode 100644
index 0049380..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/ReceiveCredentialsTest.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.ViewMatchers
-import net.sharksystem.R
-import net.sharksystem.ui.contacts.receiveCredentials.ReceiveCredentialsFragment
-import org.junit.jupiter.api.Test
-
-class ReceiveCredentialsTest {
-
- @Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(ViewMatchers.withId(R.layout.fragment_receive_credentials)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_receive_credentials_abort_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_receive_credentials_certificate_description_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_receive_credentials_cic_explanation_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_receive_credentials_explanation_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_receive_credentials_save_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_receive_credentials_issue_certificate_description_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_receive_credentials_show_issued_certificates_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- Espresso.onView(ViewMatchers.withId(R.id.fragment_receive_credentials_show_own_certificate_button)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/SettingsFragmentTest.kt b/app/src/androidTest/java/net/sharksystem/sharknet/fragments/SettingsFragmentTest.kt
deleted file mode 100644
index 74234c8..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/fragments/SettingsFragmentTest.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package net.sharksystem.sharknet.fragments
-
-import androidx.fragment.app.testing.launchFragmentInContainer
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.ViewMatchers
-import net.sharksystem.R
-import net.sharksystem.ui.settings.SettingsFragment
-import org.junit.jupiter.api.Test
-
-class SettingsFragmentTest {
-
- @org.junit.jupiter.api.Test
- fun allComponentsDisplayed() {
- val scenario = launchFragmentInContainer()
- Espresso.onView(ViewMatchers.withId(R.layout.fragment_settings)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- //Espresso.onView(ViewMatchers.withId(R.id.fragment_settings_text)).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/navigation/DrawerTest.java b/app/src/androidTest/java/net/sharksystem/sharknet/navigation/DrawerTest.java
deleted file mode 100644
index d04c072..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/navigation/DrawerTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package net.sharksystem.sharknet.navigation;
-
-import static androidx.test.espresso.assertion.ViewAssertions.matches;
-import static androidx.test.espresso.contrib.DrawerMatchers.isClosed;
-import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static androidx.test.espresso.matcher.ViewMatchers.withId;
-
-import android.view.Gravity;
-
-import androidx.test.espresso.Espresso;
-import androidx.test.espresso.contrib.DrawerActions;
-import androidx.test.espresso.contrib.NavigationViewActions;
-
-import net.sharksystem.R;
-
-import org.junit.jupiter.api.Test;
-
-public class DrawerTest {
-
-
- @org.junit.jupiter.api.Test
- public void fromChannelListToSettings() {
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_settings));
-
- Espresso.onView(withId(R.layout.fragment_settings)).check(matches(isDisplayed()));
- }
-
- @org.junit.jupiter.api.Test
- public void fromChannelListToContactList() {
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_contacts));
-
- Espresso.onView(withId(R.layout.fragment_contact_list)).check(matches(isDisplayed()));
- }
-
- @org.junit.jupiter.api.Test
- public void fromChannelListToRadar() {
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_radar));
-
- Espresso.onView(withId(R.layout.fragment_radar)).check(matches(isDisplayed()));
- }
-
- @org.junit.jupiter.api.Test
- public void fromChannelListToNetwork() {
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_network));
-
- Espresso.onView(withId(R.layout.fragment_network)).check(matches(isDisplayed()));
- }
-
- @org.junit.jupiter.api.Test
- public void drawerTopToBottom() {
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_settings));
-
- Espresso.onView(withId(R.layout.fragment_settings)).check(matches(isDisplayed()));
-
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_contacts));
-
- Espresso.onView(withId(R.layout.fragment_contact_list)).check(matches(isDisplayed()));
-
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_radar));
-
- Espresso.onView(withId(R.layout.fragment_radar)).check(matches(isDisplayed()));
-
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_network));
-
- Espresso.onView(withId(R.layout.fragment_network)).check(matches(isDisplayed()));
- }
-
- @Test
- public void drawerRandomNavigation() {
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_network));
-
- Espresso.onView(withId(R.layout.fragment_network)).check(matches(isDisplayed()));
-
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_settings));
-
- Espresso.onView(withId(R.layout.fragment_settings)).check(matches(isDisplayed()));
-
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_radar));
-
- Espresso.onView(withId(R.layout.fragment_radar)).check(matches(isDisplayed()));
-
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_network));
-
- Espresso.onView(withId(R.layout.fragment_network)).check(matches(isDisplayed()));
-
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_contacts));
-
- Espresso.onView(withId(R.layout.fragment_contact_list)).check(matches(isDisplayed()));
-
- Espresso.onView(withId(R.id.drawer_layout)).
- check(matches(isClosed(Gravity.LEFT))).
- perform(DrawerActions.open());
-
- Espresso.onView(withId(R.id.nav_view)).
- perform(NavigationViewActions.navigateTo(R.id.nav_radar));
- }
-}
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/navigation/PathTest.java b/app/src/androidTest/java/net/sharksystem/sharknet/navigation/PathTest.java
deleted file mode 100644
index 4d4e072..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/navigation/PathTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package net.sharksystem.sharknet.navigation;
-
-import static androidx.test.espresso.action.ViewActions.click;
-import static androidx.test.espresso.assertion.ViewAssertions.matches;
-import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static androidx.test.espresso.matcher.ViewMatchers.withId;
-
-
-import androidx.test.espresso.Espresso;
-import androidx.test.ext.junit.rules.ActivityScenarioRule;
-
-import net.sharksystem.R;
-import net.sharksystem.ui.MainActivity;
-
-import org.junit.Rule;
-import org.junit.jupiter.api.Test;
-
-public class PathTest {
-
- @Rule
- public ActivityScenarioRule activityRule =
- new ActivityScenarioRule<>(MainActivity.class);
-
- @Test
- public void fromChannelListToChannelView() {
- Espresso.onView(withId(R.id.fragment_channel_list)).check(matches(isDisplayed()));
- Espresso.onView(withId(R.id.fragment_channel_list_add_channel_button)).perform(click());
- Espresso.onView(withId(R.id.fragment_add_channel)).check(matches(isDisplayed()));
- }
-
- @org.junit.jupiter.api.Test
- public void fromChannelListToAddChannel() {
- Espresso.onView(withId(R.layout.fragment_channel_list)).check(matches(isDisplayed()));
- Espresso.onView(withId(R.id.fragment_channel_list_add_channel_button)).perform(click());
- Espresso.onView(withId(R.id.fragment_add_channel_add_button)).perform(click());
- Espresso.onView(withId(R.id.fragment_channel_list_recycler_view)).perform(click());
- Espresso.onView(withId(R.layout.fragment_channel_view)).check(matches(isDisplayed()));
- }
-}
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/ui/MainActivityTest.java b/app/src/androidTest/java/net/sharksystem/sharknet/ui/MainActivityTest.java
deleted file mode 100644
index 8c1b376..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/ui/MainActivityTest.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package net.sharksystem.sharknet.ui;
-
-import androidx.test.ext.junit.rules.ActivityScenarioRule;
-
-import net.sharksystem.ui.MainActivity;
-
-import org.junit.Rule;
-import org.junit.jupiter.api.Test;
-
-public class MainActivityTest {
-
- @Rule
- public ActivityScenarioRule activityRule =
- new ActivityScenarioRule<>(MainActivity.class);
-
- @Test
- public void layoutCorrectlyDisplayed() {
-
- }
-}
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/ui/channel/ChannelTest.java b/app/src/androidTest/java/net/sharksystem/sharknet/ui/channel/ChannelTest.java
deleted file mode 100644
index 63fa41d..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/ui/channel/ChannelTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package net.sharksystem.sharknet.ui.channel;
-
-import androidx.test.ext.junit.rules.ActivityScenarioRule;
-
-import net.sharksystem.SharkException;
-import net.sharksystem.messenger.android.SNChannelsListActivity;
-
-import org.junit.Rule;
-import org.junit.jupiter.api.Test;
-
-import java.io.IOException;
-
-public class ChannelTest {
-
- @Rule
- public ActivityScenarioRule activityRule =
- new ActivityScenarioRule<>(SNChannelsListActivity.class);
-
-
- /**
- * This test ensures, that all components are displayed
- */
- @Test
- public void channelOverviewShowsNecessaryComponents() throws SharkException, IOException {
-
- }
-}
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/ui/firstLaunch/FirstLaunchTest.java b/app/src/androidTest/java/net/sharksystem/sharknet/ui/firstLaunch/FirstLaunchTest.java
deleted file mode 100644
index 639fd42..0000000
--- a/app/src/androidTest/java/net/sharksystem/sharknet/ui/firstLaunch/FirstLaunchTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package net.sharksystem.sharknet.ui.firstLaunch;
-
-import androidx.test.ext.junit.rules.ActivityScenarioRule;
-
-import net.sharksystem.SharkException;
-import net.sharksystem.ui.MainActivity;
-
-import org.junit.Rule;
-import org.junit.jupiter.api.Test;
-
-import java.io.IOException;
-
-public class FirstLaunchTest {
-
- @Rule
- public ActivityScenarioRule activityRule =
- new ActivityScenarioRule<>(MainActivity.class);
-
-
- /**
- * This test ensures, that all components are displayed
- */
- @Test
- public void firstStartShowsNecessaryComponents() throws SharkException, IOException {
- //Espresso.onView()
- }
-}
diff --git a/app/src/androidTest/java/net/sharksystem/sharknet/utils/RecyclerViewItemCountAssertion.java b/app/src/androidTest/java/net/sharksystem/sharknet/utils/RecyclerViewItemCountAssertion.java
new file mode 100644
index 0000000..81459e3
--- /dev/null
+++ b/app/src/androidTest/java/net/sharksystem/sharknet/utils/RecyclerViewItemCountAssertion.java
@@ -0,0 +1,37 @@
+package net.sharksystem.sharknet.utils;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import android.view.View;
+
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.test.espresso.NoMatchingViewException;
+import androidx.test.espresso.ViewAssertion;
+
+/**
+ * This class allows to check the item count
+ * inside of a RecyclerView.
+ *
+ * Use as following: onView(withId(R.id.recyclerView)).check(new RecyclerViewItemCountAssertion(5));
+ *
+ * Class is copied from here: Stack Overflow
+ */
+public class RecyclerViewItemCountAssertion implements ViewAssertion {
+ private final int expectedCount;
+
+ public RecyclerViewItemCountAssertion(int expectedCount) {
+ this.expectedCount = expectedCount;
+ }
+
+ @Override
+ public void check(View view, NoMatchingViewException noViewFoundException) {
+ if (noViewFoundException != null) {
+ throw noViewFoundException;
+ }
+
+ RecyclerView recyclerView = (RecyclerView) view;
+ RecyclerView.Adapter adapter = recyclerView.getAdapter();
+ assertThat(adapter.getItemCount(), is(expectedCount));
+ }
+}
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario1.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario1.png
new file mode 100644
index 0000000..60f97af
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario1.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario10.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario10.png
new file mode 100644
index 0000000..d4965ad
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario10.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario2_1.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario2_1.png
new file mode 100644
index 0000000..8c83274
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario2_1.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario2_2.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario2_2.png
new file mode 100644
index 0000000..9632631
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario2_2.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario3_1.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario3_1.png
new file mode 100644
index 0000000..c56186e
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario3_1.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario3_2.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario3_2.png
new file mode 100644
index 0000000..7b3dd43
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario3_2.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario4.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario4.png
new file mode 100644
index 0000000..9daca21
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario4.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario5.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario5.png
new file mode 100644
index 0000000..6991030
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario5.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario6.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario6.png
new file mode 100644
index 0000000..dfa512a
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario6.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario7.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario7.png
new file mode 100644
index 0000000..41deb66
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario7.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario8_1.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario8_1.png
new file mode 100644
index 0000000..9409414
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario8_1.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario8_2.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario8_2.png
new file mode 100644
index 0000000..fcab217
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario8_2.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario9.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario9.png
new file mode 100644
index 0000000..e017b46
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Scenario9.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/SetUp/SetUp1.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/SetUp/SetUp1.png
new file mode 100644
index 0000000..19a82cb
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/SetUp/SetUp1.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/SetUp/SetUp2.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/SetUp/SetUp2.png
new file mode 100644
index 0000000..57fe7fc
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/SetUp/SetUp2.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/SetUp/SetUp3.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/SetUp/SetUp3.png
new file mode 100644
index 0000000..78268fb
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/SetUp/SetUp3.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Arrow.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Arrow.png
new file mode 100644
index 0000000..699d266
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Arrow.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Shared1.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Shared1.png
new file mode 100644
index 0000000..d9f2131
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Shared1.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Shared2.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Shared2.png
new file mode 100644
index 0000000..039a7f1
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Shared2.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Shared3.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Shared3.png
new file mode 100644
index 0000000..8af9afe
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Shared3.png differ
diff --git a/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Shared4.png b/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Shared4.png
new file mode 100644
index 0000000..4332e7b
Binary files /dev/null and b/app/src/javadoc/net/sharksystem/addMessageScenarios/Shared/Shared4.png differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index b98111c..24059ff 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,6 +1,8 @@
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="net.sharksystem">
@@ -13,26 +15,17 @@
android:supportsRtl="true"
android:theme="@style/NoActionBar"
tools:replace="android:theme">
-
-
-
-
-
-
+
-
+
+
-
+
@@ -40,40 +33,33 @@
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
-
-
-
\ No newline at end of file
+
+
+
diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png
deleted file mode 100644
index 79f36ff..0000000
Binary files a/app/src/main/ic_launcher-playstore.png and /dev/null differ
diff --git a/app/src/main/java/net/sharksystem/android/util/PermissionCheck.java b/app/src/main/java/net/sharksystem/android/util/PermissionCheck.java
index ca61e7b..b30dc09 100644
--- a/app/src/main/java/net/sharksystem/android/util/PermissionCheck.java
+++ b/app/src/main/java/net/sharksystem/android/util/PermissionCheck.java
@@ -6,7 +6,6 @@
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
-@Deprecated
public class PermissionCheck {
public static void askForPermissions(Activity activity, String[] permissions) {
if(permissions == null || permissions.length < 1) return;
diff --git a/app/src/main/java/net/sharksystem/messenger/android/SNChannelAddMessageActivity.java b/app/src/main/java/net/sharksystem/messenger/android/SNChannelAddMessageActivity.java
index bf32c4f..1681f7a 100644
--- a/app/src/main/java/net/sharksystem/messenger/android/SNChannelAddMessageActivity.java
+++ b/app/src/main/java/net/sharksystem/messenger/android/SNChannelAddMessageActivity.java
@@ -45,7 +45,7 @@ protected void onCreate(Bundle savedInstanceState) {
Log.d(this.getLogStart(), "created with name: " + this.name + " / " + this.uri);
- TextView topicTextView = (TextView) findViewById(R.id.fragment_add_message_channel_name);
+ TextView topicTextView = (TextView) findViewById(R.id.snChannelName);
topicTextView.setText(this.name);
}
@@ -61,10 +61,10 @@ public void onEncryptedClick(View view) {
}
private void redrawComments() {
- TextView commentsTextView = findViewById(R.id.fragment_add_message_comments);
+ TextView commentsTextView = findViewById(R.id.comments);
commentsTextView.setText("");
- CheckBox encryptedCheckBox = findViewById(R.id.fragment_add_message_encrypted_checkbox);
+ CheckBox encryptedCheckBox = findViewById(R.id.snEncrypted);
if(this.selectedRecipients != null && this.selectedRecipients.size() > 1) {
if (encryptedCheckBox.isChecked()) {
@@ -90,7 +90,7 @@ public void onRemoveRecipients(View view) {
public void onSendClick(View view) {
// get new message
- EditText messageTextView = (EditText) findViewById(R.id.fragment_add_message_message_input);
+ EditText messageTextView = (EditText) findViewById(R.id.snMessage);
String messageText = messageTextView.getText().toString();
@@ -101,10 +101,10 @@ public void onSendClick(View view) {
// let's sort things out.
byte[] content = messageText.getBytes();
- CheckBox signCheckBox = findViewById(R.id.fragment_add_message_signed_checkbox);
+ CheckBox signCheckBox = findViewById(R.id.snSigned);
boolean sign = signCheckBox.isChecked();
- CheckBox encryptedCheckBox = findViewById(R.id.fragment_add_message_encrypted_checkbox);
+ CheckBox encryptedCheckBox = findViewById(R.id.snEncrypted);
boolean encrypt = encryptedCheckBox.isChecked();
// send with shark messenger
@@ -154,7 +154,7 @@ private void redrawRecipientList() {
recipientsString = sb.toString();
}
- TextView tv = this.findViewById(R.id.fragment_add_message_message_recipients);
+ TextView tv = this.findViewById(R.id.snMessageRecipients);
tv.setText(recipientsString);
this.redrawComments();
diff --git a/app/src/main/java/net/sharksystem/messenger/android/SNChannelInformation.java b/app/src/main/java/net/sharksystem/messenger/android/SNChannelInformation.java
index 36a7cd2..831bc87 100644
--- a/app/src/main/java/net/sharksystem/messenger/android/SNChannelInformation.java
+++ b/app/src/main/java/net/sharksystem/messenger/android/SNChannelInformation.java
@@ -1,6 +1,5 @@
package net.sharksystem.messenger.android;
-@Deprecated
class SNChannelInformation {
final CharSequence uri;
final CharSequence name;
diff --git a/app/src/main/java/net/sharksystem/messenger/android/SNChannelsListContentAdapter.java b/app/src/main/java/net/sharksystem/messenger/android/SNChannelsListContentAdapter.java
index c83426b..6607dae 100644
--- a/app/src/main/java/net/sharksystem/messenger/android/SNChannelsListContentAdapter.java
+++ b/app/src/main/java/net/sharksystem/messenger/android/SNChannelsListContentAdapter.java
@@ -41,8 +41,8 @@ public class MyViewHolder extends RecyclerView.ViewHolder {
public MyViewHolder(View view) {
super(view);
- uriTextView = view.findViewById(R.id.sn_channel_list_row_uri);
- nameTextView = view.findViewById(R.id.sn_channel_list_row_name);
+ uriTextView = (TextView) view.findViewById(R.id.sn_channel_list_row_uri);
+ nameTextView = (TextView) view.findViewById(R.id.sn_channel_list_row_name);
view.setOnClickListener(clickListener);
}
}
@@ -98,10 +98,10 @@ public int getItemCount() {
public void onClick(View view) {
Log.d(this.getLogStart(), "click on view recognized");
- TextView uriTextView = view.findViewById(R.id.sn_channel_list_row_uri);
+ TextView uriTextView = (TextView) view.findViewById(R.id.sn_channel_list_row_uri);
Log.d(this.getLogStart(), "uri: " + uriTextView.getText());
- TextView nameTextView = view.findViewById(R.id.sn_channel_list_row_name);
+ TextView nameTextView = (TextView) view.findViewById(R.id.sn_channel_list_row_name);
Log.d(this.getLogStart(), "name: " + nameTextView.getText());
ASAPChannelIntent intent =
diff --git a/app/src/main/java/net/sharksystem/messenger/android/SNMessageViewHelper.java b/app/src/main/java/net/sharksystem/messenger/android/SNMessageViewHelper.java
index 543f882..8d6671e 100644
--- a/app/src/main/java/net/sharksystem/messenger/android/SNMessageViewHelper.java
+++ b/app/src/main/java/net/sharksystem/messenger/android/SNMessageViewHelper.java
@@ -1,19 +1,24 @@
package net.sharksystem.messenger.android;
+import android.widget.Toast;
+
import net.sharksystem.asap.ASAPException;
import net.sharksystem.asap.ASAPHop;
import net.sharksystem.asap.ASAPSecurityException;
+import net.sharksystem.asap.utils.ASAPSerialization;
import net.sharksystem.asap.utils.DateTimeHelper;
import net.sharksystem.messenger.SharkMessage;
import net.sharksystem.sharknet.android.SharkNetApp;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.OutputStream;
import java.sql.Timestamp;
import java.util.List;
import java.util.Set;
-public class SNMessageViewHelper {
- public static CharSequence getReceiversCharSequence(SharkMessage sharkMessage) {
+class SNMessageViewHelper {
+ static CharSequence getReceiversCharSequence(SharkMessage sharkMessage) {
CharSequence receiversCharSequence;
Set recipients = sharkMessage.getRecipients();
if (recipients == null || recipients.isEmpty()) {
@@ -30,7 +35,7 @@ public static CharSequence getReceiversCharSequence(SharkMessage sharkMessage) {
sb.append("|");
}
- CharSequence recipientName;
+ CharSequence recipientName = null;
try {
recipientName = SharkNetApp.getSharkNetApp().getSharkPKI()
.getPersonValuesByID(recipientID).getName();
@@ -47,7 +52,7 @@ public static CharSequence getReceiversCharSequence(SharkMessage sharkMessage) {
return receiversCharSequence;
}
- public static CharSequence getEncryptedCharSequence(SharkMessage sharkMessage) {
+ static CharSequence getEncryptedCharSequence(SharkMessage sharkMessage) {
CharSequence encryptedCharSequence = "not E2E encrypted";
if (sharkMessage.encrypted()) {
encryptedCharSequence = "is E2E encrypted";
@@ -56,7 +61,7 @@ public static CharSequence getEncryptedCharSequence(SharkMessage sharkMessage) {
return encryptedCharSequence;
}
- public static CharSequence getSenderCharSequence(SharkMessage sharkMessage) {
+ static CharSequence getSenderCharSequence(SharkMessage sharkMessage) {
CharSequence senderName;
@@ -91,7 +96,7 @@ public static CharSequence getContentCharSequence(SharkMessage sharkMessage) {
}
public static CharSequence getVerifiedCharSequence(SharkMessage sharkMessage) {
- CharSequence verified2View;
+ CharSequence verified2View = "not verified";
if (sharkMessage.couldBeDecrypted()) {
try {
if (sharkMessage.verified()) {
@@ -110,10 +115,10 @@ public static CharSequence getVerifiedCharSequence(SharkMessage sharkMessage) {
}
public static CharSequence getCreationTimeCharSequence(SharkMessage sharkMessage) {
- CharSequence creationTimeCharSequence;
+ CharSequence creationTimeCharSequence = "time: unknown";
if(sharkMessage.couldBeDecrypted()) {
- Timestamp creationTime;
+ Timestamp creationTime = null;
try {
creationTime = sharkMessage.getCreationTime();
creationTimeCharSequence = DateTimeHelper.long2DateString(creationTime.getTime());
diff --git a/app/src/main/java/net/sharksystem/pki/android/CertificateListActivity.java b/app/src/main/java/net/sharksystem/pki/android/CertificateListActivity.java
index f5c51c8..4b6d989 100644
--- a/app/src/main/java/net/sharksystem/pki/android/CertificateListActivity.java
+++ b/app/src/main/java/net/sharksystem/pki/android/CertificateListActivity.java
@@ -159,7 +159,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
Toast.makeText(this, "something clicked", Toast.LENGTH_SHORT).show();
return true;
- case R.id.fragment_receive_credentials_abort_button:
+ case R.id.abortButton:
this.finish();
return true;
diff --git a/app/src/main/java/net/sharksystem/pki/android/CredentialExchangeActivity.java b/app/src/main/java/net/sharksystem/pki/android/CredentialExchangeActivity.java
index 75978e6..c8f0e9d 100644
--- a/app/src/main/java/net/sharksystem/pki/android/CredentialExchangeActivity.java
+++ b/app/src/main/java/net/sharksystem/pki/android/CredentialExchangeActivity.java
@@ -42,9 +42,6 @@ static void addCredentialMessageToObjectHolder(CredentialMessage credentialMessa
objectHolder.setObject(CredentialViewActivity.CREDENTIAL_VIEW_ONLY_TAG, Boolean.TRUE);
}
- /**
- * Called when the user wants to send his own credentials
- */
public void onSendCredentialsClick(View view) {
EditText cicEditText = findViewById(R.id.editTextCic);
byte[] cic = cicEditText.getText().toString().getBytes(StandardCharsets.UTF_8);
@@ -70,9 +67,6 @@ public void onSendCredentialsClick(View view) {
}
}
- /**
- * Called when the user wants to receive the credentials from another user
- */
public void onReceiveCredentialsClick(View view) {
Intent intent = new Intent(this, CredentialReceiveActivity.class);
this.startActivity(intent);
diff --git a/app/src/main/java/net/sharksystem/pki/android/CredentialReceiveActivity.java b/app/src/main/java/net/sharksystem/pki/android/CredentialReceiveActivity.java
index fbc8a95..f50686e 100644
--- a/app/src/main/java/net/sharksystem/pki/android/CredentialReceiveActivity.java
+++ b/app/src/main/java/net/sharksystem/pki/android/CredentialReceiveActivity.java
@@ -4,15 +4,16 @@
import android.os.Bundle;
import android.util.Log;
import android.view.View;
+import android.widget.Toast;
import net.sharksystem.R;
+import net.sharksystem.asap.ASAPMessages;
import net.sharksystem.pki.CredentialMessage;
import net.sharksystem.pki.SharkCredentialReceivedListener;
import net.sharksystem.sharknet.android.SharkNetActivity;
-/**
- * Activity for receiving credentials
- */
+import java.util.Iterator;
+
public class CredentialReceiveActivity extends SharkNetActivity
implements SharkCredentialReceivedListener {
@@ -27,23 +28,19 @@ protected void onCreate(Bundle savedInstanceState) {
Log.d(getLogStart(), "credential message Listener registered");
}
- /**
- * Called when the users cancels the receiving process
- */
public void onAbortClick(View v) {
this.finish();
}
- /**
- * Called when the credentials were received
- */
@Override
public void credentialReceived(CredentialMessage credentialMessage) {
CredentialExchangeActivity.addCredentialMessageToObjectHolder(credentialMessage, false);
// TODO shouldn't it be possible to remove the listener
// since this is a manual process of receiving credentials?
Intent intent = new Intent(this, CredentialViewActivity.class);
+
this.startActivity(intent);
+
this.finish();
}
}
diff --git a/app/src/main/java/net/sharksystem/pki/android/OwnerActivity.java b/app/src/main/java/net/sharksystem/pki/android/OwnerActivity.java
index 1a67868..eb0dbc2 100644
--- a/app/src/main/java/net/sharksystem/pki/android/OwnerActivity.java
+++ b/app/src/main/java/net/sharksystem/pki/android/OwnerActivity.java
@@ -16,10 +16,6 @@
import net.sharksystem.sharknet.android.SharkNetActivity;
import net.sharksystem.sharknet.android.SharkNetApp;
-/**
- * This activity is responsible for allowing the user to change the previously specified owner name
- * and to initialize the exchange of the pki credentials
- */
public class OwnerActivity extends SharkNetActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -43,10 +39,9 @@ protected void onCreate(Bundle savedInstanceState) {
this.getSharkNetApp().setupDrawerLayout(this);
}
-
private void setKeyCreationDateView() throws ASAPSecurityException {
TextView creationTime = this.findViewById(R.id.ownerKeysCreationTime);
- // that's funny because long is a homonym: data type but also means a long period of time... ok, this is not funny at all... :/
+ // that's funny because long is a homonym: data type but also means a long periode of time... ok, this is not funny at all... :/
long longTime = this.getSharkNetApp().getSharkPKI().getKeysCreationTime();
if(longTime == DateTimeHelper.TIME_NOT_SET) {
@@ -65,18 +60,11 @@ private void notifyKeyPairCreated() {
this.startActivity(new Intent(this, OwnerActivity.class));
}
- /**
- * Called when the user wants to send/receive the credentials to/from another user
- */
public void onSendOrReceiveCredentials(View view) {
this.finish();
this.startActivity(new Intent(this, CredentialExchangeActivity.class));
}
-
- /**
- * Called when the user clicks the save button to save the new owner name
- */
public void onSaveClick(View view) {
EditText ownerNameEditText = findViewById(R.id.ownerDisplayName);
String ownerNameString = ownerNameEditText.getText().toString();
@@ -94,35 +82,24 @@ public void onSaveClick(View view) {
}
}
-
-
public void onShowOwnerAsSubjectCertificates(View view) {
Log.d(Util.getLogStart(this), "onShowOwnerAsSubjectCertificates");
- Intent intent;
+ Intent intent = null;
intent = new PersonIntent(this,
this.getSharkNetApp().getOwnerID(),
CertificateListActivity.class);
this.startActivity(intent);
}
- /**
- * Creates a new key pair in a new Thread
- */
public void onCreateNewKeys(View view) {
new CreateKeyPairThread(this).start();
}
- /**
- * Clicked by the user to get back to the last activity
- */
public void onAbortClick(View view) {
// go back to previous activity
this.finish();
}
- /**
- * Thread for generating key pairs
- */
private class CreateKeyPairThread extends Thread {
private final OwnerActivity ownerActivity;
@@ -131,7 +108,7 @@ private class CreateKeyPairThread extends Thread {
}
public void run() {
- String text;
+ String text = null;
try {
OwnerActivity.this.getSharkNetApp().getSharkPKI().generateKeyPair();
diff --git a/app/src/main/java/net/sharksystem/pki/android/PersonListSelectionActivity.java b/app/src/main/java/net/sharksystem/pki/android/PersonListSelectionActivity.java
index dc52a23..04733c0 100644
--- a/app/src/main/java/net/sharksystem/pki/android/PersonListSelectionActivity.java
+++ b/app/src/main/java/net/sharksystem/pki/android/PersonListSelectionActivity.java
@@ -34,7 +34,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
this.doDone();
return true;
- case R.id.fragment_receive_credentials_abort_button:
+ case R.id.abortButton:
this.finish();
return true;
diff --git a/app/src/main/java/net/sharksystem/pki/android/PersonListViewActivity.java b/app/src/main/java/net/sharksystem/pki/android/PersonListViewActivity.java
index 9e41509..6f89e80 100644
--- a/app/src/main/java/net/sharksystem/pki/android/PersonListViewActivity.java
+++ b/app/src/main/java/net/sharksystem/pki/android/PersonListViewActivity.java
@@ -45,7 +45,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
this.doAddPerson();
return true;
- case R.id.fragment_receive_credentials_abort_button:
+ case R.id.abortButton:
this.finish();
return true;
diff --git a/app/src/main/java/net/sharksystem/pki/android/SelectableListContentAdapterHelper.java b/app/src/main/java/net/sharksystem/pki/android/SelectableListContentAdapterHelper.java
index e33e082..856e5db 100644
--- a/app/src/main/java/net/sharksystem/pki/android/SelectableListContentAdapterHelper.java
+++ b/app/src/main/java/net/sharksystem/pki/android/SelectableListContentAdapterHelper.java
@@ -8,12 +8,12 @@
import java.util.HashSet;
import java.util.Set;
-public class SelectableListContentAdapterHelper {
+class SelectableListContentAdapterHelper {
private Set selectedItemIDs = new HashSet<>();
private Set uidSet = new HashSet<>();
private Set preselectedUIDSet = null;
- public void setPreselection(Set preselected) {
+ void setPreselection(Set preselected) {
this.preselectedUIDSet = preselected;
}
diff --git a/app/src/main/java/net/sharksystem/sharknet/android/InitActivity.java b/app/src/main/java/net/sharksystem/sharknet/android/InitActivity.java
index f58c6b8..c0aa666 100644
--- a/app/src/main/java/net/sharksystem/sharknet/android/InitActivity.java
+++ b/app/src/main/java/net/sharksystem/sharknet/android/InitActivity.java
@@ -11,79 +11,55 @@
import net.sharksystem.R;
import net.sharksystem.SharkException;
import net.sharksystem.messenger.android.SNChannelsListActivity;
+import net.sharksystem.pki.android.CredentialExchangeActivity;
+import net.sharksystem.pki.android.OwnerActivity;
+import net.sharksystem.pki.android.PersonListViewActivity;
+import net.sharksystem.sharknet.android.settings.SettingsActivity;
+
import java.io.IOException;
-/**
- * Initial Activity which is the entry point of the Shark Messenger application
- */
public class InitActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Log.d(this.getLogStart(), "Startup SharkNetApplication");
- //Log that the SharkMessenger was started the first time
- Log.d(this.getLogStart(), "Shark Messenger was started!");
-
- //check if this start is the first one ever on this device
try {
- //if the owner id is already present, the user already entered it, so this can't be
- // the first start
- //if this call throws an exception, then this is in fact the first start, so in the
- // catch block this case is treated. To be concise: this could actually be the second
- // or further time this app was started, as the user may cancelled the app before
- // setting his name, so the owner id is still not set. When the owner id was confirmed,
- // any further starts aren't counting as initial first start ever again.
+ // used before? is there an ownerID?
String ownerID = SharkNetApp.getOwnerID(this);
+ // yes - ignition!
this.initializeSystem(ownerID);
-
} catch(SharkException se) {
- Log.d(this.getLogStart(), "Shark Messenger was most probably started the first " +
- "time on this device. Full certainty will be delivered by the following exception message: " +
- se.getLocalizedMessage());
+ Log.d(this.getLogStart(), "most probably first app usage: "
+ + se.getLocalizedMessage());
- //as this is the first start, the owner id was never set before. This needs to be done
- // now. It's done within this activity by displaying the therefor intended layout
+ // no - ask for name with this activity
setContentView(R.layout.init);
}
}
private void initializeSystem(String ownerID) {
try {
-
- /* This code will almost certainly be removed in a later step. Differentiating between
- the first and any other launch isn't necessary anymore
- //if it's the first launch ever
boolean veryFirstLaunch = false;
if(ownerID == null) {
veryFirstLaunch = true;
ownerID = SharkNetApp.getOwnerID(this);
}
- */
- //core initialization
SharkNetApp.initializeSharkNetApp(this, ownerID);
- Log.d(this.getLogStart(), "Shark system was initialized. The main Shark Messenger Activity is started now.");
-
+ Log.d(this.getLogStart(), "shark system is initialized - start first activity");
- /*
- TODO: this code isn't necessary:
- at the end, there should be one app which includes all functionality
-
- if it's the first launch, then always open the OwnerActivity next
- else wise, the next activity is chosen by the following "switch"
- Class> firstActivity = veryFirstLaunch ? OwnerActivity.class : SNChannelsListActivity.class;
- Class> firstActivity = veryFirstLaunch ? OwnerActivity.class : SNTestActivity.class;
- Class> firstActivity = veryFirstLaunch ? OwnerActivity.class : PersonListViewActivity.class;
- Class> firstActivity = veryFirstLaunch ? OwnerActivity.class : SettingsActivity.class;
- Class> firstActivity = veryFirstLaunch ? OwnerActivity.class : CredentialExchangeActivity.class;
-
- */
+// Class firstActivity = veryFirstLaunch ? OwnerActivity.class : SNChannelsListActivity.class;
+// Class firstActivity = veryFirstLaunch ? OwnerActivity.class : SNTestActivity.class;
+// Class firstActivity = veryFirstLaunch ? OwnerActivity.class : PersonListViewActivity.class;
+ Class firstActivity = veryFirstLaunch ? OwnerActivity.class : SettingsActivity.class;
+// Class firstActivity = veryFirstLaunch ? OwnerActivity.class : CredentialExchangeActivity.class;
+ Log.d(this.getLogStart(), "shark system is initialized - start first activity:"
+ + firstActivity.getClass().getSimpleName());
this.finish();
-
- //launch main Shark Messenger activity
- Intent intent = new Intent(this, SNChannelsListActivity.class);
+ Intent intent = new Intent(this, firstActivity);
this.startActivity(intent);
}
catch(SharkException se) {
@@ -97,32 +73,20 @@ private void initializeSystem(String ownerID) {
}
}
- /**
- * This method is called when the user wants to save his owner id and can therefor only be
- * invoked, when it was the first time, the user opened this app.
- */
public void onSaveClick(View view) {
- //Read string from text field
EditText ownerNameEditText = this.findViewById(R.id.initOwnerName);
+
String ownerName = ownerNameEditText.getText().toString();
try {
- //now initialize
SharkNetApp.initializeSystem(this, ownerName);
- //even though, the ownerId was generated by the above function, pass null to distinguish
- // between first and second or higher start
- this.initializeSystem(SharkNetApp.getOwnerID(this));
-
+ this.initializeSystem(null);
} catch (SharkException e) {
Toast.makeText(this, e.getLocalizedMessage(), Toast.LENGTH_SHORT).show();
}
}
- /**
- * Returns the log identifier for this class. It is for logging purposes only
- * @return the identifying tag for this class
- */
private String getLogStart() {
- return "SharkMessenger InitActivity";
+ return "SharkNet2 InitActivity";
}
}
diff --git a/app/src/main/java/net/sharksystem/sharknet/android/SharkNetApp.java b/app/src/main/java/net/sharksystem/sharknet/android/SharkNetApp.java
index 8564ef4..fcb854b 100644
--- a/app/src/main/java/net/sharksystem/sharknet/android/SharkNetApp.java
+++ b/app/src/main/java/net/sharksystem/sharknet/android/SharkNetApp.java
@@ -246,7 +246,6 @@ public static String getOwnerID(Context context) throws SharkException {
*/
public static void initializeSystem(Context ctx, CharSequence ownerName)
throws SharkException {
- //owner name can't be empty or the default name
checkOwnerName(ownerName);
SharedPreferences sharedPref = ctx.getSharedPreferences(
@@ -254,12 +253,11 @@ public static void initializeSystem(Context ctx, CharSequence ownerName)
SharedPreferences.Editor editor = sharedPref.edit();
- //owner name saved under associated tag
editor.putString(OWNER_NAME, ownerName.toString());
// create owner id
// if (!sharedPref.contains(OWNER_ID)) {
- String ownerID = ASAP.createUniqueID(); // TODO is changed on every startup - correct? Otherwise uncomment
+ String ownerID = ASAP.createUniqueID(); // TODO is changed on every startup - correct?
editor.putString(OWNER_ID, ownerID);
// }
editor.apply();
diff --git a/app/src/main/java/net/sharksystem/sharknet/android/settings/HubDescriptionEditActivity.java b/app/src/main/java/net/sharksystem/sharknet/android/settings/HubDescriptionEditActivity.java
index 905b654..ca7c656 100644
--- a/app/src/main/java/net/sharksystem/sharknet/android/settings/HubDescriptionEditActivity.java
+++ b/app/src/main/java/net/sharksystem/sharknet/android/settings/HubDescriptionEditActivity.java
@@ -28,7 +28,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = this.getIntent();
- // prepare defaults if a new entry is created
+ // prepare defaults if a new enty is created
CharSequence hostNameString = "hostName";
CharSequence portString = String.valueOf(Hub.DEFAULT_PORT);
int layout = R.layout.settings_hub_description_editor_drawer_layout;
@@ -57,23 +57,23 @@ protected void onCreate(Bundle savedInstanceState) {
SharkNetApp.getSharkNetApp().setupDrawerLayout(this);
- EditText etHostName = this.findViewById(R.id.fragment_hub_view_host_name_input);
- EditText etPort = this.findViewById(R.id.fragment_hub_view_port_input);
+ EditText etHostName = this.findViewById(R.id.settingsTCPHubDescriptionHostName);
+ EditText etPort = this.findViewById(R.id.settingsTCPHubDescriptionPort);
etHostName.setText(hostNameString);
etPort.setText(portString);
}
public void onClick(View view) {
- if(view == this.findViewById(R.id.fragment_receive_credentials_abort_button)) {
+ if(view == this.findViewById(R.id.abortButton)) {
this.finish();
return;
}
- if(view == this.findViewById(R.id.fragment_hub_view_default_values_button)) {
- EditText etHostName = this.findViewById(R.id.fragment_hub_view_host_name_input);
- EditText etPort = this.findViewById(R.id.fragment_hub_view_port_input);
- ToggleButton tbMultiChannel = this.findViewById(R.id.fragment_hub_view_multi_channel_button);
+ if(view == this.findViewById(R.id.defaultButton)) {
+ EditText etHostName = this.findViewById(R.id.settingsTCPHubDescriptionHostName);
+ EditText etPort = this.findViewById(R.id.settingsTCPHubDescriptionPort);
+ ToggleButton tbMultiChannel = this.findViewById(R.id.settingsTCPHubDescriptionMultiChannel);
etHostName.setText("asaphub.f4.htw-berlin.de");
etPort.setText("6910");
@@ -84,9 +84,9 @@ public void onClick(View view) {
// remove or add - in any case create a description object from GUI entries
// add new one
- EditText etHostName = this.findViewById(R.id.fragment_hub_view_host_name_input);
- EditText etPort = this.findViewById(R.id.fragment_hub_view_port_input);
- ToggleButton tbMultiChannel = this.findViewById(R.id.fragment_hub_view_multi_channel_button);
+ EditText etHostName = this.findViewById(R.id.settingsTCPHubDescriptionHostName);
+ EditText etPort = this.findViewById(R.id.settingsTCPHubDescriptionPort);
+ ToggleButton tbMultiChannel = this.findViewById(R.id.settingsTCPHubDescriptionMultiChannel);
String hostNameString = etHostName.getEditableText().toString();
String portString = etPort.getEditableText().toString();
@@ -110,7 +110,7 @@ public void onClick(View view) {
if(view == this.findViewById(R.id.deleteButton)) {
sPeer.removeHubDescription(descriptionFromGUI);
}
- else if(view == this.findViewById(R.id.fragment_hub_view_save_button)) {
+ else if(view == this.findViewById(R.id.save)) {
// remove old one - it was most probably changed
if(this.origHubDescription != null) {
sPeer.removeHubDescription(this.origHubDescription);
diff --git a/app/src/main/java/net/sharksystem/sharknet/android/settings/SettingsActivity.java b/app/src/main/java/net/sharksystem/sharknet/android/settings/SettingsActivity.java
index ea2b849..3b548e3 100644
--- a/app/src/main/java/net/sharksystem/sharknet/android/settings/SettingsActivity.java
+++ b/app/src/main/java/net/sharksystem/sharknet/android/settings/SettingsActivity.java
@@ -4,14 +4,31 @@
import android.os.Bundle;
import android.util.Log;
import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
import android.widget.CompoundButton;
+import android.widget.ListView;
import android.widget.ToggleButton;
import net.sharksystem.R;
+import net.sharksystem.SharkPeer;
import net.sharksystem.asap.android.apps.ASAPActivity;
+import net.sharksystem.asap.android.apps.ASAPAndroidPeer;
+import net.sharksystem.asap.android.apps.HubConnectionManagerApplicationSide;
+import net.sharksystem.asap.android.apps.HubManagerStatusChangedListener;
+import net.sharksystem.hub.HubConnectionManager;
+import net.sharksystem.hub.peerside.HubConnectorDescription;
+import net.sharksystem.sharknet.android.SharkNetActivity;
import net.sharksystem.sharknet.android.SharkNetApp;
-public class SettingsActivity extends ASAPActivity {
+import java.util.ArrayList;
+import java.util.List;
+
+public class SettingsActivity extends ASAPActivity implements HubManagerStatusChangedListener {
+ private HubConnectionManagerApplicationSide hubConnectionManager;
+ private ListView listViewConnectedHubs;
+ private ListView listViewFailedAttempts;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -20,6 +37,10 @@ protected void onCreate(Bundle savedInstanceState) {
SharkNetApp.getSharkNetApp().setupDrawerLayout(this);
+ hubConnectionManager = (HubConnectionManagerApplicationSide) this.getHubConnectionManager();
+ listViewConnectedHubs = findViewById(R.id.settingsConnectedHubsList);
+ listViewFailedAttempts = findViewById(R.id.settingsFailedAttemptsList);
+ hubConnectionManager.addListener(this);
// add listener for each setting
////////////////////////////////////////////////////////////////////////////
@@ -27,7 +48,7 @@ protected void onCreate(Bundle savedInstanceState) {
////////////////////////////////////////////////////////////////////////////
///////////////// BLUETOOTH
- ToggleButton toggle = (ToggleButton) findViewById(R.id.fragment_network_bluetooth_on_off_button);
+ ToggleButton toggle = (ToggleButton) findViewById(R.id.settingsBluetoothToggleButton);
// set initial status
toggle.setChecked(this.isBluetoothEnvironmentOn());
@@ -93,7 +114,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
});
*/
///////////////// BLUETOOTH DISCOVERY AND DISCOVERABLE = SCAN BT
- toggle = (ToggleButton) findViewById(R.id.fragment_network_bluetooth_scan_button);
+ toggle = (ToggleButton) findViewById(R.id.settingsBluetoothD_And_D_ExplanationButton);
// set initial status
toggle.setChecked(isBluetoothDiscovery());
@@ -116,7 +137,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
});
///////////////// ASAP Hub on / off
- toggle = (ToggleButton) findViewById(R.id.fragment_network_bluetooth_connect_hubs_button);
+ toggle = (ToggleButton) findViewById(R.id.settingsASAPHubsExplanationButton);
// set initial status
toggle.setChecked(isASAPHubsConnected());
@@ -127,14 +148,25 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (!dontDoAnything) {
if (isChecked) {
- Log.d(getLogStart(), "ui said: switch on BT D and D");
- connectASAPHubs();
+ Log.d(getLogStart(), String.format("connect ASAPHubs.. Available " +
+ "descriptions: %d",SharkNetApp.getSharkNetApp().getSharkPeer().getHubDescriptions().size()));
+ for (HubConnectorDescription hcd: SharkNetApp.getSharkNetApp().getSharkPeer().getHubDescriptions() ) {
+ connectASAPHubs(hcd);
+ }
} else {
- disconnectASAPHubs();
+ for (HubConnectorDescription hcd: SharkNetApp.getSharkNetApp().getSharkPeer().getHubDescriptions() ) {
+ disconnectASAPHubs(hcd);
+ }
}
}
}
});
+
+ ///////////////// ASAP Hub refresh connected hubs list and failed connection attempts list
+ Button refreshButton = findViewById(R.id.settingsRefreshHubListButton);
+ refreshButton.setOnClickListener(view -> {
+ hubConnectionManager.refreshHubList();
+ });
}
private boolean dontDoAnything = false;
@@ -142,7 +174,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
private void refreshToggleButtons() {
this.dontDoAnything = true;
- ToggleButton toggle = (ToggleButton) findViewById(R.id.fragment_network_bluetooth_on_off_button);
+ ToggleButton toggle = (ToggleButton) findViewById(R.id.settingsBluetoothToggleButton);
toggle.setChecked(this.isBluetoothEnvironmentOn());
toggle.refreshDrawableState();
@@ -156,7 +188,7 @@ private void refreshToggleButtons() {
toggle.refreshDrawableState();
*/
- toggle = (ToggleButton) findViewById(R.id.fragment_network_bluetooth_scan_button);
+ toggle = (ToggleButton) findViewById(R.id.settingsBluetoothD_And_D_ExplanationButton);
toggle.setChecked(this.isBluetoothDiscovery());
toggle.refreshDrawableState();
@@ -220,4 +252,18 @@ public void asapNotifyBTDiscoveryStopped() {
super.asapNotifyBTDiscoveryStopped();
this.refreshToggleButtons();
}
+
+ @Override
+ public void notifyHubListReceived() {
+ List connectedHubs = new ArrayList<>();
+ for (HubConnectorDescription hcd : hubConnectionManager.getConnectedHubs()) {
+ connectedHubs.add(hcd.toString());
+ }
+ List failedAttempts = new ArrayList<>();
+ for (HubConnectionManager.FailedConnectionAttempt attempt : hubConnectionManager.getFailedConnectionAttempts()) {
+ failedAttempts.add(attempt.getHubConnectorDescription().toString());
+ }
+ listViewConnectedHubs.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, connectedHubs.toArray(new String[0])));
+ listViewFailedAttempts.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, failedAttempts.toArray(new String[0])));
+ }
}
diff --git a/app/src/main/java/net/sharksystem/ui/MainActivity.java b/app/src/main/java/net/sharksystem/ui/MainActivity.java
deleted file mode 100644
index b007961..0000000
--- a/app/src/main/java/net/sharksystem/ui/MainActivity.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package net.sharksystem.ui;
-
-import android.os.Bundle;
-import android.util.Log;
-
-import com.google.android.material.navigation.NavigationView;
-
-import androidx.lifecycle.ViewModelProvider;
-import androidx.navigation.NavController;
-import androidx.navigation.Navigation;
-import androidx.navigation.fragment.NavHostFragment;
-import androidx.navigation.ui.AppBarConfiguration;
-import androidx.navigation.ui.NavigationUI;
-import androidx.drawerlayout.widget.DrawerLayout;
-import androidx.appcompat.app.AppCompatActivity;
-
-import net.sharksystem.R;
-import net.sharksystem.SharkException;
-import net.sharksystem.databinding.ActivityMainBinding;
-import net.sharksystem.sharknet.android.SharkNetApp;
-import net.sharksystem.ui.channels.massage.AddMessageViewModel;
-
-import java.io.IOException;
-
-/**
- * Main Activity of the Shark messenger application
- */
-public class MainActivity extends AppCompatActivity {
-
- /**
- * Object for app bar configuration
- */
- private AppBarConfiguration appBarConfiguration;
-
- /**
- * Binding to access elements from the layout
- */
- private ActivityMainBinding binding;
-
- private MainAppViewModel viewModel;
-
- private NavController navController;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- //use bindings for easier use of view elements
- // see: https://developer.android.com/topic/libraries/view-binding
- binding = ActivityMainBinding.inflate(getLayoutInflater());
- this.viewModel = new ViewModelProvider(this).get(MainAppViewModel.class);
-
- this.setContentView(binding.getRoot());
-
- //set action bar at the top of the screen
- this.setSupportActionBar(binding.appBarMain.toolbar);
-
- //find the drawer layout and the navigation view (equivalent to findViewById call)
- DrawerLayout drawer = binding.drawerLayout;
-
- this.viewModel.shouldDrawerBeLocked().observe(this, shouldBeLocked -> {
- if(shouldBeLocked) {
- drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
- } else {
- drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
- }
- });
-
- NavigationView navigationView = binding.navView;
-
- // Passing each menu ID as a set of Ids because each
- // menu should be considered as top level destinations.
- appBarConfiguration = new AppBarConfiguration.Builder(
- R.id.nav_channels,
- R.id.nav_settings,
- R.id.nav_contacts,
- R.id.nav_radar,
- R.id.nav_network)
- .setOpenableLayout(drawer)
- .build();
-
-
- //Setting up the Navigation Host Fragment which is the part of the layout which changes
- // through navigation. In this app, it is the main part of the visible area, below the
- // app bar.
- NavHostFragment navHostFragment =
- (NavHostFragment) getSupportFragmentManager()
- .findFragmentById(R.id.nav_host_fragment_content_main);
-
- //The Navigation Controller manages the navigation. Mainly used to navigate to a new
- // destination (= display new fragment based on user input).
- this.navController = navHostFragment.getNavController();
-
- this.navController.addOnDestinationChangedListener(((controller, destination, bundle) -> {
- if(destination.getId() == R.id.nav_channel_view) {
- new ViewModelProvider(this).get(AddMessageViewModel.class).
- getUri().observe(this, destination::setLabel);
- }
- }));
-
- NavigationUI.setupActionBarWithNavController(this, navController, this.appBarConfiguration);
- NavigationUI.setupWithNavController(navigationView, navController);
-
- this.viewModel.getName().observe(this, name -> {
- //initialize SharkNetApp
- try {
- SharkNetApp.initializeSharkNetApp(this, name);
- } catch (SharkException | IOException e) {
- Log.d(this.getClass().getSimpleName(), e.getLocalizedMessage());
- }
- });
- }
-
- @Override
- public void onStart() {
- super.onStart();
-
- //check if this start is the first one ever on this device
- try {
- //if the owner id is already present, the user already entered it, so this can't be
- // the first start
- //if this call throws an exception, then this is in fact the first start, so in the
- // catch block this case is treated. To be concise: this could actually be the second
- // or further time this app was started, as the user may cancelled the app before
- // setting his name, so the owner id is still not set. When the owner id was confirmed,
- // any further starts aren't counting as initial first start ever again.
- String name = SharkNetApp.getOwnerID(this);
- //if already initialize once before, update view model, which will inform any observers
- // an observer was defined in the onCreate method of this activity. The observer will
- // initialize the SharkNetApp
- this.viewModel.setName(name);
- } catch (SharkException e) {
- //as this is the first start, the owner id was never set before. This needs to be done
- // now. It's done within this activity by displaying the therefor intended layout
- //navController.popBackStack();
- this.navController.navigate(R.id.action_nav_channels_to_nav_firstStart);
- }
- }
-
- /**
- * Navigating up means pressing the back button. In this case the home screen is displayed.
- * @return True if navigating up was possible.
- */
- @Override
- public boolean onSupportNavigateUp() {
- NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main);
- return NavigationUI.navigateUp(navController, this.appBarConfiguration)
- || super.onSupportNavigateUp();
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/MainAppViewModel.java b/app/src/main/java/net/sharksystem/ui/MainAppViewModel.java
deleted file mode 100644
index 68ba212..0000000
--- a/app/src/main/java/net/sharksystem/ui/MainAppViewModel.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package net.sharksystem.ui;
-
-import androidx.lifecycle.LiveData;
-import androidx.lifecycle.MutableLiveData;
-import androidx.lifecycle.ViewModel;
-/**
- * ViewModel saving any data related for the app
- */
-public class MainAppViewModel extends ViewModel {
-
- /**
- * The name inputted by the user on initial start of the app
- */
- private final MutableLiveData inputName;
-
- private final MutableLiveData bluetoothEnabled;
-
- private final MutableLiveData drawerShouldBeLocked;
-
- /**
- * Constructor for ViewModel
- */
- public MainAppViewModel() {
- this.inputName = new MutableLiveData<>();
- this.bluetoothEnabled = new MutableLiveData<>();
- this.drawerShouldBeLocked = new MutableLiveData<>();
- this.drawerShouldBeLocked.setValue(false);
- }
-
- /**
- * Get the name of the user as LiveData object
- * @return the name of the user
- */
- public LiveData getName() {
- return this.inputName;
- }
-
- /**
- * Set the name of the user. Observers will be informed
- * @param name the new name of the user
- */
- public void setName(String name) {
- this.inputName.setValue(name);
- }
-
- public LiveData isBluetoothEnabled() {
- return this.bluetoothEnabled;
- }
-
- public void setBluetoothEnabled(boolean enable) {
- this.bluetoothEnabled.setValue(enable);
- }
-
- public LiveData shouldDrawerBeLocked() {
- return this.drawerShouldBeLocked;
- }
-
- public void requestLockDrawer() {
- this.drawerShouldBeLocked.setValue(true);
- }
-
- public void requestUnlockDrawer() {
- this.drawerShouldBeLocked.setValue(false);
- }
-
-
-}
diff --git a/app/src/main/java/net/sharksystem/ui/SelectionMode.java b/app/src/main/java/net/sharksystem/ui/SelectionMode.java
deleted file mode 100644
index d9a34b1..0000000
--- a/app/src/main/java/net/sharksystem/ui/SelectionMode.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package net.sharksystem.ui;
-
-/**
- * Mode in which a fragment with a recycler view can be, if the items can be deleted
- */
-public enum SelectionMode {
- /**
- * State in which a selected item redirects to a more detailed view of the item or something
- * similar
- */
- SELECT,
-
- /**
- * State in which items are deleted
- */
- DELETE
-}
diff --git a/app/src/main/java/net/sharksystem/ui/channels/AddChannelFragment.java b/app/src/main/java/net/sharksystem/ui/channels/AddChannelFragment.java
deleted file mode 100644
index 7607cf7..0000000
--- a/app/src/main/java/net/sharksystem/ui/channels/AddChannelFragment.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package net.sharksystem.ui.channels;
-
-import android.content.Intent;
-import android.os.Bundle;
-
-import androidx.fragment.app.Fragment;
-import androidx.navigation.Navigation;
-
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.EditText;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import net.sharksystem.R;
-import net.sharksystem.android.ASAPChannelIntent;
-import net.sharksystem.asap.utils.PeerIDHelper;
-import net.sharksystem.databinding.FragmentAddChannelBinding;
-import net.sharksystem.messenger.SharkMessengerException;
-import net.sharksystem.messenger.android.SNChannelViewActivity;
-import net.sharksystem.sharknet.android.SharkNetApp;
-
-import java.io.IOException;
-
-/**
- * Fragment for adding a new Channel
- */
-public class AddChannelFragment extends Fragment {
-
- /**
- * Binding to access elements from the layout
- */
- private FragmentAddChannelBinding binding;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- this.binding = FragmentAddChannelBinding.inflate(inflater, container, false);
-
- //Create a new unique id for the channel and set it in the view
- String uniqueID = PeerIDHelper.createUniqueID();
- String channelUri = "sn2://" + uniqueID;
- this.binding.fragmentAddChannelChannelUri.setText(channelUri);
-
- //add an onClickListener when the user wants to create the specified channel
- this.binding.fragmentAddChannelAddButton.setOnClickListener(view -> {
-
- //get the needed data from the view
- EditText nameText = this.binding.fragmentAddChannelAddNameInputField;
- String channelNameString = nameText.getEditableText().toString();
- TextView tvUri = this.binding.fragmentAddChannelChannelUri;
- String uriString = tvUri.getText().toString();
-
- try {
- //create the channel
- SharkNetApp.getSharkNetApp().getSharkMessenger().createChannel(
- uriString, channelNameString
- );
-
- //navigate back
- Navigation.findNavController(view).navigate(R.id.action_nav_add_channel_to_nav_channels);
-
- } catch (IOException e) {
- String text = "failure: " + e.getLocalizedMessage();
- Log.e(this.getLogStart(), text);
- Toast.makeText(this.getContext(), "IO error - that's serious", Toast.LENGTH_SHORT).show();
- } catch (SharkMessengerException e) {
- String text = "failure: " + e.getLocalizedMessage();
- Log.w(this.getLogStart(), text);
- Toast.makeText(this.getContext(), "already exists(?)", Toast.LENGTH_SHORT).show();
- }
- });
-
- //add onClickListener for aborting the addition of a new channel
- this.binding.fragmentAddChannelExitButton.setOnClickListener(view -> {
- Navigation.findNavController(view).navigate(R.id.nav_channels);
- });
-
- return binding.getRoot();
- }
-
- private String getLogStart() {
- return this.getClass().getSimpleName();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/channels/ChannelListContentAdapter.java b/app/src/main/java/net/sharksystem/ui/channels/ChannelListContentAdapter.java
deleted file mode 100644
index 0cdc96d..0000000
--- a/app/src/main/java/net/sharksystem/ui/channels/ChannelListContentAdapter.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package net.sharksystem.ui.channels;
-
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-
-import net.sharksystem.R;
-import net.sharksystem.messenger.SharkMessengerChannel;
-import net.sharksystem.messenger.SharkMessengerException;
-import net.sharksystem.sharknet.android.SharkNetApp;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * ContentAdapter for items in the ChannelListFragment
- */
-public class ChannelListContentAdapter
- extends RecyclerView.Adapter {
-
- /**
- * Listeners which want to be informed when an item was clicked
- */
- private List listeners;
-
- /**
- * Constructor of the ContentAdapter
- */
- public ChannelListContentAdapter() {
- this.listeners = new ArrayList<>();
- }
-
- /**
- * ViewHolder for the items (=channels)
- */
- public class ViewHolder extends RecyclerView.ViewHolder {
-
- /**
- * TextView of the channel uri
- */
- private final TextView uriTextView;
-
- /**
- * TextView of the channel name
- */
- private final TextView nameTextView;
-
- /**
- * Constructor of the ViewModel
- * @param view the item as view
- */
- public ViewHolder(View view) {
- super(view);
- // Define click listener for the ViewHolder's View
- this.uriTextView = view.findViewById(R.id.sn_channel_list_row_uri);
- this.nameTextView = view.findViewById(R.id.sn_channel_list_row_name);
- }
-
- /**
- * Returns the uri as TextView
- * @return the uri as TextView object
- */
- public TextView getUriTextView() {
- return this.uriTextView;
- }
- }
-
-
- /**
- * Adds a listener to the list of listeners
- * @param listener the new listener
- */
- public void addChannelSelectedListener(ChannelSelectedListener listener) {
- this.listeners.add(listener);
- }
-
- /**
- * Called when a new item is created
- * @param parent The ViewGroup into which the new View will be added after it is bound to
- * an adapter position.
- * @param viewType The view type of the new View.
- * @return The new ViewHolder of the item
- */
- @NonNull
- @Override
- public ChannelListContentAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- // Create a new view, which defines the UI of the list item
- View view = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.sn_channels_list_row, parent, false);
-
- ViewHolder viewHolder = new ViewHolder(view);
-
- //inform the listeners when items were clicked.
- view.setOnClickListener(itemView -> {
- for (ChannelSelectedListener listener : this.listeners)
- listener.channelSelectedWithShortClick(viewHolder);
-
- });
-
- view.setOnLongClickListener(itemView -> {
- for (ChannelSelectedListener listener : this.listeners)
- listener.channelSelectedWithLongClick(viewHolder);
- return false;
- });
-
- return viewHolder;
- }
-
- /**
- * Bind ViewHolder to data
- * @param holder The ViewHolder which should be updated to represent the contents of the
- * item at the given position in the data set.
- * @param position The position of the item within the adapter's data set.
- */
- @Override
- public void onBindViewHolder(@NonNull ChannelListContentAdapter.ViewHolder holder, int position) {
- try {
- SharkMessengerChannel channel =
- SharkNetApp.getSharkNetApp().getSharkMessenger().getChannel(position);
-
- holder.uriTextView.setText(channel.getURI());
- holder.nameTextView.setText(channel.getName());
-
- } catch (IOException | SharkMessengerException e) {
- Log.e(this.getClass().getSimpleName(), "problems while showing channel information: "
- + e.getLocalizedMessage());
- }
- }
-
- /**
- * Returns the number of channels in the recycler view
- * @return the number of channels
- */
- @Override
- public int getItemCount() {
- int count = 0;
- try {
- count = SharkNetApp.getSharkNetApp().getSharkMessenger().getChannelUris().size();
- } catch (Exception e) {
- return 0;
- }
- return count;
- }
-}
diff --git a/app/src/main/java/net/sharksystem/ui/channels/ChannelListFragment.java b/app/src/main/java/net/sharksystem/ui/channels/ChannelListFragment.java
deleted file mode 100644
index f225d41..0000000
--- a/app/src/main/java/net/sharksystem/ui/channels/ChannelListFragment.java
+++ /dev/null
@@ -1,198 +0,0 @@
-package net.sharksystem.ui.channels;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.core.view.MenuProvider;
-import androidx.fragment.app.Fragment;
-import androidx.lifecycle.Lifecycle;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.navigation.Navigation;
-import androidx.recyclerview.widget.DefaultItemAnimator;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Toast;
-
-import net.sharksystem.R;
-import net.sharksystem.SharkNotSupportedException;
-import net.sharksystem.databinding.FragmentChannelListBinding;
-import net.sharksystem.messenger.SharkMessengerException;
-import net.sharksystem.sharknet.android.SharkNetApp;
-import net.sharksystem.ui.SelectionMode;
-import net.sharksystem.ui.channels.massage.AddMessageViewModel;
-
-import java.io.IOException;
-
-/**
- * Fragment for displaying a list of all channels
- */
-public class ChannelListFragment extends Fragment implements ChannelSelectedListener {
-
- /**
- * Binding to access elements from the layout
- */
- private FragmentChannelListBinding binding;
-
- /**
- * The ViewModel for saving related data
- */
- private ChannelListViewModel viewModel;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
- @Nullable Bundle savedInstanceState) {
-
- this.binding = FragmentChannelListBinding.inflate(inflater, container, false);
-
- //Get the ViewModel from the provider which has the functionality of a singleton implemented
- // if the specified owner (this.requireActivity()) is always the same. Otherwise a new
- // instance is returned, so always passing the same owner is necessary if a connection
- // between the fragments should be established
- this.viewModel = new ViewModelProvider(this.requireActivity())
- .get(ChannelListViewModel.class);
- this.viewModel.setMode(SelectionMode.SELECT);
-
- //Set-Up RecyclerView
- RecyclerView recyclerView = binding.fragmentChannelListRecyclerView;
-
- ChannelListContentAdapter adapter = new ChannelListContentAdapter();
- //add this fragment as a listener to the adapter
- adapter.addChannelSelectedListener(this);
-
- RecyclerView.LayoutManager layoutManager =
- new LinearLayoutManager(this.getContext());
-
- recyclerView.setLayoutManager(layoutManager);
- recyclerView.setItemAnimator(new DefaultItemAnimator());
- recyclerView.setAdapter(adapter);
-
- //add the onClickListener for the add button to add a new channel
- this.binding.fragmentChannelListAddChannelButton.setOnClickListener(view ->
- Navigation.findNavController(view)
- .navigate(R.id.action_nav_channels_to_nav_add_channel));
-
- return binding.getRoot();
- }
-
- /**
- * Implementation of the listener interface method.
- * Called when a item of the recycler view was shortly clicked.
- * @param viewHolder the ViewHolder object of the channel item
- */
- @Override
- public void channelSelectedWithShortClick(ChannelListContentAdapter.ViewHolder viewHolder) {
- //get the uri from the ViewHolder object, as this is needed to identify the channel
- String uri = viewHolder.getUriTextView().getText().toString();
-
-
- //if in deletion mode (= some channel was long-clicked before) a short click on another
- // channel will mark this newly selected channel also to be deleted.
- //if not, the normal behavior of showing the message in more detail is executed
- if(this.viewModel.getMode().getValue() == SelectionMode.SELECT) {
- //set the uri in the view model from the AddMessageFragment. This is NOT the same as
- // the ViewModel that is saved as an attribute in this class. It is a completely
- // different one. The uri ist needed in order to write a message into that channel, and
- // as the uri can't be contained later, it is passed on here, where the channel is
- // selected.
- new ViewModelProvider(this.requireActivity()).get(AddMessageViewModel.class).setUri(uri);
-
- Navigation.findNavController(this.binding.fragmentChannelListRecyclerView)
- .navigate(R.id.action_nav_channels_to_nav_channel_view);
-
- } else {
- //if the deletion mode is on, there are two different cases:
- //1) the view isn't already selected to be deleted, so this needs to be done now
- //2) the view was already selected and needs to be unselected
-
- if(!this.viewModel.getDeletionList().getValue().contains(viewHolder)) {
- //Case 1: add the channel to the deletion list and change the background color,
- // so the user sees that the channel was selected
- this.viewModel.getDeletionList().getValue().add(viewHolder);
- viewHolder.itemView.setBackgroundColor(0x88888888);
- } else {
- //Case 2: remove the channel from the deletion list and change the background color
- // back to normal, so it appears to be unselected
- //TODO: the background color is not pure white. Change to real back ground color
- this.viewModel.getDeletionList().getValue().remove(viewHolder);
- viewHolder.itemView.setBackgroundColor(0xFFFFFFFF);
- }
- }
-
-
- }
-
- /**
- * Implementation of the listener interface method.
- * Called when a item of the recycler view was clicked for a longer period.
- * @param viewHolder the ViewHolder object of the item
- */
- @Override
- public void channelSelectedWithLongClick(ChannelListContentAdapter.ViewHolder viewHolder) {
- //If the fragment is currently in the selection state, a long click changes the state
- // to the deletion state.
- //If the fragment was already in the deletion state, nothing happens
- if(this.viewModel.getMode().getValue() == SelectionMode.SELECT) {
- //First a menu provider needs to be created, as in the deletion state a new app bar icon
- // is displayed. That's the trash-bin which can be clicked to finally delete the
- // selected items.
- MenuProvider menuProvider = new MenuProvider() {
- @Override
- public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) {
- menuInflater.inflate(R.menu.menu_channel_list_delete, menu);
- }
-
- /**
- * When an item is click, this method is called.
- * @param menuItem the menu item that was selected
- * @return i have no idea, seems to change noting if true or false
- */
- @Override
- public boolean onMenuItemSelected(@NonNull MenuItem menuItem) {
- //TODO: delete selected channels
- //go through each channel in the saved list from the ViewModel
- for (ChannelListContentAdapter.ViewHolder channel :
- viewModel.getDeletionList().getValue()) {
- try {
- SharkNetApp.getSharkNetApp().getSharkMessenger()
- .removeChannel(channel.getUriTextView().getText());
- } catch (IOException | SharkMessengerException |
- SharkNotSupportedException ignored) {
- //Functionality not yet implemented
- Toast.makeText(getContext(), "Not yet implemented functionality",
- Toast.LENGTH_LONG).show();
- }
- }
- //after deletion, the state is set back to the normal selection state
- viewModel.setMode(SelectionMode.SELECT);
-
- //any selected items are unselected from the list and from the view by removing
- // the highlighting
- for(ChannelListContentAdapter.ViewHolder channel : viewModel.getDeletionList()
- .getValue()) {
- channel.itemView.setBackgroundColor(0xFFFFFFFF);
- }
- viewModel.getDeletionList().getValue().clear();
- return false;
- }
- };
-
- //Add the menu to the activity app bar. Only as long as the fragment is in the resumed
- // state.
- //TODO: pressing the up button in deletion state finishes the app, as we are already in
- // at the root fragment. This needs to be changed. the back button should do the same
- // as if the delete icon was pressed but without deletion.
- this.requireActivity().addMenuProvider(menuProvider, this.getViewLifecycleOwner(),
- Lifecycle.State.RESUMED);
-
- this.viewModel.setMode(SelectionMode.DELETE);
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/channels/ChannelListViewModel.java b/app/src/main/java/net/sharksystem/ui/channels/ChannelListViewModel.java
deleted file mode 100644
index 020a62e..0000000
--- a/app/src/main/java/net/sharksystem/ui/channels/ChannelListViewModel.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package net.sharksystem.ui.channels;
-
-import androidx.lifecycle.LiveData;
-import androidx.lifecycle.MutableLiveData;
-import androidx.lifecycle.ViewModel;
-
-import net.sharksystem.ui.SelectionMode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * ViewModel for the ChannelListFragment. Separation of storing and displaying
- */
-public class ChannelListViewModel extends ViewModel {
-
- /**
- * The mode in which the fragment currently is
- */
- private final MutableLiveData mode;
-
- /**
- * The list of channels that are selected to be deleted
- */
- private final MutableLiveData> deletionList;
-
- /**
- * Constructor for ViewModel
- */
- public ChannelListViewModel() {
- this.mode = new MutableLiveData<>();
- this.deletionList = new MutableLiveData<>();
- this.deletionList.setValue(new ArrayList<>());
- }
-
- /**
- * Returns the mode as LiveData object
- * @return the mode
- */
- public LiveData getMode() {
- return this.mode;
- }
-
- /**
- * Set the mode of the fragment.
- * As this is a ViewModel, observers will be informed.
- * @param mode the new mode
- */
- public void setMode(SelectionMode mode) {
- this.mode.setValue(mode);
- }
-
- /**
- * Returns the list of channels that should be removed als live data.
- * @return the list of channels
- */
- public LiveData> getDeletionList() {
- return this.deletionList;
- }
-}
diff --git a/app/src/main/java/net/sharksystem/ui/channels/ChannelSelectedListener.java b/app/src/main/java/net/sharksystem/ui/channels/ChannelSelectedListener.java
deleted file mode 100644
index 30d0c3b..0000000
--- a/app/src/main/java/net/sharksystem/ui/channels/ChannelSelectedListener.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package net.sharksystem.ui.channels;
-
-/**
- * Listener that is informed when a channel was selected
- */
-public interface ChannelSelectedListener {
-
- /**
- * When the item was clicked shortly
- * @param viewHolder the ViewHolder object of the channel item
- */
- void channelSelectedWithShortClick(ChannelListContentAdapter.ViewHolder viewHolder);
-
- /**
- * When the item was clicked for a longer time
- * @param viewHolder the ViewHolder object of the item
- */
- void channelSelectedWithLongClick(ChannelListContentAdapter.ViewHolder viewHolder);
-}
diff --git a/app/src/main/java/net/sharksystem/ui/channels/massage/AddMessageFragment.java b/app/src/main/java/net/sharksystem/ui/channels/massage/AddMessageFragment.java
deleted file mode 100644
index 654085b..0000000
--- a/app/src/main/java/net/sharksystem/ui/channels/massage/AddMessageFragment.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package net.sharksystem.ui.channels.massage;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.navigation.Navigation;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.Toast;
-
-import net.sharksystem.R;
-import net.sharksystem.databinding.FragmentAddMassageBinding;
-import net.sharksystem.messenger.SharkMessengerException;
-import net.sharksystem.sharknet.android.SharkNetApp;
-import net.sharksystem.ui.SelectionMode;
-import net.sharksystem.ui.contacts.ContactViewModel;
-
-import java.io.IOException;
-
-/**
- * Fragment for adding a message to a channel
- */
-public class AddMessageFragment extends Fragment {
-
- /**
- * Binding to access elements from the layout
- */
- private FragmentAddMassageBinding binding;
-
- /**
- * The ViewModel containing the needed uri
- */
- private AddMessageViewModel viewModel;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- this.viewModel = new ViewModelProvider(this.requireActivity()).get(AddMessageViewModel.class);
-
- this.binding = FragmentAddMassageBinding.inflate(inflater, container, false);
-
- //Set-Up onClickListeners
- this.binding.fragmentAddMessageSelectRecipientsButton.setOnClickListener(view -> {
- //TODO: select recipients
- new ViewModelProvider(this.requireActivity()).get(ContactViewModel.class).
- setSelectionMode(SelectionMode.SELECT);
- Navigation.findNavController(view).navigate(R.id.action_nav_add_message_to_nav_contacts);
- });
-
- this.binding.fragmentAddMessageSelectAnybodyButton.setOnClickListener(view -> {
- //TODO: select any recipient functionality
- });
-
- this.binding.fragmentAddMessageSendMessageButton.setOnClickListener(view -> {
- // get new message
- EditText messageTextView = binding.fragmentAddMessageMessageInput;
- String messageText = messageTextView.getText().toString();
-
- if (messageText.isEmpty()) {
- Toast.makeText(this.getContext(), "message is empty", Toast.LENGTH_SHORT).show();
- } else {
- try {
- // let's sort things out.
- byte[] content = messageText.getBytes();
-
- CheckBox signCheckBox = binding.fragmentAddMessageSignedCheckbox;
- boolean sign = signCheckBox.isChecked();
-
- CheckBox encryptedCheckBox = binding.fragmentAddMessageEncryptedCheckbox;
- boolean encrypt = encryptedCheckBox.isChecked();
-
- this.viewModel.getUri().observe(this.getViewLifecycleOwner(), uriState -> {
- this.binding.fragmentAddMessageChannelName.setText(uriState);
- });
-
- CharSequence uri = this.binding.fragmentAddMessageChannelName.getText();
-
- // send with shark messenger
- SharkNetApp.getSharkNetApp().getSharkMessenger().sendSharkMessage(
- content, uri, sign, encrypt);
-
- } catch (IOException | SharkMessengerException e) {
- Toast.makeText(this.getContext(), e.getLocalizedMessage(), Toast.LENGTH_SHORT).show();
- e.printStackTrace();
- }
- }
-
- //navigate back to the ChannelViewFragment
- Navigation.findNavController(view).navigate(R.id.action_nav_add_message_to_nav_channel_view);
- });
-
- this.binding.fragmentAddMessageAbortButton.setOnClickListener(view -> {
- Navigation.findNavController(view).navigate(R.id.action_nav_add_message_to_nav_channel_view);
- });
-
- return this.binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/channels/massage/AddMessageViewModel.java b/app/src/main/java/net/sharksystem/ui/channels/massage/AddMessageViewModel.java
deleted file mode 100644
index 547a6c5..0000000
--- a/app/src/main/java/net/sharksystem/ui/channels/massage/AddMessageViewModel.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package net.sharksystem.ui.channels.massage;
-
-import androidx.lifecycle.LiveData;
-import androidx.lifecycle.MutableLiveData;
-import androidx.lifecycle.ViewModel;
-
-/**
- * ViewModel for sending a new message.
- */
-public class AddMessageViewModel extends ViewModel {
-
- /**
- * The uri of the channel in which the message is send
- */
- private final MutableLiveData uri;
-
- /**
- * Constructor of the ViewModel
- */
- public AddMessageViewModel() {
- this.uri = new MutableLiveData<>();
- }
-
- /**
- * Return the uri as observable LiveData object
- * @return
- */
- public LiveData getUri() {
- return this.uri;
- }
-
- /**
- * Set the uri.
- * This is done in the ChannelListFragment to determine which channel was selected, as it is
- * impossible to get the uri when in the ChannelViewFragment or AddMessageFragment
- * @param uri the uri
- */
- public void setUri(String uri) {
- this.uri.setValue(uri);
- }
-}
diff --git a/app/src/main/java/net/sharksystem/ui/channels/massage/ChannelViewContentAdapter.java b/app/src/main/java/net/sharksystem/ui/channels/massage/ChannelViewContentAdapter.java
deleted file mode 100644
index e31df59..0000000
--- a/app/src/main/java/net/sharksystem/ui/channels/massage/ChannelViewContentAdapter.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package net.sharksystem.ui.channels.massage;
-
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-
-import net.sharksystem.R;
-import net.sharksystem.messenger.SharkMessage;
-import net.sharksystem.messenger.SharkMessengerComponent;
-import net.sharksystem.messenger.SharkMessengerException;
-import net.sharksystem.messenger.android.SNMessageViewHelper;
-import net.sharksystem.sharknet.android.SharkNetApp;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * ContentAdapter for the message list in the channel view
- */
-public class ChannelViewContentAdapter extends RecyclerView.Adapter {
-
- /**
- * ViewHolder for message items in the RecyclerView
- */
- public static class ViewHolder extends RecyclerView.ViewHolder {
- private final TextView encryptedTextView;
- private final TextView verifiedTextView;
- private final TextView dateTextView;
- private final TextView messageTextView;
- private final TextView senderTextView;
-
- public ViewHolder(View view) {
- super(view);
-
- this.dateTextView = view.findViewById(R.id.sn_channel_message_row_date);
- this.messageTextView = view.findViewById(R.id.sn_channel_message_row_message);
- this.senderTextView = view.findViewById(R.id.sn_channel_message_row_sender);
- this.encryptedTextView = view.findViewById(R.id.sn_channel_message_row_encrypted);
- this.verifiedTextView = view.findViewById(R.id.sn_channel_message_row_verified);
- }
- }
-
- /**
- * The uri of the selected channel
- */
- private final CharSequence uri;
-
- private final List listeners;
-
- /**
- * Constructor of the ContentAdapter
- * @param uri the uri of the selected channel
- */
- public ChannelViewContentAdapter(CharSequence uri) {
- this.uri = uri;
- this.listeners = new ArrayList<>();
- }
-
- public void addListener(MessageSelectedListener listener) {
- this.listeners.add(listener);
- }
-
-
- @NonNull
- @Override
- public ChannelViewContentAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- View itemView = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.sn_channel_message_row, parent, false);
-
- ViewHolder viewHolder = new ViewHolder(itemView);
-
- itemView.setOnClickListener(view -> {
- for (MessageSelectedListener listener : this.listeners) {
- listener.onMessageSelected(view.getId());
- }
- });
-
- return viewHolder;
- }
-
- @Override
- public void onBindViewHolder(@NonNull ChannelViewContentAdapter.ViewHolder holder, int position) {
- try {
- //byte[] asapMessage = this.asapChannel.getMessages().getMessage(position, false);
- SharkMessengerComponent sharkMessenger =
- SharkNetApp.getSharkNetApp().getSharkMessenger();
-
- SharkMessage sharkMessage = sharkMessenger.getChannel(this.uri)
- .getMessages(false, true)
- .getSharkMessage(position, false);
-
- CharSequence encrypted2View = SNMessageViewHelper.getEncryptedCharSequence(sharkMessage);
- CharSequence sender2View = SNMessageViewHelper.getSenderCharSequence(sharkMessage);
- CharSequence content2View = SNMessageViewHelper.getContentCharSequence(sharkMessage);
- CharSequence verified2View = SNMessageViewHelper.getVerifiedCharSequence(sharkMessage);
- CharSequence timestamp2View = SNMessageViewHelper.getCreationTimeCharSequence(sharkMessage);
-
- holder.dateTextView.setText(timestamp2View);
- holder.messageTextView.setText(content2View);
- holder.senderTextView.setText(sender2View);
- holder.encryptedTextView.setText(encrypted2View);
- holder.verifiedTextView.setText(verified2View);
- holder.itemView.setId(position);
-
- } catch (Throwable e) {
- String a = this.getClass().getSimpleName();
- Log.e(a, "cannot access message storage (yet?)");
- Log.e(a, "position == " + position);
- Log.e(a, e.getClass().getName());
- Log.e(a, e.getLocalizedMessage());
- }
- }
-
- @Override
- public int getItemCount() {
- try {
- return SharkNetApp.getSharkNetApp()
- .getSharkMessenger()
- .getChannel(this.uri)
- .getMessages()
- .size();
-
- } catch (IOException | SharkMessengerException e) {
- Log.e("", "cannot access message storage (yet?)");
- Log.e("", "got exception class: " + e.getClass().getSimpleName()
- + "message: " + e.getLocalizedMessage());
- return 0;
- }
- }
-}
diff --git a/app/src/main/java/net/sharksystem/ui/channels/massage/ChannelViewFragment.java b/app/src/main/java/net/sharksystem/ui/channels/massage/ChannelViewFragment.java
deleted file mode 100644
index 06458ac..0000000
--- a/app/src/main/java/net/sharksystem/ui/channels/massage/ChannelViewFragment.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package net.sharksystem.ui.channels.massage;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.navigation.Navigation;
-import androidx.recyclerview.widget.DefaultItemAnimator;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import net.sharksystem.R;
-import net.sharksystem.databinding.FragmentChannelViewBinding;
-
-/**
- * Fragment for a specific channel. Send messages into that channel
- */
-public class ChannelViewFragment extends Fragment implements MessageSelectedListener {
-
- /**
- * Binding to access elements from the layout
- */
- private FragmentChannelViewBinding binding;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- this.binding = FragmentChannelViewBinding.inflate(inflater, container, false);
-
- //Set-Up the RecyclerView
- RecyclerView recyclerView = this.binding.fragmentChannelViewRecyclerView;
-
- AddMessageViewModel viewModel = new ViewModelProvider(this.requireActivity()).get(AddMessageViewModel.class);
-
- ChannelViewContentAdapter adapter = new ChannelViewContentAdapter(viewModel.getUri().getValue());
- adapter.addListener(this);
-
- RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this.getContext());
-
- recyclerView.setLayoutManager(layoutManager);
- recyclerView.setItemAnimator(new DefaultItemAnimator());
- recyclerView.setAdapter(adapter);
-
- this.binding.fragmentChannelViewAddMessageButton.setOnClickListener(view ->
- Navigation.findNavController(view)
- .navigate(R.id.action_nav_channel_view_to_nav_add_message));
-
- return this.binding.getRoot();
- }
-
-
- @Override
- public void onMessageSelected(int id) {
- MessageViewModel viewModel = new ViewModelProvider(this.requireActivity()).
- get(MessageViewModel.class);
-
- viewModel.setPosition(id);
-
- //TODO: message view should slide in and out from the right side of the screen
- Navigation.findNavController(this.requireView())
- .navigate(R.id.action_nav_channel_view_to_nav_message_view);
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/channels/massage/MessageSelectedListener.java b/app/src/main/java/net/sharksystem/ui/channels/massage/MessageSelectedListener.java
deleted file mode 100644
index bda57f8..0000000
--- a/app/src/main/java/net/sharksystem/ui/channels/massage/MessageSelectedListener.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package net.sharksystem.ui.channels.massage;
-
-public interface MessageSelectedListener {
-
- void onMessageSelected(int id);
-}
diff --git a/app/src/main/java/net/sharksystem/ui/channels/massage/MessageViewFragment.java b/app/src/main/java/net/sharksystem/ui/channels/massage/MessageViewFragment.java
deleted file mode 100644
index 4b96baa..0000000
--- a/app/src/main/java/net/sharksystem/ui/channels/massage/MessageViewFragment.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package net.sharksystem.ui.channels.massage;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.lifecycle.ViewModelProvider;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import net.sharksystem.databinding.FragmentMessageViewBinding;
-import net.sharksystem.messenger.SharkMessage;
-import net.sharksystem.messenger.SharkMessengerComponent;
-import net.sharksystem.messenger.SharkMessengerException;
-import net.sharksystem.messenger.android.SNMessageViewHelper;
-import net.sharksystem.sharknet.android.SharkNetApp;
-
-import java.io.IOException;
-
-/**
- * Fragment to display detailed information about a message
- */
-public class MessageViewFragment extends Fragment {
-
- private FragmentMessageViewBinding binding;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- this.binding = FragmentMessageViewBinding.inflate(inflater, container, false);
-
- MessageViewModel messageViewModel = new ViewModelProvider(this.requireActivity()).
- get(MessageViewModel.class);
-
- AddMessageViewModel addMessageViewModel = new ViewModelProvider(this.requireActivity()).
- get(AddMessageViewModel.class);
-
- CharSequence uri = addMessageViewModel.getUri().getValue();
- int position = messageViewModel.getPosition().getValue();
-
- SharkMessengerComponent sharkMessenger =
- SharkNetApp.getSharkNetApp().getSharkMessenger();
-
- try {
- SharkMessage sharkMessage = sharkMessenger.getChannel(uri)
- .getMessages(false, true)
- .getSharkMessage(position, false);
-
- // Receivers
- CharSequence receiversCharSequence =
- SNMessageViewHelper.getReceiversCharSequence(sharkMessage);
- this.binding.fragmentMessageViewRecipients.setText(receiversCharSequence);
-
- // encrypted
- CharSequence encryptedCharSequence =
- SNMessageViewHelper.getEncryptedCharSequence(sharkMessage);
- this.binding.fragmentMessageViewEncrypted.setText(encryptedCharSequence);
-
- // sender
- CharSequence senderCharSequence =
- SNMessageViewHelper.getSenderCharSequence(sharkMessage);
- this.binding.fragmentMessageViewSender.setText(senderCharSequence);
-
- // content
- CharSequence contentCharSequence =
- SNMessageViewHelper.getContentCharSequence(sharkMessage);
- this.binding.fragmentMessageViewMessage.setText(contentCharSequence);
-
- // verified
- CharSequence verifiedCharSequence =
- SNMessageViewHelper.getVerifiedCharSequence(sharkMessage);
- this.binding.fragmentMessageViewVerified.setText(verifiedCharSequence);
-
- // time stamp
- CharSequence creationTimeCharSequence =
- SNMessageViewHelper.getCreationTimeCharSequence(sharkMessage);
- this.binding.fragmentMessageViewTime.setText(creationTimeCharSequence);
-
- // identity assurance
- CharSequence iACharSequence =
- SNMessageViewHelper.getIdentityAssuranceCharSequence(sharkMessage);
- this.binding.fragmentMessageViewIA.setText(iACharSequence);
-
- // asap hops
- CharSequence asapHopsSequence =
- SNMessageViewHelper.getASAPHopsCharSequence(sharkMessage);
- this.binding.fragmentMessageViewHops.setText(asapHopsSequence);
-
- } catch (SharkMessengerException | IOException e) {
- throw new RuntimeException(e);
- }
-
- return this.binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/channels/massage/MessageViewModel.java b/app/src/main/java/net/sharksystem/ui/channels/massage/MessageViewModel.java
deleted file mode 100644
index 35b0442..0000000
--- a/app/src/main/java/net/sharksystem/ui/channels/massage/MessageViewModel.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package net.sharksystem.ui.channels.massage;
-
-import androidx.lifecycle.LiveData;
-import androidx.lifecycle.MutableLiveData;
-import androidx.lifecycle.ViewModel;
-
-public class MessageViewModel extends ViewModel {
-
- private final MutableLiveData position;
-
- public MessageViewModel() {
- this.position = new MutableLiveData<>();
- }
-
- public void setPosition(int id) {
- this.position.setValue(id);
- }
-
- public LiveData getPosition() {
- return this.position;
- }
-}
diff --git a/app/src/main/java/net/sharksystem/ui/contacts/AddContactFragment.java b/app/src/main/java/net/sharksystem/ui/contacts/AddContactFragment.java
deleted file mode 100644
index 0fcc025..0000000
--- a/app/src/main/java/net/sharksystem/ui/contacts/AddContactFragment.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package net.sharksystem.ui.contacts;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.navigation.Navigation;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import net.sharksystem.R;
-import net.sharksystem.databinding.FragmentAddContactBinding;
-
-/**
- * Fragment for adding a new contact
- */
-public class AddContactFragment extends Fragment {
-
- /**
- * Binding to access elements from the layout
- */
- private FragmentAddContactBinding binding;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- this.binding = FragmentAddContactBinding.inflate(inflater, container, false);
-
- //setting up onClickListeners
- //..when the user aborts
- this.binding.fragmentAddContactAbortButton.setOnClickListener(view ->
- Navigation.findNavController(view).navigate(R.id.action_nav_add_contact_to_nav_contacts)
- );
-
- //...when the user want's to continue the addition of a new contact.
- this.binding.fragmentAddContactContinueButton.setOnClickListener(view ->
- Navigation.findNavController(view).navigate(R.id.action_nav_add_contact_to_nav_receive_credentials)
- );
-
- this.binding.fragmentAddContactRadarButton.setOnClickListener(view ->
- Navigation.findNavController(view).navigate(R.id.action_nav_add_contact_to_nav_radar)
- );
-
- //...for navigating to the network
- this.binding.fragmentAddContactNetworkButton.setOnClickListener(view ->
- Navigation.findNavController(view).navigate(R.id.action_nav_add_contact_to_nav_network)
- );
-
- // Inflate the layout for this fragment
- return this.binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/contacts/ContactDetailsLookup.java b/app/src/main/java/net/sharksystem/ui/contacts/ContactDetailsLookup.java
deleted file mode 100644
index 7b4f6cd..0000000
--- a/app/src/main/java/net/sharksystem/ui/contacts/ContactDetailsLookup.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package net.sharksystem.ui.contacts;
-
-import android.view.MotionEvent;
-import android.view.View;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.recyclerview.selection.ItemDetailsLookup;
-import androidx.recyclerview.widget.RecyclerView;
-
-public class ContactDetailsLookup extends ItemDetailsLookup {
-
- private final RecyclerView recyclerView;
-
- public ContactDetailsLookup(RecyclerView recyclerView) {
- this.recyclerView = recyclerView;
- }
-
- @Nullable
- @Override
- public ItemDetails getItemDetails(@NonNull MotionEvent e) {
- View view = this.recyclerView.findChildViewUnder(e.getX(), e.getY());
- RecyclerView.ViewHolder viewHolder = this.recyclerView.getChildViewHolder(view);
-
- if (viewHolder instanceof ContactListContentAdapter.ViewHolder) {
- ContactListContentAdapter.ViewHolder specificViewHolder =
- (ContactListContentAdapter.ViewHolder) viewHolder;
-
- return new ItemDetailsLookup.ItemDetails() {
- @Override
- public int getPosition() {
- return viewHolder.getBindingAdapterPosition();
- }
- @Override
- public Long getSelectionKey() {
- return (long) specificViewHolder.getBindingAdapterPosition();
- }
- };
- } else return null;
- }
-}
diff --git a/app/src/main/java/net/sharksystem/ui/contacts/ContactListContentAdapter.java b/app/src/main/java/net/sharksystem/ui/contacts/ContactListContentAdapter.java
deleted file mode 100644
index d98adf1..0000000
--- a/app/src/main/java/net/sharksystem/ui/contacts/ContactListContentAdapter.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package net.sharksystem.ui.contacts;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.selection.SelectionTracker;
-import androidx.recyclerview.widget.RecyclerView;
-
-import net.sharksystem.R;
-import net.sharksystem.asap.ASAPSecurityException;
-import net.sharksystem.asap.persons.PersonValues;
-import net.sharksystem.sharknet.android.SharkNetApp;
-
-/**
- * ContentAdapter for items in the contact list fragment
- */
-public class ContactListContentAdapter extends RecyclerView.Adapter {
-
-
- public static class ViewHolder extends RecyclerView.ViewHolder {
-
- private final TextView personName;
- private final TextView personIdentityAssurance;
- private final TextView personSelected;
- private final TextView personCertificateExchangeFailure;
-
- public ViewHolder(View view) {
- super(view);
-
- this.personName = view.findViewById(R.id.person_list_row_person_name);
- this.personIdentityAssurance = view.findViewById(R.id.person_list_row_identity_assurance_level);
- this.personSelected = view.findViewById(R.id.cert_exchange_failure);
- this.personCertificateExchangeFailure = view.findViewById(R.id.person_list_row_selected);
-
- //TODO: add OnLongClickListener to delete contact(s)
- //view.setOnLongClickListener(contactView -> {
- //});
- }
- }
-
- private SelectionTracker tracker;
-
- public ContactListContentAdapter() {
- this.setHasStableIds(true);
- }
-
- public void setTracker(SelectionTracker tracker) {
- this.tracker = tracker;
- }
-
-
- @NonNull
- @Override
- public ContactListContentAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- View view = LayoutInflater.from(parent.getContext()).
- inflate(R.layout.person_list_row, parent, false);
-
- return new ContactListContentAdapter.ViewHolder(view);
- }
-
- @Override
- public void onBindViewHolder(@NonNull ContactListContentAdapter.ViewHolder holder, int position) {
- try {
- PersonValues personValues =
- SharkNetApp.getSharkNetApp().getSharkPKI().getPersonValuesByPosition(position);
-
- CharSequence userID = personValues.getUserID();
- //this.scs.setSelectedText(Integer.toString(position), userID,
- //holder.itemView, holder.personSelected);
- int identityAssurance = personValues.getIdentityAssurance();
- int signingFailureRate = personValues.getSigningFailureRate();
-
- holder.itemView.setTag(R.id.user_id_tag, userID);
- holder.personName.setText(personValues.getName());
- holder.personIdentityAssurance.setText(String.valueOf(identityAssurance));
- holder.personCertificateExchangeFailure.setText(String.valueOf(signingFailureRate));
-
- holder.itemView.setActivated(this.tracker.
- isSelected((long) holder.getBindingAdapterPosition()));
-
- } catch (ASAPSecurityException e) {
- //Toast.makeText(this.ctx, "error finding person information: ", Toast.LENGTH_SHORT).show();
- }
- }
-
- @Override
- public int getItemCount() {
- return SharkNetApp.getSharkNetApp().getSharkPKI().getNumberOfPersons();
- }
-
- @Override
- public long getItemId(int position) {
- return position;
- }
-}
diff --git a/app/src/main/java/net/sharksystem/ui/contacts/ContactListFragment.java b/app/src/main/java/net/sharksystem/ui/contacts/ContactListFragment.java
deleted file mode 100644
index 1136cd4..0000000
--- a/app/src/main/java/net/sharksystem/ui/contacts/ContactListFragment.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package net.sharksystem.ui.contacts;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.fragment.app.Fragment;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.navigation.Navigation;
-import androidx.recyclerview.selection.ItemDetailsLookup;
-import androidx.recyclerview.selection.OnItemActivatedListener;
-import androidx.recyclerview.selection.SelectionPredicates;
-import androidx.recyclerview.selection.SelectionTracker;
-import androidx.recyclerview.selection.StableIdKeyProvider;
-import androidx.recyclerview.selection.StorageStrategy;
-import androidx.recyclerview.widget.DefaultItemAnimator;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-
-import net.sharksystem.R;
-import net.sharksystem.asap.ASAPSecurityException;
-import net.sharksystem.databinding.FragmentContactListBinding;
-import net.sharksystem.pki.android.PersonStatusHelper;
-import net.sharksystem.pki.android.SelectableListContentAdapterHelper;
-import net.sharksystem.sharknet.android.SharkNetApp;
-import net.sharksystem.asap.persons.PersonValues;
-import net.sharksystem.ui.SelectionMode;
-
-import java.util.Set;
-
-/**
- * Fragment for displaying all contacts in a list
- */
-public class ContactListFragment extends Fragment implements OnItemActivatedListener {
-
- /**
- * Binding to access elements from the layout
- */
- private FragmentContactListBinding binding;
-
- private ContactViewModel viewModel;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
- @Nullable Bundle savedInstanceState) {
-
- this.binding = FragmentContactListBinding.inflate(inflater, container, false);
- this.viewModel = new ViewModelProvider(this.requireActivity()).get(ContactViewModel.class);
-
- this.viewModel.getSelectionMode().observe(this.getViewLifecycleOwner(), selectionMode -> {
- if(selectionMode == SelectionMode.SELECT) {
- this.binding.fragmentContactsAddContactButton.
- setImageResource(R.drawable.ic_sync_black_24dp);
-
- this.binding.fragmentContactsAddContactButton.setOnClickListener(view -> {
- System.out.println("Moin");
- });
- }
- });
-
- PersonStatusHelper personsApp =
- PersonStatusHelper.getPersonsStorage();
-
- Set preselectionSet = personsApp.getPreselectionSet();
- //Log.d(this.getLogStart(), "got preselectedset: " + preselectionSet);
- if (preselectionSet != null && !preselectionSet.isEmpty()) {
- SelectableListContentAdapterHelper selectableContentSource = new SelectableListContentAdapterHelper();
- selectableContentSource.setPreselection(preselectionSet);
- personsApp.setPreselectionSet(null);
- }
-
-
- //Set-Up RecyclerView
- RecyclerView recyclerView = this.binding.fragmentContactsRecyclerView;
-
- ContactListContentAdapter adapter = new ContactListContentAdapter();
-
- RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this.getContext());
-
- recyclerView.setLayoutManager(layoutManager);
- recyclerView.setItemAnimator(new DefaultItemAnimator());
- recyclerView.setAdapter(adapter);
-
- SelectionTracker tracker = new SelectionTracker.Builder<>(
- "contact-selection",
- recyclerView,
- new StableIdKeyProvider(recyclerView),
- new ContactDetailsLookup(recyclerView),
- StorageStrategy.createLongStorage()).
- withSelectionPredicate(SelectionPredicates.createSelectAnything()).
- withOnItemActivatedListener(this).
- build();
-
- adapter.setTracker(tracker);
-
- tracker.addObserver(new SelectionTracker.SelectionObserver() {
- @Override
- public void onItemStateChanged(@NonNull Long key, boolean selected) {
- super.onItemStateChanged(key, selected);
-
- }
- });
-
- //add onClickListener when the user clicks the button to add a contact
- this.binding.fragmentContactsAddContactButton.setOnClickListener(view ->
- Navigation.findNavController(view).navigate(R.id.action_nav_contacts_to_add_contact)
- );
-
- return this.binding.getRoot();
- }
-
- @Override
- public boolean onItemActivated(@NonNull ItemDetailsLookup.ItemDetails item, @NonNull MotionEvent e) {
- try {
- PersonValues values = SharkNetApp.getSharkNetApp().getSharkPKI().
- getPersonValuesByPosition(item.getPosition());
-
- this.viewModel.setPerson(values);
-
- Navigation.findNavController(this.requireView()).
- navigate(R.id.action_nav_contacts_to_nav_contact_view);
-
- return true;
- } catch (ASAPSecurityException ex) {
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/contacts/ContactViewFragment.java b/app/src/main/java/net/sharksystem/ui/contacts/ContactViewFragment.java
deleted file mode 100644
index 478a7bb..0000000
--- a/app/src/main/java/net/sharksystem/ui/contacts/ContactViewFragment.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package net.sharksystem.ui.contacts;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.navigation.Navigation;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.google.android.material.snackbar.Snackbar;
-
-import net.sharksystem.R;
-import net.sharksystem.asap.persons.PersonValues;
-import net.sharksystem.databinding.FragmentContactViewBinding;
-
-/**
- * Fragment for showing contact data
- */
-public class ContactViewFragment extends Fragment {
-
- /**
- * Binding to access elements from the layout
- */
- private FragmentContactViewBinding binding;
-
- private ContactViewModel viewModel;
-
- @NonNull
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- this.binding = FragmentContactViewBinding.inflate(inflater, container, false);
- this.viewModel = new ViewModelProvider(this.requireActivity()).get(ContactViewModel.class);
-
- PersonValues personValues = this.viewModel.getPersonValues();
-
- CharSequence userID = personValues.getUserID();
- CharSequence username = personValues.getName();
- int iA = personValues.getIdentityAssurance();
- int signingFailure = personValues.getSigningFailureRate();
-
- this.binding.personEditUserID.setText(userID);
- this.binding.personName.setText(username);
- this.binding.personEditIdentityAssuranceLevel.setText(String.valueOf(iA));
- this.binding.signingFailureValue.setSelection(signingFailure);
-
- //Set-Up OnClickListeners
- this.binding.fragmentContactViewUserIDDescriptionButton.setOnClickListener(view ->
- Snackbar.make(view, R.string.explainUserIDText, Snackbar.LENGTH_LONG).show());
-
- this.binding.fragmentContactViewNameDescriptionButton.setOnClickListener(view ->
- Snackbar.make(view, R.string.explainUserNameText, Snackbar.LENGTH_LONG).show());
-
- this.binding.fragmentContactViewIdentityAssuranceDescriptionButton.setOnClickListener(view ->
- Snackbar.make(view, R.string.explainIdentityAssuranceText, Snackbar.LENGTH_LONG).show()
- );
-
- this.binding.fragmentContactViewSigningFailureDescriptionButton.setOnClickListener(view ->
- Snackbar.make(view, R.string.explainSigningFailureText, Snackbar.LENGTH_LONG).show()
- );
-
- this.binding.fragmentReceiveCredentialsCertificateDescriptionButton.setOnClickListener(view ->
- Snackbar.make(view, R.string.explainWasCertifiedText, Snackbar.LENGTH_LONG).show()
- );
-
- this.binding.fragmentReceiveCredentialsShowOwnCertificateButton.setOnClickListener(view -> {
- //TODO: display certificates that where certified by the user
- });
-
- this.binding.fragmentReceiveCredentialsIssueCertificateDescriptionButton.setOnClickListener(view ->
- Snackbar.make(view, R.string.explainCertifiedText, Snackbar.LENGTH_LONG).show()
- );
-
- this.binding.fragmentReceiveCredentialsShowIssuedCertificatesButton.setOnClickListener(view -> {
- //TODO: display certificates that where issued by the user
- });
-
- this.binding.fragmentReceiveCredentialsSaveButton.setOnClickListener(view ->
- Navigation.findNavController(view).navigate(R.id.action_nav_contact_view_to_nav_contacts)
- );
-
- this.binding.fragmentReceiveCredentialsAbortButton.setOnClickListener(view ->
- Navigation.findNavController(view).navigate(R.id.action_nav_contact_view_to_nav_contacts)
- );
-
- return this.binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/contacts/ContactViewModel.java b/app/src/main/java/net/sharksystem/ui/contacts/ContactViewModel.java
deleted file mode 100644
index 8653a18..0000000
--- a/app/src/main/java/net/sharksystem/ui/contacts/ContactViewModel.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package net.sharksystem.ui.contacts;
-
-import androidx.lifecycle.LiveData;
-import androidx.lifecycle.MutableLiveData;
-import androidx.lifecycle.ViewModel;
-
-import net.sharksystem.asap.persons.PersonValues;
-import net.sharksystem.ui.SelectionMode;
-
-public class ContactViewModel extends ViewModel {
-
- private PersonValues personValues;
-
- private final MutableLiveData selectionMode;
-
- public ContactViewModel() {
- this.selectionMode = new MutableLiveData<>();
- }
-
-
- PersonValues getPersonValues() {
- return this.personValues;
- }
-
- void setPerson(PersonValues values) {
- this.personValues = values;
- }
-
- public LiveData getSelectionMode() {
- return this.selectionMode;
- }
-
- public void setSelectionMode(SelectionMode mode) {
- this.selectionMode.setValue(mode);
- }
-}
diff --git a/app/src/main/java/net/sharksystem/ui/contacts/receiveCredentials/ReceiveCredentialsFragment.java b/app/src/main/java/net/sharksystem/ui/contacts/receiveCredentials/ReceiveCredentialsFragment.java
deleted file mode 100644
index 0087231..0000000
--- a/app/src/main/java/net/sharksystem/ui/contacts/receiveCredentials/ReceiveCredentialsFragment.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package net.sharksystem.ui.contacts.receiveCredentials;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.navigation.Navigation;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import net.sharksystem.R;
-import net.sharksystem.databinding.FragmentReceiveCredentialsBinding;
-
-/**
- * Fragment displaying the received credential or a waiting message until the credential is received
- */
-public class ReceiveCredentialsFragment extends Fragment {
-
- /**
- * Binding to access elements from the layout
- */
- private FragmentReceiveCredentialsBinding binding;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- this.binding = FragmentReceiveCredentialsBinding.inflate(inflater, container, false);
-
- //add onClickListener for aborting the receiving
- this.binding.fragmentReceiveCredentialsAbortButton.setOnClickListener(view ->
- Navigation.findNavController(view).navigate(R.id.action_nav_receive_credentials_to_nav_add_contact)
- );
-
- // Inflate the layout for this fragment
- return this.binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/firstLaunch/FirstStartFragment.java b/app/src/main/java/net/sharksystem/ui/firstLaunch/FirstStartFragment.java
deleted file mode 100644
index c037207..0000000
--- a/app/src/main/java/net/sharksystem/ui/firstLaunch/FirstStartFragment.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package net.sharksystem.ui.firstLaunch;
-
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.fragment.app.Fragment;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.navigation.Navigation;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Toast;
-
-import net.sharksystem.R;
-import net.sharksystem.SharkException;
-import net.sharksystem.databinding.FragmentFirstStartBinding;
-import net.sharksystem.sharknet.android.SharkNetApp;
-import net.sharksystem.ui.MainAppViewModel;
-
-
-/**
- * Fragment showed at the first start of the app. The user must set his name.
- */
-public class FirstStartFragment extends Fragment {
-
- /**
- * Binding to access elements from the layout
- */
- private FragmentFirstStartBinding binding;
-
- private MainAppViewModel mainAppViewModel;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
- @Nullable Bundle savedInstanceState) {
-
- this.binding = FragmentFirstStartBinding.inflate(inflater, container, false);
- this.mainAppViewModel = new ViewModelProvider(this.requireActivity()).
- get(MainAppViewModel.class);
-
- mainAppViewModel.requestLockDrawer();
-
- //add onClickListener for the save button
- binding.fragmentFirstStartSaveButton.setOnClickListener(view -> {
- try {
- mainAppViewModel.requestUnlockDrawer();
- String inputName = this.binding.fragmentFirstStartNameInput.getText().toString();
- SharkNetApp.initializeSystem(this.requireActivity(), inputName);
- new ViewModelProvider(this.requireActivity()).get(MainAppViewModel.class)
- .setName(SharkNetApp.getOwnerID(this.requireActivity()));
-
- Navigation.findNavController(view).navigate(R.id.action_nav_firstStart_to_nav_channels);
- } catch (SharkException se) {
- Toast.makeText(this.getContext(), se.getLocalizedMessage(), Toast.LENGTH_LONG).show();
- }
- });
-
- return binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/network/NetworkFragment.java b/app/src/main/java/net/sharksystem/ui/network/NetworkFragment.java
deleted file mode 100644
index 4d6f385..0000000
--- a/app/src/main/java/net/sharksystem/ui/network/NetworkFragment.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package net.sharksystem.ui.network;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.fragment.app.Fragment;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.navigation.Navigation;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import net.sharksystem.R;
-import net.sharksystem.databinding.FragmentNetworkBinding;
-import net.sharksystem.ui.MainAppViewModel;
-
-
-public class NetworkFragment extends Fragment {
-
- /**
- * Binding to access elements from the layout
- */
- private FragmentNetworkBinding binding;
-
- private MainAppViewModel mainAppViewModel;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
- @Nullable Bundle savedInstanceState) {
-
- this.binding = FragmentNetworkBinding.inflate(inflater,container,false);
-
- this.mainAppViewModel = new ViewModelProvider(this.requireActivity()).
- get(MainAppViewModel.class);
-
- //Set-Up OnClickListeners
- //...when bluetooth is switched on or off
- this.binding.fragmentNetworkBluetoothOnOffButton.setOnCheckedChangeListener((buttonView, isChecked) -> {
- //TODO: activate or deactivate bluetooth - doesn't work like this
- this.mainAppViewModel.setBluetoothEnabled(isChecked);
- });
-
- //...when bluetooth scanning should be enabled or disabled
- this.binding.fragmentNetworkBluetoothScanButton.setOnCheckedChangeListener(((buttonView, isChecked) -> {
- //TODO: make visible and scan or stop discovery and itself stop being discoverable
- if (isChecked) {
- //asapActivity.startBluetoothDiscovery();
- //asapActivity.startBluetoothDiscoverable();
- } else {
- //sharkNetApp.stopBluetooth(); TODO
- }
- }));
-
- //...when connections to hubs should be made or not
- this.binding.fragmentNetworkBluetoothConnectHubsButton.setOnCheckedChangeListener(((buttonView, isChecked) -> {
- //TODO: allow to connect to hubs or not
- if (isChecked) {
- //asapActivity.connectASAPHubs();
- } else {
- //asapActivity.disconnectASAPHubs();
- }
- }));
-
- //...when hubs are configured
- this.binding.fragmentNetworkBluetoothConfigureHubsButton.setOnClickListener(view ->
- Navigation.findNavController(view)
- .navigate(R.id.action_nav_network_to_nav_hub_list));
-
- return this.binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/network/hub/HubDetailsLookup.java b/app/src/main/java/net/sharksystem/ui/network/hub/HubDetailsLookup.java
deleted file mode 100644
index 5505c4b..0000000
--- a/app/src/main/java/net/sharksystem/ui/network/hub/HubDetailsLookup.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package net.sharksystem.ui.network.hub;
-
-import android.view.MotionEvent;
-import android.view.View;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.recyclerview.selection.ItemDetailsLookup;
-import androidx.recyclerview.widget.RecyclerView;
-
-public class HubDetailsLookup extends ItemDetailsLookup {
-
- private final RecyclerView recyclerView;
-
- public HubDetailsLookup(RecyclerView recyclerView) {
- this.recyclerView = recyclerView;
- }
-
- @Nullable
- @Override
- public ItemDetailsLookup.ItemDetails getItemDetails(@NonNull MotionEvent e) {
- View view = this.recyclerView.findChildViewUnder(e.getX(), e.getY());
- RecyclerView.ViewHolder viewHolder = this.recyclerView.getChildViewHolder(view);
-
- if (viewHolder instanceof HubListContentAdapter.ViewHolder) {
- HubListContentAdapter.ViewHolder specificViewHolder =
- (HubListContentAdapter.ViewHolder) viewHolder;
-
- return new ItemDetailsLookup.ItemDetails() {
- @Override
- public int getPosition() {
- return viewHolder.getBindingAdapterPosition();
- }
- @Override
- public Long getSelectionKey() {
- return (long) specificViewHolder.getBindingAdapterPosition();
- }
- };
- } else return null;
- }
-}
diff --git a/app/src/main/java/net/sharksystem/ui/network/hub/HubListContentAdapter.java b/app/src/main/java/net/sharksystem/ui/network/hub/HubListContentAdapter.java
deleted file mode 100644
index 66bd5c4..0000000
--- a/app/src/main/java/net/sharksystem/ui/network/hub/HubListContentAdapter.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package net.sharksystem.ui.network.hub;
-
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.selection.SelectionTracker;
-import androidx.recyclerview.widget.RecyclerView;
-
-import net.sharksystem.R;
-import net.sharksystem.SharkException;
-import net.sharksystem.hub.peerside.HubConnectorDescription;
-import net.sharksystem.sharknet.android.SharkNetApp;
-
-/**
- * ContentAdapter for items in the recycler view of the HubListFragment
- */
-public class HubListContentAdapter extends RecyclerView.Adapter {
-
- public static class ViewHolder extends RecyclerView.ViewHolder {
-
- public TextView connectorType;
- public TextView connectorDescriptionString;
- public TextView multiChannel;
-
- public ViewHolder(View view) {
- super(view);
- this.connectorType = (TextView)
- view.findViewById(R.id.settings_hub_descriptions_row_connectorType);
- this.connectorDescriptionString = (TextView)
- view.findViewById(R.id.settings_hub_descriptions_row_connectorDescriptionString);
- this.multiChannel = (TextView)
- view.findViewById(R.id.settings_hub_descriptions_row_connectorMultiChannel);
- }
- }
-
-
-
- private SelectionTracker tracker;
-
- public HubListContentAdapter() {
- this.setHasStableIds(true);
- }
-
- public void setTracker(SelectionTracker tracker) {
- this.tracker = tracker;
- }
-
-
- @NonNull
- @Override
- public HubListContentAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- View view = LayoutInflater.from(parent.getContext()).
- inflate(R.layout.settings_hub_descriptions_row, parent, false);
-
- return new ViewHolder(view);
- }
-
- @Override
- public void onBindViewHolder(@NonNull HubListContentAdapter.ViewHolder holder, int position) {
- try {
- HubConnectorDescription hubDescriptions =
- SharkNetApp.getSharkNetApp().getSharkPeer().getHubDescription(position);
-
- String typeString = "unknown type";
- String multiChannelString = "shared connection";
- if (hubDescriptions.getType() == HubConnectorDescription.TCP) {
- typeString = "TCP";
- if (hubDescriptions.canMultiChannel()) {
- multiChannelString = "multi channel";
- }
- }
-
- holder.connectorType.setText(typeString);
- holder.connectorDescriptionString.setText(hubDescriptions.toString());
- holder.multiChannel.setText(multiChannelString);
-
- holder.itemView.setActivated(this.tracker.
- isSelected((long) holder.getBindingAdapterPosition()));
-
- } catch (SharkException e) {
- Log.e(this.getClass().getSimpleName(), "problems while showing channel information: "
- + e.getLocalizedMessage());
- e.printStackTrace();
- }
- }
-
- @Override
- public int getItemCount() {
- return SharkNetApp.getSharkNetApp().getSharkPeer().getHubDescriptions().size();
- }
- @Override
- public long getItemId(int position) {
- return position;
- }
-
-}
diff --git a/app/src/main/java/net/sharksystem/ui/network/hub/HubListFragment.java b/app/src/main/java/net/sharksystem/ui/network/hub/HubListFragment.java
deleted file mode 100644
index d899cdd..0000000
--- a/app/src/main/java/net/sharksystem/ui/network/hub/HubListFragment.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package net.sharksystem.ui.network.hub;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.navigation.Navigation;
-import androidx.recyclerview.selection.ItemDetailsLookup;
-import androidx.recyclerview.selection.OnItemActivatedListener;
-import androidx.recyclerview.selection.SelectionPredicates;
-import androidx.recyclerview.selection.SelectionTracker;
-import androidx.recyclerview.selection.StableIdKeyProvider;
-import androidx.recyclerview.selection.StorageStrategy;
-import androidx.recyclerview.widget.DefaultItemAnimator;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-
-import net.sharksystem.R;
-import net.sharksystem.SharkException;
-import net.sharksystem.databinding.FragmentHubListBinding;
-import net.sharksystem.hub.peerside.HubConnectorDescription;
-import net.sharksystem.sharknet.android.SharkNetApp;
-
-/**
- * Fragment for displaying a list of all configured hubs
- */
-public class HubListFragment extends Fragment implements OnItemActivatedListener {
-
- /**
- * Binding to access elements from the layout
- */
- private FragmentHubListBinding binding;
-
- private HubViewModel viewModel;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- this.binding = FragmentHubListBinding.inflate(inflater, container, false);
- this.viewModel = new ViewModelProvider(this.requireActivity()).get(HubViewModel.class);
-
- //Set-Up Recycler View
- RecyclerView recyclerView = this.binding.fragmentHubListRecyclerView;
-
- HubListContentAdapter adapter = new HubListContentAdapter();
- RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this.getContext());
-
- recyclerView.setLayoutManager(layoutManager);
- recyclerView.setItemAnimator(new DefaultItemAnimator());
- recyclerView.setAdapter(adapter);
-
- SelectionTracker tracker = new SelectionTracker.Builder<>(
- "contact-selection",
- recyclerView,
- new StableIdKeyProvider(recyclerView),
- new HubDetailsLookup(recyclerView),
- StorageStrategy.createLongStorage()).
- withSelectionPredicate(SelectionPredicates.createSelectAnything()).
- withOnItemActivatedListener(this).
- build();
-
- adapter.setTracker(tracker);
-
-
- //Set OnClickListener when the user clicks the add button
- this.binding.fragmentHubListAddHubButton.setOnClickListener(view -> {
- this.viewModel.setSelectedHub(null);
- Navigation.findNavController(view)
- .navigate(R.id.action_nav_hub_list_to_nav_hub_view);
- });
-
-
- return this.binding.getRoot();
- }
-
- @Override
- public boolean onItemActivated(@NonNull ItemDetailsLookup.ItemDetails item, @NonNull MotionEvent e) {
- try {
- HubConnectorDescription hcd = SharkNetApp.getSharkNetApp().getSharkPeer().
- getHubDescription(item.getPosition());
-
- this.viewModel.setSelectedHub(hcd);
-
- Navigation.findNavController(this.requireView()).
- navigate(R.id.action_nav_hub_list_to_nav_hub_view);
-
- return true;
- } catch (SharkException ex) {
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/network/hub/HubViewFragment.java b/app/src/main/java/net/sharksystem/ui/network/hub/HubViewFragment.java
deleted file mode 100644
index 7a9095a..0000000
--- a/app/src/main/java/net/sharksystem/ui/network/hub/HubViewFragment.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package net.sharksystem.ui.network.hub;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.navigation.Navigation;
-
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Toast;
-
-import net.sharksystem.R;
-import net.sharksystem.SharkPeer;
-import net.sharksystem.databinding.FragmentHubViewBinding;
-import net.sharksystem.hub.ASAPHubException;
-import net.sharksystem.hub.peerside.HubConnectorDescription;
-import net.sharksystem.hub.peerside.TCPHubConnectorDescriptionImpl;
-import net.sharksystem.sharknet.android.SharkNetApp;
-
-import java.io.IOException;
-
-/**
- * Fragment for configuration of a hub
- */
-public class HubViewFragment extends Fragment {
-
- /**
- * Binding to access elements from the layout
- */
- private FragmentHubViewBinding binding;
-
- private HubViewModel viewModel;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- this.binding = FragmentHubViewBinding.inflate(inflater, container, false);
- this.viewModel = new ViewModelProvider(this.requireActivity()).get(HubViewModel.class);
-
- //Set-Up OnClickListeners
- //...when default values should be inserted to editable fields
- this.binding.fragmentHubViewDefaultValuesButton.setOnClickListener(view -> {
- this.binding.fragmentHubViewHostNameInput.
- setText(this.viewModel.getDefaultHostName());
-
- this.binding.fragmentHubViewPortInput.
- setText(String.valueOf(this.viewModel.getDefaultPortNumber()));
-
- this.binding.fragmentHubViewMultiChannelButton.
- setChecked(this.viewModel.isMultiChannelEnabledByDefault());
- });
-
- //initialize
- if(this.viewModel.getState() == HubViewState.CREATE) {
- //if a new hub should be added, the default values are initialized by simulating a click
- // on the default values button
- this.binding.fragmentHubViewDefaultValuesButton.callOnClick();
-
- } else {
- //else wise the values from the selected hub are loaded
- try {
- HubConnectorDescription hcd = this.viewModel.getSelectedHub().getValue();
- this.binding.fragmentHubViewHostNameInput.
- setText(hcd.getHostName());
-
- this.binding.fragmentHubViewPortInput.
- setText(String.valueOf(hcd.getPortNumber()));
-
- this.binding.fragmentHubViewMultiChannelButton.
- setChecked(hcd.canMultiChannel());
- } catch (ASAPHubException | NullPointerException e) {
- throw new RuntimeException();
- }
-
- }
-
- //..when the configured hub should be saved
- this.binding.fragmentHubViewSaveButton.setOnClickListener(view -> {
-
- String hostName = this.binding.fragmentHubViewHostNameInput.getText().toString();
- String portString = this.binding.fragmentHubViewPortInput.getText().toString();
- boolean multiChannelEnabled = this.binding.fragmentHubViewMultiChannelButton.isChecked();
- System.out.println(multiChannelEnabled);
-
- try {
- int portNumber = Integer.parseInt(portString);
-
- HubConnectorDescription newHcd =
- new TCPHubConnectorDescriptionImpl(hostName, portNumber, multiChannelEnabled);
-
- SharkPeer peer = SharkNetApp.getSharkNetApp().getSharkPeer();
-
- //if(view == this.findViewById(R.id.deleteButton)) {
- // sPeer.removeHubDescription(descriptionFromGUI);
- //}
- // remove old one - it was most probably changed
- if(this.viewModel.getState() == HubViewState.EDIT) {
- HubConnectorDescription hcd = this.viewModel.getSelectedHub().getValue();
- peer.removeHubDescription(hcd);
- }
- // add data from GUI
- peer.addHubDescription(newHcd);
-
-
- Navigation.findNavController(view).
- navigate(R.id.action_nav_hub_view_to_nav_hub_list);
-
- } catch (NumberFormatException e) {
- Toast.makeText(this.getContext(), "port must be a number: " + portString,
- Toast.LENGTH_SHORT).show();
- } catch (IOException e) {
- Toast.makeText(this.getContext(), "port must be a number: " + portString,
- Toast.LENGTH_SHORT).show();
- Log.e(this.getClass().getSimpleName(), "not good: " + e.getLocalizedMessage());
- }
- });
-
- //...when the configuration is aborted
- this.binding.fragmentHubViewAbortButton.setOnClickListener(view ->
- Navigation.findNavController(view).navigate(R.id.action_nav_hub_view_to_nav_hub_list)
- );
-
- return this.binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/network/hub/HubViewModel.java b/app/src/main/java/net/sharksystem/ui/network/hub/HubViewModel.java
deleted file mode 100644
index 77bf3df..0000000
--- a/app/src/main/java/net/sharksystem/ui/network/hub/HubViewModel.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package net.sharksystem.ui.network.hub;
-
-import androidx.lifecycle.LiveData;
-import androidx.lifecycle.MutableLiveData;
-import androidx.lifecycle.ViewModel;
-
-import net.sharksystem.hub.peerside.HubConnectorDescription;
-
-public class HubViewModel extends ViewModel {
-
- private static final String DEFAULT_HOST_NAME = "asaphub.f4.htw-berlin.de";
- private static final int DEFAULT_PORT_NUMBER = 6910;
-
- private static final boolean STANDARD_MULTI_CHANNEL_ENABLED_STATE = false;
-
- private final MutableLiveData selectedHub;
-
-
- public HubViewModel() {
- this.selectedHub = new MutableLiveData<>();
- }
-
- protected LiveData getSelectedHub() throws IllegalStateException {
- if(this.selectedHub != null) {
- return this.selectedHub;
- } else {
- throw new IllegalStateException();
- }
- }
-
- public void setSelectedHub(HubConnectorDescription hub) {
- this.selectedHub.setValue(hub);
- }
-
-
- protected HubViewState getState() {
- if(this.selectedHub.getValue() != null) {
- return HubViewState.EDIT;
- } else {
- return HubViewState.CREATE;
- }
- }
-
- protected String getDefaultHostName() {
- return DEFAULT_HOST_NAME;
- }
-
- protected int getDefaultPortNumber() {
- return DEFAULT_PORT_NUMBER;
- }
-
- protected boolean isMultiChannelEnabledByDefault() {
- return STANDARD_MULTI_CHANNEL_ENABLED_STATE;
- }
-}
diff --git a/app/src/main/java/net/sharksystem/ui/network/hub/HubViewState.java b/app/src/main/java/net/sharksystem/ui/network/hub/HubViewState.java
deleted file mode 100644
index 7750e88..0000000
--- a/app/src/main/java/net/sharksystem/ui/network/hub/HubViewState.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package net.sharksystem.ui.network.hub;
-
-public enum HubViewState {
- CREATE,
- EDIT
-}
diff --git a/app/src/main/java/net/sharksystem/ui/radar/RadarFragment.java b/app/src/main/java/net/sharksystem/ui/radar/RadarFragment.java
deleted file mode 100644
index 424ebcc..0000000
--- a/app/src/main/java/net/sharksystem/ui/radar/RadarFragment.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package net.sharksystem.ui.radar;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.fragment.app.Fragment;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import net.sharksystem.databinding.FragmentRadarBinding;
-
-
-public class RadarFragment extends Fragment {
-
- /**
- * Binding to access elements from the layout
- */
- private FragmentRadarBinding binding;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
- @Nullable Bundle savedInstanceState) {
-
- this.binding = FragmentRadarBinding.inflate(inflater, container, false);
-
- return this.binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/settings/SettingsFragment.java b/app/src/main/java/net/sharksystem/ui/settings/SettingsFragment.java
deleted file mode 100644
index 022f3d2..0000000
--- a/app/src/main/java/net/sharksystem/ui/settings/SettingsFragment.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package net.sharksystem.ui.settings;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.fragment.app.Fragment;
-import androidx.navigation.Navigation;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import net.sharksystem.R;
-import net.sharksystem.databinding.FragmentSettingsBinding;
-
-public class SettingsFragment extends Fragment {
-
- private FragmentSettingsBinding binding;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
- @Nullable Bundle savedInstanceState) {
-
- this.binding = FragmentSettingsBinding.inflate(inflater, container, false);
-
- this.binding.fragmentSettingsPersonalDataButton.setOnClickListener(view ->
- Navigation.findNavController(view).navigate(R.id.action_nav_settings_to_nav_personal_data)
- );
-
- this.binding.fragmentSettingsRsaKeyButton.setOnClickListener(view ->
- Navigation.findNavController(view).navigate(R.id.action_nav_settings_to_nav_rsa)
- );
-
- this.binding.fragmentSettingsSendCredentialsButton.setOnClickListener(view ->
- Navigation.findNavController(view).navigate(R.id.action_nav_settings_to_nav_send_credentials_info)
- );
-
- this.binding.fragmentSettingsCertificatesButton.setOnClickListener(view ->
- Navigation.findNavController(view).navigate(R.id.action_nav_settings_to_nav_certificate_list)
- );
-
- return this.binding.getRoot();
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/settings/certificates/CertificateListFragment.java b/app/src/main/java/net/sharksystem/ui/settings/certificates/CertificateListFragment.java
deleted file mode 100644
index 5bb35e9..0000000
--- a/app/src/main/java/net/sharksystem/ui/settings/certificates/CertificateListFragment.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package net.sharksystem.ui.settings.certificates;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import net.sharksystem.databinding.FragmentCertificateListBinding;
-
-public class CertificateListFragment extends Fragment {
-
- private FragmentCertificateListBinding binding;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- this.binding = FragmentCertificateListBinding.inflate(this.getLayoutInflater());
-
- return this.binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/settings/personal/PersonalDataFragment.java b/app/src/main/java/net/sharksystem/ui/settings/personal/PersonalDataFragment.java
deleted file mode 100644
index ee04e37..0000000
--- a/app/src/main/java/net/sharksystem/ui/settings/personal/PersonalDataFragment.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package net.sharksystem.ui.settings.personal;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.navigation.Navigation;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Toast;
-
-import net.sharksystem.R;
-import net.sharksystem.SharkException;
-import net.sharksystem.databinding.FragmentPersonalDataBinding;
-import net.sharksystem.sharknet.android.SharkNetApp;
-
-/**
- * This fragments displays the user's personal data.
- */
-public class PersonalDataFragment extends Fragment {
-
- /**
- * Binding for easy access to layout elements
- */
- private FragmentPersonalDataBinding binding;
-
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- this.binding = FragmentPersonalDataBinding.inflate(this.getLayoutInflater());
-
- //Get the current username and update user interface
- this.binding.fragmentPersonalDataNameInput.
- setText(SharkNetApp.getSharkNetApp().getOwnerName());
-
- //Get the current OwnerID and update user interface
- this.binding.fragmentPersonalDataOwnerId.
- setText(SharkNetApp.getSharkNetApp().getOwnerID());
-
- //ClickListener for saving data
- this.binding.fragmentPersonalDataSaveButton.setOnClickListener(view -> {
-
- String ownerNameString = this.binding.fragmentPersonalDataNameInput.getText().toString();
-
- SharkNetApp app = SharkNetApp.getSharkNetApp();
- try {
- // TODO should this be initialize system? that would change ownerID
- app.changeOwnerName(this.requireActivity(), ownerNameString);
- } catch (SharkException e) {
- Toast.makeText(this.getContext(), e.getLocalizedMessage(), Toast.LENGTH_SHORT).show();
- }
-
- //Navigate back to main settings view
- Navigation.findNavController(view).
- navigate(R.id.action_nav_personal_data_to_nav_settings);
- });
-
- return this.binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/settings/rsa/RsaFragment.java b/app/src/main/java/net/sharksystem/ui/settings/rsa/RsaFragment.java
deleted file mode 100644
index 2a82d7f..0000000
--- a/app/src/main/java/net/sharksystem/ui/settings/rsa/RsaFragment.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package net.sharksystem.ui.settings.rsa;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.navigation.Navigation;
-
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import net.sharksystem.R;
-import net.sharksystem.asap.ASAPSecurityException;
-import net.sharksystem.asap.utils.DateTimeHelper;
-import net.sharksystem.databinding.FragmentRsaBinding;
-import net.sharksystem.sharknet.android.SharkNetApp;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-/**
- * This fragment allows you to generate a new RSA key and see when your key was last generated.
- */
-public class RsaFragment extends Fragment {
-
- /**
- * Binding for easy access to layout elements
- */
- private FragmentRsaBinding binding;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- this.binding = FragmentRsaBinding.inflate(this.getLayoutInflater());
-
- //Display key creation time
- try {
- String creationTime = DateTimeHelper.long2DateString(SharkNetApp.getSharkNetApp().
- getSharkPKI().getKeysCreationTime());
-
- this.binding.fragmentRsaDate.setText(creationTime);
-
- } catch (ASAPSecurityException e) {
- Log.e(this.getClass().getSimpleName(), e.getLocalizedMessage());
- }
-
- //Generate new key pair in separate thread
- this.binding.fragmentRsaGenerateButton.setOnClickListener(view -> {
- //Using Java ScheduledExecutor. Thread would be possible as well
- ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
- executorService.schedule(() -> {
- try {
- SharkNetApp.getSharkNetApp().getSharkPKI().generateKeyPair();
-
- String creationTime = DateTimeHelper.long2DateString(SharkNetApp.
- getSharkNetApp().getSharkPKI().getKeysCreationTime());
-
- this.binding.fragmentRsaDate.setText(creationTime);
-
- } catch (ASAPSecurityException e) {
- Log.e(this.getClass().getSimpleName(), e.getLocalizedMessage());
- }
- }, 0, TimeUnit.MILLISECONDS);
-
- Navigation.findNavController(view).navigate(R.id.action_nav_rsa_to_nav_settings);
- });
-
-
- return this.binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/settings/sendCredentials/CredentialsViewModel.java b/app/src/main/java/net/sharksystem/ui/settings/sendCredentials/CredentialsViewModel.java
deleted file mode 100644
index 4c3d92e..0000000
--- a/app/src/main/java/net/sharksystem/ui/settings/sendCredentials/CredentialsViewModel.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package net.sharksystem.ui.settings.sendCredentials;
-
-import androidx.lifecycle.ViewModel;
-
-public class CredentialsViewModel extends ViewModel {
-
- private CharSequence cic;
-
-
- public CredentialsViewModel() {
- this.cic = "";
- }
-
- CharSequence getCIC() {
- return this.cic;
- }
-
- void setCIC(CharSequence cic) {
- this.cic = cic;
- }
-}
diff --git a/app/src/main/java/net/sharksystem/ui/settings/sendCredentials/SendCredentialsFragment.java b/app/src/main/java/net/sharksystem/ui/settings/sendCredentials/SendCredentialsFragment.java
deleted file mode 100644
index 567e5a4..0000000
--- a/app/src/main/java/net/sharksystem/ui/settings/sendCredentials/SendCredentialsFragment.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package net.sharksystem.ui.settings.sendCredentials;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.lifecycle.ViewModelProvider;
-
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Toast;
-
-import net.sharksystem.SharkException;
-import net.sharksystem.asap.ASAPSecurityException;
-import net.sharksystem.asap.utils.DateTimeHelper;
-import net.sharksystem.databinding.FragmentSendCredentialsBinding;
-import net.sharksystem.pki.CredentialMessage;
-import net.sharksystem.sharknet.android.SharkNetApp;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-
-/**
- * This fragment shows the entire credential that will be sent to the receiver.
- */
-public class SendCredentialsFragment extends Fragment {
-
- private FragmentSendCredentialsBinding binding;
-
- private CredentialsViewModel viewModel;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- this.binding = FragmentSendCredentialsBinding.inflate(this.getLayoutInflater());
-
- this.viewModel = new ViewModelProvider(this.requireActivity()).get(CredentialsViewModel.class);
-
- byte[] cic = this.viewModel.getCIC().toString().getBytes(StandardCharsets.UTF_8);
-
- try {
- CredentialMessage cm = SharkNetApp.getSharkNetApp().
- getSharkPKI().createCredentialMessage(cic);
-
- CharSequence id = cm.getSubjectID();
- CharSequence name = cm.getSubjectName();
- long validSince = cm.getValidSince();
- int randomInt = cm.getRandomInt();
- CharSequence hash = "not yet implemented";
- CharSequence cicCS = new String(cic, StandardCharsets.UTF_8);
-
- this.binding.credentialSubjectIDValue.setText(id);
- this.binding.credentialSubjectNameValue.setText(name);
- this.binding.credentialValidSinceValue.setText(DateTimeHelper.long2DateString(validSince));
- this.binding.credentialRandomNumberValue.setText(String.valueOf(randomInt));
- this.binding.credentialHashPublicKeyValue.setText(hash);
- this.binding.credentialExtraDataValue.setText(cicCS);
-
- this.binding.actionButton.setOnClickListener(view -> {
- try {
- //TODO: why is this not working?
- SharkNetApp.getSharkNetApp().getSharkPKI().
- acceptAndSignCredential(cm);
-
- } catch (IOException | ASAPSecurityException e) {
- String s = "fatal: could not add certificate: " + e.getLocalizedMessage();
- Log.e(this.getClass().getSimpleName(), s);
- Toast.makeText(this.getContext(), s, Toast.LENGTH_SHORT).show();
- }
- });
-
- } catch (SharkException e) {
- Log.d(this.getClass().getSimpleName(), "could not send credential: " + e.getLocalizedMessage());
- Toast.makeText(this.getContext(), "could not send credential: " + e.getLocalizedMessage(),
- Toast.LENGTH_SHORT).show();
- }
-
- return this.binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/net/sharksystem/ui/settings/sendCredentials/SendCredentialsInfoFragment.java b/app/src/main/java/net/sharksystem/ui/settings/sendCredentials/SendCredentialsInfoFragment.java
deleted file mode 100644
index a997ff7..0000000
--- a/app/src/main/java/net/sharksystem/ui/settings/sendCredentials/SendCredentialsInfoFragment.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package net.sharksystem.ui.settings.sendCredentials;
-
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.navigation.Navigation;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import net.sharksystem.R;
-import net.sharksystem.databinding.FragmentSendCredentialsInfoBinding;
-
-/**
- * This fragment informs the user about the earnestness of exchanging credentials and lets the
- * sender add a Custom Identification Code that the sender told him to add, so he can identify
- * the sender.
- */
-public class SendCredentialsInfoFragment extends Fragment {
-
- /**
- * Binding for easy access to layout elements
- */
- private FragmentSendCredentialsInfoBinding binding;
-
- /**
- * View Model for saving the credential message for the fragment, where it is really send
- */
- private CredentialsViewModel viewModel;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- this.binding = FragmentSendCredentialsInfoBinding.inflate(this.getLayoutInflater());
-
- this.viewModel = new ViewModelProvider(this.requireActivity()).get(CredentialsViewModel.class);
-
- //Abort button brings the user back to the settings overview screen
- this.binding.fragmentSendCredentialsInfoAbortButton.setOnClickListener(view ->
- Navigation.findNavController(view)
- .navigate(R.id.action_nav_send_credentials_info_to_nav_settings)
- );
-
- //If the user continues, the credentials will be saved including optional CIC
- this.binding.fragmentSendCredentialsInfoContinueButton.setOnClickListener(view -> {
- this.viewModel.setCIC(this.binding.fragmentSendCredentialsInfoCicInput.getText().
- toString());
-
- Navigation.findNavController(view).
- navigate(R.id.action_nav_send_credentials_info_to_nav_send_credentials);
- });
-
- return this.binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_search_black_24dp.xml b/app/src/main/res/drawable/ic_search_black_24dp.xml
deleted file mode 100644
index affc7ba..0000000
--- a/app/src/main/res/drawable/ic_search_black_24dp.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/setting_background.xml b/app/src/main/res/drawable/setting_background.xml
deleted file mode 100644
index 4979584..0000000
--- a/app/src/main/res/drawable/setting_background.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
deleted file mode 100644
index 56e5d58..0000000
--- a/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml
deleted file mode 100644
index e1e4f2a..0000000
--- a/app/src/main/res/layout/app_bar_main.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/certificate_exchange_layout.xml b/app/src/main/res/layout/certificate_exchange_layout.xml
index 8db2bef..2b931c3 100644
--- a/app/src/main/res/layout/certificate_exchange_layout.xml
+++ b/app/src/main/res/layout/certificate_exchange_layout.xml
@@ -7,17 +7,17 @@
>
+ android:textSize="@dimen/textSizeGoodReadableSmall" />
diff --git a/app/src/main/res/layout/channel_list_row_item.xml b/app/src/main/res/layout/channel_list_row_item.xml
deleted file mode 100644
index 77d9ef6..0000000
--- a/app/src/main/res/layout/channel_list_row_item.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml
deleted file mode 100644
index dafb245..0000000
--- a/app/src/main/res/layout/content_main.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/credential_view_layout.xml b/app/src/main/res/layout/credential_view_layout.xml
index d8ea3a8..f11ba4f 100644
--- a/app/src/main/res/layout/credential_view_layout.xml
+++ b/app/src/main/res/layout/credential_view_layout.xml
@@ -8,7 +8,7 @@
android:id="@+id/credentialExplainTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/send_credential_credential_description" />
+ android:text="@string/credentialDescription" />
+ android:text="@string/credentialSubjectIDTag" />
+ android:text="@string/credentialSubjectNameTag" />
+ android:text="@string/credentialValidSinceTag" />
+ android:text="@string/credentialRandomNumberTag" />
+ android:text="@string/credentialHashPublicKeyTag" />
+ android:text="@string/credentialExtraDataTag" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/fragment_add_contact.xml b/app/src/main/res/layout/fragment_add_contact.xml
deleted file mode 100644
index 22bc3f8..0000000
--- a/app/src/main/res/layout/fragment_add_contact.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/fragment_add_massage.xml b/app/src/main/res/layout/fragment_add_massage.xml
deleted file mode 100644
index f5edb4e..0000000
--- a/app/src/main/res/layout/fragment_add_massage.xml
+++ /dev/null
@@ -1,202 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_certificate_list.xml b/app/src/main/res/layout/fragment_certificate_list.xml
deleted file mode 100644
index f3418f7..0000000
--- a/app/src/main/res/layout/fragment_certificate_list.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_channel_list.xml b/app/src/main/res/layout/fragment_channel_list.xml
deleted file mode 100644
index 6384ea7..0000000
--- a/app/src/main/res/layout/fragment_channel_list.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_channel_view.xml b/app/src/main/res/layout/fragment_channel_view.xml
deleted file mode 100644
index 7904cce..0000000
--- a/app/src/main/res/layout/fragment_channel_view.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_contact_list.xml b/app/src/main/res/layout/fragment_contact_list.xml
deleted file mode 100644
index 19c6ca8..0000000
--- a/app/src/main/res/layout/fragment_contact_list.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_contact_view.xml b/app/src/main/res/layout/fragment_contact_view.xml
deleted file mode 100644
index b155427..0000000
--- a/app/src/main/res/layout/fragment_contact_view.xml
+++ /dev/null
@@ -1,149 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_first_start.xml b/app/src/main/res/layout/fragment_first_start.xml
deleted file mode 100644
index 8352925..0000000
--- a/app/src/main/res/layout/fragment_first_start.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_hub_list.xml b/app/src/main/res/layout/fragment_hub_list.xml
deleted file mode 100644
index 6a2824a..0000000
--- a/app/src/main/res/layout/fragment_hub_list.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_hub_view.xml b/app/src/main/res/layout/fragment_hub_view.xml
deleted file mode 100644
index 33a4c0b..0000000
--- a/app/src/main/res/layout/fragment_hub_view.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_message_view.xml b/app/src/main/res/layout/fragment_message_view.xml
deleted file mode 100644
index 9325718..0000000
--- a/app/src/main/res/layout/fragment_message_view.xml
+++ /dev/null
@@ -1,245 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_network.xml b/app/src/main/res/layout/fragment_network.xml
deleted file mode 100644
index 59fd721..0000000
--- a/app/src/main/res/layout/fragment_network.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_personal_data.xml b/app/src/main/res/layout/fragment_personal_data.xml
deleted file mode 100644
index 87c6ed1..0000000
--- a/app/src/main/res/layout/fragment_personal_data.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_radar.xml b/app/src/main/res/layout/fragment_radar.xml
deleted file mode 100644
index cfd501e..0000000
--- a/app/src/main/res/layout/fragment_radar.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_receive_credentials.xml b/app/src/main/res/layout/fragment_receive_credentials.xml
deleted file mode 100644
index 90dc079..0000000
--- a/app/src/main/res/layout/fragment_receive_credentials.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_rsa.xml b/app/src/main/res/layout/fragment_rsa.xml
deleted file mode 100644
index bc1ffab..0000000
--- a/app/src/main/res/layout/fragment_rsa.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_send_credentials.xml b/app/src/main/res/layout/fragment_send_credentials.xml
deleted file mode 100644
index 9613a79..0000000
--- a/app/src/main/res/layout/fragment_send_credentials.xml
+++ /dev/null
@@ -1,202 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_send_credentials_info.xml b/app/src/main/res/layout/fragment_send_credentials_info.xml
deleted file mode 100644
index 823f5c3..0000000
--- a/app/src/main/res/layout/fragment_send_credentials_info.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml
deleted file mode 100644
index 1af553b..0000000
--- a/app/src/main/res/layout/fragment_settings.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/init.xml b/app/src/main/res/layout/init.xml
index d73892d..a50ab2b 100644
--- a/app/src/main/res/layout/init.xml
+++ b/app/src/main/res/layout/init.xml
@@ -22,10 +22,10 @@
/>
\ No newline at end of file
diff --git a/app/src/main/res/layout/nav_header_main.xml b/app/src/main/res/layout/nav_header_main.xml
deleted file mode 100644
index cf3de3f..0000000
--- a/app/src/main/res/layout/nav_header_main.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/owner_layout.xml b/app/src/main/res/layout/owner_layout.xml
index d3c0e39..87c2757 100644
--- a/app/src/main/res/layout/owner_layout.xml
+++ b/app/src/main/res/layout/owner_layout.xml
@@ -16,14 +16,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onSaveClick"
- android:text="@string/global_save" />
+ android:text="@string/save" />
+ android:text="@string/abort" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/person_add_received_credential_layout.xml b/app/src/main/res/layout/person_add_received_credential_layout.xml
index 8542c90..94f1492 100644
--- a/app/src/main/res/layout/person_add_received_credential_layout.xml
+++ b/app/src/main/res/layout/person_add_received_credential_layout.xml
@@ -61,10 +61,10 @@
/>
\ No newline at end of file
diff --git a/app/src/main/res/layout/person_edit_layout.xml b/app/src/main/res/layout/person_edit_layout.xml
index fedd0d9..306a78b 100644
--- a/app/src/main/res/layout/person_edit_layout.xml
+++ b/app/src/main/res/layout/person_edit_layout.xml
@@ -28,7 +28,7 @@
SF TODO
+
+ Credentials exchange is a very crucial process. Take it very carefully.
+ \n
+ One peer must start to send information. Can be you or the new peer. Decide.
+ \n
+ One press send the other receive. Following the instructions very carefully.
+ Afterwords, reverse your roles and do it again.
+
+
+
+ This credential is exchanged between peers. Receivers must very carefully ensure
+ sender\'s identity. Ask for an ID or something else. Ensure that the information below are
+ really sent be the peer or device that is nearby.
+ \n
+ This exchange is crucial. It is the very basis of this network of trust and your reputation.
+ \n
+ Senders help receivers in any possible way to ensure their identity. Receiver must not
+ accept those information if sender does not cooperate.
+
+
+ You can attach a Custom Identification Code (CIC) to your credentials.
+ This code is given to you by the receiver and is used to prove to them
+ that you are how you claim to be.
+
You can give the receiver a Custom Identification Code (CIC).
The sender should attach this code to their credentials.
@@ -286,5 +158,13 @@
CIC
- Message:
+
+ Peer ID
+ Peer name
+ Key valid since
+ Random number
+ Key Hash
+ Extra Data
+
+
diff --git a/build.gradle b/build.gradle
index ae3caab..10ee0fb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -8,7 +8,7 @@ buildscript {
// jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.4.2'
+ classpath 'com.android.tools.build:gradle:7.4.1'
// NOTE: Do not place your application dependencies here; they belong
@@ -24,6 +24,6 @@ allprojects {
}
}
-tasks.register('clean') {
+task clean(type: Delete) {
delete rootProject.buildDir
}
diff --git a/gradle.properties b/gradle.properties
index 1ea32cc..dc251f5 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -12,5 +12,4 @@ org.gradle.jvmargs=-Xmx1536m
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useAndroidX=true
-android.enableJetifier=true
-org.gradle.unsafe.configuration-cache=true
\ No newline at end of file
+android.enableJetifier=true
\ No newline at end of file