mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-21 03:52:48 +00:00
Add visual indication when no PCs have been found yet
This commit is contained in:
parent
a67791b8aa
commit
244130fc1b
@ -40,11 +40,13 @@ import android.widget.AdapterView.OnItemClickListener;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.GridView;
|
import android.widget.GridView;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
|
|
||||||
public class PcView extends Activity {
|
public class PcView extends Activity {
|
||||||
private ImageButton settingsButton, addComputerButton;
|
private ImageButton settingsButton, addComputerButton;
|
||||||
|
private RelativeLayout noPcFoundLayout;
|
||||||
private GridView pcGrid;
|
private GridView pcGrid;
|
||||||
private PcGridAdapter pcGridAdapter;
|
private PcGridAdapter pcGridAdapter;
|
||||||
private ComputerManagerService.ComputerManagerBinder managerBinder;
|
private ComputerManagerService.ComputerManagerBinder managerBinder;
|
||||||
@ -141,6 +143,13 @@ public class PcView extends Activity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
noPcFoundLayout = (RelativeLayout) findViewById(R.id.no_pc_found_layout);
|
||||||
|
if (pcGridAdapter.getCount() == 0) {
|
||||||
|
noPcFoundLayout.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
noPcFoundLayout.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
pcGridAdapter.notifyDataSetChanged();
|
pcGridAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,6 +551,9 @@ public class PcView extends Activity {
|
|||||||
else {
|
else {
|
||||||
// Add a new entry
|
// Add a new entry
|
||||||
pcGridAdapter.addComputer(new ComputerObject(details));
|
pcGridAdapter.addComputer(new ComputerObject(details));
|
||||||
|
|
||||||
|
// Remove the "Discovery in progress" view
|
||||||
|
noPcFoundLayout.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify the view that the data has changed
|
// Notify the view that the data has changed
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
tools:context=".PcView" >
|
tools:context=".PcView" >
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toLeftOf="@+id/manuallyAddPc"
|
||||||
|
android:layout_toRightOf="@+id/settingsButton">
|
||||||
<GridView
|
<GridView
|
||||||
android:id="@+id/pcGridView"
|
android:id="@+id/pcGridView"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
@ -16,9 +21,30 @@
|
|||||||
android:columnWidth="160dp"
|
android:columnWidth="160dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"/>
|
||||||
android:layout_toLeftOf="@+id/manuallyAddPc"
|
<RelativeLayout
|
||||||
android:layout_toRightOf="@+id/settingsButton"/>
|
android:id="@+id/no_pc_found_layout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_centerHorizontal="true">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/pcs_loading"
|
||||||
|
android:layout_width="75dp"
|
||||||
|
android:layout_height="75dp"
|
||||||
|
android:src="@drawable/image_loading"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toRightOf="@+id/pcs_loading"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Searching for PCs on the network..."/>
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/settingsButton"
|
android:id="@+id/settingsButton"
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
tools:context=".PcView" >
|
tools:context=".PcView" >
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toLeftOf="@+id/manuallyAddPc"
|
||||||
|
android:layout_toRightOf="@+id/settingsButton">
|
||||||
<GridView
|
<GridView
|
||||||
android:id="@+id/pcGridView"
|
android:id="@+id/pcGridView"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
@ -16,9 +21,30 @@
|
|||||||
android:columnWidth="160dp"
|
android:columnWidth="160dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"/>
|
||||||
android:layout_toLeftOf="@+id/manuallyAddPc"
|
<RelativeLayout
|
||||||
android:layout_toRightOf="@+id/settingsButton"/>
|
android:id="@+id/no_pc_found_layout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_centerHorizontal="true">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/pcs_loading"
|
||||||
|
android:layout_width="75dp"
|
||||||
|
android:layout_height="75dp"
|
||||||
|
android:src="@drawable/image_loading"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toRightOf="@+id/pcs_loading"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Searching for PCs on the network..."/>
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/settingsButton"
|
android:id="@+id/settingsButton"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user