Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
speng31b
May 8, 2010

e

speng31b fucked around with this message at 18:11 on Nov 1, 2022

Adbot
ADBOT LOVES YOU

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

That does look rad as hell. I don't know if they'd consider the wireframes 'Material' enough, but if they do you could end up in one of their keynote videos at this rate

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

speng31b posted:

Just released an update to the latest app I've been working on, a prototyping/design tool. Previously we just had simple wireframe support (think super-simple vector art). Now we've added interactive screen links sort of like POP, but without having to take pictures and whatnot. Anyhow I made up a dynamic transition system for the screen links that makes for a pretty neat video:

https://www.youtube.com/watch?v=R6JpEXdHtnc

That's... Impressive.

Tunga
May 7, 2004

Grimey Drawer

speng31b posted:

Just released an update to the latest app I've been working on, a prototyping/design tool. Previously we just had simple wireframe support (think super-simple vector art). Now we've added interactive screen links sort of like POP, but without having to take pictures and whatnot. Anyhow I made up a dynamic transition system for the screen links that makes for a pretty neat video:

https://www.youtube.com/watch?v=R6JpEXdHtnc
This is great, nice work. Can we get a link to the app :) ?

speng31b
May 8, 2010

Whoops sorry. It's here

And yeah I was kind of hoping it would get some kind of editor's featured thing, but I'm worried it doesn't have enough drop shadows and giant circular buttons. In the next update I'm going to try to add more drop shadows and giant circular buttons that perform mysterious functions indicated by ambiguous iconography to make sure I'm in line with the latest style guidelines.

Here you can see I have used my app to create the vision of more giant circular buttons:



e: my next idea for an app - generate giant drop-shadowed circular buttons which you can then share with others. These buttons perform unknown actions, some beneficial and some horrible. You get to send someone the button and then get sent back a camera or mic recording of their reaction when they press the giant circular button and are greeted with cheer or disaster. It will get all the good PR because it's so Material.

speng31b fucked around with this message at 18:13 on Nov 1, 2022

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

I think the big button should bump the little buttons and send a ripple out when creating new ones, like a Newton's cradle. That way you get a visual sense of the result propagating from the source, which is Material as gently caress. Maybe if they reach the edge of the screen any new ones can be sent to a local Chromecast or a Wear device. Don't steal my ideas

Anyone know if there's a way to get Android Studio to reference some other source code when stepping through the debugger? I'm trying to fix some nonsense with a SurfaceView but I can't tell what's going on in there, since the SDK source for the class is just a stub, and referring to a webpage is pretty tedious. Grepcode is pretty neat though :shobon:

speng31b
May 8, 2010

As long as the source is nonobfuscated and non-ndk it shouldn't be a stub. If it's either of those you're hosed sorry. The latest version of Android studio will even decompile obfuscated jars and put them back together as best it can on ctrl+click which is pretty cool. And yeah grepcode is cool. If you cant ctrl+click to it and it's not in grepcode then you've probably hit the end of the line!

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
In the SDK controls, you should be able to download the source for your target, as well as the images etc.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Nah I mean the source for SurfaceView in the SDK sources is literally this

Java code:
package android.view;

import com.android.layoutlib.bridge.MockView;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;

/**
 * Mock version of the SurfaceView.
 * Only non override public methods from the real SurfaceView have been added in there.
 * Methods that take an unknown class as parameter or as return object, have been removed for now.
 *
 * TODO: generate automatically.
 *
 */
public class SurfaceView extends MockView {

    public SurfaceView(Context context) {
        this(context, null);
    }

    public SurfaceView(Context context, AttributeSet attrs) {
        this(context, attrs , 0);
    }

    public SurfaceView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public SurfaceView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    public SurfaceHolder getHolder() {
        return mSurfaceHolder;
    }

    private SurfaceHolder mSurfaceHolder = new SurfaceHolder() {

        @Override
        public boolean isCreating() {
            return false;
        }

        @Override
        public void addCallback(Callback callback) {
        }

        @Override
        public void removeCallback(Callback callback) {
        }

        @Override
        public void setFixedSize(int width, int height) {
        }

...etc
So the implementation is in AOSP but not the SDK? Or something? And there's no way to force the debugger to refer to an external source? It knows what line number it's on and everything, I don't need all the fancy live variable state annotations, just live stepping through a source file.

baka kaba fucked around with this message at 16:50 on Jul 3, 2015

speng31b
May 8, 2010

baka kaba posted:

Nah I mean the source for SurfaceView in the SDK sources is literally this

Java code:
package android.view;

import com.android.layoutlib.bridge.MockView;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;

/**
 * Mock version of the SurfaceView.
 * Only non override public methods from the real SurfaceView have been added in there.
 * Methods that take an unknown class as parameter or as return object, have been removed for now.
 *
 * TODO: generate automatically.
 *
 */
public class SurfaceView extends MockView {

    public SurfaceView(Context context) {
        this(context, null);
    }

    public SurfaceView(Context context, AttributeSet attrs) {
        this(context, attrs , 0);
    }

    public SurfaceView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public SurfaceView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    public SurfaceHolder getHolder() {
        return mSurfaceHolder;
    }

    private SurfaceHolder mSurfaceHolder = new SurfaceHolder() {

        @Override
        public boolean isCreating() {
            return false;
        }

        @Override
        public void addCallback(Callback callback) {
        }

        @Override
        public void removeCallback(Callback callback) {
        }

        @Override
        public void setFixedSize(int width, int height) {
        }

...etc
So the implementation is in AOSP but not the SDK? Or something?

It's a little weird. For classes that use android internals they'll provide stubs so they don't have apps built against an SDK that has access to system internal libs. If you look at AOSP you should notice that the actual SurfaceView source imports the following:

import com.android.internal.view.BaseIWindow;

Anything in AOSP that needs to import from internal will have a similar stub impl in the SDKs your apps build against. That's why I always have grepcode available or AOSP pullable.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Oh ok, thanks! That's annoying. So being able to point to an external source file would be even more useful then, if this isn't exactly a one-off situation

speng31b
May 8, 2010

baka kaba posted:

Oh ok, thanks! That's annoying. So being able to point to an external source file would be even more useful then, if this isn't exactly a one-off situation

It's pretty uncommon. Most things you'd want to jump to source on have complete source in the app facing SDK.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
Yeah, you're looking at the decompiled SDK target "source" (i.e. the stubs), when you should be looking at the sources you can download separately with your target. Your IDE should be able to target a different set of source files, but Android Studio should handle doing that already.

Volmarias fucked around with this message at 19:00 on Jul 3, 2015

TIP
Mar 21, 2006

Your move, creep.



I just released my first Android app, a minesweeper clone called Swine Peeper where you try to find your pigs in a field without waking them up.

I made it to teach myself programming and I'm hoping to score a sweet job with it.

Here it is on CodePen, please tell me if you see anything especially stupid in my code:
http://codepen.io/tipvfl/pen/WvMjdb?editors=001

Here is the trial Android version:
https://play.google.com/store/apps/details?id=com.ionicframework.swinepeeperfree751101

And the full Android version:
https://play.google.com/store/apps/details?id=com.ionicframework.myapp630896

This was a ridiculous amount of work and despite it being just a clone of a game I'm pretty proud of it for being my first real project.

Doghouse
Oct 22, 2004

I was playing Harvest Moon 64 with this kid who lived on my street and my cows were not doing well and I got so raged up and frustrated that my eyes welled up with tears and my friend was like are you crying dude. Are you crying because of the cows. I didn't understand the feeding mechanic.
So my three person group is putting together a basic Android app for a school project, and I have a layout question.

My layout basically has a number of EditTexts for users to input text. Then underneath, there is room for a list of spinners. They user can click a button and add another spinner (they can choose a custom list of exercises, one from each spinner). Underneath that, there are a few buttons. So I made the spinner a LinearLayout, but you can't scroll through the list if it gets long. So I tried wrapping the LinearLayout with a scroll view, but that doesn't seem to be working right. I guess I want the list to expand and let the user scroll through it and have the buttons be pushed down. How should I be doing that?

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Volmarias posted:

Yeah, you're looking at the decompiled SDK target "source" (i.e. the stubs), when you should be looking at the sources you can download separately with your target. Your IDE should be able to target a different set of source files, but Android Studio should handle doing that already.

Just in case I'm missing something, this is what I have



Most of the library is the full source code, this is the first class I've run into where it's explicitly a mock class with everything stubbed out (I've had a few that did decompile though). What speng said makes sense, but if there is a way to get the real SurfaceView source displaying in the IDE so the debugger can show where it's up to, that would help a ton

Tip posted:

I just released my first Android app, a minesweeper clone called Swine Peeper where you try to find your pigs in a field without waking them up.

I made it to teach myself programming and I'm hoping to score a sweet job with it.

Here it is on CodePen, please tell me if you see anything especially stupid in my code:
http://codepen.io/tipvfl/pen/WvMjdb?editors=001

Nice job! It's got a good feel to it, I like how the state saves too. Couple of bugs I noticed:
  • On Chrome anyway, the mouse pointer turns into a text caret over certain squares (the ones that have a number under them) which is a big clue!
  • This one was hard for me to reproduce... but sometimes if you long-click and then drag to another square, all the pigs appear. Going diagonally seemed to make it more likely, but I might be imagining that
  • Not a big deal, but some of the columns have a noticeably bigger gap between them, so the field looks a little uneven
I know it's the android thread and I looked at the javascript version :v:

baka kaba fucked around with this message at 02:52 on Jul 7, 2015

hooah
Feb 6, 2006
WTF?
I don't think I quite understand how TextViews work. I'm able to read data from the accelerometer and send it to the log, but I can't get it to display. I have an activity that's called when the user presses the "start" button on the main activity; here's its layout:

XML code:
<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"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context="com.example.spart_000.accel_demo.DisplayData">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minLines="1"
        android:id="@+id/xCoord" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minLines="1"
        android:id="@+id/yCoord"
        android:layout_below="@+id/xCoord"
        android:layout_alignParentStart="true" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minLines="1"
        android:id="@+id/zCoord"
        android:layout_below="@+id/yCoord"
        android:layout_alignParentStart="true" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/button_stop"
        android:onClick="stopCollect"
        android:layout_gravity="center_vertical"
        android:id="@+id/stop_button"
        android:layout_below="@+id/zCoord"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="119dp" />

</RelativeLayout>
For now, I just want to print the x, y, and z values from the accelerometer in three separate TextViews. I figured that each time the sensor changed, if it's been more than 100 ms since the last time the text was updated, it should be updated again. Here's the code from the above activity's onSensorChanged method:

Java code:
public void onSensorChanged(SensorEvent event){
    Sensor mySensor = event.sensor;

    if(mySensor.getType() == Sensor.TYPE_ACCELEROMETER){
        float x = event.values[0];
        float y = event.values[1];
        float z = event.values[2];

        Log.d(TAG, "x = " + Float.toString(x));

        long curTime = System.currentTimeMillis();

        if((curTime - lastUpdate) > 100){
            lastUpdate = curTime;
            mXTextView.setText(Float.toString(x));
            mYTextView.setText(Float.toString(y));
            mZTextView.setText(Float.toString(z));
        }
    }
}
However, nothing's being displayed in the TextViews. Why is that?

TIP
Mar 21, 2006

Your move, creep.



baka kaba posted:

Nice job! It's got a good feel to it, I like how the state saves too. Couple of bugs I noticed:
  • On Chrome anyway, the mouse pointer turns into a text caret over certain squares (the ones that have a number under them) which is a big clue!
  • This one was hard for me to reproduce... but sometimes if you long-click and then drag to another square, all the pigs appear. Going diagonally seemed to make it more likely, but I might be imagining that
  • Not a big deal, but some of the columns have a noticeably bigger gap between them, so the field looks a little uneven
I know it's the android thread and I looked at the javascript version :v:

Thanks for trying it out and good spotting on the bugs!

I had not noticed the text caret issue, that is a little annoying and I might fix it. It's not much of a priority though as it's mainly meant to be a mobile app.

The appearing pigs trick is actually you managing to start the cheat mode. You can, at any point, make them all appear by holding a square down for 5 seconds. The timer is set up to clear on releasing the click or leaving the square, but occasionally with weird mouse movement chrome doesn't properly report those states. I did some work to minimize it, and I haven't seen it in the app version, but it might be worth just ripping out the cheat mode to prevent accidental cheating.

As far as the column gapping, every column has the exact same settings and the gapping seems to be a quirk of the css rendering at certain resolutions and grid sizes. I think it would be fixable if I was working with a fixed resolution or I had fixed board sizes but I'm generating the CSS for sizing of game board elements on the fly on a dynamically scaling resolution independent play area.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

hooah posted:

I don't think I quite understand how TextViews work. I'm able to read data from the accelerometer and send it to the log, but I can't get it to display. I have an activity that's called when the user presses the "start" button on the main activity; here's its layout:

XML code:
<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"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context="com.example.spart_000.accel_demo.DisplayData">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minLines="1"
        android:id="@+id/xCoord" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minLines="1"
        android:id="@+id/yCoord"
        android:layout_below="@+id/xCoord"
        android:layout_alignParentStart="true" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minLines="1"
        android:id="@+id/zCoord"
        android:layout_below="@+id/yCoord"
        android:layout_alignParentStart="true" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/button_stop"
        android:onClick="stopCollect"
        android:layout_gravity="center_vertical"
        android:id="@+id/stop_button"
        android:layout_below="@+id/zCoord"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="119dp" />

</RelativeLayout>
For now, I just want to print the x, y, and z values from the accelerometer in three separate TextViews. I figured that each time the sensor changed, if it's been more than 100 ms since the last time the text was updated, it should be updated again. Here's the code from the above activity's onSensorChanged method:

Java code:
public void onSensorChanged(SensorEvent event){
    Sensor mySensor = event.sensor;

    if(mySensor.getType() == Sensor.TYPE_ACCELEROMETER){
        float x = event.values[0];
        float y = event.values[1];
        float z = event.values[2];

        Log.d(TAG, "x = " + Float.toString(x));

        long curTime = System.currentTimeMillis();

        if((curTime - lastUpdate) > 100){
            lastUpdate = curTime;
            mXTextView.setText(Float.toString(x));
            mYTextView.setText(Float.toString(y));
            mZTextView.setText(Float.toString(z));
        }
    }
}
However, nothing's being displayed in the TextViews. Why is that?

What's lastUpdate's starting value? Add a log line to the inside of that if block, or better yet a breakpoint. Does it reach there?

Are your textviews visible? If you give them starting values, do you see them?

Also, does your callback happen on the UI thread? Do you need to call postInvalidate for some reason?

hooah
Feb 6, 2006
WTF?

Volmarias posted:

What's lastUpdate's starting value? Add a log line to the inside of that if block, or better yet a breakpoint. Does it reach there?

lastUpdate is initialized to 0. I set a breakpoint to the innermost if's lastUpdate = curTime statement and it got reached.

quote:

Are your textviews visible? If you give them starting values, do you see them?
They haven't been visible so far. I'm not entirely sure how to give them a starting value; I tried adding mXTextView.setText("X-value text view"); to the activity's onCreate method, but that didn't change anything.

quote:

Also, does your callback happen on the UI thread? Do you need to call postInvalidate for some reason?

I don't know about any of this. How would I figure out the answers to these questions?

Tunga
May 7, 2004

Grimey Drawer
You can give them a text value in the XML, same as you did for the button. That will let you check that they exist and are visible.

hooah
Feb 6, 2006
WTF?
Oh, of course. I did that, and can see the text. The problem was that I was setting the member variable TextViews to a new TextView, rather than grabbing by id. Duh.

However, now I guess I don't quite understand the values coming out of the accelerometer. When the phone's flat on the table, x and y are ~0, and z is ~10. When the phone's vertical and in front of my face (that is, just lifted up from the table, only rotating the screen "forwards"), x is still ~0, but y and z exchange values. I can't seem to move the phone in a way that at least two axes don't add up to 10. That is, I can't make all the outputs the same value. I'll go read up on the various position/motion-related sensors (there's a hell of a lot for some reason).

hooah fucked around with this message at 13:11 on Jul 8, 2015

Tunga
May 7, 2004

Grimey Drawer

hooah posted:

When the phone's flat on the table, x and y are ~0, and z is ~10. When the phone's vertical and in front of my face (that is, just lifted up from the table, only rotating the screen "forwards"), x is still ~0, but y and z exchange values. I can't seem to move the phone in a way that at least two axes don't add up to 10. That is, I can't make all the outputs the same value.
Correct, because gravity is ~10m/s^2.

hooah
Feb 6, 2006
WTF?

Tunga posted:

Correct, because gravity is ~10m/s^2.

Oh. Well of course. After reading the sensors pages some more, the recommendation that linear acceleration and rotation vector are likely to be the most useful, so I've changed my app to display that data. However, it doesn't seem to update both at once. Usually the rotational data updates a lot, but the linear data hardly ever updates. Here's my onSensorChanged method; what am I doing wrong?

Java code:
public void onSensorChanged(SensorEvent event){
    Sensor mySensor = event.sensor;

    if(mySensor.getType() == Sensor.TYPE_LINEAR_ACCELERATION){
        float x = event.values[0];
        float y = event.values[1];
        float z = event.values[2];

        long curTime = System.currentTimeMillis();

        if((curTime - lastUpdate) > 100){
            lastUpdate = curTime;
            mLinXText.setText(Float.toString(x));
            mLinYText.setText(Float.toString(y));
            mLinZText.setText(Float.toString(z));
        }
    }

    if(mySensor.getType() == Sensor.TYPE_ROTATION_VECTOR){
        float x = event.values[0];
        float y = event.values[1];
        float z = event.values[2];

        long curTime = System.currentTimeMillis();

        if((curTime - lastUpdate) > 100){
            lastUpdate = curTime;
            mRotXText.setText(Float.toString(x));
            mRotYText.setText(Float.toString(y));
            mRotZText.setText(Float.toString(z));
        }
    }
}

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

hooah posted:

Oh. Well of course. After reading the sensors pages some more, the recommendation that linear acceleration and rotation vector are likely to be the most useful, so I've changed my app to display that data. However, it doesn't seem to update both at once. Usually the rotational data updates a lot, but the linear data hardly ever updates. Here's my onSensorChanged method; what am I doing wrong?

Java code:
public void onSensorChanged(SensorEvent event){
    Sensor mySensor = event.sensor;

    if(mySensor.getType() == Sensor.TYPE_LINEAR_ACCELERATION){
        float x = event.values[0];
        float y = event.values[1];
        float z = event.values[2];

        long curTime = System.currentTimeMillis();

        if((curTime - lastUpdate) > 100){
            lastUpdate = curTime;
            mLinXText.setText(Float.toString(x));
            mLinYText.setText(Float.toString(y));
            mLinZText.setText(Float.toString(z));
        }
    }

    if(mySensor.getType() == Sensor.TYPE_ROTATION_VECTOR){
        float x = event.values[0];
        float y = event.values[1];
        float z = event.values[2];

        long curTime = System.currentTimeMillis();

        if((curTime - lastUpdate) > 100){
            lastUpdate = curTime;
            mRotXText.setText(Float.toString(x));
            mRotYText.setText(Float.toString(y));
            mRotZText.setText(Float.toString(z));
        }
    }
}

Just a guess, but the orientation of your phone probably changes a lot more frequently (and to a greater degree) than how hard you're accelerating it. Unless you're shaking your phone around like a spaz, you're not going to have frequent acceleration events because the system is not going to report really tiny accelerations or you'd get lots of noise from things like "I'm walking while on the phone."

hooah
Feb 6, 2006
WTF?

LeftistMuslimObama posted:

Just a guess, but the orientation of your phone probably changes a lot more frequently (and to a greater degree) than how hard you're accelerating it. Unless you're shaking your phone around like a spaz, you're not going to have frequent acceleration events because the system is not going to report really tiny accelerations or you'd get lots of noise from things like "I'm walking while on the phone."

That seems reasonable, but if I comment out the rotation vector block, the linear data updates more frequently.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Well they're both hitting the same last update timestamp, right? Also you can set different update speeds when you register the sensor, remember

What's your end goal here? If you're trying to do something like display the device orientation, you might be better using something like the orientation sensor or whatever, than trying to wrangle the individual sensors it uses yourself

e- orientation not rotation. I love how the android dev site is completely unreadable on mobile devices :catstare:

baka kaba fucked around with this message at 18:42 on Jul 8, 2015

hooah
Feb 6, 2006
WTF?
The end goal is going to be something like "detect a certain gesture, compare it to that gesture's 'standard'". Right now, I'm just trying to get a proof-of-concept done that can just record data (to a file, but that should be fairly straightforward - right?). The last update and update speeds I got from this tutorial over here. Removing the check on "recentness" seems to make the display behave a little better: now the linear data updates a handful of times per second, but the rotation data absolutely flies. Ideally I'd like to sample both sensors at the same time. I think.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

baka kaba posted:

Well they're both hitting the same last update timestamp, right? Also you can set different update speeds when you register the sensor, remember

What's your end goal here? If you're trying to do something like display the device orientation, you might be better using something like the orientation sensor or whatever, than trying to wrangle the individual sensors it uses yourself

e- orientation not rotation. I love how the android dev site is completely unreadable on mobile devices :catstare:

Well you're not coding via the mobile device sooo... :ironicat:

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

hooah posted:

The end goal is going to be something like "detect a certain gesture, compare it to that gesture's 'standard'". Right now, I'm just trying to get a proof-of-concept done that can just record data (to a file, but that should be fairly straightforward - right?). The last update and update speeds I got from this tutorial over here. Removing the check on "recentness" seems to make the display behave a little better: now the linear data updates a handful of times per second, but the rotation data absolutely flies. Ideally I'd like to sample both sensors at the same time. I think.

Yeah some of them are jumpy as hell. You can slow it down with a different update speed for that sensor, but either way you'll probably want to handle your 'recentness' separately for each sensor with their own timestamps and such, or possibly keep a running average and check that every so often (which will filter the readings and make sure the one you do record isn't a twitchy outlier)

Volmarias posted:

Well you're not coding via the mobile device sooo... :ironicat:

It would be nice to see more than the first column of a table though! At least let me scroll the thing over or switch to the desktop site (thanks Chrome). This ain't the Material experience I signed up for

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Doghouse posted:

So my three person group is putting together a basic Android app for a school project, and I have a layout question.

My layout basically has a number of EditTexts for users to input text. Then underneath, there is room for a list of spinners. They user can click a button and add another spinner (they can choose a custom list of exercises, one from each spinner). Underneath that, there are a few buttons. So I made the spinner a LinearLayout, but you can't scroll through the list if it gets long. So I tried wrapping the LinearLayout with a scroll view, but that doesn't seem to be working right. I guess I want the list to expand and let the user scroll through it and have the buttons be pushed down. How should I be doing that?

I waited in case someone who knows what they're talking about chipped in, but why didn't the ScrollView work? I just tried it and my problem is the scrollview eventually fills the screen and pushes the buttons off the bottom. I ended up basically doing this:
http://www.curious-creature.com/2010/08/15/scrollviews-handy-trick/
Which is basically the buttons acting as a footer, so they're always locked to the bottom of the screen, and the scrollview fills the rest

I can't get what I think you want though, which is a scrollview with buttons hanging off the bottom, which move down as the scrollview expands, but stop at the bottom (meaning the scrollview hits a maximum size and starts scrolling its content). You can probably do it programmatically if you like a challenge/hate life, but I'm not sure if you can do it in basic XML. Someone else might know, I never got the hang of layouts

Tunga
May 7, 2004

Grimey Drawer
ScrollViews with content below can be a bit fiddly. Usually you can achieve good results with creative use of fillViewport and/or weight values.

baka kaba posted:

I can't get what I think you want though, which is a scrollview with buttons hanging off the bottom, which move down as the scrollview expands, but stop at the bottom (meaning the scrollview hits a maximum size and starts scrolling its content).
What behaviour do you get if you just stick a ScrollView and a LinearView into a LinearView?

Edit: VVVV Yeah, I mean a LinearLayout. It has been a long week!

Tunga fucked around with this message at 15:38 on Jul 9, 2015

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

You mean a LinearLayout? It actually works as expected until the ScrollView content gets long - the ScrollView locks to the bottom of the screen and shoves the buttons off the screen entirely (you can't see them, anyway). It's weird behaviour

You can do it with a relative layout too, and maybe if you mess around with padding and offsets you can make it happen, but it feels like trying to work around something broken to me v:shobon:v

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
Use layout weights. Your bottom layout with buttons has height wrap_content and weight 0, your scroll view has height 0 and weight 1.

Tunga
May 7, 2004

Grimey Drawer

Volmarias posted:

Use layout weights. Your bottom layout with buttons has height wrap_content and weight 0, your scroll view has height 0 and weight 1.
This will always expand the ScrollView to fill the remaining space, which is not the goal, as far as I understand. They want the ScrollView to fill the minimal possible space while holding its content, and to not expand past the point where the rest of the views will not longer fit on the screen.

I'm pretty sure it's possible in XML but I'd have to play with some layouts to say for sure how to do it.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
Edit: never mind

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Yeah there's a million ways to get the buttons stuck to the bottom as a footer, seems like. But having the whole thing only wrap its content, without expanding beyond the screen height... that's a bunch of work for some reason. I still think padding and an offset will work, but it's kludgy. I am probably missing something about the layout system though

speng31b
May 8, 2010

If someone were to post an mspaint thingy explaining exactly what this Frankenstein's monster of scrollviews and linearlayouts needs to look like I'll post the layout for it. I know every trick with scrollviews and linearlayouts and layoutweights and they are all stupid and should be documented somewhere.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

I have AS open right now so I could have just used the layout designer but hey, you can't beat the bespoke artisanal touch of an mspaint



So basically the button hangs off the bottom of the scrollview, which is only wrapping its content - it's basically 'not there' as far as the user's concerned, until you add too many views to its layout, and then it becomes a scrollable area. So the scrollview is the only element that expands to fill available space, but only as needed, and the other elements always have to be visible - the button should never float lower than the edge of the screen

Or the shorter version - EditTexts, some amount of Spinners, Button, all stacked vertically and against the previous element. If it won't all fit on the screen, the Spinners become a scrollable list that fits the available space

Adbot
ADBOT LOVES YOU

Fergus Mac Roich
Nov 5, 2008

Soiled Meat
Sorry, a stupid question maybe but I haven't been able to figure it out from tutorials. What is the general guiding principle behind when you need to split something into a separate Activity, provided you are using Fragments?

I seem to be able to construct as complex a UI as I want, with many screens and moving parts, just by shuffling Fragments around.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply