From 05cdb85012a5a4bf369b7f65459cafb1efc8e604 Mon Sep 17 00:00:00 2001 From: sakal Date: Tue, 24 May 2016 00:18:09 -0700 Subject: [PATCH] UI for AppRTC Android demo that doesn't require Design Support Library For simplicity, this CL removes the need for Design Support Library. UI is slightly changed for this to be possible. Floating Action Button for adding favorite is removed and instead there's a button next to the TextView. Review-Url: https://codereview.webrtc.org/2003983002 Cr-Commit-Position: refs/heads/master@{#12861} --- .../examples/androidapp/AndroidManifest.xml | 1 - .../res/drawable-hdpi/ic_add_white_24dp.png | Bin 127 -> 0 bytes .../res/drawable-mdpi/ic_add_white_24dp.png | Bin 88 -> 0 bytes .../res/drawable-xhdpi/ic_add_white_24dp.png | Bin 97 -> 0 bytes .../res/drawable-xxhdpi/ic_add_white_24dp.png | Bin 97 -> 0 bytes .../drawable-xxxhdpi/ic_add_white_24dp.png | Bin 102 -> 0 bytes .../res/layout/activity_connect.xml | 19 +++----- .../res/layout/dialog_add_favorite.xml | 14 ------ .../androidapp/res/menu/connect_menu.xml | 7 ++- .../org/appspot/apprtc/ConnectActivity.java | 41 +++++------------- webrtc/webrtc_examples.gyp | 3 -- 11 files changed, 21 insertions(+), 64 deletions(-) delete mode 100644 webrtc/examples/androidapp/res/drawable-hdpi/ic_add_white_24dp.png delete mode 100644 webrtc/examples/androidapp/res/drawable-mdpi/ic_add_white_24dp.png delete mode 100644 webrtc/examples/androidapp/res/drawable-xhdpi/ic_add_white_24dp.png delete mode 100644 webrtc/examples/androidapp/res/drawable-xxhdpi/ic_add_white_24dp.png delete mode 100644 webrtc/examples/androidapp/res/drawable-xxxhdpi/ic_add_white_24dp.png delete mode 100644 webrtc/examples/androidapp/res/layout/dialog_add_favorite.xml diff --git a/webrtc/examples/androidapp/AndroidManifest.xml b/webrtc/examples/androidapp/AndroidManifest.xml index dfe8975b31..608e381fcb 100644 --- a/webrtc/examples/androidapp/AndroidManifest.xml +++ b/webrtc/examples/androidapp/AndroidManifest.xml @@ -23,7 +23,6 @@ diff --git a/webrtc/examples/androidapp/res/drawable-hdpi/ic_add_white_24dp.png b/webrtc/examples/androidapp/res/drawable-hdpi/ic_add_white_24dp.png deleted file mode 100644 index 694179bd46b685e55da1b4dde2575bde0b2bfd64..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 127 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8K;o2QFoh{y5d1PRu~4CX)Hf7s8+ zA**4&;-Ni_&aj!VDzSo@fq7N>%r!;1bAd`3JYD@<);T3K0RTZ}7R&$u diff --git a/webrtc/examples/androidapp/res/drawable-xhdpi/ic_add_white_24dp.png b/webrtc/examples/androidapp/res/drawable-xhdpi/ic_add_white_24dp.png deleted file mode 100644 index 67bb598e52a36b6caba846efe733501479965a41..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 97 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZA`BpB)|k7xlYrjj7PUFVdQ&MBb@07vc`*Z=?k diff --git a/webrtc/examples/androidapp/res/drawable-xxxhdpi/ic_add_white_24dp.png b/webrtc/examples/androidapp/res/drawable-xxxhdpi/ic_add_white_24dp.png deleted file mode 100644 index d64c22e9edfdcf9babea9681c44e2dee53a6d2f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 102 zcmeAS@N?(olHy`uVBq!ia0vp^2_Vb}Bp6OT_L>T$m`Z~Df*BafCZDwc^5i{T978G? xlN*`>5BzUTIj7P7-(I3-fns}2dtZ?oBSS_(`pg9u0+k>GJYD@<);T3K0RZru9Krwq diff --git a/webrtc/examples/androidapp/res/layout/activity_connect.xml b/webrtc/examples/androidapp/res/layout/activity_connect.xml index acc20dc6a1..2a80774b72 100644 --- a/webrtc/examples/androidapp/res/layout/activity_connect.xml +++ b/webrtc/examples/androidapp/res/layout/activity_connect.xml @@ -1,7 +1,6 @@ + + - - \ No newline at end of file diff --git a/webrtc/examples/androidapp/res/layout/dialog_add_favorite.xml b/webrtc/examples/androidapp/res/layout/dialog_add_favorite.xml deleted file mode 100644 index 28b533aa0c..0000000000 --- a/webrtc/examples/androidapp/res/layout/dialog_add_favorite.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - \ No newline at end of file diff --git a/webrtc/examples/androidapp/res/menu/connect_menu.xml b/webrtc/examples/androidapp/res/menu/connect_menu.xml index 8beddddd45..a723f54941 100644 --- a/webrtc/examples/androidapp/res/menu/connect_menu.xml +++ b/webrtc/examples/androidapp/res/menu/connect_menu.xml @@ -1,14 +1,13 @@ - + diff --git a/webrtc/examples/androidapp/src/org/appspot/apprtc/ConnectActivity.java b/webrtc/examples/androidapp/src/org/appspot/apprtc/ConnectActivity.java index 557c3e8c73..fa279dec14 100644 --- a/webrtc/examples/androidapp/src/org/appspot/apprtc/ConnectActivity.java +++ b/webrtc/examples/androidapp/src/org/appspot/apprtc/ConnectActivity.java @@ -10,19 +10,17 @@ package org.appspot.apprtc; +import android.app.Activity; +import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; -import android.support.design.widget.FloatingActionButton; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.ContextMenu; import android.view.KeyEvent; -import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -45,14 +43,14 @@ import java.util.Random; /** * Handles the initial setup where the user selects which room to join. */ -public class ConnectActivity extends AppCompatActivity { +public class ConnectActivity extends Activity { private static final String TAG = "ConnectActivity"; private static final int CONNECTION_REQUEST = 1; private static final int REMOVE_FAVORITE_INDEX = 0; private static boolean commandLineRun = false; private ImageButton connectButton; - private FloatingActionButton addFavoriteButton; + private ImageButton addFavoriteButton; private EditText roomEditText; private ListView roomListView; private SharedPreferences sharedPref; @@ -130,6 +128,8 @@ public class ConnectActivity extends AppCompatActivity { registerForContextMenu(roomListView); connectButton = (ImageButton) findViewById(R.id.connect_button); connectButton.setOnClickListener(connectListener); + addFavoriteButton = (ImageButton) findViewById(R.id.add_favorite_button); + addFavoriteButton.setOnClickListener(addFavoriteListener); // If an implicit VIEW intent is launching the app, go directly to that URL. final Intent intent = getIntent(); @@ -142,9 +142,6 @@ public class ConnectActivity extends AppCompatActivity { String room = sharedPref.getString(keyprefRoom, ""); connectToRoom(room, true, loopback, runTimeMs); } - - addFavoriteButton = (FloatingActionButton) findViewById(R.id.add_favorite_button); - addFavoriteButton.setOnClickListener(addFavoriteListener); } @Override @@ -413,27 +410,11 @@ public class ConnectActivity extends AppCompatActivity { private final OnClickListener addFavoriteListener = new OnClickListener() { @Override public void onClick(View view) { - AlertDialog.Builder builder = new AlertDialog.Builder(ConnectActivity.this); - - final View dialogView = LayoutInflater.from(ConnectActivity.this) - .inflate(R.layout.dialog_add_favorite, null); - final EditText favoriteEditText = (EditText) dialogView.findViewById(R.id.favorite_edittext); - favoriteEditText.append(roomEditText.getText()); - - builder.setTitle(R.string.add_favorite_title) - .setPositiveButton(R.string.add, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialogInterface, int i) { - String newRoom = favoriteEditText.getText().toString(); - if (newRoom.length() > 0 && !roomList.contains(newRoom)) { - adapter.add(newRoom); - adapter.notifyDataSetChanged(); - } - } - }) - .setView(dialogView) - .setNegativeButton(R.string.cancel, null); - builder.show(); + String newRoom = roomEditText.getText().toString(); + if (newRoom.length() > 0 && !roomList.contains(newRoom)) { + adapter.add(newRoom); + adapter.notifyDataSetChanged(); + } } }; diff --git a/webrtc/webrtc_examples.gyp b/webrtc/webrtc_examples.gyp index 6f07b4d7fe..16dc83756a 100755 --- a/webrtc/webrtc_examples.gyp +++ b/webrtc/webrtc_examples.gyp @@ -408,7 +408,6 @@ 'type': 'none', 'dependencies': [ 'api/api.gyp:libjingle_peerconnection_java', - '<(DEPTH)/third_party/android_tools/android_tools.gyp:android_support_design_javalib' ], 'variables': { 'apk_name': 'AppRTCDemo', @@ -419,11 +418,9 @@ 'R_package_relpath': 'org/appspot/apprtc', 'input_jars_paths': [ 'examples/androidapp/third_party/autobanh/autobanh.jar', - '<(DEPTH)/third_party/android_tools/sdk/extras/android/support/v4/android-support-v4.jar', ], 'library_dexed_jars_paths': [ 'examples/androidapp/third_party/autobanh/autobanh.jar', - '<(DEPTH)/third_party/android_tools/sdk/extras/android/support/v4/android-support-v4.jar', ], 'native_lib_target': 'libjingle_peerconnection_so', 'add_to_dependents_classpaths':1,