* #32667: adjustements for release
diff --git a/src/org/sflphone/fragments/AccountCreationFragment.java b/src/org/sflphone/fragments/AccountCreationFragment.java
index 48e461b..0d6103b 100644
--- a/src/org/sflphone/fragments/AccountCreationFragment.java
+++ b/src/org/sflphone/fragments/AccountCreationFragment.java
@@ -94,7 +94,7 @@
}
});
-// inflatedView.findViewById(R.id.dev_account).setVisibility(View.GONE); // Hide this button in release apk
+ inflatedView.findViewById(R.id.dev_account).setVisibility(View.GONE); // Hide this button in release apk
inflatedView.findViewById(R.id.dev_account).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
diff --git a/src/org/sflphone/fragments/AccountManagementFragment.java b/src/org/sflphone/fragments/AccountManagementFragment.java
index dbfacb5..f68d9b4 100644
--- a/src/org/sflphone/fragments/AccountManagementFragment.java
+++ b/src/org/sflphone/fragments/AccountManagementFragment.java
@@ -47,6 +47,8 @@
import org.sflphone.service.ISipService;
import org.sflphone.views.dragsortlv.DragSortListView;
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
import android.app.Activity;
import android.app.ListFragment;
import android.app.LoaderManager.LoaderCallbacks;
@@ -79,6 +81,11 @@
AccountsReceiver accountReceiver;
AccountsAdapter mAccountsAdapter;
AccountsAdapter mIP2IPAdapter;
+
+ DragSortListView mDnDListView;
+ private View mLoadingView;
+ private int mShortAnimationDuration;
+
private DragSortListView.DropListener onDrop = new DragSortListView.DropListener() {
@Override
public void drop(int from, int to) {
@@ -135,10 +142,13 @@
Log.i(TAG, "Create Account Management Fragment");
mAccountsAdapter = new AccountsAdapter(getActivity(), new ArrayList<Account>());
- mIP2IPAdapter = new AccountsAdapter(getActivity(), new ArrayList<Account>());
+ mIP2IPAdapter = new AccountsAdapter(getActivity(), new ArrayList<Account>());
this.setHasOptionsMenu(true);
accountReceiver = new AccountsReceiver(this);
+ mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);
+ Log.i(TAG,"anim time: "+ mShortAnimationDuration);
+
}
@Override
@@ -158,9 +168,10 @@
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- DragSortListView list = getListView();
- list.setDropListener(onDrop);
- list.setOnItemClickListener(new OnItemClickListener() {
+ mDnDListView = getListView();
+
+ mDnDListView.setDropListener(onDrop);
+ mDnDListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) {
@@ -178,7 +189,8 @@
}
});
- list.setEmptyView(view.findViewById(android.R.id.empty));
+
+ mLoadingView = view.findViewById(R.id.loading_spinner);
}
@Override
@@ -213,7 +225,11 @@
ip2ip = results.getParcelable(AccountsLoader.ACCOUNT_IP2IP);
mAccountsAdapter.addAll(tmp);
mIP2IPAdapter.removeAll();
- mIP2IPAdapter.insert(ip2ip, 0);;
+ mIP2IPAdapter.insert(ip2ip, 0);
+ if(mAccountsAdapter.isEmpty()){
+ mDnDListView.setEmptyView(getView().findViewById(R.id.empty_account_list));
+ }
+ crossfade();
}
@Override
@@ -334,7 +350,7 @@
final Account item = accounts.get(pos);
entryView.alias.setText(accounts.get(pos).getAlias());
- if(item.isIP2IP()){
+ if (item.isIP2IP()) {
entryView.host.setText(item.getRegistered_state());
entryView.enabled.setVisibility(View.GONE);
} else {
@@ -354,9 +370,6 @@
}
});
}
-
-
-
return rowView;
}
@@ -410,4 +423,26 @@
}
}
+
+ private void crossfade() {
+
+ // Set the content view to 0% opacity but visible, so that it is visible
+ // (but fully transparent) during the animation.
+ mDnDListView.setAlpha(0f);
+ mDnDListView.setVisibility(View.VISIBLE);
+
+ // Animate the content view to 100% opacity, and clear any animation
+ // listener set on the view.
+ mDnDListView.animate().alpha(1f).setDuration(mShortAnimationDuration).setListener(null);
+
+ // Animate the loading view to 0% opacity. After the animation ends,
+ // set its visibility to GONE as an optimization step (it won't
+ // participate in layout passes, etc.)
+ mLoadingView.animate().alpha(0f).setDuration(mShortAnimationDuration).setListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mLoadingView.setVisibility(View.GONE);
+ }
+ });
+ }
}
diff --git a/src/org/sflphone/loaders/AccountsLoader.java b/src/org/sflphone/loaders/AccountsLoader.java
index 90f956d..e4bf4ce 100644
--- a/src/org/sflphone/loaders/AccountsLoader.java
+++ b/src/org/sflphone/loaders/AccountsLoader.java
@@ -24,13 +24,14 @@
service = ref;
}
- @SuppressWarnings("unchecked") // Hashmap runtime cast
+ @SuppressWarnings("unchecked")
+ // Hashmap runtime cast
@Override
public Bundle loadInBackground() {
ArrayList<Account> accounts = new ArrayList<Account>();
Account IP2IP = null;
-
+
try {
ArrayList<String> accountIDs = (ArrayList<String>) service.getAccountList();
HashMap<String, String> details;
@@ -43,10 +44,10 @@
}
details = (HashMap<String, String>) service.getAccountDetails(id);
Account tmp = new Account(id, details);
-
+
accounts.add(tmp);
-
- Log.i(TAG, "account:"+tmp.getAlias()+" "+tmp.isEnabled());
+
+ Log.i(TAG, "account:" + tmp.getAlias() + " " + tmp.isEnabled());
}
} catch (RemoteException e) {
@@ -54,7 +55,7 @@
} catch (NullPointerException e1) {
Log.e(TAG, e1.toString());
}
-
+
Bundle result = new Bundle();
result.putParcelableArrayList(ACCOUNTS, accounts);
result.putParcelable(ACCOUNT_IP2IP, IP2IP);
diff --git a/src/org/sflphone/service/SipService.java b/src/org/sflphone/service/SipService.java
index dfe9b3e..1fe1acf 100644
--- a/src/org/sflphone/service/SipService.java
+++ b/src/org/sflphone/service/SipService.java
@@ -153,7 +153,7 @@
LocalBroadcastManager.getInstance(this).unregisterReceiver(receiver);
notificationManager.onServiceDestroy();
// sflphoneApp.setServiceRunning(false);
- Toast.makeText(this, "Sflphone Service stopped", Toast.LENGTH_SHORT).show();
+
managerImpl.finish();
super.onDestroy();