diff --git a/assets/html/passive_data_kit/generator_app_events_disclosure.html b/assets/html/passive_data_kit/generator_app_events_disclosure.html new file mode 100755 index 0000000..a6a5067 --- /dev/null +++ b/assets/html/passive_data_kit/generator_app_events_disclosure.html @@ -0,0 +1,26 @@ + + + + + + + +

+ TODO: Write disclosure for use of app event data... +

+ +

+ Place completed file in assets/html/passive_data_kit/generator_app_event_disclosure.html in your project to override this placeholder. +

+ + \ No newline at end of file diff --git a/res/layout/pdk_placeholder_disclosure_view.xml b/res/layout/pdk_placeholder_disclosure_view.xml new file mode 100755 index 0000000..79ff490 --- /dev/null +++ b/res/layout/pdk_placeholder_disclosure_view.xml @@ -0,0 +1,8 @@ + + + \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 0c44cc9..082c7b1 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -31,5 +31,7 @@ Tap here to learn how this app uses your data. Waiting for chart data… + + A disclosure view is not implemented for this generator.\n\nContact the app developer for assistance… diff --git a/src/com/audacious_software/passive_data_kit/activities/DataDisclosureDetailActivity.java b/src/com/audacious_software/passive_data_kit/activities/DataDisclosureDetailActivity.java index 5c5e3da..938d597 100755 --- a/src/com/audacious_software/passive_data_kit/activities/DataDisclosureDetailActivity.java +++ b/src/com/audacious_software/passive_data_kit/activities/DataDisclosureDetailActivity.java @@ -3,7 +3,6 @@ import android.content.Context; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; -import android.util.Log; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; @@ -84,8 +83,6 @@ public View getView (int position, View convertView, ViewGroup parent) { actionsList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView adapterView, View view, int position, long l) { - Log.e("PDK", "TAPPED: " + position); - Action action = actions.get(position); FrameLayout dataView = (FrameLayout) me.findViewById(R.id.data_view); diff --git a/src/com/audacious_software/passive_data_kit/activities/DataStreamActivity.java b/src/com/audacious_software/passive_data_kit/activities/DataStreamActivity.java index a0f4808..e599390 100755 --- a/src/com/audacious_software/passive_data_kit/activities/DataStreamActivity.java +++ b/src/com/audacious_software/passive_data_kit/activities/DataStreamActivity.java @@ -1,6 +1,5 @@ package com.audacious_software.passive_data_kit.activities; -import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Handler; @@ -9,7 +8,6 @@ import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; -import android.util.Log; import android.view.Menu; import android.view.MenuItem; @@ -17,8 +15,6 @@ import com.audacious_software.passive_data_kit.generators.Generators; import com.audacious_software.pdk.passivedatakit.R; -import java.util.ArrayList; - public class DataStreamActivity extends AppCompatActivity implements Generators.GeneratorUpdatedListener { private DataPointsAdapter mAdapter = null; private Menu mMenu = null; @@ -82,7 +78,13 @@ public void onGeneratorUpdated(String identifier, long timestamp, Bundle data) { @Override public void run() { me.mAdapter.sortGenerators(); - me.mAdapter.notifyDataSetChanged(); + + try { + me.mAdapter.notifyDataSetChanged(); + } catch (IllegalStateException e) { + // Do nothing - recycler is already updating... + } + int count = me.mAdapter.getItemCount(); me.getSupportActionBar().setSubtitle(me.getResources().getQuantityString(R.plurals.activity_data_stream_subtitle, count, count)); diff --git a/src/com/audacious_software/passive_data_kit/activities/OAuthResponseActivity.java b/src/com/audacious_software/passive_data_kit/activities/OAuthResponseActivity.java index 3edcfa3..7f22691 100755 --- a/src/com/audacious_software/passive_data_kit/activities/OAuthResponseActivity.java +++ b/src/com/audacious_software/passive_data_kit/activities/OAuthResponseActivity.java @@ -3,14 +3,8 @@ import android.net.Uri; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; -import android.util.Log; import com.audacious_software.passive_data_kit.generators.wearables.WithingsDevice; -import com.audacious_software.pdk.passivedatakit.R; - -/** - * Created by cjkarr on 3/18/2017. - */ public class OAuthResponseActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { @@ -22,9 +16,6 @@ protected void onResume() { Uri u = this.getIntent().getData(); - Log.e("PDK", "CALLBACK FROM OAUTH: " + u); - Log.e("PDK", "PATH: " + u.getPath()); - if (u.getPath().startsWith(WithingsDevice.API_OAUTH_CALLBACK_PATH)) { WithingsDevice.getInstance(this).finishAuthentication(u); } diff --git a/src/com/audacious_software/passive_data_kit/activities/generators/DataPointsAdapter.java b/src/com/audacious_software/passive_data_kit/activities/generators/DataPointsAdapter.java index 0ab1f8a..157b2e3 100755 --- a/src/com/audacious_software/passive_data_kit/activities/generators/DataPointsAdapter.java +++ b/src/com/audacious_software/passive_data_kit/activities/generators/DataPointsAdapter.java @@ -4,13 +4,13 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.support.v7.widget.RecyclerView; -import android.util.Log; import android.view.View; import android.view.ViewGroup; import com.audacious_software.passive_data_kit.Logger; import com.audacious_software.passive_data_kit.generators.Generator; import com.audacious_software.passive_data_kit.generators.Generators; +import com.audacious_software.passive_data_kit.generators.diagnostics.AppEvent; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -75,6 +75,8 @@ public void onBindViewHolder(final DataPointViewHolder holder, int position) { Method bindViewHolder = generatorClass.getDeclaredMethod("bindViewHolder", DataPointViewHolder.class); bindViewHolder.invoke(null, holder); } catch (Exception e) { + AppEvent.getInstance(this.mContext).logThrowable(e); + try { generatorClass = Generator.class; diff --git a/src/com/audacious_software/passive_data_kit/activities/generators/GeneratorsAdapter.java b/src/com/audacious_software/passive_data_kit/activities/generators/GeneratorsAdapter.java index adf3618..acd53d7 100755 --- a/src/com/audacious_software/passive_data_kit/activities/generators/GeneratorsAdapter.java +++ b/src/com/audacious_software/passive_data_kit/activities/generators/GeneratorsAdapter.java @@ -3,12 +3,12 @@ import android.content.Context; import android.content.Intent; import android.support.v7.widget.RecyclerView; -import android.util.Log; +import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; -import android.widget.Toast; +import android.widget.TextView; import com.audacious_software.passive_data_kit.Logger; import com.audacious_software.passive_data_kit.activities.DataDisclosureDetailActivity; @@ -21,6 +21,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; +import java.util.regex.Pattern; public class GeneratorsAdapter extends RecyclerView.Adapter { private Context mContext = null; @@ -43,26 +44,14 @@ public void onBindViewHolder(final GeneratorViewHolder holder, int position) { Class generatorClass = activeGenerators.get(position); - Log.e("PDK", "GENERATOR CLASS: " + generatorClass); - try { Method bindViewHolder = generatorClass.getDeclaredMethod("bindDisclosureViewHolder", GeneratorViewHolder.class); bindViewHolder.invoke(null, holder); } catch (Exception e) { -// e.printStackTrace(); - try { - generatorClass = Generator.class; - - Method bindViewHolder = generatorClass.getDeclaredMethod("bindDisclosureViewHolder", GeneratorViewHolder.class); - - bindViewHolder.invoke(null, holder); - } catch (NoSuchMethodException e1) { - Logger.getInstance(holder.itemView.getContext()).logThrowable(e1); - } catch (InvocationTargetException e1) { - Logger.getInstance(holder.itemView.getContext()).logThrowable(e1); - } catch (IllegalAccessException e1) { - Logger.getInstance(holder.itemView.getContext()).logThrowable(e1); - } + TextView generatorLabel = (TextView) holder.itemView.findViewById(R.id.label_generator); + + String[] tokens = generatorClass.getName().split(Pattern.quote(".")); + generatorLabel.setText(tokens[tokens.length - 1] + "*"); } final Class finalClass = generatorClass; @@ -72,11 +61,12 @@ public void onBindViewHolder(final GeneratorViewHolder holder, int position) { public void onClick(View view) { me.mDataView.removeAllViews(); + View dataView = LayoutInflater.from(holder.itemView.getContext()).inflate(R.layout.pdk_placeholder_disclosure_view, null); + try { Method bindViewHolder = finalClass.getDeclaredMethod("getDisclosureDataView", GeneratorViewHolder.class); - View dataView = (View) bindViewHolder.invoke(null, holder); - me.mDataView.addView(dataView); + dataView = (View) bindViewHolder.invoke(null, holder); } catch (NoSuchMethodException e1) { Logger.getInstance(holder.itemView.getContext()).logThrowable(e1); } catch (InvocationTargetException e1) { @@ -84,11 +74,27 @@ public void onClick(View view) { } catch (IllegalAccessException e1) { Logger.getInstance(holder.itemView.getContext()).logThrowable(e1); } + + me.mDataView.addView(dataView); } }); ImageView settingsButton = (ImageView) holder.itemView.findViewById(R.id.button_disclosure_item); + settingsButton.setVisibility(View.GONE); + + try { + Method getDisclosureActions = finalClass.getDeclaredMethod("getDisclosureActions", Context.class); + + final List actions = (List) getDisclosureActions.invoke(null, holder.itemView.getContext()); + + if (actions.size() > 0) { + settingsButton.setVisibility(View.VISIBLE); + } + } catch (Exception e) { + // Do nothing - leave invisible... + } + settingsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -98,7 +104,6 @@ public void onClick(View view) { holder.itemView.getContext().startActivity(intent); } }); - } @Override diff --git a/src/com/audacious_software/passive_data_kit/generators/device/Battery.java b/src/com/audacious_software/passive_data_kit/generators/device/Battery.java index 62a853f..f874144 100755 --- a/src/com/audacious_software/passive_data_kit/generators/device/Battery.java +++ b/src/com/audacious_software/passive_data_kit/generators/device/Battery.java @@ -18,6 +18,7 @@ import com.audacious_software.passive_data_kit.PassiveDataKit; import com.audacious_software.passive_data_kit.activities.generators.DataPointViewHolder; +import com.audacious_software.passive_data_kit.activities.generators.GeneratorViewHolder; import com.audacious_software.passive_data_kit.diagnostics.DiagnosticAction; import com.audacious_software.passive_data_kit.generators.Generator; import com.audacious_software.passive_data_kit.generators.Generators; @@ -37,10 +38,6 @@ import java.util.Date; import java.util.List; -/** - * Created by cjkarr on 4/17/2017. - */ - public class Battery extends Generator { private static final String GENERATOR_IDENTIFIER = "pdk-device-battery"; @@ -280,6 +277,16 @@ public static ArrayList diagnostics(Context context) { return new ArrayList<>(); } + public static String getGeneratorTitle(Context context) { + return context.getString(R.string.generator_device_battery); + } + + public static void bindDisclosureViewHolder(final GeneratorViewHolder holder) { + TextView generatorLabel = (TextView) holder.itemView.findViewById(R.id.label_generator); + + generatorLabel.setText(Battery.getGeneratorTitle(holder.itemView.getContext())); + } + public static void bindViewHolder(DataPointViewHolder holder) { final Context context = holder.itemView.getContext(); diff --git a/src/com/audacious_software/passive_data_kit/generators/device/ForegroundApplication.java b/src/com/audacious_software/passive_data_kit/generators/device/ForegroundApplication.java index 8cefa60..9815305 100755 --- a/src/com/audacious_software/passive_data_kit/generators/device/ForegroundApplication.java +++ b/src/com/audacious_software/passive_data_kit/generators/device/ForegroundApplication.java @@ -12,7 +12,6 @@ import android.os.Build; import android.os.Bundle; import android.provider.Settings; -import android.util.Log; import android.view.Display; import android.view.LayoutInflater; import android.view.View; @@ -24,6 +23,7 @@ import com.audacious_software.passive_data_kit.PassiveDataKit; import com.audacious_software.passive_data_kit.activities.generators.DataPointViewHolder; +import com.audacious_software.passive_data_kit.activities.generators.GeneratorViewHolder; import com.audacious_software.passive_data_kit.diagnostics.DiagnosticAction; import com.audacious_software.passive_data_kit.generators.Generator; import com.audacious_software.passive_data_kit.generators.Generators; @@ -38,10 +38,6 @@ import java.util.HashMap; import java.util.List; -/** - * Created by cjkarr on 5/10/2017. - */ - public class ForegroundApplication extends Generator{ private static final String GENERATOR_IDENTIFIER = "pdk-foreground-application"; @@ -190,6 +186,16 @@ public void run() { return actions; } + public static String getGeneratorTitle(Context context) { + return context.getString(R.string.generator_foreground_application); + } + + public static void bindDisclosureViewHolder(final GeneratorViewHolder holder) { + TextView generatorLabel = (TextView) holder.itemView.findViewById(R.id.label_generator); + + generatorLabel.setText(ForegroundApplication.getGeneratorTitle(holder.itemView.getContext())); + } + public static void bindViewHolder(DataPointViewHolder holder) { final Context context = holder.itemView.getContext(); @@ -345,27 +351,37 @@ public int compare(HashMap mapOne, HashMap mapTw } for (int i = 0; i < whenAppRowIds.length && i < latest.size(); i++) { - String appPackage = latest.get(i); int appRowId = whenAppRowIds[i]; - View row = cardContent.findViewById(appRowId); - row.setVisibility(View.VISIBLE); - - TextView appName = (TextView) row.findViewById(R.id.app_name); - ImageView appIcon = (ImageView) row.findViewById(R.id.application_icon); + String appPackage = latest.get(i); - try { - String name = packageManager.getApplicationLabel(packageManager.getApplicationInfo(appPackage, PackageManager.GET_META_DATA)).toString(); + while (appPackage == null && i < latest.size() - 1) { + i += 1; - appName.setText(name); - Drawable icon = packageManager.getApplicationIcon(appPackage); - appIcon.setImageDrawable(icon); - } catch (PackageManager.NameNotFoundException e) { - AppEvent.getInstance(context).logThrowable(e); + appPackage = latest.get(i); } - TextView appWhen = (TextView) row.findViewById(R.id.app_last_used); - appWhen.setText(Generator.formatTimestamp(context, appWhens.get(appPackage) / 1000)); + if (appPackage != null) { + View row = cardContent.findViewById(appRowId); + row.setVisibility(View.VISIBLE); + + TextView appName = (TextView) row.findViewById(R.id.app_name); + ImageView appIcon = (ImageView) row.findViewById(R.id.application_icon); + + try { + String name = packageManager.getApplicationLabel(packageManager.getApplicationInfo(appPackage, PackageManager.GET_META_DATA)).toString(); + + appName.setText(name); + Drawable icon = packageManager.getApplicationIcon(appPackage); + appIcon.setImageDrawable(icon); + } catch (PackageManager.NameNotFoundException e) { + appName.setText("" + appPackage); + appIcon.setImageDrawable(null); + } + + TextView appWhen = (TextView) row.findViewById(R.id.app_last_used); + appWhen.setText(Generator.formatTimestamp(context, appWhens.get(appPackage) / 1000)); + } } cardContent.setVisibility(View.VISIBLE); diff --git a/src/com/audacious_software/passive_data_kit/generators/device/Location.java b/src/com/audacious_software/passive_data_kit/generators/device/Location.java index 2a9d81a..591778c 100755 --- a/src/com/audacious_software/passive_data_kit/generators/device/Location.java +++ b/src/com/audacious_software/passive_data_kit/generators/device/Location.java @@ -539,7 +539,11 @@ public void onMapReady(GoogleMap googleMap) { } if (locations.size() > 0) { - googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), (int) (16 * metrics.density))); + try { + googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), (int) (16 * metrics.density))); + } catch (IllegalStateException e) { + // View not ready to update yet... + } } DisplayMetrics metrics = context.getResources().getDisplayMetrics(); diff --git a/src/com/audacious_software/passive_data_kit/generators/device/ScreenState.java b/src/com/audacious_software/passive_data_kit/generators/device/ScreenState.java index d8a7432..f1d1aab 100755 --- a/src/com/audacious_software/passive_data_kit/generators/device/ScreenState.java +++ b/src/com/audacious_software/passive_data_kit/generators/device/ScreenState.java @@ -20,6 +20,7 @@ import com.audacious_software.passive_data_kit.PassiveDataKit; import com.audacious_software.passive_data_kit.activities.generators.DataPointViewHolder; +import com.audacious_software.passive_data_kit.activities.generators.GeneratorViewHolder; import com.audacious_software.passive_data_kit.diagnostics.DiagnosticAction; import com.audacious_software.passive_data_kit.generators.Generator; import com.audacious_software.passive_data_kit.generators.Generators; @@ -171,6 +172,16 @@ public static ArrayList diagnostics(Context context) { return new ArrayList<>(); } + public static String getGeneratorTitle(Context context) { + return context.getString(R.string.generator_screen_state); + } + + public static void bindDisclosureViewHolder(final GeneratorViewHolder holder) { + TextView generatorLabel = (TextView) holder.itemView.findViewById(R.id.label_generator); + + generatorLabel.setText(ForegroundApplication.getGeneratorTitle(holder.itemView.getContext())); + } + public static void bindViewHolder(DataPointViewHolder holder) { final Context context = holder.itemView.getContext(); diff --git a/src/com/audacious_software/passive_data_kit/generators/diagnostics/AppEvent.java b/src/com/audacious_software/passive_data_kit/generators/diagnostics/AppEvent.java index 5f2c478..0a2d04c 100755 --- a/src/com/audacious_software/passive_data_kit/generators/diagnostics/AppEvent.java +++ b/src/com/audacious_software/passive_data_kit/generators/diagnostics/AppEvent.java @@ -353,6 +353,8 @@ public boolean logEvent(String eventName, Map eventDet } else if (value instanceof Boolean) { detailsBundle.putBoolean(key, ((Boolean) value).booleanValue()); detailsJson.put(key, ((Boolean) value).booleanValue()); + } else if (value == null) { + throw new NullPointerException("Value is null."); } else { detailsBundle.putString(key, "Unknown Class: " + value.getClass().getCanonicalName()); detailsJson.put(key, "Unknown Class: " + value.getClass().getCanonicalName()); @@ -389,7 +391,12 @@ public void logThrowable(Throwable t) { HashMap details = new HashMap<>(); details.put(AppEvent.DETAILS_THROWABLE_STACKTRACE, out.toString()); - details.put(AppEvent.DETAILS_THROWABLE_MESSAGE, t.getMessage()); + + if (t.getMessage() != null) { + details.put(AppEvent.DETAILS_THROWABLE_MESSAGE, t.getMessage()); + } else { + details.put(AppEvent.DETAILS_THROWABLE_MESSAGE, "(No message provided.)"); + } this.logEvent(AppEvent.EVENT_LOG_THROWABLE, details); } diff --git a/src/com/audacious_software/passive_data_kit/generators/diagnostics/SystemStatus.java b/src/com/audacious_software/passive_data_kit/generators/diagnostics/SystemStatus.java index d1a6298..394ffc9 100755 --- a/src/com/audacious_software/passive_data_kit/generators/diagnostics/SystemStatus.java +++ b/src/com/audacious_software/passive_data_kit/generators/diagnostics/SystemStatus.java @@ -21,6 +21,7 @@ import com.audacious_software.passive_data_kit.PassiveDataKit; import com.audacious_software.passive_data_kit.activities.generators.DataPointViewHolder; +import com.audacious_software.passive_data_kit.activities.generators.GeneratorViewHolder; import com.audacious_software.passive_data_kit.diagnostics.DiagnosticAction; import com.audacious_software.passive_data_kit.generators.Generator; import com.audacious_software.passive_data_kit.generators.Generators; @@ -41,10 +42,6 @@ import java.util.LinkedList; import java.util.List; -/** - * Created by cjkarr on 4/17/2017. - */ - public class SystemStatus extends Generator { private static final String GENERATOR_IDENTIFIER = "pdk-system-status"; @@ -198,6 +195,16 @@ public static ArrayList diagnostics(Context context) { return new ArrayList<>(); } + public static String getGeneratorTitle(Context context) { + return context.getString(R.string.generator_diagnostics_system_status); + } + + public static void bindDisclosureViewHolder(final GeneratorViewHolder holder) { + TextView generatorLabel = (TextView) holder.itemView.findViewById(R.id.label_generator); + + generatorLabel.setText(SystemStatus.getGeneratorTitle(holder.itemView.getContext())); + } + public static void bindViewHolder(DataPointViewHolder holder) { final Context context = holder.itemView.getContext(); diff --git a/src/com/audacious_software/passive_data_kit/generators/sensors/Accelerometer.java b/src/com/audacious_software/passive_data_kit/generators/sensors/Accelerometer.java index 1930409..24ef1ee 100755 --- a/src/com/audacious_software/passive_data_kit/generators/sensors/Accelerometer.java +++ b/src/com/audacious_software/passive_data_kit/generators/sensors/Accelerometer.java @@ -26,6 +26,7 @@ import com.audacious_software.passive_data_kit.PassiveDataKit; import com.audacious_software.passive_data_kit.activities.generators.DataPointViewHolder; +import com.audacious_software.passive_data_kit.activities.generators.GeneratorViewHolder; import com.audacious_software.passive_data_kit.diagnostics.DiagnosticAction; import com.audacious_software.passive_data_kit.generators.Generator; import com.audacious_software.passive_data_kit.generators.Generators; @@ -335,6 +336,16 @@ public void run() { return actions; } + public static String getGeneratorTitle(Context context) { + return context.getString(R.string.generator_sensors_accelerometer); + } + + public static void bindDisclosureViewHolder(final GeneratorViewHolder holder) { + TextView generatorLabel = (TextView) holder.itemView.findViewById(R.id.label_generator); + + generatorLabel.setText(Accelerometer.getGeneratorTitle(holder.itemView.getContext())); + } + public static void bindViewHolder(final DataPointViewHolder holder) { if (Accelerometer.sIsDrawing) { return; diff --git a/src/com/audacious_software/passive_data_kit/generators/sensors/AmbientLight.java b/src/com/audacious_software/passive_data_kit/generators/sensors/AmbientLight.java index c603b9d..6b7cfe2 100755 --- a/src/com/audacious_software/passive_data_kit/generators/sensors/AmbientLight.java +++ b/src/com/audacious_software/passive_data_kit/generators/sensors/AmbientLight.java @@ -26,6 +26,7 @@ import com.audacious_software.passive_data_kit.PassiveDataKit; import com.audacious_software.passive_data_kit.activities.generators.DataPointViewHolder; +import com.audacious_software.passive_data_kit.activities.generators.GeneratorViewHolder; import com.audacious_software.passive_data_kit.diagnostics.DiagnosticAction; import com.audacious_software.passive_data_kit.generators.Generator; import com.audacious_software.passive_data_kit.generators.Generators; @@ -249,6 +250,16 @@ public void run() { return actions; } + public static String getGeneratorTitle(Context context) { + return context.getString(R.string.generator_sensors_ambient_light); + } + + public static void bindDisclosureViewHolder(final GeneratorViewHolder holder) { + TextView generatorLabel = (TextView) holder.itemView.findViewById(R.id.label_generator); + + generatorLabel.setText(AmbientLight.getGeneratorTitle(holder.itemView.getContext())); + } + public static void bindViewHolder(final DataPointViewHolder holder) { if (AmbientLight.sIsDrawing) { return; diff --git a/src/com/audacious_software/passive_data_kit/generators/wearables/WithingsDevice.java b/src/com/audacious_software/passive_data_kit/generators/wearables/WithingsDevice.java index febed05..969e70f 100755 --- a/src/com/audacious_software/passive_data_kit/generators/wearables/WithingsDevice.java +++ b/src/com/audacious_software/passive_data_kit/generators/wearables/WithingsDevice.java @@ -25,6 +25,7 @@ import com.audacious_software.passive_data_kit.PassiveDataKit; import com.audacious_software.passive_data_kit.activities.generators.DataPointViewHolder; +import com.audacious_software.passive_data_kit.activities.generators.GeneratorViewHolder; import com.audacious_software.passive_data_kit.diagnostics.DiagnosticAction; import com.audacious_software.passive_data_kit.generators.Generator; import com.audacious_software.passive_data_kit.generators.Generators; @@ -1246,6 +1247,16 @@ public void run() { t.start(); } + public static String getGeneratorTitle(Context context) { + return context.getString(R.string.generator_withings_device); + } + + public static void bindDisclosureViewHolder(final GeneratorViewHolder holder) { + TextView generatorLabel = (TextView) holder.itemView.findViewById(R.id.label_generator); + + generatorLabel.setText(WithingsDevice.getGeneratorTitle(holder.itemView.getContext())); + } + public static void bindViewHolder(final DataPointViewHolder holder) { final WithingsDevice withings = WithingsDevice.getInstance(holder.itemView.getContext());