Commit ccfecf7e authored by Grigory Fedorov's avatar Grigory Fedorov

Floating Action Button used in ContactEditor (group add)

github.com/makovkastar/FloatingActionButton library used.
parent b7f8e945
......@@ -26,5 +26,6 @@ dependencies {
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v13:22.0.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'com.melnykov:floatingactionbutton:1.2.0'
compile project('otr4j')
}
......@@ -18,9 +18,12 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ListView;
import com.melnykov.fab.FloatingActionButton;
import com.xabber.android.data.Application;
import com.xabber.android.data.NetworkException;
import com.xabber.android.data.account.AccountManager;
......@@ -30,6 +33,7 @@ import com.xabber.android.data.intent.EntityIntentBuilder;
import com.xabber.android.data.roster.AbstractContact;
import com.xabber.android.data.roster.OnContactChangedListener;
import com.xabber.android.data.roster.RosterManager;
import com.xabber.android.ui.dialog.GroupAddDialogFragment;
import com.xabber.android.ui.helper.ContactTitleActionBarInflater;
import com.xabber.androiddev.R;
import com.xabber.xmpp.address.Jid;
......@@ -37,7 +41,7 @@ import com.xabber.xmpp.address.Jid;
import java.util.Collection;
public class ContactEditor extends GroupListActivity implements
OnContactChangedListener, OnAccountChangedListener {
OnContactChangedListener, OnAccountChangedListener, View.OnClickListener {
private String account;
private String user;
......@@ -60,6 +64,11 @@ public class ContactEditor extends GroupListActivity implements
Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND);
finish();
}
ListView listView = (ListView) findViewById(android.R.id.list);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.attachToListView(listView);
fab.setOnClickListener(this);
}
@Override
......@@ -131,4 +140,13 @@ public class ContactEditor extends GroupListActivity implements
return EntityIntentBuilder.getUser(intent);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.fab:
showGroupAddDialog();
return;
}
}
}
......@@ -138,7 +138,7 @@ public abstract class GroupListActivity extends ManagedListActivity implements O
return false;
}
private void showGroupAddDialog() {
protected void showGroupAddDialog() {
GroupAddDialogFragment.newInstance(getGroups()).show(getFragmentManager(), "GROUP-ADD");
}
......
......@@ -61,7 +61,7 @@ public abstract class BaseContactInflater {
this.activity = activity;
layoutInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Bitmap bitmap = BitmapFactory.decodeResource(activity.getResources(), R.drawable.shadow);
Bitmap bitmap = BitmapFactory.decodeResource(activity.getResources(), R.drawable.contact_shadow);
shadowDrawable = new BitmapDrawable(activity.getResources(), bitmap);
shadowDrawable.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT);
......
......@@ -100,7 +100,7 @@
android:id="@+id/shadow"
android:layout_width="match_parent"
android:layout_height="@dimen/contact_list_item_height"
android:background="@drawable/shadow"
android:background="@drawable/contact_shadow"
android:visibility="gone"
/>
</RelativeLayout>
......@@ -12,14 +12,16 @@
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<LinearLayout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<include layout="@layout/toolbar_default"/>
<include layout="@layout/toolbar_default"
android:id="@+id/toolbar_default"
/>
<TextView
android:text="@string/contact_group"
......@@ -29,13 +31,32 @@
android:paddingBottom="2dip"
android:paddingLeft="2dip"
android:paddingRight="2dip"
android:id="@+id/edit_groups_title"
android:layout_below="@+id/toolbar_default"
/>
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingLeft="6dip"
android:paddingLeft="8dp"
android:paddingStart="8dp"
android:layout_below="@+id/edit_groups_title"
/>
</LinearLayout>
\ No newline at end of file
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_margin="16dp"
android:src="@drawable/ic_add_white_24dp"
fab:fab_colorNormal="@color/red_500"
fab:fab_colorPressed="@color/red_700"
fab:fab_colorRipple="@color/red_300"
/>
</RelativeLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment