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
brand engager
Mar 23, 2011

You really aren't getting it

Adbot
ADBOT LOVES YOU

FAT32 SHAMER
Aug 16, 2012



Yeah, sorry, I’m not. You normally call Firebase.initialize(context) from your Application subclass, and you seem to be stuffing a context reference into a singleton object, which is bad practice.

Can you post more code so we have a better idea of what you’re trying to do and accomplish?

brand engager
Mar 23, 2011

Trying to setup unit tests for this analytics implementation we have that relies on firebase. For whatever reason google wrote the functions on the firebase object as extension functions which is making it difficult or impossible to mock those functions. I'll probably end up wrapping all the calls with another object that just directly forwards them without any additional logic to minimize the amount of untested code.

FAT32 SHAMER
Aug 16, 2012



I don’t think that will solve your issue, but you could give it a shot :). If you’re only doing this for code coverage percentage then imo it’s not worth it, tho I’m sure someone else itt may have a better solution

I have never successfully mocked Firebase poo poo before because as soon as you have it sorted to mock the firebase instance then you need to mock context and then you need to mock this and that and a bunch of other poo poo

FAT32 SHAMER
Aug 16, 2012



I googled it to make sure and I think I may be mistaking something, since you can apparently mock context nowadays

brand engager
Mar 23, 2011

Extension functions are pretty awkward in general for testing, since they don't actually "belong" to the object. Like if I had some type named Thing and in a file named Extensions.kt I wrote
Kotlin code:
// File is Extensions.kt

fun Thing.doIt(text: String) {
    // do whatever here
}
This results in some java code that looks something like
Java code:
public static class ExtensionsKt {
    public static void doIt(Thing thing, String text) {
        // do whatever here
    }
}
so the function is part of some entirely separate object and calls doIt on mock instances of Thing still go to the unmocked extension function. This is really annoying for reading unit tests because non-extensions on that object are mocked but extensions aren't.

Away all Goats
Jul 5, 2005

Goose's rebellion

I'm doing an exercise on tween animations of the earth orbiting around the sun. For some reason I cannot get the earth to pivot around the image of the sun, only itself. Can someone tell me what I'm doing wrong?

code:
class ExerciseThree: AppCompatActivity(){
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.exercise03)

        // Find the image views in the layout
        val sunImageView = findViewById<ImageView>(R.id.imageSun)
        val earthImageView = findViewById<ImageView>(R.id.imageEarth)

        // Set up the orbit path animation
        earthImageView.pivotX = sunImageView.x + sunImageView.width / 2f
        earthImageView.pivotY = sunImageView.y + sunImageView.height / 2f

        // Set up the orbit animation
        val orbitAnimation = ObjectAnimator.ofFloat(
            earthImageView,
            "rotation",
            0f,
            360f
        ).apply {
            duration = 4000 // Set the duration of the animation to 4 seconds
            repeatCount = ObjectAnimator.INFINITE // Set the animation to repeat infinitely
            interpolator = LinearInterpolator() // Use a linear interpolator to keep the speed constant
        }

        // Start the orbit and orbit path animations
        orbitAnimation.start()

    }
I have the two images constrained properly, with the sun in the very center and the earth starting right above it.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
You probably want some combination of rotating and moving your planet view, rather than purely rotating it.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
My suspicion (check with debugger) is that the sun x/y values will show 0,0, as those aren't offset from parent values. You'll probably want to place the earth directly inside the sun, then offset, then rotate.

The Dave
Sep 9, 2003

I'm embarrassed to ask because this is such a kiddy newb question, but are there any painless ways to take an APK from the Play store and extract artwork assets from it?

More specifically, I was wondering if there was any way to rip textures and background art from Street Fighter Duel. I'm sure I'm being super naive here.

Sereri
Sep 30, 2008

awwwrigami

The play store most likely not, but there are sites like APK mirror that host apks of free apps you can then download.

The APK should then just be a zip file and you might find the asset in there.

brand engager
Mar 23, 2011

Yeah you can just unzip an apk, though it sounds like this is a game so the game data might be in some framework-specific format instead of PNGs

The Dave
Sep 9, 2003

Yeah I don't think the game graphics are stored as PNGs. Probably a pain in the rear end of pulling things apart to try and extract it.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
If you have a rooted service, I THINK the APK is downloaded to a cache folder and not immediately cleaned up.

Small White Dragon
Nov 23, 2007

No relation.
If I have, say, a game in Xamarin, is this the right way to get the location to store saves etc?

code:
Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDocuments).Path
Do I need any special permissions for that?

Volmarias
Dec 31, 2002

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

Small White Dragon posted:

If I have, say, a game in Xamarin, is this the right way to get the location to store saves etc?

code:
Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDocuments).Path
Do I need any special permissions for that?

getFilesDir might be more appropriate, unless you specifically want them to be on potentially external storage.

As per the docs you may need to use a couple permissions depending on how far back you want to be compatible.

Small White Dragon
Nov 23, 2007

No relation.
Edit: nevermind

Small White Dragon fucked around with this message at 19:55 on Jun 14, 2023

Small White Dragon
Nov 23, 2007

No relation.
Okay actual question.

For those of you doing active Android projects here, I'm wondering if you have any suggestions for places that will test your app on a variety of devices at a reasonable price?

FAT32 SHAMER
Aug 16, 2012



The last time I looked into that, the options were either skeezy as hell, or more expensive long term than just buying the 3 or 4 most popular phones on the market rn. Ideally you’ll have a foldable (which is probably a Samsung), a non foldable Samsung, a pixel, and a OnePlus or Huawei depending on where you are in the world and where your target market is

b0lt
Apr 29, 2005

Small White Dragon posted:

Okay actual question.

For those of you doing active Android projects here, I'm wondering if you have any suggestions for places that will test your app on a variety of devices at a reasonable price?

Firebase Test Lab

FAT32 SHAMER
Aug 16, 2012



https://blog.pragmaticengineer.com/google-shutting-down-firebase-dynamic-links/

Classic google

Volmarias
Dec 31, 2002

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

Services can solve this problem via the magic and sublime mystery of "serving users a 302 based on user agent headers" easily enough that I never got the point of this. Indeed, they usually do it whether I want their loving app or not!

Infomaniac
Jul 3, 2007
Support Cartographers Without Borders
What's pro Android development like in TYOL 2024?

FAT32 SHAMER
Aug 16, 2012



The same as 2020 but AS is faster and has some handy tools, Compose has made UI a lot easier, and some things are more stable or robust than they were

Infomaniac
Jul 3, 2007
Support Cartographers Without Borders

FAT32 SHAMER posted:

The same as 2020 but AS is faster and has some handy tools, Compose has made UI a lot easier, and some things are more stable or robust than they were

Thanks

Adbot
ADBOT LOVES YOU

Cat Machine
Jun 18, 2008

Infomaniac posted:

What's pro Android development like in TYOL 2024?
Your boss will ask you every month if your codebase can be migrated to Flutter, but other than that it’s alright when Google isn’t deprecating poo poo for no good reason

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