1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-03 15:32:54 +01:00

Put FW/HW info inside its own TextView to cleanup the device list

This commit is contained in:
Andreas Shimokawa 2015-05-05 11:16:57 +02:00
parent cf12c78a64
commit d09b5442cf
7 changed files with 52 additions and 22 deletions

View File

@ -1,4 +1,9 @@
###Changelog
####Version (next)
* Add discovery and pairing Activity
* Listen vor Pebble Message intents and forward notification (used by Conversations)
* Make Strings translatable and add German, Spanish and Korean translation
####Version 0.3.4
* Pebble: Huge speedup for app/firmware installation.
* Pebble: Use a separate notification with progress bar for installation procedure

View File

@ -117,7 +117,7 @@ public class GBDevice implements Parcelable {
mState = state;
}
String getStateString() {
public String getStateString() {
switch (mState) {
case NOT_CONNECTED:
return GBApplication.getContext().getString(R.string.not_connected);
@ -131,14 +131,15 @@ public class GBDevice implements Parcelable {
return GBApplication.getContext().getString(R.string.unknown_state);
}
public String getInfoString() {
if (mFirmwareVersion != null) {
if (mHardwareVersion != null) {
return GBApplication.getContext().getString(R.string.connectionstate_hw_fw, getStateString(), mHardwareVersion, mFirmwareVersion);
return GBApplication.getContext().getString(R.string.connectionstate_hw_fw, mHardwareVersion, mFirmwareVersion);
}
return GBApplication.getContext().getString(R.string.connectionstate_fw, getStateString(), mFirmwareVersion);
return GBApplication.getContext().getString(R.string.connectionstate_fw, mFirmwareVersion);
} else {
return getStateString();
return "";
}
}

View File

@ -16,13 +16,11 @@ import nodomain.freeyourgadget.gadgetbridge.R;
public class GBDeviceAdapter extends ArrayAdapter<GBDevice> {
private final Context context;
private final List<GBDevice> deviceList;
public GBDeviceAdapter(Context context, List<GBDevice> deviceList) {
super(context, 0, deviceList);
this.context = context;
this.deviceList = deviceList;
}
@Override
@ -37,10 +35,12 @@ public class GBDeviceAdapter extends ArrayAdapter<GBDevice> {
}
TextView deviceStatusLabel = (TextView) view.findViewById(R.id.device_status);
TextView deviceNameLabel = (TextView) view.findViewById(R.id.device_name);
TextView deviceInfoLabel = (TextView) view.findViewById(R.id.device_info);
ImageView deviceImageView = (ImageView) view.findViewById(R.id.device_image);
deviceStatusLabel.setText(device.getInfoString());
deviceStatusLabel.setText(device.getStateString());
deviceNameLabel.setText(device.getName());
deviceInfoLabel.setText(device.getInfoString());
switch (device.getType()) {
case PEBBLE:

View File

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/activatedBackgroundIndicator"
android:padding="8dp" >
android:padding="8dp">
<ImageView
android:id="@+id/device_image"
@ -11,26 +11,50 @@
android:layout_height="48dp"
android:layout_alignParentLeft="true" />
<LinearLayout
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/device_image"
android:orientation="vertical"
android:paddingLeft="8dp" >
android:paddingLeft="8dp">
<TextView
<TextView
android:id="@+id/device_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollHorizontally="false"
android:singleLine="true" />
android:layout_alignLeft="@+id/statuswrapper"
android:layout_toLeftOf="@+id/device_info"
android:singleLine="true"
android:textColor="@color/primarytext"
android:typeface="sans" />
<LinearLayout
android:id="@+id/statuswrapper"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/device_name"
android:orientation="vertical"
android:paddingTop="3dp">
<TextView
android:id="@+id/device_status"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/primarytext"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/device_status"
android:id="@+id/device_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold" />
</LinearLayout>
android:layout_alignBaseline="@+id/device_name"
android:layout_alignParentRight="true"
android:gravity="right"
android:textColor="@color/secondarytext"
android:textSize="12sp" />
</RelativeLayout>
</RelativeLayout>

View File

@ -44,8 +44,8 @@
<string name="connecting">verbinde</string>
<string name="connected">verbunden</string>
<string name="unknown_state">unbekannter Zustand</string>
<string name="connectionstate_hw_fw">%1$s (HW: %2$s FW: %3$s)</string>
<string name="connectionstate_fw">%1$s (FW: %2$s)</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">FW: %1$s</string>
<string name="_unknown_">(unknown)</string>
<string name="test">Test</string>
<string name="test_notification">Test Benachrichtigung</string>

View File

@ -39,8 +39,8 @@
<string name="connecting">conectando</string>
<string name="connected">conectado</string>
<string name="unknown_state">estado desconocido</string>
<string name="connectionstate_hw_fw">%1$s (HW: %2$s FW: %3$s)</string>
<string name="connectionstate_fw">%1$s (FW: %2$s)</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">FW: %1$s</string>
<string name="_unknown_">(desconocido)</string>
<string name="test">Probar</string>
<string name="test_notification">Probar notificación</string>

View File

@ -46,8 +46,8 @@
<string name="connecting">connecting</string>
<string name="connected">connected</string>
<string name="unknown_state">unknown state</string>
<string name="connectionstate_hw_fw">%1$s (HW: %2$s FW: %3$s)</string>
<string name="connectionstate_fw">%1$s (FW: %2$s)</string>
<string name="connectionstate_hw_fw">HW: %1$s FW: %2$s</string>
<string name="connectionstate_fw">FW: %1$s</string>
<string name="_unknown_">(unknown)</string>
<string name="test">Test</string>
<string name="test_notification">Test Notification</string>