Commit 48962d1b authored by Ricki Hirner's avatar Ricki Hirner 🐑

Use vector drawable support library for Android <5

parent 42ba4825
......@@ -23,6 +23,8 @@ android {
minSdkVersion 16
targetSdkVersion 25
vectorDrawables.useSupportLibrary = true
}
flavorDimensions "type"
......
......@@ -12,6 +12,8 @@ import android.app.Application
import android.content.Context
import android.graphics.Bitmap
import android.graphics.drawable.BitmapDrawable
import android.os.Build
import android.support.v7.app.AppCompatDelegate
import at.bitfire.davdroid.log.Logger
class App: Application() {
......@@ -46,6 +48,9 @@ class App: Application() {
override fun onCreate() {
super.onCreate()
Logger.initialize(this)
if (Build.VERSION.SDK_INT <= 21)
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
}
}
......@@ -511,8 +511,8 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
tv.text = info.description
}
tv = v.findViewById(R.id.read_only)
tv.visibility = if (info.readOnly) View.VISIBLE else View.GONE
v.findViewById<ImageView>(R.id.read_only).visibility =
if (info.readOnly) View.VISIBLE else View.GONE
return v
}
......@@ -549,14 +549,14 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
tv.text = info.description
}
tv = v.findViewById(R.id.read_only)
tv.visibility = if (info.readOnly) View.VISIBLE else View.GONE
v.findViewById<ImageView>(R.id.read_only).visibility =
if (info.readOnly) View.VISIBLE else View.GONE
tv = v.findViewById(R.id.events)
tv.visibility = if (info.supportsVEVENT) View.VISIBLE else View.GONE
v.findViewById<ImageView>(R.id.events).visibility =
if (info.supportsVEVENT) View.VISIBLE else View.GONE
tv = v.findViewById(R.id.tasks)
tv.visibility = if (info.supportsVTODO) View.VISIBLE else View.GONE
v.findViewById<ImageView>(R.id.tasks).visibility =
if (info.supportsVTODO) View.VISIBLE else View.GONE
return v
}
......
......@@ -9,6 +9,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -51,24 +52,25 @@
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Calendar Description"/>
</LinearLayout>
<TextView
<ImageView
android:id="@+id/read_only"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="@drawable/ic_remove_circle_dark"/>
app:srcCompat="@drawable/ic_remove_circle_dark"/>
<TextView
<ImageView
android:id="@+id/events"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="@drawable/ic_today_dark"/>
app:srcCompat="@drawable/ic_today_dark"/>
<TextView
<ImageView
android:id="@+id/tasks"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="@drawable/ic_alarm_on_dark"/>
app:srcCompat="@drawable/ic_alarm_on_dark"/>
</LinearLayout>
......@@ -8,6 +8,7 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -45,10 +46,10 @@
</LinearLayout>
<TextView
<ImageView
android:id="@+id/read_only"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="@drawable/ic_remove_circle_dark"/>
app:srcCompat="@drawable/ic_remove_circle_dark"/>
</LinearLayout>
\ No newline at end of file
......@@ -23,10 +23,10 @@
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/ic_account_circle_white"/>
app:srcCompat="@drawable/ic_account_circle_white"/>
<TextView
android:id="@+id/account_name"
......
......@@ -44,6 +44,6 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_add_light"/>
app:srcCompat="@drawable/ic_add_light"/>
</android.support.design.widget.CoordinatorLayout>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment