1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 09:17:29 +01:00

Add background image for empty ControlCenter

This commit is contained in:
Lem Dulfo 2016-04-09 13:41:58 +08:00 committed by cpfeiffer
parent 80a21f2ec2
commit 83e6e6b85f
3 changed files with 17 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -56,6 +57,8 @@ public class ControlCenter extends AppCompatActivity {
private TextView hintTextView; private TextView hintTextView;
private FloatingActionButton fab; private FloatingActionButton fab;
private ImageView background;
private SwipeRefreshLayout swipeLayout; private SwipeRefreshLayout swipeLayout;
private GBDeviceAdapter mGBDeviceAdapter; private GBDeviceAdapter mGBDeviceAdapter;
private GBDevice selectedDevice = null; private GBDevice selectedDevice = null;
@ -130,6 +133,7 @@ public class ControlCenter extends AppCompatActivity {
hintTextView = (TextView) findViewById(R.id.hintTextView); hintTextView = (TextView) findViewById(R.id.hintTextView);
ListView deviceListView = (ListView) findViewById(R.id.deviceListView); ListView deviceListView = (ListView) findViewById(R.id.deviceListView);
fab = (FloatingActionButton) findViewById(R.id.fab); fab = (FloatingActionButton) findViewById(R.id.fab);
background = (ImageView) findViewById(R.id.no_items_bg);
fab.setOnClickListener(new View.OnClickListener() { fab.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -381,6 +385,12 @@ public class ControlCenter extends AppCompatActivity {
} }
} }
if (deviceList.isEmpty()) {
background.setVisibility(View.VISIBLE);
} else {
background.setVisibility(View.INVISIBLE);
}
if (connected) { if (connected) {
hintTextView.setText(R.string.tap_connected_device_for_app_mananger); hintTextView.setText(R.string.tap_connected_device_for_app_mananger);
} else if (!deviceList.isEmpty()) { } else if (!deviceList.isEmpty()) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -9,6 +9,13 @@
android:paddingBottom="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.ControlCenter"> tools:context="nodomain.freeyourgadget.gadgetbridge.activities.ControlCenter">
<ImageView
android:id="@+id/no_items_bg"
android:layout_centerInParent="true"
android:src="@drawable/gadgetbridge_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<android.support.v4.widget.SwipeRefreshLayout <android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/controlcenter_swipe_layout" android:id="@+id/controlcenter_swipe_layout"
android:paddingLeft="0px" android:paddingLeft="0px"