From 4984f2f7ad6cfb36d65a8732acd0be59f43e9c04 Mon Sep 17 00:00:00 2001 From: Amine Date: Sat, 13 Oct 2018 20:49:26 +0200 Subject: [PATCH] Removed the intro. It was causing issues. --- app/build.gradle | 3 - .../IntroActivityEspressoTest.kt | 91 ------------------- .../MainActivityEspressoTest.kt | 2 - app/src/main/AndroidManifest.xml | 4 - .../bou/readerforselfoss/IntroActivity.kt | 70 -------------- .../bou/readerforselfoss/MainActivity.kt | 12 +-- .../persistence/dao/DrawerDataDao.kt | 1 - app/src/main/res/layout/activity_home.xml | 4 +- 8 files changed, 4 insertions(+), 183 deletions(-) delete mode 100644 app/src/androidTest/java/apps/amine/bou/readerforselfoss/IntroActivityEspressoTest.kt delete mode 100644 app/src/main/java/apps/amine/bou/readerforselfoss/IntroActivity.kt diff --git a/app/build.gradle b/app/build.gradle index ad8380e..9ba9726 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -108,9 +108,6 @@ dependencies { //multidex implementation 'androidx.multidex:multidex:2.0.0' - // Intro - implementation 'agency.tango.android:material-intro-screen:0.0.5' - // About implementation('com.mikepenz:aboutlibraries:6.2.0@aar') { transitive = true diff --git a/app/src/androidTest/java/apps/amine/bou/readerforselfoss/IntroActivityEspressoTest.kt b/app/src/androidTest/java/apps/amine/bou/readerforselfoss/IntroActivityEspressoTest.kt deleted file mode 100644 index 9455253..0000000 --- a/app/src/androidTest/java/apps/amine/bou/readerforselfoss/IntroActivityEspressoTest.kt +++ /dev/null @@ -1,91 +0,0 @@ -package apps.amine.bou.readerforselfoss - -import android.content.Context -import android.content.Intent -import androidx.test.InstrumentationRegistry.getInstrumentation -import androidx.test.espresso.Espresso.onView -import androidx.test.espresso.action.ViewActions.click -import androidx.test.espresso.assertion.ViewAssertions.matches -import androidx.test.espresso.intent.Intents -import androidx.test.espresso.intent.Intents.intended -import androidx.test.espresso.intent.Intents.times -import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent -import androidx.test.espresso.matcher.ViewMatchers.isDisplayed -import androidx.test.espresso.matcher.ViewMatchers.withId -import androidx.test.espresso.matcher.ViewMatchers.withText -import androidx.test.rule.ActivityTestRule -import androidx.test.runner.AndroidJUnit4 -import apps.amine.bou.readerforselfoss.utils.Config -import org.junit.After -import org.junit.Before -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import java.util.* - -@RunWith(AndroidJUnit4::class) -class IntroActivityEspressoTest { - - @Rule @JvmField - val rule = ActivityTestRule(IntroActivity::class.java, true, false) - - @Before - fun clearData() { - val editor = - getInstrumentation().targetContext - .getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE) - .edit() - editor.clear() - editor.commit() - - Intents.init() - } - - @Test - fun nextEachTimes() { - - rule.launchActivity(Intent()) - - onView(withText(R.string.intro_hello_title)).check(matches(isDisplayed())) - onView(withId(R.id.button_next)).perform(click()) - onView(withText(R.string.intro_needs_selfoss_message)).check(matches(isDisplayed())) - onView(withId(R.id.button_next)).perform(click()) - onView(withText(R.string.intro_all_set_message)).check(matches(isDisplayed())) - onView(withId(R.id.button_next)).perform(click()) - - intended(hasComponent(IntroActivity::class.java.name), times(1)) - intended(hasComponent(LoginActivity::class.java.name), times(1)) - } - - @Test - fun nextBackRandomTimes() { - val max = 5 - val min = 1 - - val random = (Random().nextInt(max + 1 - min)) + min - - rule.launchActivity(Intent()) - - onView(withText(R.string.intro_hello_title)).check(matches(isDisplayed())) - onView(withId(R.id.button_next)).perform(click()) - - repeat(random) { _ -> - onView(withText(R.string.intro_needs_selfoss_message)).check(matches(isDisplayed())) - onView(withId(R.id.button_next)).perform(click()) - onView(withText(R.string.intro_all_set_message)).check(matches(isDisplayed())) - onView(withId(R.id.button_back)).perform(click()) - } - - onView(withId(R.id.button_next)).perform(click()) - onView(withText(R.string.intro_all_set_message)).check(matches(isDisplayed())) - onView(withId(R.id.button_next)).perform(click()) - - intended(hasComponent(IntroActivity::class.java.name), times(1)) - intended(hasComponent(LoginActivity::class.java.name), times(1)) - } - - @After - fun releaseIntents() { - Intents.release() - } -} \ No newline at end of file diff --git a/app/src/androidTest/java/apps/amine/bou/readerforselfoss/MainActivityEspressoTest.kt b/app/src/androidTest/java/apps/amine/bou/readerforselfoss/MainActivityEspressoTest.kt index c5bc6ba..a9228d2 100644 --- a/app/src/androidTest/java/apps/amine/bou/readerforselfoss/MainActivityEspressoTest.kt +++ b/app/src/androidTest/java/apps/amine/bou/readerforselfoss/MainActivityEspressoTest.kt @@ -45,7 +45,6 @@ class MainActivityEspressoTest { rule.launchActivity(intent) intended(hasComponent(MainActivity::class.java.name)) - intended(hasComponent(IntroActivity::class.java.name)) intended(hasComponent(LoginActivity::class.java.name), times(0)) } @@ -58,7 +57,6 @@ class MainActivityEspressoTest { intended(hasComponent(MainActivity::class.java.name)) intended(hasComponent(LoginActivity::class.java.name)) - intended(hasComponent(IntroActivity::class.java.name), times(0)) } @After diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5d23e85..ea477bc 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -21,10 +21,6 @@ - - diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/IntroActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/IntroActivity.kt deleted file mode 100644 index 3ce0e9b..0000000 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/IntroActivity.kt +++ /dev/null @@ -1,70 +0,0 @@ -package apps.amine.bou.readerforselfoss - -import agency.tango.materialintroscreen.MaterialIntroActivity -import agency.tango.materialintroscreen.MessageButtonBehaviour -import agency.tango.materialintroscreen.SlideFragmentBuilder -import android.content.Intent -import android.net.Uri -import android.os.Bundle -import android.preference.PreferenceManager -import androidx.appcompat.app.AppCompatDelegate -import android.view.View - -class IntroActivity : MaterialIntroActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - AppCompatDelegate.setCompatVectorFromResourcesEnabled(true) - - addSlide( - SlideFragmentBuilder() - .backgroundColor(R.color.colorPrimary) - .buttonsColor(R.color.colorAccent) - .image(R.drawable.web_hi_res_512) - .title(getString(R.string.intro_hello_title)) - .description(getString(R.string.intro_hello_message)) - .build() - ) - - addSlide( - SlideFragmentBuilder() - .backgroundColor(R.color.colorAccent) - .buttonsColor(R.color.colorPrimary) - .image(R.drawable.ic_info_outline_white_48px) - .title(getString(R.string.intro_needs_selfoss_title)) - .description(getString(R.string.intro_needs_selfoss_message)) - .build(), - MessageButtonBehaviour( - View.OnClickListener { - val browserIntent = Intent( - Intent.ACTION_VIEW, - Uri.parse("https://selfoss.aditu.de") - ) - startActivity(browserIntent) - }, getString(R.string.intro_needs_selfoss_link) - ) - ) - - addSlide( - SlideFragmentBuilder() - .backgroundColor(R.color.colorPrimaryDark) - .buttonsColor(R.color.colorAccentDark) - .image(R.drawable.ic_thumb_up_white_48px) - .title(getString(R.string.intro_all_set_title)) - .description(getString(R.string.intro_all_set_message)) - .build() - ) - } - - override fun onFinish() { - super.onFinish() - val getPrefs = PreferenceManager.getDefaultSharedPreferences(baseContext) - val e = getPrefs.edit() - e.putBoolean("firstStart", false) - e.apply() - val intent = Intent(this, LoginActivity::class.java) - startActivity(intent) - finish() - } -} diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/MainActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/MainActivity.kt index 112747f..93d54c5 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/MainActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/MainActivity.kt @@ -11,17 +11,9 @@ class MainActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - if (PreferenceManager.getDefaultSharedPreferences(baseContext).getBoolean( - "firstStart", - true - )) { - val i = Intent(this@MainActivity, IntroActivity::class.java) - startActivity(i) - } else { - val intent = Intent(this, LoginActivity::class.java) - startActivity(intent) - } + val intent = Intent(this, LoginActivity::class.java) + startActivity(intent) finish() } } diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/persistence/dao/DrawerDataDao.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/persistence/dao/DrawerDataDao.kt index 8188025..f142bc0 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/persistence/dao/DrawerDataDao.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/persistence/dao/DrawerDataDao.kt @@ -1,6 +1,5 @@ package apps.amine.bou.readerforselfoss.persistence.dao -import androidx.lifecycle.LiveData import androidx.room.Delete import androidx.room.Dao import androidx.room.Insert diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml index 45b28d5..39a0437 100644 --- a/app/src/main/res/layout/activity_home.xml +++ b/app/src/main/res/layout/activity_home.xml @@ -86,14 +86,14 @@ android:text="@string/nothing_here" android:textAlignment="center" android:textAppearance="@style/TextAppearance.AppCompat.Headline" - android:background="@color/transparent" + android:background="@android:color/transparent" android:visibility="gone" />