Remove the unmaintained fab progress circle
This commit is contained in:
@@ -49,7 +49,6 @@ dependencies {
|
||||
implementation "com.android.support:gridlayout-v7:$supportLibraryVersion"
|
||||
implementation 'com.futuremind.recyclerfastscroll:fastscroll:0.2.5'
|
||||
implementation 'com.evernote:android-job:1.2.1'
|
||||
implementation 'com.github.jorgecastilloprz:fabprogresscircle:1.01'
|
||||
implementation "com.google.android.gms:play-services-ads:$playServicesVersion"
|
||||
implementation "com.google.android.gms:play-services-analytics:$playServicesVersion"
|
||||
implementation "com.google.android.gms:play-services-gcm:$playServicesVersion"
|
||||
|
||||
@@ -42,7 +42,6 @@ import android.support.v7.widget.TooltipCompat
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import com.github.jorgecastilloprz.FABProgressCircle
|
||||
import com.github.shadowsocks.App.Companion.app
|
||||
import com.github.shadowsocks.acl.Acl
|
||||
import com.github.shadowsocks.acl.CustomRulesFragment
|
||||
@@ -88,7 +87,6 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
|
||||
|
||||
// UI
|
||||
private lateinit var fab: FloatingActionButton
|
||||
private lateinit var fabProgressCircle: FABProgressCircle
|
||||
internal var crossfader: Crossfader<CrossFadeSlidingPaneLayout>? = null
|
||||
internal lateinit var drawer: Drawer
|
||||
private var previousSelectedDrawer: Long = 0 // it's actually lateinit
|
||||
@@ -113,10 +111,6 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
|
||||
private val greyTint by lazy { ContextCompat.getColorStateList(this, R.color.material_primary_500) }
|
||||
private val greenTint by lazy { ContextCompat.getColorStateList(this, R.color.material_green_700) }
|
||||
|
||||
private fun hideCircle() = try {
|
||||
fabProgressCircle.hide()
|
||||
} catch (_: NullPointerException) { } // ignore
|
||||
|
||||
// service
|
||||
var state = BaseService.IDLE
|
||||
override val serviceCallback: IShadowsocksServiceCallback.Stub by lazy {
|
||||
@@ -137,23 +131,18 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
|
||||
when (state) {
|
||||
BaseService.CONNECTING -> {
|
||||
fab.setImageResource(R.drawable.ic_start_busy)
|
||||
fabProgressCircle.show()
|
||||
statusText.setText(R.string.connecting)
|
||||
}
|
||||
BaseService.CONNECTED -> {
|
||||
if (this.state == BaseService.CONNECTING) fabProgressCircle.beginFinalAnimation()
|
||||
else fabProgressCircle.postDelayed(this::hideCircle, 1000)
|
||||
fab.setImageResource(R.drawable.ic_start_connected)
|
||||
statusText.setText(R.string.vpn_connected)
|
||||
}
|
||||
BaseService.STOPPING -> {
|
||||
fab.setImageResource(R.drawable.ic_start_busy)
|
||||
if (this.state == BaseService.CONNECTED) fabProgressCircle.show() // ignore for stopped
|
||||
statusText.setText(R.string.stopping)
|
||||
}
|
||||
else -> {
|
||||
fab.setImageResource(R.drawable.ic_start_idle)
|
||||
fabProgressCircle.postDelayed(this::hideCircle, 1000)
|
||||
if (msg != null) {
|
||||
Snackbar.make(findViewById(R.id.snackbar),
|
||||
getString(R.string.vpn_error).format(Locale.ENGLISH, msg), Snackbar.LENGTH_LONG).show()
|
||||
@@ -322,7 +311,6 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
|
||||
}
|
||||
|
||||
fab = findViewById(R.id.fab)
|
||||
fabProgressCircle = findViewById(R.id.fabProgressCircle)
|
||||
fab.setOnClickListener {
|
||||
if (state == BaseService.CONNECTED) app.stopService() else thread {
|
||||
if (BaseService.usingVpnMode) {
|
||||
@@ -404,7 +392,6 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
app.remoteConfig.fetch()
|
||||
if (state !in arrayOf(BaseService.STOPPING, BaseService.CONNECTING)) hideCircle()
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
|
||||
@@ -67,23 +67,25 @@
|
||||
android:layout_gravity="fill_horizontal" android:gravity="end"/>
|
||||
</com.github.shadowsocks.widget.BoundedGridLayout>
|
||||
</LinearLayout>
|
||||
<com.github.jorgecastilloprz.FABProgressCircle android:id="@+id/fabProgressCircle"
|
||||
app:reusable="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="6dp"
|
||||
android:layout_alignTop="@+id/stat"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="@dimen/fab_margin_top">
|
||||
<android.support.design.widget.FloatingActionButton android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:backgroundTint="@color/material_primary_500"
|
||||
app:srcCompat="@drawable/ic_start_idle"
|
||||
app:pressedTranslationZ="6dp"
|
||||
app:borderWidth="0dp"/>
|
||||
</com.github.jorgecastilloprz.FABProgressCircle>
|
||||
|
||||
<!-- workaround for 0 elevation in disabled state -->
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignTop="@+id/stat"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="-28dp"
|
||||
android:elevation="6dp">
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:backgroundTint="@color/material_primary_500"
|
||||
app:fabSize="normal"
|
||||
app:pressedTranslationZ="6dp"
|
||||
app:srcCompat="@drawable/ic_start_idle"/>
|
||||
</FrameLayout>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:id="@+id/snackbar"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="fab_margin_top">-28dp</dimen>
|
||||
</resources>
|
||||
@@ -3,6 +3,4 @@
|
||||
<dimen name="profile_item_max_width">480dp</dimen>
|
||||
<dimen name="qr_code_size">250dp</dimen>
|
||||
<dimen name="profile_padding">8dp</dimen>
|
||||
<!-- TODO: Remove when this issue is fixed: https://github.com/JorgeCastilloPrz/FABProgressCircle/issues/19 -->
|
||||
<dimen name="fab_margin_top">-44dp</dimen>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user