Skip to content

Commit 48786db

Browse files
jddukecopybara-github
authored andcommitted
Update object detection app to Androidx
PiperOrigin-RevId: 263845574
1 parent 77e1a4d commit 48786db

5 files changed

Lines changed: 16 additions & 13 deletions

File tree

lite/examples/object_detection/android/app/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ apply from:'download_model.gradle'
3838

3939
dependencies {
4040
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
41-
implementation 'com.android.support:appcompat-v7:28.0.0'
42-
implementation 'com.android.support:design:28.0.0'
41+
implementation 'androidx.appcompat:appcompat:1.0.0'
42+
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.0.0'
43+
implementation 'com.google.android.material:material:1.0.0'
4344
implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly'
4445
}

lite/examples/object_detection/android/app/src/main/java/org/tensorflow/lite/examples/detection/CameraActivity.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
import android.os.Handler;
3535
import android.os.HandlerThread;
3636
import android.os.Trace;
37-
import android.support.annotation.NonNull;
38-
import android.support.design.widget.BottomSheetBehavior;
39-
import android.support.v7.app.AppCompatActivity;
40-
import android.support.v7.widget.SwitchCompat;
41-
import android.support.v7.widget.Toolbar;
37+
import androidx.annotation.NonNull;
38+
import com.google.android.material.bottomsheet.BottomSheetBehavior;
39+
import androidx.appcompat.app.AppCompatActivity;
40+
import androidx.appcompat.widget.SwitchCompat;
41+
import androidx.appcompat.widget.Toolbar;
4242
import android.util.Size;
4343
import android.view.Surface;
4444
import android.view.View;

lite/examples/object_detection/android/app/src/main/res/layout/activity_camera.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
-->
1616

17-
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
17+
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
1818
xmlns:tools="http://schemas.android.com/tools"
1919
android:layout_width="match_parent"
2020
android:layout_height="match_parent"
@@ -35,7 +35,7 @@
3535
android:layout_height="match_parent"
3636
tools:context="org.tensorflow.demo.CameraActivity" />
3737

38-
<android.support.v7.widget.Toolbar
38+
<androidx.appcompat.widget.Toolbar
3939
android:id="@+id/toolbar"
4040
android:layout_width="match_parent"
4141
android:layout_height="?attr/actionBarSize"
@@ -46,11 +46,11 @@
4646
android:layout_width="wrap_content"
4747
android:layout_height="wrap_content"
4848
android:src="@drawable/tfl_logo" />
49-
</android.support.v7.widget.Toolbar>
49+
</androidx.appcompat.widget.Toolbar>
5050

5151
</RelativeLayout>
5252

5353
<include
5454
android:id="@+id/bottom_sheet_layout"
5555
layout="@layout/layout_bottom_sheet" />
56-
</android.support.design.widget.CoordinatorLayout>
56+
</androidx.coordinatorlayout.widget.CoordinatorLayout>

lite/examples/object_detection/android/app/src/main/res/layout/layout_bottom_sheet.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
android:orientation="vertical"
1111
android:padding="8dp"
1212
app:behavior_hideable="true"
13-
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
13+
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
1414

1515
<LinearLayout
1616
android:id="@+id/gesture_layout"
@@ -173,7 +173,7 @@
173173
android:text="API"
174174
android:textColor="@android:color/black" />
175175

176-
<android.support.v7.widget.SwitchCompat
176+
<androidx.appcompat.widget.SwitchCompat
177177
android:id="@+id/api_info_switch"
178178
android:layout_width="match_parent"
179179
android:layout_height="wrap_content"

lite/examples/object_detection/android/gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ org.gradle.jvmargs=-Xmx1536m
1111
# This option should only be used with decoupled projects. More details, visit
1212
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1313
# org.gradle.parallel=true
14+
android.useAndroidX=true
15+
android.enableJetifier=true

0 commit comments

Comments
 (0)