cleanup Debug activity a bit, add Spinner and remove a lot of buttons
This commit is contained in:
parent
5bdc7933b3
commit
ed343778ee
|
@ -13,13 +13,17 @@ import android.support.v4.app.RemoteInput;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.Spinner;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
|
@ -39,8 +43,8 @@ public class DebugActivity extends GBActivity {
|
||||||
private static final String ACTION_REPLY
|
private static final String ACTION_REPLY
|
||||||
= "nodomain.freeyourgadget.gadgetbridge.DebugActivity.action.reply";
|
= "nodomain.freeyourgadget.gadgetbridge.DebugActivity.action.reply";
|
||||||
|
|
||||||
private Button sendSMSButton;
|
private Spinner sendTypeSpinner;
|
||||||
private Button sendEmailButton;
|
private Button sendButton;
|
||||||
private Button incomingCallButton;
|
private Button incomingCallButton;
|
||||||
private Button outgoingCallButton;
|
private Button outgoingCallButton;
|
||||||
private Button startCallButton;
|
private Button startCallButton;
|
||||||
|
@ -75,10 +79,6 @@ public class DebugActivity extends GBActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private Button sendChatButton;
|
|
||||||
private Button sendTelegramButton;
|
|
||||||
private Button sendTwitterButton;
|
|
||||||
private Button sendFacebookButton;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -93,79 +93,26 @@ public class DebugActivity extends GBActivity {
|
||||||
registerReceiver(mReceiver, filter); // for ACTION_REPLY
|
registerReceiver(mReceiver, filter); // for ACTION_REPLY
|
||||||
|
|
||||||
editContent = (EditText) findViewById(R.id.editContent);
|
editContent = (EditText) findViewById(R.id.editContent);
|
||||||
sendSMSButton = (Button) findViewById(R.id.sendSMSButton);
|
|
||||||
sendSMSButton.setOnClickListener(new View.OnClickListener() {
|
ArrayList<String> spinnerArray = new ArrayList<>();
|
||||||
@Override
|
for (NotificationType notificationType : NotificationType.values()) {
|
||||||
public void onClick(View v) {
|
spinnerArray.add(notificationType.name());
|
||||||
NotificationSpec notificationSpec = new NotificationSpec();
|
|
||||||
notificationSpec.phoneNumber = editContent.getText().toString();
|
|
||||||
notificationSpec.body = editContent.getText().toString();
|
|
||||||
notificationSpec.type = NotificationType.SMS;
|
|
||||||
notificationSpec.id = -1;
|
|
||||||
GBApplication.deviceService().onNotification(notificationSpec);
|
|
||||||
}
|
}
|
||||||
});
|
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, spinnerArray);
|
||||||
sendEmailButton = (Button) findViewById(R.id.sendEmailButton);
|
sendTypeSpinner = (Spinner) findViewById(R.id.sendTypeSpinner);
|
||||||
sendEmailButton.setOnClickListener(new View.OnClickListener() {
|
sendTypeSpinner.setAdapter(spinnerArrayAdapter);
|
||||||
|
|
||||||
|
sendButton = (Button) findViewById(R.id.sendButton);
|
||||||
|
sendButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
NotificationSpec notificationSpec = new NotificationSpec();
|
NotificationSpec notificationSpec = new NotificationSpec();
|
||||||
notificationSpec.sender = getResources().getText(R.string.app_name).toString();
|
String testString = editContent.getText().toString();
|
||||||
notificationSpec.subject = editContent.getText().toString();
|
notificationSpec.phoneNumber = testString;
|
||||||
notificationSpec.body = editContent.getText().toString();
|
notificationSpec.body = testString;
|
||||||
notificationSpec.type = NotificationType.EMAIL;
|
notificationSpec.sender = testString;
|
||||||
notificationSpec.id = -1;
|
notificationSpec.subject = testString;
|
||||||
GBApplication.deviceService().onNotification(notificationSpec);
|
notificationSpec.type = NotificationType.values()[sendTypeSpinner.getSelectedItemPosition()];
|
||||||
}
|
|
||||||
});
|
|
||||||
sendChatButton = (Button) findViewById(R.id.sendChatButton);
|
|
||||||
sendChatButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
NotificationSpec notificationSpec = new NotificationSpec();
|
|
||||||
notificationSpec.sender = getResources().getText(R.string.app_name).toString();
|
|
||||||
notificationSpec.subject = editContent.getText().toString();
|
|
||||||
notificationSpec.body = editContent.getText().toString();
|
|
||||||
notificationSpec.type = NotificationType.CHAT;
|
|
||||||
notificationSpec.id = -1;
|
|
||||||
GBApplication.deviceService().onNotification(notificationSpec);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sendTelegramButton = (Button) findViewById(R.id.sendTelegramButton);
|
|
||||||
sendTelegramButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
NotificationSpec notificationSpec = new NotificationSpec();
|
|
||||||
notificationSpec.sender = getResources().getText(R.string.app_name).toString();
|
|
||||||
notificationSpec.subject = editContent.getText().toString();
|
|
||||||
notificationSpec.body = editContent.getText().toString();
|
|
||||||
notificationSpec.type = NotificationType.TELEGRAM;
|
|
||||||
notificationSpec.id = -1;
|
|
||||||
GBApplication.deviceService().onNotification(notificationSpec);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sendTwitterButton = (Button) findViewById(R.id.sendTwitterButton);
|
|
||||||
sendTwitterButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
NotificationSpec notificationSpec = new NotificationSpec();
|
|
||||||
notificationSpec.sender = getResources().getText(R.string.app_name).toString();
|
|
||||||
notificationSpec.subject = editContent.getText().toString();
|
|
||||||
notificationSpec.body = editContent.getText().toString();
|
|
||||||
notificationSpec.type = NotificationType.TWITTER;
|
|
||||||
notificationSpec.id = -1;
|
|
||||||
GBApplication.deviceService().onNotification(notificationSpec);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sendFacebookButton = (Button) findViewById(R.id.sendFacebookButton);
|
|
||||||
sendFacebookButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
NotificationSpec notificationSpec = new NotificationSpec();
|
|
||||||
notificationSpec.sender = getResources().getText(R.string.app_name).toString();
|
|
||||||
notificationSpec.subject = editContent.getText().toString();
|
|
||||||
notificationSpec.body = editContent.getText().toString();
|
|
||||||
notificationSpec.type = NotificationType.FACEBOOK;
|
|
||||||
notificationSpec.id = -1;
|
notificationSpec.id = -1;
|
||||||
GBApplication.deviceService().onNotification(notificationSpec);
|
GBApplication.deviceService().onNotification(notificationSpec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
<GridLayout
|
<GridLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:columnCount="3"
|
android:alignmentMode="alignMargins"
|
||||||
android:rowCount="15"
|
android:columnCount="2"
|
||||||
android:alignmentMode="alignMargins">
|
android:rowCount="15">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView"
|
android:id="@+id/textView"
|
||||||
|
@ -35,60 +35,6 @@
|
||||||
android:text="Message / Caller"
|
android:text="Message / Caller"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/sendSMSButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_column="0"
|
|
||||||
android:layout_gravity="fill_horizontal"
|
|
||||||
android:layout_row="2"
|
|
||||||
android:text="SMS" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/sendEmailButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_column="1"
|
|
||||||
android:layout_gravity="fill_horizontal"
|
|
||||||
android:layout_row="2"
|
|
||||||
android:text="E-Mail"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/sendChatButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_column="2"
|
|
||||||
android:layout_gravity="fill_horizontal"
|
|
||||||
android:layout_row="2"
|
|
||||||
android:text="Chat"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/sendTelegramButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_column="0"
|
|
||||||
android:layout_gravity="fill_horizontal"
|
|
||||||
android:layout_row="3"
|
|
||||||
android:text="Telegram" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/sendTwitterButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_column="1"
|
|
||||||
android:layout_gravity="fill_horizontal"
|
|
||||||
android:layout_row="3"
|
|
||||||
android:text="Twitter"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/sendFacebookButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_column="2"
|
|
||||||
android:layout_gravity="fill_horizontal"
|
|
||||||
android:layout_row="3"
|
|
||||||
android:text="Facebook"/>
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/editContent"
|
android:id="@+id/editContent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -101,15 +47,23 @@
|
||||||
android:inputType="textMultiLine"
|
android:inputType="textMultiLine"
|
||||||
android:text="Test" />
|
android:text="Test" />
|
||||||
|
|
||||||
<Button
|
<Spinner
|
||||||
android:id="@+id/testNotificationButton"
|
android:id="@+id/sendTypeSpinner"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_column="0"
|
android:layout_column="0"
|
||||||
android:layout_columnSpan="3"
|
|
||||||
android:layout_gravity="fill_horizontal"
|
android:layout_gravity="fill_horizontal"
|
||||||
android:layout_row="11"
|
android:layout_row="2"
|
||||||
android:text="create test notification" />
|
android:text="send as SMS" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/sendButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_column="1"
|
||||||
|
android:layout_gravity="fill_horizontal"
|
||||||
|
android:layout_row="2"
|
||||||
|
android:text="Send" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/incomingCallButton"
|
android:id="@+id/incomingCallButton"
|
||||||
|
@ -117,7 +71,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_column="0"
|
android:layout_column="0"
|
||||||
android:layout_gravity="fill_horizontal"
|
android:layout_gravity="fill_horizontal"
|
||||||
android:layout_row="4"
|
android:layout_row="3"
|
||||||
android:text="incoming call" />
|
android:text="incoming call" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@ -126,9 +80,8 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_column="1"
|
android:layout_column="1"
|
||||||
android:layout_gravity="fill_horizontal"
|
android:layout_gravity="fill_horizontal"
|
||||||
android:layout_row="4"
|
android:layout_row="3"
|
||||||
android:text="outgoing call"
|
android:text="outgoing call" />
|
||||||
android:layout_columnSpan="2" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/startCallButton"
|
android:id="@+id/startCallButton"
|
||||||
|
@ -136,7 +89,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_column="0"
|
android:layout_column="0"
|
||||||
android:layout_gravity="fill_horizontal"
|
android:layout_gravity="fill_horizontal"
|
||||||
android:layout_row="5"
|
android:layout_row="4"
|
||||||
android:text="start call" />
|
android:text="start call" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@ -145,18 +98,16 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_column="1"
|
android:layout_column="1"
|
||||||
android:layout_gravity="fill_horizontal"
|
android:layout_gravity="fill_horizontal"
|
||||||
android:layout_row="5"
|
android:layout_row="4"
|
||||||
android:text="end call"
|
android:text="end call" />
|
||||||
android:layout_columnSpan="2" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/setTimeButton"
|
android:id="@+id/setTimeButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_column="0"
|
android:layout_column="0"
|
||||||
android:layout_columnSpan="1"
|
|
||||||
android:layout_gravity="fill_horizontal"
|
android:layout_gravity="fill_horizontal"
|
||||||
android:layout_row="6"
|
android:layout_row="5"
|
||||||
android:text="set time" />
|
android:text="set time" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@ -164,29 +115,40 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_column="1"
|
android:layout_column="1"
|
||||||
android:layout_columnSpan="2"
|
|
||||||
android:layout_gravity="fill_horizontal"
|
android:layout_gravity="fill_horizontal"
|
||||||
android:layout_row="6"
|
android:layout_row="5"
|
||||||
android:text="set music info" />
|
android:text="set music info" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/HearRateButton"
|
android:id="@+id/HearRateButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_column="0"
|
android:layout_column="0"
|
||||||
android:layout_columnSpan="3"
|
android:layout_columnSpan="2"
|
||||||
android:layout_gravity="fill_horizontal"
|
android:layout_gravity="fill_horizontal"
|
||||||
android:layout_row="9"
|
android:layout_row="6"
|
||||||
android:text="Heart Rate Test" />
|
android:text="Heart Rate Test" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/rebootButton"
|
android:id="@+id/rebootButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_column="0"
|
android:layout_column="0"
|
||||||
android:layout_columnSpan="3"
|
android:layout_columnSpan="2"
|
||||||
android:layout_gravity="fill_horizontal"
|
android:layout_gravity="fill_horizontal"
|
||||||
android:layout_row="12"
|
android:layout_row="7"
|
||||||
android:text="reboot" />
|
android:text="reboot" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/testNotificationButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_column="0"
|
||||||
|
android:layout_columnSpan="2"
|
||||||
|
android:layout_gravity="fill_horizontal"
|
||||||
|
android:layout_row="8"
|
||||||
|
android:text="create test notification" />
|
||||||
|
|
||||||
</GridLayout>
|
</GridLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue