forked from github/szkolny
[UI] Show nightly version badge in main activity.
This commit is contained in:
parent
d68ab0d010
commit
5ab5dbe940
@ -18,6 +18,7 @@ import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.core.graphics.ColorUtils
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.navigation.NavOptions
|
||||
import com.danimahardhika.cafebar.CafeBar
|
||||
@ -294,6 +295,13 @@ class MainActivity : AppCompatActivity(), CoroutineScope {
|
||||
mainSnackbar.setCoordinator(b.navView.coordinator, b.navView.bottomBar)
|
||||
errorSnackbar.setCoordinator(b.navView.coordinator, b.navView.bottomBar)
|
||||
|
||||
if (BuildConfig.VERSION_NAME.contains("nightly")) {
|
||||
b.nightlyText.isVisible = true
|
||||
b.nightlyText.text = "Nightly\n"+BuildConfig.VERSION_NAME.substringAfterLast(".")
|
||||
}
|
||||
else
|
||||
b.nightlyText.isVisible = false
|
||||
|
||||
navLoading = true
|
||||
|
||||
b.navView.apply {
|
||||
|
@ -32,6 +32,22 @@
|
||||
|
||||
</pl.szczodrzynski.navlib.NavView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nightlyText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginHorizontal="48dp"
|
||||
android:layout_marginVertical="8dp"
|
||||
android:background="@drawable/bg_rounded_4dp"
|
||||
android:backgroundTint="#a0ff0000"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:gravity="center"
|
||||
android:padding="4dp"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="Nightly\n20200503" />
|
||||
</FrameLayout>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
Loading…
Reference in New Issue
Block a user