]> rtime.felk.cvut.cz Git - orte.git/blob - orte/contrib/shape_android/src/org/ocera/orte/shape_android/SettingsActivity.java
Simplified approach to write application.
[orte.git] / orte / contrib / shape_android / src / org / ocera / orte / shape_android / SettingsActivity.java
1 /**
2  * 
3  *      This file is part of shape_android.
4  *
5  *  shape_android is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation, either version 3 of the License, or
8  *  (at your option) any later version.
9  *
10  *  shape_android is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with shape_android.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  */
19 package org.ocera.orte.shape_android;
20
21 import android.content.Context;
22 import android.net.wifi.WifiManager;
23 import android.os.Bundle;
24 import android.preference.PreferenceActivity;
25 import android.preference.EditTextPreference;
26 import android.text.format.Formatter;
27
28 /**
29  * This activity show settings.
30  * 
31  * @author jiri hubacek <jiri.hubacek@gmail.com>
32  * @version %I, %G
33  * @since 1.2
34  */
35 public class SettingsActivity extends PreferenceActivity
36 {
37         /**
38          * Setting up workspace.
39          * 
40          * @since 1.2
41          */
42         @Override
43         protected void onCreate(Bundle savedInstanceState)
44         {
45                 super.onCreate(savedInstanceState);
46                 addPreferencesFromResource(R.layout.activity_settings);
47                 
48                 WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
49                 EditTextPreference pref = (EditTextPreference) findPreference("prefManagers");
50
51                 //TODO should be done in respect to @strings
52                 pref.setSummary("Comma separated manager\'s IP addresses" + " (actual IP: "+Formatter.formatIpAddress(wifiManager.getConnectionInfo().getIpAddress())+")");
53         }
54 }