Better multi-account management + fix landscape fc
This commit is contained in:
parent
caa668604b
commit
ff5672fae4
4 changed files with 105 additions and 37 deletions
|
@ -15,8 +15,17 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<View android:layout_width="0px" android:visibility="invisible" android:layout_weight="1" android:layout_height="fill_parent" />
|
<FrameLayout
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_width="fill_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_marginBottom="23sp">
|
||||||
|
|
||||||
|
<View android:layout_width="0px" android:visibility="invisible" android:layout_weight="1" android:layout_height="fill_parent" />
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/CallControlRow" android:layout_height="wrap_content" android:layout_width="fill_parent" android:gravity="bottom">
|
<LinearLayout android:id="@+id/CallControlRow" android:layout_height="wrap_content" android:layout_width="fill_parent" android:gravity="bottom">
|
||||||
<org.linphone.ui.CallButton android:id="@+id/Call"
|
<org.linphone.ui.CallButton android:id="@+id/Call"
|
||||||
|
@ -25,10 +34,51 @@
|
||||||
android:layout_weight="1" android:background="@drawable/clavier_bg" android:src="@drawable/stopcall_red"/>
|
android:layout_weight="1" android:background="@drawable/clavier_bg" android:src="@drawable/stopcall_red"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<EditText android:id="@+id/status_label" android:layout_width="fill_parent"
|
</LinearLayout>
|
||||||
android:clickable="false" android:focusable="false"
|
|
||||||
android:cursorVisible="false" android:textSize="12sp" android:height="15sp"
|
|
||||||
android:background="@android:color/transparent" android:textColor="@android:color/white"
|
|
||||||
android:lines="1" android:layout_height="wrap_content"></EditText>
|
|
||||||
|
|
||||||
|
<SlidingDrawer
|
||||||
|
android:id="@+id/drawer"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:handle="@+id/handle"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:content="@+id/accounts">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@id/handle"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:background="#000000"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/status_label"
|
||||||
|
android:clickable="false"
|
||||||
|
android:focusable="false"
|
||||||
|
android:cursorVisible="false"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:background="#000000"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_weight="4"
|
||||||
|
android:textColor="@android:color/white" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_weight="100"
|
||||||
|
android:src="@drawable/conf_details"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@id/accounts"
|
||||||
|
android:background="#CC000000"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent" />
|
||||||
|
|
||||||
|
</SlidingDrawer>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -95,6 +95,7 @@ public class DialerActivity extends Activity implements LinphoneGuiListener {
|
||||||
|
|
||||||
private void displayRegisterStatus() {
|
private void displayRegisterStatus() {
|
||||||
ListView accounts = (ListView) findViewById(R.id.accounts);
|
ListView accounts = (ListView) findViewById(R.id.accounts);
|
||||||
|
if (accounts != null) {
|
||||||
accounts.setDividerHeight(0);
|
accounts.setDividerHeight(0);
|
||||||
ArrayList<HashMap<String,String>> hashMapAccountsStateList = new ArrayList<HashMap<String,String>>();
|
ArrayList<HashMap<String,String>> hashMapAccountsStateList = new ArrayList<HashMap<String,String>>();
|
||||||
for (LinphoneProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) {
|
for (LinphoneProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) {
|
||||||
|
@ -109,6 +110,7 @@ public class DialerActivity extends Activity implements LinphoneGuiListener {
|
||||||
accounts.setAdapter((ListAdapter) adapterForList);
|
accounts.setAdapter((ListAdapter) adapterForList);
|
||||||
accounts.invalidate();
|
accounts.invalidate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
setContentView(R.layout.dialer);
|
setContentView(R.layout.dialer);
|
||||||
|
@ -123,6 +125,7 @@ public class DialerActivity extends Activity implements LinphoneGuiListener {
|
||||||
mStatus = (TextView) findViewById(R.id.status_label);
|
mStatus = (TextView) findViewById(R.id.status_label);
|
||||||
|
|
||||||
SlidingDrawer drawer = (SlidingDrawer) findViewById(R.id.drawer);
|
SlidingDrawer drawer = (SlidingDrawer) findViewById(R.id.drawer);
|
||||||
|
if (drawer != null) {
|
||||||
drawer.setOnDrawerScrollListener(new OnDrawerScrollListener() {
|
drawer.setOnDrawerScrollListener(new OnDrawerScrollListener() {
|
||||||
public void onScrollEnded() {
|
public void onScrollEnded() {
|
||||||
|
|
||||||
|
@ -132,6 +135,7 @@ public class DialerActivity extends Activity implements LinphoneGuiListener {
|
||||||
displayRegisterStatus();
|
displayRegisterStatus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
AddressAware numpad = (AddressAware) findViewById(R.id.Dialer);
|
AddressAware numpad = (AddressAware) findViewById(R.id.Dialer);
|
||||||
if (numpad != null)
|
if (numpad != null)
|
||||||
|
|
|
@ -123,6 +123,7 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
|
||||||
// Get the good preference screen
|
// Get the good preference screen
|
||||||
accounts = (PreferenceCategory) root.getPreference(0);
|
accounts = (PreferenceCategory) root.getPreference(0);
|
||||||
accounts.removeAll();
|
accounts.removeAll();
|
||||||
|
|
||||||
Preference addAccount = (Preference) root.getPreference(1);
|
Preference addAccount = (Preference) root.getPreference(1);
|
||||||
addAccount.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
addAccount.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
|
@ -198,7 +199,20 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
|
||||||
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|
||||||
if (requestCode == ADD_SIP_ACCOUNT) {
|
if (requestCode == ADD_SIP_ACCOUNT) {
|
||||||
|
//Verify if last created account is filled
|
||||||
|
SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
|
||||||
|
int n = prefs.getInt(getString(R.string.pref_extra_accounts), 1);
|
||||||
|
String keyUsername = getString(R.string.pref_username_key) + (n-1 == 0 ? "" : Integer.toString(n-1));
|
||||||
|
|
||||||
|
if (prefs.getString(keyUsername, "").equals("")) {
|
||||||
|
//If not, we suppress it to not display a blank field
|
||||||
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
|
editor.putInt(getString(R.string.pref_extra_accounts), n-1);
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
|
||||||
createDynamicAccountsPreferences();
|
createDynamicAccountsPreferences();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class LinphonePreferencesSIPAccountActivity extends PreferenceActivity {
|
||||||
|
|
||||||
private String getAccountNumber(int n) {
|
private String getAccountNumber(int n) {
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
return n + "";
|
return Integer.toString(n);
|
||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue