1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-25 11:26:47 +01:00
This commit is contained in:
mamutcho 2019-12-12 19:32:55 +02:00
commit 068033ad8e
7 changed files with 0 additions and 1244 deletions

View File

@ -85,11 +85,6 @@ dependencies {
implementation "net.e175.klaus:solarpositioning:0.0.9"
// use pristine greendao instead of our custom version, since our custom jitpack-packaged
// version contains way too much and our custom patches are in the generator only.
implementation 'com.twofortyfouram:android-plugin-client-sdk-for-locale:[4.0.3, 5.0['
implementation 'com.twofortyfouram:android-plugin-host-sdk-for-locale:[2.0.3,3.0['
implementation 'com.twofortyfouram:android-plugin-api-for-locale:[1.0.2,2.0['
implementation "org.greenrobot:greendao:2.2.1"
implementation "org.apache.commons:commons-lang3:3.7"
implementation "org.cyanogenmod:platform.sdk:6.0"

View File

@ -515,26 +515,6 @@
<activity
android:name=".devices.qhybrid.QHybridAppChoserActivity"
android:exported="true" />
<activity
android:name=".devices.qhybrid.TaskerPluginActivity"
android:exported="true"
android:icon="@drawable/ic_device_pebble"
android:label="@string/tasker_notification">
<intent-filter>
<action android:name="com.twofortyfouram.locale.intent.action.EDIT_SETTING" />
</intent-filter>
</activity>
<receiver
android:name=".devices.qhybrid.TaskerPluginReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.twofortyfouram.locale.intent.action.FIRE_SETTING"/>
</intent-filter>
</receiver>
</application>
</manifest>

View File

@ -1,109 +0,0 @@
/* Copyright (C) 2019 Daniel Dakhno
This file is part of Gadgetbridge.
Gadgetbridge is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gadgetbridge is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.devices.qhybrid;
import android.content.Intent;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import com.twofortyfouram.locale.sdk.client.ui.activity.AbstractPluginActivity;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.misfit.PlayNotificationRequest;
public class TaskerPluginActivity extends AbstractPluginActivity {
public static final String key_hours = "qhybrid_hours";
public static final String key_minute = "qhybrid_minutes";
public static final String key_vibration = "qhybrid_vibration";
RadioGroup group;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tasker_plugin);
group = findViewById(R.id.qhybrid_tasker_vibration);
for(PlayNotificationRequest.VibrationType type : PlayNotificationRequest.VibrationType.values()){
RadioButton button = new RadioButton(this);
button.setText(type.name() + " (" + type.name() + ")");
button.setId(type.getValue());
group.addView(button);
}
group.check(PlayNotificationRequest.VibrationType.NO_VIBE.getValue());
RadioButton custom = new RadioButton(this);
custom.setText("variable %vibration");
custom.setId(10);
group.addView(custom);
Intent intent = getIntent();
if(intent.hasExtra(key_hours)){
((TextView) findViewById(R.id.qhybrid_hour_degrees)).setText(intent.getStringExtra(key_hours));
}
if(intent.hasExtra(key_minute)){
((TextView) findViewById(R.id.qhybrid_minute_degrees)).setText(intent.getStringExtra(key_minute));
}
if(intent.hasExtra(key_vibration)){
String vibe = intent.getStringExtra(key_vibration);
if(vibe.equals("%vibration")){
group.check(10);
}else {
group.check(Integer.parseInt(vibe));
}
}
}
@Override
public boolean isBundleValid(@NonNull Bundle bundle) {
return true;
}
@Override
public void onPostCreateWithPreviousResult(@NonNull Bundle bundle, @NonNull String s) {
}
@Nullable
@Override
public Bundle getResultBundle() {
int vibration = group.getCheckedRadioButtonId();
Bundle bundle = new Bundle();
bundle.putString(key_hours, ((EditText) findViewById(R.id.qhybrid_hour_degrees)).getText().toString());
bundle.putString(key_minute, ((EditText) findViewById(R.id.qhybrid_minute_degrees)).getText().toString());
if(vibration == 10){
bundle.putString(key_vibration, "%vibration");
}else{
bundle.putString(key_vibration, String.valueOf(vibration));
}
TaskerPlugin.Setting.setVariableReplaceKeys(bundle, new String[]{key_hours, key_minute, key_vibration});
return bundle;
}
@NonNull
@Override
public String getResultBlurb(@NonNull Bundle bundle) {
return "nope";
}
}

View File

@ -1,51 +0,0 @@
/* Copyright (C) 2019 Daniel Dakhno
This file is part of Gadgetbridge.
Gadgetbridge is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gadgetbridge is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.devices.qhybrid;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.QHybridSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.misfit.PlayNotificationRequest;
public class TaskerPluginReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String min = intent.getStringExtra(TaskerPluginActivity.key_minute);
String hour = intent.getStringExtra(TaskerPluginActivity.key_hours);
String vibration = intent.getStringExtra(TaskerPluginActivity.key_vibration);
int minDegrees = (int)Float.parseFloat(min);
int hourDegrees = (int)Float.parseFloat(hour);
NotificationConfiguration config = new NotificationConfiguration(
(short)minDegrees,
(short)hourDegrees,
null,
null,
false,
PlayNotificationRequest.VibrationType.fromValue(Byte.parseByte(vibration))
);
Intent send = new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION);
send.putExtra("CONFIG", config);
LocalBroadcastManager.getInstance(context).sendBroadcast(send);
}
}

View File

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".devices.qhybrid.TaskerPluginActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hour degrees:" />
<EditText
android:id="@+id/qhybrid_hour_degrees"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="minute degrees:" />
<EditText
android:id="@+id/qhybrid_minute_degrees"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/qhybrid_tasker_vibration"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -757,7 +757,6 @@
<string name="watch9_calibration_button">Calibrate</string>
<string name="title_activity_watch9_pairing">Watch 9 pairing</string>
<string name="title_activity_watch9_calibration">Watch 9 calibration</string>
<string name="tasker_notification">Play Q Hybrid notification</string>
<string name="pref_title_contextual_arabic">Contextual Arabic</string>
<string name="pref_summary_contextual_arabic">Enable this to support contextual Arabic</string>
<string name="preferences_rtl_settings">Right To Left Support</string>