Merge branch 'master' into db-refactoring
@ -48,6 +48,7 @@ dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:appcompat-v7:23.1.1'
|
||||
compile 'com.android.support:support-v4:23.1.1'
|
||||
compile 'com.android.support:design:23.3.0'
|
||||
compile 'com.github.tony19:logback-android-classic:1.1.1-4'
|
||||
compile 'org.slf4j:slf4j-api:1.7.7'
|
||||
compile 'com.github.PhilJay:MPAndroidChart:v2.2.3'
|
||||
|
@ -1,12 +1,21 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.activities;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -20,6 +29,7 @@ import org.slf4j.LoggerFactory;
|
||||
public abstract class AbstractSettingsActivity extends PreferenceActivity {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AbstractSettingsActivity.class);
|
||||
private AppCompatDelegate delegate;
|
||||
|
||||
/**
|
||||
* A preference value change listener that updates the preference's summary
|
||||
@ -56,15 +66,15 @@ public abstract class AbstractSettingsActivity extends PreferenceActivity {
|
||||
}
|
||||
|
||||
private static class ExtraSetSummaryOnChangeListener extends SimpleSetSummaryOnChangeListener {
|
||||
private final Preference.OnPreferenceChangeListener delegate;
|
||||
private final Preference.OnPreferenceChangeListener prefChangeListener;
|
||||
|
||||
public ExtraSetSummaryOnChangeListener(Preference.OnPreferenceChangeListener delegate) {
|
||||
this.delegate = delegate;
|
||||
public ExtraSetSummaryOnChangeListener(Preference.OnPreferenceChangeListener prefChangeListener) {
|
||||
this.prefChangeListener = prefChangeListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object value) {
|
||||
boolean result = delegate.onPreferenceChange(preference, value);
|
||||
boolean result = prefChangeListener.onPreferenceChange(preference, value);
|
||||
if (result) {
|
||||
return super.onPreferenceChange(preference, value);
|
||||
}
|
||||
@ -74,11 +84,17 @@ public abstract class AbstractSettingsActivity extends PreferenceActivity {
|
||||
|
||||
private static final SimpleSetSummaryOnChangeListener sBindPreferenceSummaryToValueListener = new SimpleSetSummaryOnChangeListener();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
getDelegate().installViewFactory();
|
||||
getDelegate().onCreate(savedInstanceState);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getDelegate().onPostCreate(savedInstanceState);
|
||||
|
||||
for (String prefKey : getPreferenceKeysWithSummary()) {
|
||||
final Preference pref = findPreference(prefKey);
|
||||
@ -90,6 +106,67 @@ public abstract class AbstractSettingsActivity extends PreferenceActivity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPostResume() {
|
||||
super.onPostResume();
|
||||
getDelegate().onPostResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTitleChanged(CharSequence title, int color) {
|
||||
super.onTitleChanged(title, color);
|
||||
getDelegate().setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
getDelegate().onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getDelegate().onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
getDelegate().onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MenuInflater getMenuInflater() {
|
||||
return getDelegate().getMenuInflater();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(@LayoutRes int layoutResID) {
|
||||
getDelegate().setContentView(layoutResID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(View view) {
|
||||
getDelegate().setContentView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(View view, ViewGroup.LayoutParams params) {
|
||||
getDelegate().setContentView(view, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContentView(View view, ViewGroup.LayoutParams params) {
|
||||
getDelegate().addContentView(view, params);
|
||||
}
|
||||
|
||||
public void invalidateOptionsMenu() {
|
||||
getDelegate().invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Subclasses should reimplement this to return the keys of those
|
||||
* preferences which should print its values as a summary below the
|
||||
@ -141,4 +218,19 @@ public abstract class AbstractSettingsActivity extends PreferenceActivity {
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
public ActionBar getSupportActionBar() {
|
||||
return getDelegate().getSupportActionBar();
|
||||
}
|
||||
|
||||
public void setSupportActionBar(@Nullable Toolbar toolbar) {
|
||||
getDelegate().setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
private AppCompatDelegate getDelegate() {
|
||||
if (delegate == null) {
|
||||
delegate = AppCompatDelegate.create(this, null);
|
||||
}
|
||||
return delegate;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.CheckBox;
|
||||
@ -12,7 +12,7 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBAlarm;
|
||||
|
||||
public class AlarmDetails extends Activity {
|
||||
public class AlarmDetails extends AppCompatActivity {
|
||||
|
||||
private GBAlarm alarm;
|
||||
private TimePicker timePicker;
|
||||
|
@ -1,11 +1,11 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
|
||||
public class AndroidPairingActivity extends Activity {
|
||||
public class AndroidPairingActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -12,6 +11,7 @@ import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -34,7 +34,7 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
|
||||
|
||||
public class AppBlacklistActivity extends Activity {
|
||||
public class AppBlacklistActivity extends AppCompatActivity {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AppBlacklistActivity.class);
|
||||
|
||||
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
@ -53,7 +53,6 @@ public class AppBlacklistActivity extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_appblacklist);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
final PackageManager pm = getPackageManager();
|
||||
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
|
@ -1,6 +1,5 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -11,6 +10,7 @@ import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -37,7 +37,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.PebbleUtils;
|
||||
|
||||
|
||||
public class AppManagerActivity extends Activity {
|
||||
public class AppManagerActivity extends AppCompatActivity {
|
||||
public static final String ACTION_REFRESH_APPLIST
|
||||
= "nodomain.freeyourgadget.gadgetbridge.appmanager.action.refresh_applist";
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AppManagerActivity.class);
|
||||
@ -134,7 +134,6 @@ public class AppManagerActivity extends Activity {
|
||||
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
|
||||
setContentView(R.layout.activity_appmanager);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
ListView appListView = (ListView) findViewById(R.id.appListView);
|
||||
mGBDeviceAppAdapter = new GBDeviceAppAdapter(this, appList);
|
||||
|
@ -1,11 +1,12 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.activities;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.ListView;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@ -20,7 +21,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBAlarm;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MIBAND_ALARMS;
|
||||
|
||||
|
||||
public class ConfigureAlarms extends ListActivity {
|
||||
public class ConfigureAlarms extends AppCompatActivity {
|
||||
|
||||
private static final int REQ_CONFIGURE_ALARM = 1;
|
||||
|
||||
@ -33,7 +34,6 @@ public class ConfigureAlarms extends ListActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_configure_alarms);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
preferencesAlarmListSet = sharedPrefs.getStringSet(PREF_MIBAND_ALARMS, new HashSet<String>());
|
||||
@ -45,7 +45,8 @@ public class ConfigureAlarms extends ListActivity {
|
||||
|
||||
mGBAlarmListAdapter = new GBAlarmListAdapter(this, preferencesAlarmListSet);
|
||||
|
||||
setListAdapter(mGBAlarmListAdapter);
|
||||
ListView listView = (ListView) findViewById(R.id.alarm_list);
|
||||
listView.setAdapter(mGBAlarmListAdapter);
|
||||
updateAlarmsFromPrefs();
|
||||
}
|
||||
|
||||
|
@ -15,15 +15,18 @@ import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
@ -45,7 +48,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
|
||||
public class ControlCenter extends Activity {
|
||||
public class ControlCenter extends AppCompatActivity {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ControlCenter.class);
|
||||
|
||||
@ -53,6 +56,9 @@ public class ControlCenter extends Activity {
|
||||
= "nodomain.freeyourgadget.gadgetbridge.controlcenter.action.set_version";
|
||||
|
||||
private TextView hintTextView;
|
||||
private FloatingActionButton fab;
|
||||
private ImageView background;
|
||||
|
||||
private SwipeRefreshLayout swipeLayout;
|
||||
private GBDeviceAdapter mGBDeviceAdapter;
|
||||
private GBDevice selectedDevice = null;
|
||||
@ -123,8 +129,19 @@ public class ControlCenter extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_controlcenter);
|
||||
|
||||
hintTextView = (TextView) findViewById(R.id.hintTextView);
|
||||
ListView deviceListView = (ListView) findViewById(R.id.deviceListView);
|
||||
fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
background = (ImageView) findViewById(R.id.no_items_bg);
|
||||
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
launchDiscoveryActivity();
|
||||
}
|
||||
});
|
||||
|
||||
mGBDeviceAdapter = new GBDeviceAdapter(this, deviceList);
|
||||
deviceListView.setAdapter(this.mGBDeviceAdapter);
|
||||
deviceListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@ -332,18 +349,19 @@ public class ControlCenter extends Activity {
|
||||
Intent quitIntent = new Intent(GBApplication.ACTION_QUIT);
|
||||
LocalBroadcastManager.getInstance(this).sendBroadcast(quitIntent);
|
||||
return true;
|
||||
case R.id.action_discover:
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
startActivity(new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS));
|
||||
} else {
|
||||
startActivity(new Intent(this, DiscoveryActivity.class));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void launchDiscoveryActivity() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
startActivity(new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS));
|
||||
} else {
|
||||
startActivity(new Intent(this, DiscoveryActivity.class));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
|
||||
@ -367,6 +385,12 @@ public class ControlCenter extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceList.isEmpty()) {
|
||||
background.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
background.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
if (connected) {
|
||||
hintTextView.setText(R.string.tap_connected_device_for_app_mananger);
|
||||
} else if (!deviceList.isEmpty()) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
@ -14,6 +13,7 @@ import android.os.Bundle;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.RemoteInput;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
@ -37,7 +37,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
|
||||
|
||||
public class DebugActivity extends Activity {
|
||||
public class DebugActivity extends AppCompatActivity {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DebugActivity.class);
|
||||
|
||||
private static final String EXTRA_REPLY = "reply";
|
||||
@ -81,7 +81,6 @@ public class DebugActivity extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_debug);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(GBApplication.ACTION_QUIT);
|
||||
|
@ -12,6 +12,7 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
@ -32,7 +33,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
|
||||
public class DiscoveryActivity extends Activity implements AdapterView.OnItemClickListener {
|
||||
public class DiscoveryActivity extends AppCompatActivity implements AdapterView.OnItemClickListener {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DiscoveryActivity.class);
|
||||
private static final long SCAN_DURATION = 60000; // 60s
|
||||
|
||||
@ -290,6 +291,11 @@ public class DiscoveryActivity extends Activity implements AdapterView.OnItemCli
|
||||
return false;
|
||||
}
|
||||
BluetoothAdapter adapter = bluetoothService.getAdapter();
|
||||
if (adapter == null) {
|
||||
LOG.warn("No bluetooth available");
|
||||
this.adapter = null;
|
||||
return false;
|
||||
}
|
||||
if (!adapter.isEnabled()) {
|
||||
LOG.warn("Bluetooth not enabled");
|
||||
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
|
||||
|
@ -1,10 +1,10 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.webkit.ConsoleMessage;
|
||||
@ -32,7 +32,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.PebbleUtils;
|
||||
|
||||
public class ExternalPebbleJSActivity extends Activity {
|
||||
public class ExternalPebbleJSActivity extends AppCompatActivity {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ExternalPebbleJSActivity.class);
|
||||
|
||||
@ -61,7 +61,6 @@ public class ExternalPebbleJSActivity extends Activity {
|
||||
}
|
||||
|
||||
setContentView(R.layout.activity_external_pebble_js);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
WebView myWebView = (WebView) findViewById(R.id.configureWebview);
|
||||
myWebView.clearCache(true);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -9,6 +8,7 @@ import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
@ -35,7 +35,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
|
||||
|
||||
public class FwAppInstallerActivity extends Activity implements InstallActivity {
|
||||
public class FwAppInstallerActivity extends AppCompatActivity implements InstallActivity {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(FwAppInstallerActivity.class);
|
||||
private static final String ITEM_DETAILS = "details";
|
||||
@ -113,7 +113,7 @@ public class FwAppInstallerActivity extends Activity implements InstallActivity
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_appinstaller);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
GBDevice dev = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE);
|
||||
if (dev != null) {
|
||||
device = dev;
|
||||
|
@ -60,11 +60,11 @@ public class GBDeviceAdapter extends ArrayAdapter<GBDevice> {
|
||||
if (device.isBusy()) {
|
||||
deviceStatusLabel.setText(device.getBusyTask());
|
||||
busyIndicator.setVisibility(View.VISIBLE);
|
||||
batteryLabel.setVisibility(View.GONE);
|
||||
batteryStatusLabel.setVisibility(View.GONE);
|
||||
batteryLabel.setVisibility(View.INVISIBLE);
|
||||
batteryStatusLabel.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
deviceStatusLabel.setText(device.getStateString());
|
||||
busyIndicator.setVisibility(View.GONE);
|
||||
busyIndicator.setVisibility(View.INVISIBLE);
|
||||
batteryLabel.setVisibility(View.VISIBLE);
|
||||
batteryStatusLabel.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@ -113,13 +113,25 @@ public class GBDeviceAdapter extends ArrayAdapter<GBDevice> {
|
||||
|
||||
switch (device.getType()) {
|
||||
case PEBBLE:
|
||||
deviceImageView.setImageResource(R.drawable.ic_device_pebble);
|
||||
if (device.isConnected()) {
|
||||
deviceImageView.setImageResource(R.drawable.ic_device_pebble);
|
||||
} else {
|
||||
deviceImageView.setImageResource(R.drawable.ic_device_pebble_disabled);
|
||||
}
|
||||
break;
|
||||
case MIBAND:
|
||||
deviceImageView.setImageResource(R.drawable.ic_device_miband);
|
||||
if (device.isConnected()) {
|
||||
deviceImageView.setImageResource(R.drawable.ic_device_miband);
|
||||
} else {
|
||||
deviceImageView.setImageResource(R.drawable.ic_device_miband_disabled);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
deviceImageView.setImageResource(R.drawable.ic_launcher);
|
||||
if (device.isConnected()) {
|
||||
deviceImageView.setImageResource(R.drawable.ic_launcher);
|
||||
} else {
|
||||
deviceImageView.setImageResource(R.drawable.ic_device_default_disabled);
|
||||
}
|
||||
}
|
||||
|
||||
return view;
|
||||
|
BIN
app/src/main/res/drawable-hdpi/ic_device_default_disabled.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-hdpi/ic_device_miband_disabled.png
Normal file
After Width: | Height: | Size: 971 B |
BIN
app/src/main/res/drawable-hdpi/ic_device_pebble_disabled.png
Normal file
After Width: | Height: | Size: 1008 B |
BIN
app/src/main/res/drawable-mdpi/ic_device_default_disabled.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_device_miband_disabled.png
Normal file
After Width: | Height: | Size: 584 B |
BIN
app/src/main/res/drawable-mdpi/ic_device_pebble_disabled.png
Normal file
After Width: | Height: | Size: 650 B |
BIN
app/src/main/res/drawable-xhdpi/ic_device_default_disabled.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_device_miband_disabled.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_device_pebble_disabled.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_device_default_disabled.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_device_miband_disabled.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_device_pebble_disabled.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/drawable/gadgetbridge_img.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
app/src/main/res/drawable/ic_add_black.png
Normal file
After Width: | Height: | Size: 201 B |
@ -1,4 +1,4 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
@ -10,7 +10,7 @@
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@android:id/list"
|
||||
android:id="@+id/alarm_list"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
|
@ -1,36 +1,62 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
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"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.ControlCenter">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/no_items_bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/gadgetbridge_img" />
|
||||
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/controlcenter_swipe_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="0px"
|
||||
android:paddingLeft="0px"
|
||||
android:paddingRight="0px"
|
||||
android:paddingTop="0px"
|
||||
android:paddingBottom="0px"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:paddingTop="0px">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/deviceListView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/deviceListView"
|
||||
android:layout_above="@+id/hintTextView"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_above="@+id/hintTextView" />
|
||||
android:layout_centerHorizontal="true" />
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
|
||||
<TextView
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:id="@+id/hintTextView"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:src="@drawable/ic_add_black"
|
||||
app:elevation="6dp"
|
||||
app:pressedTranslationZ="12dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginRight="10dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hintTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/fab"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textStyle="italic" />
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/secondarytext"
|
||||
android:textStyle="italic"
|
||||
android:text="@string/tap_connected_device_for_app_mananger" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<GridLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/activatedBackgroundIndicator"
|
||||
@ -11,83 +11,85 @@
|
||||
android:id="@+id/device_image"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:contentDescription="@string/candidate_item_device_image" />
|
||||
android:contentDescription="@string/candidate_item_device_image"
|
||||
tools:src="@drawable/ic_device_pebble" />
|
||||
|
||||
<GridLayout
|
||||
android:background="?android:attr/activatedBackgroundIndicator"
|
||||
android:paddingBottom="2dp"
|
||||
android:columnCount="5"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:background="?android:attr/activatedBackgroundIndicator"
|
||||
android:columnCount="3"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingTop="3dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:typeface="sans" />
|
||||
<TextView
|
||||
android:id="@+id/device_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:typeface="sans"
|
||||
tools:text="My Pebble Watch" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/device_busy_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_rowSpan="2"
|
||||
android:indeterminate="true" />
|
||||
<TextView
|
||||
android:id="@+id/battery_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="7sp"
|
||||
android:paddingRight="7sp"
|
||||
android:textColor="@color/secondarytext"
|
||||
android:textStyle="bold"
|
||||
tools:text="BAT" />
|
||||
|
||||
<android.support.v4.widget.Space
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_rowSpan="2" />
|
||||
<ImageView
|
||||
android:id="@+id/device_info_image"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_vertical|right"
|
||||
android:layout_rowSpan="2"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/candidate_item_device_image"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_information_outline_grey600_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/battery_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/secondarytext"
|
||||
android:textStyle="bold"
|
||||
android:paddingLeft="7sp"
|
||||
android:paddingRight="7sp" />
|
||||
<TextView
|
||||
android:id="@+id/device_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:gravity="start|bottom"
|
||||
android:textStyle="bold"
|
||||
tools:text="@string/connecting" />
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/ic_information_outline_grey600_24dp"
|
||||
android:id="@+id/device_info_image"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_rowSpan="2"
|
||||
android:scaleType="centerInside"
|
||||
android:contentDescription="@string/candidate_item_device_image"
|
||||
android:clickable="true"
|
||||
android:layout_gravity="center_vertical|right" />
|
||||
<TextView
|
||||
android:id="@+id/battery_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="start|bottom"
|
||||
android:paddingLeft="7sp"
|
||||
android:paddingRight="7sp"
|
||||
android:textColor="@color/secondarytext"
|
||||
android:textStyle="bold"
|
||||
tools:text="100% CHG" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="start|bottom"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="fill_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/battery_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start|bottom"
|
||||
android:textColor="@color/secondarytext"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="end"
|
||||
android:paddingRight="7sp"
|
||||
android:paddingLeft="7sp" />
|
||||
<ProgressBar
|
||||
android:id="@+id/device_busy_indicator"
|
||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="4dp"
|
||||
android:indeterminate="true"
|
||||
android:visibility="visible"
|
||||
tools:visibility="visible" />
|
||||
</GridLayout>
|
||||
|
||||
|
||||
<ListView
|
||||
android:id="@+id/device_item_infos"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_columnSpan="2"
|
||||
android:layout_gravity="fill"
|
||||
android:layout_marginStart="@dimen/widget_margin"
|
||||
android:gravity="fill_horizontal"
|
||||
android:layout_columnSpan="2"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="fill"
|
||||
android:paddingLeft="36dp" />
|
||||
android:paddingLeft="36dp"
|
||||
android:visibility="gone" />
|
||||
</GridLayout>
|
||||
|
@ -2,8 +2,6 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.ControlCenter">
|
||||
<item android:id="@+id/action_discover" android:title="@string/action_discover"
|
||||
android:orderInCategory="100" app:showAsAction="never" />
|
||||
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
||||
android:orderInCategory="100" app:showAsAction="never" />
|
||||
<item android:id="@+id/action_debug" android:title="@string/action_debug"
|
||||
|
@ -1,10 +1,13 @@
|
||||
<resources>
|
||||
|
||||
<style name="GadgetbridgeTheme" parent="@android:style/Theme.Material.Light.DarkActionBar">
|
||||
<style name="GadgetbridgeTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<item name="android:colorPrimary">@color/primary_light</item>
|
||||
<item name="android:colorPrimaryDark">@color/primarydark_light</item>
|
||||
<item name="android:colorAccent">@color/accent</item>
|
||||
<item name="android:textColor">@color/primary_text_default_material_light</item>
|
||||
<item name="colorPrimary">@color/primary_light</item>
|
||||
<item name="colorPrimaryDark">@color/primarydark_light</item>
|
||||
<item name="colorAccent">@color/accent</item>
|
||||
|
||||
<!-- unfortunately it doesn't work this way :( -->
|
||||
<!--
|
||||
|
@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="primary_light" type="color">#ffff5000</color>
|
||||
<color name="primary_light" type="color">#ff5000</color>
|
||||
<color name="primarydark_light" type="color">#f0f03000</color>
|
||||
|
||||
<color name="primary_dark" type="color">#fff03000</color>
|
||||
<color name="primary_dark" type="color">#f03000</color>
|
||||
<color name="primarydark_dark" type="color">#f0f03000</color>
|
||||
|
||||
<color name="accent" type="color">#ff0091ea</color>
|
||||
<color name="accent" type="color">#0091ea</color>
|
||||
<color name="primarytext" type="color">#ff000000</color>
|
||||
<color name="secondarytext" type="color">#ff808080</color>
|
||||
<color name="divider" type="color">#1f000000</color>
|
||||
|
@ -83,8 +83,8 @@
|
||||
<string name="this_is_a_test_notification_from_gadgetbridge">This is a Test Notification from Gadgetbridge</string>
|
||||
<string name="bluetooth_is_not_supported_">Bluetooth is not supported.</string>
|
||||
<string name="bluetooth_is_disabled_">Bluetooth is disabled.</string>
|
||||
<string name="tap_connected_device_for_app_mananger">tap connected device for App Mananger</string>
|
||||
<string name="tap_a_device_to_connect">tap a device to connect</string>
|
||||
<string name="tap_connected_device_for_app_mananger">Tap connected device for App Manager</string>
|
||||
<string name="tap_a_device_to_connect">Tap a device to connect</string>
|
||||
<string name="cannot_connect_bt_address_invalid_">Cannot connect. BT address invalid?</string>
|
||||
<string name="gadgetbridge_running">Gadgetbridge running</string>
|
||||
<string name="installing_binary_d_d">installing binary %1$d/%2$d</string>
|
||||
|
@ -1,9 +1,12 @@
|
||||
<resources>
|
||||
|
||||
<style name="GadgetbridgeTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
|
||||
<style name="GadgetbridgeTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<item name="android:actionBarStyle">@style/GadgetbridgeActionBar</item>
|
||||
<item name="android:actionBarWidgetTheme">@style/GadgetbridgeActionBarWidget</item>
|
||||
<item name="android:textColor">@color/primarytext</item>
|
||||
<item name="colorPrimary">@color/primary_light</item>
|
||||
<item name="colorPrimaryDark">@color/primarydark_light</item>
|
||||
<item name="colorAccent">@color/accent</item>
|
||||
</style>
|
||||
|
||||
<style name="GadgetbridgeActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
|
||||
|