2020-01-09 10:44:32 +01:00
/ * Copyright ( C ) 2016 - 2020 Andreas Shimokawa , Daniele Gobbetti
2017-03-10 14:53:19 +01:00
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/>. */
2016-06-14 20:04:54 +02:00
package nodomain.freeyourgadget.gadgetbridge.activities.appmanager ;
2023-01-02 15:15:48 +01:00
import java.nio.charset.StandardCharsets ;
2016-06-17 22:43:06 +02:00
import java.util.ArrayList ;
2016-11-09 19:20:37 +01:00
import java.util.List ;
import java.util.UUID ;
2016-06-17 22:43:06 +02:00
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp ;
2021-05-29 16:42:32 +02:00
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType ;
2016-11-09 19:20:37 +01:00
import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.PebbleProtocol ;
import nodomain.freeyourgadget.gadgetbridge.util.PebbleUtils ;
2016-06-17 22:43:06 +02:00
2016-06-14 20:04:54 +02:00
public class AppManagerFragmentInstalledApps extends AbstractAppManagerFragment {
2016-11-09 19:20:37 +01:00
2016-06-14 20:04:54 +02:00
@Override
2016-11-09 19:20:37 +01:00
protected List < GBDeviceApp > getSystemAppsInCategory ( ) {
List < GBDeviceApp > systemApps = new ArrayList < > ( ) ;
2023-01-02 15:15:48 +01:00
if ( mGBDevice . getType ( ) = = DeviceType . PEBBLE ) {
//systemApps.add(new GBDeviceApp(UUID.fromString("4dab81a6-d2fc-458a-992c-7a1f3b96a970"), "Sports (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
//systemApps.add(new GBDeviceApp(UUID.fromString("cf1e816a-9db0-4511-bbb8-f60c48ca8fac"), "Golf (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
systemApps . add ( new GBDeviceApp ( UUID . fromString ( " 1f03293d-47af-4f28-b960-f2b02a6dd757 " ) , " Music (System) " , " Pebble Inc. " , " " , GBDeviceApp . Type . APP_SYSTEM ) ) ;
systemApps . add ( new GBDeviceApp ( PebbleProtocol . UUID_NOTIFICATIONS , " Notifications (System) " , " Pebble Inc. " , " " , GBDeviceApp . Type . APP_SYSTEM ) ) ;
systemApps . add ( new GBDeviceApp ( UUID . fromString ( " 67a32d95-ef69-46d4-a0b9-854cc62f97f9 " ) , " Alarms (System) " , " Pebble Inc. " , " " , GBDeviceApp . Type . APP_SYSTEM ) ) ;
systemApps . add ( new GBDeviceApp ( UUID . fromString ( " 18e443ce-38fd-47c8-84d5-6d0c775fbe55 " ) , " Watchfaces (System) " , " Pebble Inc. " , " " , GBDeviceApp . Type . APP_SYSTEM ) ) ;
if ( mGBDevice ! = null ) {
if ( PebbleUtils . hasHealth ( mGBDevice . getModel ( ) ) ) {
systemApps . add ( new GBDeviceApp ( UUID . fromString ( " 0863fc6a-66c5-4f62-ab8a-82ed00a98b5d " ) , " Send Text (System) " , " Pebble Inc. " , " " , GBDeviceApp . Type . APP_SYSTEM ) ) ;
systemApps . add ( new GBDeviceApp ( PebbleProtocol . UUID_PEBBLE_HEALTH , " Health (System) " , " Pebble Inc. " , " " , GBDeviceApp . Type . APP_SYSTEM ) ) ;
}
if ( PebbleUtils . hasHRM ( mGBDevice . getModel ( ) ) ) {
systemApps . add ( new GBDeviceApp ( PebbleProtocol . UUID_WORKOUT , " Workout (System) " , " Pebble Inc. " , " " , GBDeviceApp . Type . APP_SYSTEM ) ) ;
}
if ( PebbleUtils . getFwMajor ( mGBDevice . getFirmwareVersion ( ) ) > = 4 ) {
systemApps . add ( new GBDeviceApp ( PebbleProtocol . UUID_WEATHER , " Weather (System) " , " Pebble Inc. " , " " , GBDeviceApp . Type . APP_SYSTEM ) ) ;
}
2016-12-30 20:14:13 +01:00
}
2023-01-02 15:15:48 +01:00
} else if ( mGBDevice . getType ( ) = = DeviceType . FOSSILQHYBRID ) {
systemApps . add ( new GBDeviceApp ( UUID . nameUUIDFromBytes ( " workoutApp " . getBytes ( StandardCharsets . UTF_8 ) ) , " workoutApp " , " " , " " , GBDeviceApp . Type . APP_ACTIVITYTRACKER ) ) ;
2016-06-17 22:43:06 +02:00
}
2016-11-09 19:20:37 +01:00
return systemApps ;
2016-06-14 20:04:54 +02:00
}
2016-06-15 19:56:34 +02:00
2016-06-24 13:39:29 +02:00
@Override
protected boolean isCacheManager ( ) {
return false ;
}
2016-06-17 22:43:06 +02:00
@Override
protected String getSortFilename ( ) {
2016-06-15 19:56:34 +02:00
return mGBDevice . getAddress ( ) + " .watchapps " ;
}
2016-06-17 22:43:06 +02:00
@Override
protected void onChangedAppOrder ( ) {
super . onChangedAppOrder ( ) ;
sendOrderToDevice ( mGBDevice . getAddress ( ) + " .watchfaces " ) ;
}
2016-06-24 13:39:29 +02:00
@Override
protected boolean filterApp ( GBDeviceApp gbDeviceApp ) {
return gbDeviceApp . getType ( ) = = GBDeviceApp . Type . APP_ACTIVITYTRACKER | | gbDeviceApp . getType ( ) = = GBDeviceApp . Type . APP_GENERIC ;
}
2016-06-14 20:04:54 +02:00
}