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

kitten smoothie posted:

Looks like it's just a WebView wrapper around a JQuery Mobile site, and was created using this https://www.biznessapps.com/ (at least from what I could tell running it through apktool).

http://pullappsinc.ca/home.html lol "hypertext" "information" "transfer" "MOBILE APP."

I actually can't stop looking at this website. Everything about it.

speng31b fucked around with this message at 00:27 on Jan 25, 2016

Adbot
ADBOT LOVES YOU

kitten smoothie
Dec 29, 2001

speng31b posted:

http://pullappsinc.ca/home.html lol "hypertext" "information" "transfer" "MOBILE APP."

I'm the $6000 webview wrapper

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Does anyone in this thread use Stetho (http://facebook.github.io/stetho/)? Looking to gather feedback on it from people outside FB who use it.

Tunga
May 7, 2004

Grimey Drawer

Subjunctive posted:

Does anyone in this thread use Stetho (http://facebook.github.io/stetho/)? Looking to gather feedback on it from people outside FB who use it.
I tend to assume that Facebook's libraries are written as poorly as their apps and avoid them. We tried Fresco once and it solved exactly none of the problems we had with loading images on low-memory devices and didn't seem to offer any meaningful benefits so we went back to rolling our own solution. This doesn't actually answer your question though, sorry.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Tunga posted:

I tend to assume that Facebook's libraries are written as poorly as their apps and avoid them. We tried Fresco once and it solved exactly none of the problems we had with loading images on low-memory devices and didn't seem to offer any meaningful benefits so we went back to rolling our own solution. This doesn't actually answer your question though, sorry.

That's fine, it's useful to know. Do you remember what the problems were that you have with Fresco?

Stetho isn't a library really, other than a stub. It's a debugging/inspection tool.

speng31b
May 8, 2010

Subjunctive posted:

Does anyone in this thread use Stetho (http://facebook.github.io/stetho/)? Looking to gather feedback on it from people outside FB who use it.

Nope, but I'm always interested in checking out this kind of tool. I'll probably take a look this week or next and post back.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

speng31b posted:

Nope, but I'm always interested in checking out this kind of tool. I'll probably take a look this week or next and post back.

That'd be great!

Tunga
May 7, 2004

Grimey Drawer

Subjunctive posted:

That's fine, it's useful to know. Do you remember what the problems were that you have with Fresco?
The problems we had were not really with Fresco, more we have quite a specific use-case for images and older Android devices just don't cope well with it. Our app provides a way for users to upload images onto customised products, some of which can allow for a dozen or so images (imagine something like a calendar). These images can be zoomed/cropped by the user so we have to persist the state of each image and display it accurately on the preview and then upload them at the end. You can do this easily with standard APIs as long as you have ~1GB of RAM but when you go back to older devices with 512MB or similar it will end up just throwing random poo poo away until your app crashes in some spectacular fashion.

We tried Fresco as it claimed to do some neat stuff with memory but, to be fair, this isn't really the thing it was designed to solve (as far as I understand) and the actual issue here is a straight up hard limit on device memory rather than just the heap being too small.

We eventually solved this by resampling the images on the fly so we don't keep giant version around in memory and only grabbing the full quality versions when we're ready to do the upload. And a couple of other tricks. I didn't write any of the code and had only just joined the company when this was all happening so that's about as much as I know.

kitten smoothie
Dec 29, 2001

Subjunctive posted:

Does anyone in this thread use Stetho (http://facebook.github.io/stetho/)? Looking to gather feedback on it from people outside FB who use it.

Yeah, it's in our team's debug builds. I've set up the OkHttp interceptors for monitoring network traffic and it's often easier to use the view inspector versus futzing with Hierarchy Viewer. Also nice for going and editing text view contents real time and making sure that crap like word wrap works like I want.

I don't know a whole lot if the rest of my team uses it but I find it handy.

Mezzanine
Aug 23, 2009
Wow, that Stetho is really nice! I also do a lot of web development, so I'm used to the interface. It's nice to be able to hover over components and see the layouts highlighted when I'm adjusting UI, and also to see the whole activity -> fragment -> layout -> view hierarchy just like when writing a web page. Plus, you can fudge around with SharedPreferences and cookies and stuff like that.

NoDamage
Dec 2, 2000
Do recent versions of Android have a browser extension capability similar to iOS 8's Safari extensions? I'd love to be able to run some JS in the browser and extract the resulting HTML.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Does anyone know of a way to get a simulator to pretend it has secure key storage? I recognize that I would be telling the OS to lie to me, and I'm fine changing a setting to that effect, but it would make testing some things much easier.

speng31b
May 8, 2010

NoDamage posted:

Do recent versions of Android have a browser extension capability similar to iOS 8's Safari extensions? I'd love to be able to run some JS in the browser and extract the resulting HTML.

I have no idea what iOS 8's Safari extensions do, but in newish versions of Android you can enable debugging on webviews and inspect them over USB debugging with chrome://inspect to debug stuff with the chrome developer tools.

Or maybe you're looking for something like https://developer.chrome.com/multidevice/android/customtabs ?

Subjunctive posted:

Does anyone know of a way to get a simulator to pretend it has secure key storage? I recognize that I would be telling the OS to lie to me, and I'm fine changing a setting to that effect, but it would make testing some things much easier.

Not sure about that specifically, but you can do literally anything you can do on a rooted device with Genymotion.

speng31b fucked around with this message at 03:25 on Feb 4, 2016

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

speng31b posted:

Not sure about that specifically, but you can do literally anything you can do on a rooted device with Genymotion.

Yeah, I've been digging through AOSP to see if there's a way to do it without building a custom image (shoot me). So far no dice.

NoDamage
Dec 2, 2000

speng31b posted:

I have no idea what iOS 8's Safari extensions do, but in newish versions of Android you can enable debugging on webviews and inspect them over USB debugging with chrome://inspect to debug stuff with the chrome developer tools.

Or maybe you're looking for something like https://developer.chrome.com/multidevice/android/customtabs ?
To clarify, this would be for a user feature similar to a bookmarklet, not for development/debugging purposes. A Safari extension allows an app to run Javascript code against the currently loaded Safari page, and then return the result to the app itself. Think something like Evernote/Instapaper, where the user might want to clip the contents of the current page and save it into another app.

NoDamage fucked around with this message at 09:13 on Feb 4, 2016

Tunga
May 7, 2004

Grimey Drawer

NoDamage posted:

To clarify, this would be for a user feature similar to a bookmarklet, not for development/debugging purposes. A Safari extension allows an app to run Javascript code against the currently loaded Safari page, and then return the result to the app itself. Think something like Evernote/Instapaper, where the user might want to clip the contents of the current page and save it into another app.
I think the way to do this would be to have your app accept URL/text shares and then the user can share the URL from their browser to your app which will load/parse/process the data in whatever ways it wants to.

speng31b
May 8, 2010

Tunga posted:

I think the way to do this would be to have your app accept URL/text shares and then the user can share the URL from their browser to your app which will load/parse/process the data in whatever ways it wants to.

Yeah that's right. You can't passively extend mobile Chrome to modify its behavior, but you can handle the share intents and do whatever you want with those. And obviously if the site the user is browsing is yours, or you can put links there, you can make them app links (deep links) and fully customize the way your app responds to them.

If you do it right, Google will even index your app for search results based on the links. Then you get fun crash reports from the Google app indexing robot running on an impossible version of Android with impossible features.

speng31b fucked around with this message at 14:22 on Feb 4, 2016

Tunga
May 7, 2004

Grimey Drawer

speng31b posted:

If you do it right, Google will even index your app for search results based on the links. Then you get fun crash reports from the Google app indexing robot running on an impossible version of Android with impossible features.
We've been thinking about adding deep linking and app indexing stuff and this sounds like a thing we might want to be aware of, got any links or anything that describe the problems you had?

speng31b
May 8, 2010

Tunga posted:

We've been thinking about adding deep linking and app indexing stuff and this sounds like a thing we might want to be aware of, got any links or anything that describe the problems you had?

Not really, it's pretty straightforward nowadays. You'll just have to add the validation file to the root of the domain you're adding app indexing for so Google can be sure you own it, but Google's docs guide you through that process, and send your Google account admin emails about any problems the indexer finds that is stopping it from indexing your app. Just allow a few days for the emails to come through for some back and forth if it doesn't work on the first try, which it usually doesn't.

The biggest problem I've run into is political, where the Google account admin email was set to the way-too-fancy-for-you VP of something-or-other who doesn't care much for your timelines, so it usually helps to give whoever that is a heads-up to forward you whatever emails the indexer sends. When I was doing it the emails were the only way to get feedback, it didn't show up in the Google Play Developer Console. Hopefully they've fixed that.

speng31b fucked around with this message at 16:23 on Feb 4, 2016

NoDamage
Dec 2, 2000

Tunga posted:

I think the way to do this would be to have your app accept URL/text shares and then the user can share the URL from their browser to your app which will load/parse/process the data in whatever ways it wants to.
Yeah that's what I'm currently doing, the problem is you only get the URL so you have to reload the page in a WebView if you want to run JS on it, and then if the page is behind a paywall and the user isn't authenticated, or if the page's contents are loaded via AJAX, you might not end up loading what the user originally saw in their browser. Sounds like setting up a bookmarklet might be the best option for me, but it's not as seamless as appearing in the Share menu.

speng31b
May 8, 2010

NoDamage posted:

Yeah that's what I'm currently doing, the problem is you only get the URL so you have to reload the page in a WebView if you want to run JS on it, and then if the page is behind a paywall and the user isn't authenticated, or if the page's contents are loaded via AJAX, you might not end up loading what the user originally saw in their browser. Sounds like setting up a bookmarklet might be the best option for me, but it's not as seamless as appearing in the Share menu.

Yeah, that's your only option here.

speng31b fucked around with this message at 19:14 on Feb 4, 2016

Fergus Mac Roich
Nov 5, 2008

Soiled Meat

speng31b posted:

This is sort of par for the course with Fragments. There may be better ways to do it, but generally for the purposes of a short code snippet that needs to easily convey "I am communicating back with my Activity and doing this thing", that's going to be more understandable than posting to an event bus or local broadcast or using an interface or whatever you might do in a real use case. Also people do use this pattern pretty frequently with Fragments.

I get this for fragments, but is their container solution stuck with the casts and hardcoded getChildAt() calls? If not, what would be the way to improve that process?

speng31b
May 8, 2010

Fergus Mac Roich posted:

I get this for fragments, but is their container solution stuck with the casts and hardcoded getChildAt() calls? If not, what would be the way to improve that process?

Sorry I'm not sure what pattern uses getChildAt calls, could you clarify?

Do you mean how does something hosting multiple screens communicate with its child screens, whether those are Fragments or Views or whatever else? If so, there are a bunch of ways. If you have something makes more sense as a general blast of information to the app that any number of Screens might be interested in responding to, use an event bus or broadcast or an rx subject (https://realm.io/news/gotocph-mattias-kappler-reactive-architecture-android/)

If you want to communicate downstream with a specific screen that you know you are the parent of, make sure that screen implements an interface, then traverse your child components looking for the interface you're interested in and dispatch the information to it. In a view hierarchy, that probably looks a lot like a for loop with getChildAt and casting, which is really fine in most situations. There's nothing evil about it. If you really hate it, try abstracting away the view hierarchy using MVP of MVC or MVVM or whatever so that parent presenters/controllers know about their child presenters/controllers and not about the views themselves, then it's just presenter iterating through child presenters (which implement an interface) and calling through that. And you're super fancy so the presenters were all injected through DI with Dagger or Dagger 2, and you're decoupled as poo poo.

Or you can just iterate through the views and cast them. Live long enough as an Android developer and you'll eventually overarchitect everything.

speng31b fucked around with this message at 21:21 on Feb 4, 2016

Fergus Mac Roich
Nov 5, 2008

Soiled Meat
I might be missing something. Here's an example from Square's container pattern in their blog post.

code:
  @Override protected void onFinishInflate() {
    super.onFinishInflate();
    listView = (ItemListView) getChildAt(0);
  }
They also do this:
code:
public boolean onBackPressed() {
    if (!listViewAttached()) {
      removeViewAt(0);
      addView(listView);
      return true;
    }
    return false;
  }
Sorry if there's an obvious answer, some of my synapses aren't firing lately.

edit: Yeah, I see what you're saying about looping over the children and looking for the interface. That still feels yucky to me, but at least it's more generic than what is written there.

Fergus Mac Roich fucked around with this message at 21:25 on Feb 4, 2016

speng31b
May 8, 2010

I think that example's a bit contrived to oversimplify, or maybe just because it's really old it represents an underevolved version of the thinking that eventually lead to the adoption of MVP as the pattern most of us prefer for modern Android.

If you want to make it cleaner, imagine that instead of casting to MainActivity, MainActivity implements a Controller interface, and when it creates its child ItemListView, it gives ItemListView itself in interface form (i.e., setController(this)). Then, ItemListView calls back through the controller interface. In fact, ItemListView wasn't created directly by MainActivity, it was created by something else and injected into MainActivity as a SomethingListView interface, and MainActivity only calls its child as an interface, and the child only calls MainActivity as a an interface.

Feels cleaner, right? Anyways, I wouldn't use that article for correct architecture, just to point out why Fragments suck. Architecture has evolved a lot since then, but their examples of why Fragments are bad are still pretty relevant.

speng31b fucked around with this message at 21:59 on Feb 4, 2016

Fergus Mac Roich
Nov 5, 2008

Soiled Meat
I understand now what I need to research to get a grasp on this topic, thanks. I'm self-taught and don't know much about writing well-organized code :v: I wrote a completely braindead Android app last year, a workout logger that just supported some real basic CRUD functionality and a timer, and even that became an admittedly delicious plate of spaghetti. Modern MVP, an event bus(looks like Otto is the one to use?) and DI should make my next go at making an app dramatically cleaner.

brap
Aug 23, 2004

Grimey Drawer
I'm trying to figure out how to do a beta test of my app before publishing. Does my app seriously need to be published to beta test through Google Play? That makes no sense. I'm not trying to open it up to the general public. I just want to pull in a few friends to get feedback on the app. What should I do? Can I just email someone a signed APK and they can install the app?

speng31b
May 8, 2010

fleshweasel posted:

I'm trying to figure out how to do a beta test of my app before publishing. Does my app seriously need to be published to beta test through Google Play? That makes no sense. I'm not trying to open it up to the general public. I just want to pull in a few friends to get feedback on the app. What should I do? Can I just email someone a signed APK and they can install the app?

Anyone can install any APK from anywhere if they allow unknown sources. If you're just sharing it with a few friends, email it to them, or set up a google docs link or something.

FAILS AT EVERYTHING
Jan 2, 2006

Finally, I've escaped!

fleshweasel posted:

I'm trying to figure out how to do a beta test of my app before publishing. Does my app seriously need to be published to beta test through Google Play? That makes no sense. I'm not trying to open it up to the general public. I just want to pull in a few friends to get feedback on the app. What should I do? Can I just email someone a signed APK and they can install the app?

The easiest route is definitely to just send them over an e-mail or some kind of link with the apk so they can install (maybe with a few instructions on how they can trust unknown sources on their phone). However, if you're eventually wanting to publish and would also like your friends to see updates to the app, you might consider publishing the APK to a beta on Google Play. This method gives you a private link that you can send to whoever and they can become "beta testers". The nice benefit of this is that they will receive updates to the app through the Play store and it's as simple as uploading a new apk to make the app go live.

Some info on alpha/beta testing

FAILS AT EVERYTHING fucked around with this message at 03:46 on Feb 8, 2016

Tunga
May 7, 2004

Grimey Drawer
You can also limit the beta to a specific Google Group or Google+ Community which prevents your friends handing the beta link out to everyone.

brap
Aug 23, 2004

Grimey Drawer
A beta where only people with the opt in link can download sounds ideal. Does "publish" in Google Play have a different meaning than I think it has? Does it mean something besides "this app is visible on the store and people can search for it and download it?"

Tunga
May 7, 2004

Grimey Drawer

fleshweasel posted:

A beta where only people with the opt in link can download sounds ideal. Does "publish" in Google Play have a different meaning than I think it has? Does it mean something besides "this app is visible on the store and people can search for it and download it?"
Go to the APK section on the Developer Console and you'll see tabs for Production, Beta and Alpha. The latter two allow you to configure the various access options we described. So "publishing" a beta app will make it public in whatever you've told it to do on that tab, and so on.

Tunga
May 7, 2004

Grimey Drawer
I'm trying to build a view with an image as the background and a CardView at the bottom kind of peeking out of the bottom of the screen that you can then pull up to reveal the rest of the content and it slides over the image which stays static. If you want to see an example, the Etsy app uses a similar thing on their product pages.

I can make this work with a ScrollView but I can't work out out how to have the content start near the bottom of the screen like this. I can add a Space to the ScrollView but then how tall should it be when the screen size can vary significantly and phones/tablets etc. Is there any simple way to set the height of a view to be 80% of the screen height or screenheight - x dp or am I going to have to gently caress around with layout listeners and poo poo?

speng31b
May 8, 2010

what about just giving the scrollview containing the card no background (transparent) and a bunch of paddingTop, then putting the "background image" content in another view thats z order is lower in the same parent layout? that way you just see through the paddingTop of the scrollview into the background content, which is in the same parent viewgroup with a lower z order.

like this pseudoxml...

code:
<framelayout>
	<viewwithbackground width/height="match_parent"/>
	<scrollview paddingTop="huge" width/height="match_parent">
		<cardview/>
	</scrollview>
</framelayout>

speng31b fucked around with this message at 20:40 on Feb 11, 2016

Tunga
May 7, 2004

Grimey Drawer

speng31b posted:

what about just giving the scrollview containing the card no background (transparent) and a bunch of paddingTop, then putting the "background image" content in another view thats z order is lower in the same parent layout? that way you just see through the paddingTop of the scrollview into the background content, which is in the same parent viewgroup with a lower z order.
If you set padding on the ScrollView then I would assume the contents cannot then be scrolled upwards into that padding, so what I'll get is the card disappearing as it moves up the screen.

(Also, even if this works, the same problem remains: how much padding?)

The FrameLayout part is exactly how I did it and that part works well. It's just getting the ScrollView content to start in the right place (peeking from bottom edge of screen) that I can't figure out.

Tunga fucked around with this message at 20:44 on Feb 11, 2016

speng31b
May 8, 2010

use cliptopadding=false and/or clipchildren=false on the enclosing scrollview to fix padding clipping issues.

programmatically figure out the padding amount; you can't do that part magically with xml (or maybe you could using some space-filling view on top of the cardview in a vertical linearlayout and use a negative marginTop on the cardview? doesn't sound worth the time to try it though). just measure the framelayout's height and make the padding amount that minus X dp.

speng31b fucked around with this message at 20:51 on Feb 11, 2016

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

Does the Percent library help? Or are your views nested?

If you're trying to do the share sheet thing there are a couple of libraries around, like this one:
https://github.com/Flipboard/bottomsheet

Literal Hamster
Mar 11, 2012

YOSPOS
This is a super basic question, but how do I make use of the new Data-Binding feature in Android Studio?

The official guide says something about downloading a library through the SDK manager, but I can't see anything in there relating to data binding. All of the search results from google are from June of last year and are probably out of date.

Did I miss something really obvious?

speng31b
May 8, 2010

Don't use data binding

https://twitter.com/jakewharton/status/623353774766166016

Adbot
ADBOT LOVES YOU

kitten smoothie
Dec 29, 2001

Yeah, data binding looks to me like it's way too easy to wind up with layouts that look like JSP

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