Skip to content

Commit

Permalink
Merge pull request #460 from StepicOrg/release/1.97
Browse files Browse the repository at this point in the history
Release/1.97
  • Loading branch information
rostikjoystick authored Oct 15, 2019
2 parents 797fe66 + 5946026 commit 46a9115
Show file tree
Hide file tree
Showing 674 changed files with 2,741 additions and 4,412 deletions.
49 changes: 21 additions & 28 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ android {
versionCode versions.code
versionName versions.name

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true

multiDexEnabled true
Expand Down Expand Up @@ -77,7 +77,6 @@ android {
}
debug {
minifyEnabled true
useProguard true
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro', 'proguard-rules-dev.pro'
Expand Down Expand Up @@ -123,18 +122,24 @@ dependencies {
implementation libraries.rxJava2
implementation libraries.rxKotlin

implementation libraries.supportAppCompat
implementation libraries.supportDesign
implementation libraries.supportRecyclerView
implementation libraries.supportCardView
implementation libraries.multidex
implementation libraries.appCompat
implementation libraries.ktx
implementation libraries.recyclerview
implementation libraries.viewPager
implementation libraries.cardView
implementation libraries.constraintLayout
implementation libraries.exoPlayerCore
implementation libraries.exoPlayerUI
implementation libraries.exoPlayerMediaSession

implementation libraries.archExtensions
implementation libraries.archViewModel
implementation libraries.media
implementation libraries.multidex
implementation libraries.adapterDelegates
implementation libraries.adapters
implementation libraries.viewKit

implementation libraries.exoPlayerCore
implementation libraries.exoPlayerUI
implementation libraries.exoPlayerMediaSession

implementation libraries.gson
implementation libraries.retrofit
Expand Down Expand Up @@ -174,9 +179,7 @@ dependencies {
implementation libraries.materialDialog
implementation libraries.materialDialogCore
implementation libraries.numberPicker
implementation (libraries.datePicker) {
exclude group: 'com.android.support'
}
implementation libraries.datePicker
implementation libraries.photoView
implementation libraries.recyclerAnimators
implementation libraries.materialProgress
Expand All @@ -188,8 +191,6 @@ dependencies {

implementation libraries.shortcutBadger
implementation libraries.StoriesKit
implementation libraries.AdapterDelegates
implementation libraries.Adapters

debugImplementation libraries.leakCanary
releaseImplementation libraries.leakCanaryNoOp
Expand All @@ -206,19 +207,11 @@ dependencies {
testImplementation libraries.jodaTime
testImplementation libraries.hamcrest

androidTestImplementation(libraries.supportTestRunner) {
exclude group: 'com.android.support'
}
androidTestImplementation libraries.supportTestRules
androidTestImplementation(libraries.espressoCore) {
exclude group: 'com.android.support'
}
androidTestImplementation(libraries.espressoContrib) {
exclude group: 'com.android.support'
}
androidTestImplementation(libraries.espressoIntents) {
exclude group: 'com.android.support'
}
androidTestImplementation libraries.testRunner
androidTestImplementation libraries.testRules
androidTestImplementation libraries.espressoCore
androidTestImplementation libraries.espressoContrib
androidTestImplementation libraries.espressoIntents
}

apply plugin: 'com.google.gms.google-services'
Expand Down
11 changes: 8 additions & 3 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
-dontwarn org.stepic.droid.notifications.**

#for saving search view https://stackoverflow.com/questions/18407171/searchview-getactionview-returning-null
-keep class android.support.v7.widget.SearchView { *; }
-keep class androidx.appcompat.widget.SearchView { *; }
-keep class org.stepic.droid.ui.custom.AutoCompleteSearchView { *; }

#keep configs names
Expand All @@ -138,6 +138,11 @@
-keeppackagenames org.jsoup.nodes

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
public static **[] values();
public static ** valueOf(java.lang.String);
}

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.stepic.droid.ui.activities;


import android.support.test.espresso.ViewInteraction;
import android.support.test.filters.LargeTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.espresso.ViewInteraction;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
Expand All @@ -17,16 +17,16 @@
import org.junit.runner.RunWith;
import org.stepic.droid.R;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
import static android.support.test.espresso.action.ViewActions.pressImeActionButton;
import static android.support.test.espresso.action.ViewActions.replaceText;
import static android.support.test.espresso.action.ViewActions.scrollTo;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.closeSoftKeyboard;
import static androidx.test.espresso.action.ViewActions.pressImeActionButton;
import static androidx.test.espresso.action.ViewActions.replaceText;
import static androidx.test.espresso.action.ViewActions.scrollTo;
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 static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.allOf;

@LargeTest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.stepic.droid.adaptive.model

import java.util.*
import java.util.Calendar

class AdaptiveWeekProgress(
val start: Calendar,
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/stepic/droid/adaptive/model/Card.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import io.reactivex.disposables.Disposable
import org.stepic.droid.base.App
import org.stepic.droid.di.qualifiers.BackgroundScheduler
import org.stepic.droid.di.qualifiers.MainScheduler
import org.stepik.android.model.attempts.Attempt
import org.stepic.droid.web.Api
import org.stepik.android.model.Lesson
import org.stepik.android.model.Step
import org.stepic.droid.web.Api
import org.stepik.android.model.attempts.Attempt
import javax.inject.Inject

class Card(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.stepic.droid.adaptive.ui.activities

import android.os.Bundle
import android.support.v7.app.AppCompatDelegate
import android.view.MenuItem
import androidx.appcompat.app.AppCompatDelegate
import kotlinx.android.synthetic.main.activity_adaptive_stats.*
import org.stepic.droid.R
import org.stepic.droid.adaptive.ui.adapters.AdaptiveStatsViewPagerAdapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ package org.stepic.droid.adaptive.ui.adapters

import android.content.Context
import android.graphics.drawable.Drawable
import android.support.v4.content.ContextCompat
import android.support.v4.graphics.drawable.DrawableCompat
import android.support.v7.content.res.AppCompatResources
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.DrawableCompat
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.adaptive_rating_item.view.*
import org.stepic.droid.R
import org.stepik.android.model.adaptive.RatingItem
import org.stepic.droid.preferences.SharedPreferenceHelper
import org.stepik.android.model.adaptive.RatingItem

class AdaptiveRatingAdapter (
context: Context,
sharedPreferenceHelper: SharedPreferenceHelper
class AdaptiveRatingAdapter(
context: Context,
sharedPreferenceHelper: SharedPreferenceHelper
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private companion object {
private const val RATING_ITEM_VIEW_TYPE = 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
package org.stepic.droid.adaptive.ui.adapters

import android.content.Context
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentStatePagerAdapter
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import org.stepic.droid.R
import org.stepic.droid.adaptive.ui.fragments.AdaptiveProgressFragment
import org.stepic.droid.adaptive.ui.fragments.AdaptiveRatingFragment

class AdaptiveStatsViewPagerAdapter(fm: FragmentManager, context: Context, courseId: Long) : FragmentStatePagerAdapter(fm) {
class AdaptiveStatsViewPagerAdapter(
fm: FragmentManager,
context: Context,
courseId: Long
) : FragmentStatePagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
private val fragments = listOf(
{ AdaptiveProgressFragment.newInstance(courseId) } to context.getString(R.string.adaptive_progress),
{ AdaptiveRatingFragment.newInstance(courseId) } to context.getString(R.string.adaptive_rating)
)

override fun getItem(position: Int) = fragments[position].first()
override fun getCount(): Int = fragments.size
override fun getPageTitle(position: Int): String = fragments[position].second
override fun getItem(position: Int): Fragment =
fragments[position].first()

override fun getCount(): Int =
fragments.size

override fun getPageTitle(position: Int): String =
fragments[position].second
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.stepic.droid.adaptive.ui.adapters

import android.content.res.Resources
import android.support.v4.content.ContextCompat
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.github.mikephil.charting.charts.LineChart
import com.github.mikephil.charting.data.LineData
import com.github.mikephil.charting.data.LineDataSet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package org.stepic.droid.adaptive.ui.adapters

import android.support.annotation.StringRes
import android.view.View
import android.view.ViewGroup
import android.webkit.WebView
import android.webkit.WebViewClient
import android.widget.Button
import androidx.annotation.StringRes
import kotlinx.android.synthetic.main.adaptive_quiz_card_view.view.*
import org.stepic.droid.R
import org.stepik.android.model.adaptive.Reaction
import org.stepic.droid.adaptive.ui.animations.CardAnimations
import org.stepic.droid.adaptive.ui.custom.CardScrollView
import org.stepic.droid.adaptive.ui.custom.SwipeableLayout
Expand All @@ -17,16 +16,18 @@ import org.stepic.droid.base.App
import org.stepic.droid.core.ScreenManager
import org.stepic.droid.core.presenters.CardPresenter
import org.stepic.droid.core.presenters.contracts.CardView
import org.stepik.android.model.Step
import org.stepik.android.model.Submission
import org.stepic.droid.ui.custom.LatexSupportableWebView
import org.stepic.droid.ui.quiz.QuizDelegate
import org.stepic.droid.ui.util.snackbar
import org.stepic.droid.util.resolvers.StepTypeResolver
import org.stepik.android.model.Step
import org.stepik.android.model.Submission
import org.stepik.android.model.adaptive.Reaction
import javax.inject.Inject
import kotlin.math.max

class QuizCardViewHolder(
private val root: View
private val root: View
): ContainerView.ViewHolder(root), CardView {
private val curtain = root.curtain
private val answersProgress = root.answersProgress
Expand All @@ -48,7 +49,7 @@ class QuizCardViewHolder(
private val hardReaction = root.reaction_hard
private val easyReaction = root.reaction_easy

val cardView: android.support.v7.widget.CardView = root.card
val cardView: androidx.cardview.widget.CardView = root.card

private lateinit var quizDelegate: QuizDelegate

Expand Down Expand Up @@ -99,8 +100,8 @@ class QuizCardViewHolder(

container.setSwipeListener(object : SwipeableLayout.SwipeListener() {
override fun onScroll(scrollProgress: Float) {
hardReaction.alpha = Math.max(2 * scrollProgress, 0f)
easyReaction.alpha = Math.max(2 * -scrollProgress, 0f)
hardReaction.alpha = max(2 * scrollProgress, 0f)
easyReaction.alpha = max(2 * -scrollProgress, 0f)
}

override fun onSwipeLeft() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import androidx.core.view.children
import org.stepic.droid.R
import org.stepic.droid.adaptive.listeners.AdaptiveReactionListener
import org.stepic.droid.adaptive.listeners.AnswerListener
Expand All @@ -12,20 +13,18 @@ import org.stepic.droid.adaptive.ui.custom.QuizCardsContainer
import org.stepic.droid.core.presenters.CardPresenter
import java.util.ArrayList


open class QuizCardsAdapter(
private val listener: AdaptiveReactionListener?,
private val answerListener: AnswerListener?
private val listener: AdaptiveReactionListener?,
private val answerListener: AnswerListener?
): QuizCardsContainer.CardsAdapter<QuizCardViewHolder>() {

companion object {
@JvmStatic
private fun changeVisibilityOfAllChildrenTo(viewGroup: ViewGroup, visibility: Int, exclude: List<Int>?) {
val count = viewGroup.childCount
(0 until count)
.map { viewGroup.getChildAt(it) }
.filterNot { exclude != null && exclude.contains(it.id) }
.forEach { it.visibility = visibility }
viewGroup
.children
.filterNot { exclude != null && exclude.contains(it.id) }
.forEach { it.visibility = visibility }
}
}

Expand Down Expand Up @@ -73,9 +72,10 @@ open class QuizCardsAdapter(
onDataAdded()
}

fun isEmptyOrContainsOnlySwipedCard(lesson: Long) =
presenters.isEmpty() || presenters.size == 1 && presenters[0].card.lessonId == lesson
fun isEmptyOrContainsOnlySwipedCard(lesson: Long): Boolean =
presenters.isEmpty() || presenters.size == 1 && presenters[0].card.lessonId == lesson

override fun poll() =
presenters.removeAt(0).destroy()
override fun poll() {
presenters.removeAt(0).destroy()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package org.stepic.droid.adaptive.ui.animations

import android.content.Context
import android.graphics.Color
import android.support.design.widget.CoordinatorLayout
import android.support.v4.content.ContextCompat
import android.view.View
import android.view.animation.DecelerateInterpolator
import android.widget.TextView
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat
import com.github.jinatonic.confetti.CommonConfetti
import org.stepic.droid.R
import org.stepic.droid.adaptive.ui.custom.morphing.MorphingHelper
Expand Down
Loading

0 comments on commit 46a9115

Please sign in to comment.