Skip to content

Commit

Permalink
Material you
Browse files Browse the repository at this point in the history
  • Loading branch information
premnirmal committed Jul 7, 2022
1 parent d54d8ce commit 0175605
Show file tree
Hide file tree
Showing 69 changed files with 327 additions and 422 deletions.
22 changes: 10 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def getOldGitVersion = { ->
}

android {
compileSdkVersion 31
compileSdkVersion 32
buildToolsVersion "31.0.0"

def final name = getVersionName()
Expand All @@ -68,7 +68,7 @@ android {
defaultConfig {
applicationId appIdBase
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 32
testInstrumentationRunner "com.github.premnirmal.ticker.mock.MockTestRunner"

versionCode = code
Expand Down Expand Up @@ -195,8 +195,8 @@ android {
}

ext {
LIFECYCLE_VERSION = "2.4.0"
DAGGER_VERSION = "2.40.5"
LIFECYCLE_VERSION = "2.5.0"
DAGGER_VERSION = "2.41"
MOCKITO_VERSION = "3.4.6"
JUNIT_VERSION = "4.13.1"
RETROFIT_VERSION = "2.9.0"
Expand All @@ -210,15 +210,15 @@ ext {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

implementation "androidx.core:core-ktx:1.7.0"
implementation "androidx.core:core-ktx:1.8.0"
implementation "androidx.multidex:multidex:2.0.1"

implementation "androidx.appcompat:appcompat:1.4.1"
implementation "androidx.appcompat:appcompat:1.4.2"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "com.google.android.material:material:1.6.0-alpha02"
implementation "com.google.android.material:material:1.6.0"
implementation "androidx.preference:preference-ktx:1.2.0"
implementation "androidx.browser:browser:1.4.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.3"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.viewpager2:viewpager2:1.0.0"

implementation "javax.inject:javax.inject:1"
Expand All @@ -243,8 +243,6 @@ dependencies {

implementation "com.jakewharton.threetenabp:threetenabp:1.3.0"

implementation "io.github.inflationx:calligraphy3:3.1.1"
implementation "io.github.inflationx:viewpump:2.0.3"
implementation "com.jakewharton.timber:timber:4.7.1"
implementation "com.github.PhilJay:MPAndroidChart:v3.0.3"

Expand All @@ -254,8 +252,8 @@ dependencies {

implementation "com.robinhood.ticker:ticker:2.0.2"

prodImplementation "com.google.firebase:firebase-crashlytics:18.2.7"
prodImplementation "com.google.firebase:firebase-analytics:20.0.2"
prodImplementation "com.google.firebase:firebase-crashlytics:18.2.11"
prodImplementation "com.google.firebase:firebase-analytics:21.0.0"

// debugImplementation "com.squareup.leakcanary:leakcanary-android:2.4"

Expand Down
4 changes: 0 additions & 4 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
# If you are using custom exceptions, add this line so that custom exception types are skipped during obfuscation:
-keep public class * extends java.lang.Exception

# Calligraphy
-keep class io.github.inflationx.calligraphy3.* { *; }
-keep class io.github.inflationx.calligraphy3.*$* { *; }

# Retrofit
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
Expand Down
Empty file.
17 changes: 2 additions & 15 deletions app/src/main/kotlin/com/github/premnirmal/ticker/StocksApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,10 @@ import com.github.premnirmal.ticker.components.AppModule
import com.github.premnirmal.ticker.components.DaggerAppComponent
import com.github.premnirmal.ticker.components.Injector
import com.github.premnirmal.ticker.components.LoggingTree
import com.github.premnirmal.ticker.network.CommitsProvider
import com.github.premnirmal.ticker.network.NewsProvider
import com.github.premnirmal.ticker.notifications.NotificationsHandler
import com.github.premnirmal.ticker.widget.WidgetDataProvider
import com.github.premnirmal.tickerwidget.R
import com.google.android.material.color.DynamicColors
import com.jakewharton.threetenabp.AndroidThreeTen
import io.github.inflationx.calligraphy3.CalligraphyConfig
import io.github.inflationx.calligraphy3.CalligraphyInterceptor
import io.github.inflationx.viewpump.ViewPump
import timber.log.Timber
import javax.inject.Inject

Expand All @@ -39,16 +34,8 @@ open class StocksApp : MultiDexApplication() {
initLogger()
initThreeTen()
Injector.init(createAppComponent())
ViewPump.init(
ViewPump.builder()
.addInterceptor(
CalligraphyInterceptor(
CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/Ubuntu-Regular.ttf")
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
.build()))
.build())
Injector.appComponent.inject(holder)
DynamicColors.applyToActivitiesIfAvailable(this)
AppCompatDelegate.setDefaultNightMode(holder.appPreferences.nightMode)
initAnalytics()
initNotificationHandler()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.premnirmal.ticker.base

import android.content.Context
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
Expand All @@ -10,7 +9,6 @@ import com.github.premnirmal.ticker.components.Injector
import com.github.premnirmal.ticker.model.IStocksProvider
import com.github.premnirmal.ticker.model.IStocksProvider.FetchState
import com.github.premnirmal.ticker.showDialog
import io.github.inflationx.viewpump.ViewPumpContextWrapper
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
Expand All @@ -28,10 +26,6 @@ abstract class BaseActivity<T: ViewBinding> : AppCompatActivity() {
private var isErrorDialogShowing = false
private val holder: InjectionHolder by lazy { InjectionHolder() }

override fun attachBaseContext(newBase: Context) {
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase))
}

override fun onCreate(
savedInstanceState: Bundle?
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import com.github.premnirmal.tickerwidget.BuildConfig
import com.github.premnirmal.tickerwidget.R
import com.github.premnirmal.tickerwidget.databinding.ActivityMainBinding
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.android.material.elevation.SurfaceColors
import kotlinx.coroutines.launch
import javax.inject.Inject

Expand Down Expand Up @@ -60,8 +61,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), BottomNavigationView.O
override fun onCreate(savedInstanceState: Bundle?) {
Injector.appComponent.inject(this)
super.onCreate(savedInstanceState)
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility or (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility or
(View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
window.navigationBarColor = SurfaceColors.SURFACE_2.getColor(this)
savedInstanceState?.let { rateDialogShown = it.getBoolean(DIALOG_SHOWN, false) }

binding.bottomNavigation.setOnNavigationItemSelectedListener(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ class NewsFeedFragment : BaseFragment<FragmentNewsFeedBinding>(), ChildFragment,
SpacingDecoration(requireContext().resources.getDimensionPixelSize(dimen.list_spacing_double))
)
binding.recyclerView.adapter = adapter
binding.swipeContainer.setColorSchemeResources(R.color.color_primary_dark, R.color.spicy_salmon,
R.color.sea)
binding.swipeContainer.setOnRefreshListener { refreshNews() }
viewModel.newsFeed.observe(viewLifecycleOwner) {
if (it.wasSuccessful) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import android.content.Intent
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import android.view.Surface
import android.view.View
import android.view.ViewGroup
import android.view.ViewGroup.MarginLayoutParams
Expand All @@ -31,7 +30,6 @@ import com.github.premnirmal.ticker.components.Injector
import com.github.premnirmal.ticker.formatChange
import com.github.premnirmal.ticker.formatChangePercent
import com.github.premnirmal.ticker.getActionBarHeight
import com.github.premnirmal.ticker.getNavigationBarHeight
import com.github.premnirmal.ticker.getStatusBarHeight
import com.github.premnirmal.ticker.isNetworkOnline
import com.github.premnirmal.ticker.model.IHistoryProvider.Range
Expand Down Expand Up @@ -118,19 +116,6 @@ class QuoteDetailActivity : BaseGraphActivity<ActivityQuoteDetailBinding>(), New
binding.changePercent.setCharacterLists(TickerUtils.provideNumberList())
if (resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) {
binding.appBarLayout.addOnOffsetChangedListener(offsetChangedListener)
} else if (!resources.getBoolean(R.bool.isTablet) && resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
binding.parentView.updateLayoutParams<MarginLayoutParams> {
val rotation = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
display?.rotation ?: Surface.ROTATION_90
} else {
windowManager.defaultDisplay.rotation
}
if (rotation == Surface.ROTATION_90) {
marginEnd = getNavigationBarHeight()
} else {
marginStart = getNavigationBarHeight()
}
}
}
setupGraphView()
updateToolbar()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 2 additions & 14 deletions app/src/main/res/layout-land/activity_quote_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,26 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/app_bar_layout"
android:background="@color/default_bg"
android:elevation="0dp"
app:elevation="0dp"
>
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/default_bg"
app:titleEnabled="false"
app:layout_scrollFlags="noScroll">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/fake_status_bar"
android:background="@color/bg_toolbar"
app:layout_collapseMode="pin"
/>

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/default_bg"
app:layout_collapseMode="pin"
app:navigationIcon="?attr/homeAsUpIndicator"
app:titleTextAppearance="@style/ActionBarTitleText"
Expand Down Expand Up @@ -67,7 +63,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:textColor="@color/text_3"
android:textSize="@dimen/xlarge_text"
android:gravity="center"
app:layout_scrollFlags="scroll"
Expand Down Expand Up @@ -122,7 +117,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/quote_details_margin"
android:textAppearance="@style/TickerTextAppearanceBold"
android:textColor="@color/text_2"
android:textColor="?attr/colorOnSurface"
android:textSize="@dimen/xlarge_text"
android:gravity="center"
tools:text="$132.99"/>
Expand Down Expand Up @@ -216,7 +211,6 @@
android:id="@+id/gradient"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/default_bg"
android:visibility="gone"
android:alpha="0.0" />
<androidx.core.widget.NestedScrollView
Expand Down Expand Up @@ -269,7 +263,6 @@
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_edit"
app:tint="@color/icon_tint"
/>

</LinearLayout>
Expand Down Expand Up @@ -305,14 +298,12 @@
android:gravity="center"
android:textSize="@dimen/xlarge_text"
tools:text="3"
android:textColor="@color/text_1"
style="@style/BoldTextView"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/shares"
android:textColor="@color/text_3"
/>

</LinearLayout>
Expand All @@ -333,13 +324,12 @@
android:textSize="@dimen/xlarge_text"
tools:text="$2,400.00"
android:textAppearance="@style/TickerTextAppearanceBold"
android:textColor="@color/text_1"
android:textColor="?attr/colorOnSurface"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/equity_value"
android:textColor="@color/text_3"
/>

</LinearLayout>
Expand Down Expand Up @@ -411,7 +401,6 @@
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_edit"
app:tint="@color/icon_tint"
/>
</LinearLayout>

Expand Down Expand Up @@ -478,7 +467,6 @@
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_edit"
app:tint="@color/icon_tint"
/>

</LinearLayout>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/layout-sw600dp-land/activity_alerts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
android:id="@+id/activity_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/default_bg"
>

<com.google.android.material.appbar.AppBarLayout
Expand All @@ -17,7 +16,6 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_toolbar"
app:title="@string/add_alerts"
app:navigationIcon="?attr/homeAsUpIndicator"
app:titleTextAppearance="@style/ActionBarTitleText"
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/layout-sw600dp-land/activity_notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
android:id="@+id/activity_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/default_bg"
android:orientation="vertical"
>

Expand All @@ -18,7 +17,6 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_toolbar"
app:navigationIcon="?attr/homeAsUpIndicator"
app:title="@string/notes"
app:titleTextAppearance="@style/ActionBarTitleText"
Expand Down Expand Up @@ -56,7 +54,6 @@
android:layout_marginEnd="@dimen/tablet_margin_horizontal"
android:scrollbarSize="4dp"
android:scrollbars="vertical"
android:textColor="@color/text_1"
android:textSize="@dimen/large_text"
android:cursorVisible="true"
/>
Expand Down
Loading

0 comments on commit 0175605

Please sign in to comment.