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:
@@ -29,6 +29,11 @@
|
||||
android:label="@string/app_name"
|
||||
android:parentActivityName="protect.babymonitor.StartActivity"
|
||||
/>
|
||||
<activity
|
||||
android:name="protect.babymonitor.DiscoverActivity"
|
||||
android:label="@string/app_name"
|
||||
android:parentActivityName="protect.babymonitor.StartActivity"
|
||||
/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
30
res/layout/activity_discover.xml
Normal file
30
res/layout/activity_discover.xml
Normal 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>
|
||||
43
src/protect/babymonitor/DiscoverActivity.java
Normal file
43
src/protect/babymonitor/DiscoverActivity.java
Normal 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();
|
||||
}
|
||||
}
|
||||
@@ -47,5 +47,18 @@ public class StartActivity extends Activity
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user