mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-22 00:42:16 -05:00
OverviewFragment: Use connected/disconnected icons from navigation drawer.
This commit is contained in:
parent
91c0d23ac2
commit
3f4b2f2de3
@ -24,6 +24,7 @@ import android.support.v7.widget.RecyclerView;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.yaaic.R;
|
import org.yaaic.R;
|
||||||
@ -48,7 +49,7 @@ public class ServersAdapter extends RecyclerView.Adapter<ServersAdapter.ViewHold
|
|||||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
public final TextView titleView;
|
public final TextView titleView;
|
||||||
public final TextView hostView;
|
public final TextView hostView;
|
||||||
public final View connectionView;
|
public final ImageView connectionView;
|
||||||
public final View menuView;
|
public final View menuView;
|
||||||
public final ServerPopupMenu popupMenu;
|
public final ServerPopupMenu popupMenu;
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ public class ServersAdapter extends RecyclerView.Adapter<ServersAdapter.ViewHold
|
|||||||
|
|
||||||
titleView = (TextView) view.findViewById(R.id.title);
|
titleView = (TextView) view.findViewById(R.id.title);
|
||||||
hostView = (TextView) view.findViewById(R.id.host);
|
hostView = (TextView) view.findViewById(R.id.host);
|
||||||
connectionView = view.findViewById(R.id.connection);
|
connectionView = (ImageView) view.findViewById(R.id.connection);
|
||||||
menuView = view.findViewById(R.id.menu);
|
menuView = view.findViewById(R.id.menu);
|
||||||
|
|
||||||
popupMenu = new ServerPopupMenu(
|
popupMenu = new ServerPopupMenu(
|
||||||
@ -94,7 +95,11 @@ public class ServersAdapter extends RecyclerView.Adapter<ServersAdapter.ViewHold
|
|||||||
|
|
||||||
holder.titleView.setText(server.getTitle());
|
holder.titleView.setText(server.getTitle());
|
||||||
holder.titleView.setTextColor(color);
|
holder.titleView.setTextColor(color);
|
||||||
holder.connectionView.setBackgroundColor(color);
|
holder.connectionView.setImageResource(
|
||||||
|
server.isConnected()
|
||||||
|
? R.drawable.ic_navigation_server_connected
|
||||||
|
: R.drawable.ic_navigation_server_disconnected
|
||||||
|
);
|
||||||
holder.hostView.setText(String.format("%s @ %s : %d",
|
holder.hostView.setText(String.format("%s @ %s : %d",
|
||||||
server.getIdentity().getNickname(),
|
server.getIdentity().getNickname(),
|
||||||
server.getHost(),
|
server.getHost(),
|
||||||
|
@ -19,37 +19,38 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<android.support.v7.widget.CardView
|
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="4dp"
|
android:layout_margin="4dp"
|
||||||
card_view:cardBackgroundColor="@color/cardview_background">
|
card_view:cardBackgroundColor="@color/cardview_background">
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="8dp">
|
android:padding="8dp">
|
||||||
|
|
||||||
<View
|
<ImageView
|
||||||
android:id="@+id/connection"
|
android:id="@+id/connection"
|
||||||
android:layout_width="16dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginRight="4dp" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:src="@drawable/ic_navigation_server_disconnected"/>
|
||||||
android:layout_weight="1"
|
|
||||||
android:paddingLeft="4dp">
|
<ImageView
|
||||||
|
android:id="@+id/menu"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:clickable="true"
|
||||||
|
android:src="@drawable/ic_action_menu" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toRightOf="@id/connection"
|
||||||
|
android:layout_toLeftOf="@id/menu"
|
||||||
android:text="Server"
|
android:text="Server"
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Title" />
|
android:textAppearance="@android:style/TextAppearance.Material.Title" />
|
||||||
|
|
||||||
@ -57,14 +58,11 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
android:id="@+id/host"
|
android:id="@+id/host"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/title"
|
||||||
|
android:layout_toRightOf="@id/connection"
|
||||||
|
android:layout_toLeftOf="@id/menu"
|
||||||
android:text="irc.example.com"
|
android:text="irc.example.com"
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Body1" />
|
android:textAppearance="@android:style/TextAppearance.Material.Body1" />
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ImageView
|
</RelativeLayout>
|
||||||
android:id="@+id/menu"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/ic_action_menu" />
|
|
||||||
</LinearLayout>
|
|
||||||
</android.support.v7.widget.CardView>
|
</android.support.v7.widget.CardView>
|
||||||
|
Loading…
Reference in New Issue
Block a user