android: best view class to create popup page - android

I am developing an android camera app that allow popup of page upon pressing a button (besides the shoot button)in the view of the photo capture activity for accessing twitter services, including login(of coz with button), view tweets(listview or list fragment) of bookmarked users and posting tweets.
I am considering the approach to build the layout for the popup stuff. What come across my mind are dialog fragment, popupwindow and simply another activity.
Considering my case, what view is recommended for the popup component?

Depends on the content of your popup:
If popup contains only a list of items use PopupWindow.
If popup contains only a few buttons like ok/cancel some text etc. Use DialogFragment.
If you have more stuff, you should probably use Activity.

Related

How to open Chrome Custom Tab in a Dialog in Android Application

In my current Android application I have a requirement to open a DialogFragment to display a list of results.
Each Result has an associated url that explains the item in more detail.
I can open a Chrome Custom Tab with this url, however it closes the DialogFragment and the user has a poor experience.
Is it possible that I could open the Crome Custom Tab within its own Dialog?
That way my Results DialogFragment should not be closed, and the user can return directly to the results list.
Currently, a Custom Tab uses the entire screen, so it's not possible to use it in a similar way to a DialogFragment (which doesn't use the entire width/height of the screen).

How to make a fragment dialog draggable on an activity

So, I am developing this app that needs a dialog screen over a map that chooses an item and is dragabble, that means that it can go up or down. How can I do that?
A good example is the instagram share button.
The component you want to use is a BottomSheetDialog: https://developer.android.com/reference/android/support/design/widget/BottomSheetDialog
This type of dialog has native support for being dragged.

Android - Show dismissable Dialog on TOP (like in Chrome) of the screen

I am currently trying to add a detail view feature for some elements of my app, and I am looking to display them like this dialog box in the Chrome app:
(It opens when you click on the https lock symbol)
The box should cover the entire top of the apps window and not leave space on top, right or left, just on the bottom of course. It also should be dismissable by clicking outside of it.
I was trying to do this for a while now but without success.
How can I achieve this?
You can achieve it in several ways.
First one
Create your own analogue of DialogFragment (don't extend existing one) with your view (which'll be placed in the top) and show it like this:
getSupportFragmentManager().beginTransaction()
.add(new MyDialogFragment(), android.R.id.content)
.commit();
android.R.id.content is like root view of your activity (setContentView() adds view on top of it).
Activity one
You can create Activity that will be transparent and 'll have this "card" on the top.
Third one
Just make Dialog appear at the top of screen. Like this.
No sure if this is what you need but have a look at this library.
https://github.com/Tapadoo/Alerter

Change focus of activities in android

I am using a dialog themed activity in android to show a popup from a application context. The dialog has a transparent theme, but the issue is that I want the underlying activity to have focus and not the popup though the popup must be visble. How do I achieve this in android?
I think you would have to use a Fragment and just make it look like a popup dialog.
You can not switch focus between activities. There's only one activity "on focus" at the time, and is the one that is being displayed at that point. The transparent background doesn't mean you can access the activity below.
If i don't get it wrong, you want to be able to interact with the activity's controls while having a "Dialog" on the screen. Any sort of Dialog class from Android will not help, since they take the focus away. Not really sure about PopupWindow, but i'm guessing will be the same thing as the documentation says "that appears on top of the current activity."
You are going to have to create a custom dialog using a RelativeLayout/FrameLayout within your activity.

Can I make WebView element "floating" on top of my main layout?

Is it possible to make WebView (or any view that can parse / display html) a "floating" window on top of the main layout?
Basically I have a list of links displayed in a listView. When the user select one of the link, i'd like to load and display the results in a floating panel (sorta like a context menu, but takes almost the entire screen and scrollable) with, say a close button on the top right corner. So when the user is done viewing the content, he/she can simply click the close button to return to the previous list page.
Is this possible? or I should start a new activity that loads a separate layout for the content, with some tracking mechanism to go back the list page.
Thanks much.
What I did for the help section of my application was to create a new Activity which just contains a WebView with the Theme.Dialog set in the AndroidManifest.xml:
<activity android:name=".HelpActivity" android:theme="#android:style/Theme.Dialog"/>
This way the WebView is launched as a 'floating dialog' on top of the current screen.
Not sure if this is exactly what you want, but it's a very simple and efficient way to accomplish what I needed to do.

Categories

Resources