Add DiscoverActivity - lists of baby monitors on the network

This is the stub of the DiscoverActivity, which is responsible for
discovering all available ProtectBabyMonitor services on the
local network.
This commit is contained in:
Branden Archer
2015-12-26 15:49:32 -05:00
parent 4635a78574
commit eb9cd75c3a
4 changed files with 91 additions and 0 deletions

View File

@@ -29,6 +29,11 @@
android:label="@string/app_name" android:label="@string/app_name"
android:parentActivityName="protect.babymonitor.StartActivity" android:parentActivityName="protect.babymonitor.StartActivity"
/> />
<activity
android:name="protect.babymonitor.DiscoverActivity"
android:label="@string/app_name"
android:parentActivityName="protect.babymonitor.StartActivity"
/>
</application> </application>
</manifest> </manifest>

View File

@@ -0,0 +1,30 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="protect.babymonitor.MonitorActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="27dp"
android:text="Select a Monitor:"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TableLayout
android:id="@+id/ServiceTable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="47dp" >
</TableLayout>
</RelativeLayout>

View File

@@ -0,0 +1,43 @@
/**
* This file is part of the Protect Baby Monitor.
*
* Protect Baby Monitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Protect Baby Monitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Protect Baby Monitor. If not, see <http://www.gnu.org/licenses/>.
*/
package protect.babymonitor;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class DiscoverActivity extends Activity
{
final String TAG = "BabyMonitor";
@Override
protected void onCreate(Bundle savedInstanceState)
{
Log.i(TAG, "Baby monitor start");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_discover);
}
@Override
protected void onDestroy()
{
Log.i(TAG, "Baby monitoring stop");
super.onDestroy();
}
}

View File

@@ -47,5 +47,18 @@ public class StartActivity extends Activity
startActivity(i); startActivity(i);
} }
}); });
final Button connectButton = (Button) findViewById(R.id.connectMonitorButton);
connectButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Log.i(TAG, "Starting connection activity");
Intent i = new Intent(getApplicationContext(), DiscoverActivity.class);
startActivity(i);
}
});
} }
} }