yarolegovich / lovelydialog Goto Github PK
View Code? Open in Web Editor NEWThis library is a set of simple wrapper classes that are aimed to help you easily create fancy material dialogs.
License: Apache License 2.0
This library is a set of simple wrapper classes that are aimed to help you easily create fancy material dialogs.
License: Apache License 2.0
Hello!
i need create some static method for start loading and cancel loading... and call this method just passing the parameters.
dismiss dialog based on boolean value returned from onItemsSelected
hello sir can you add button negative for dismiss the dialog on LovelyChoiceDialog single choice?
like if user not choice now
and then its can setTopColorRes not show like hide the layout
thank you
How to change Don't show again messages:
How can I do that?
Is there a way to enable what has been checked to not show again in the LovelyInfoDialog to show up again with the 'Do not show agaiN' unchecked?
Is there anyway I could implement that?
I tried to merge the Dialog I was using to a LovelyCustomDialog, but the viewpagers doesnt seem to get the items, as it worked fine on a simple dialog, I dont know whether this is a Lovely Dialogs error or mine. Any clue?
LayoutInflater inflater = this.getLayoutInflater();
final View dialogView = inflater.inflate(R.layout.reviewleer, null);
adaptervp = new MyPagerAdapter(this, arrayReview);
ViewPager viewPager = (ViewPager) dialogView.findViewById(R.id.viewpager);
viewPager.setAdapter(adaptervp);
**new LovelyCustomDialog(this)
.setView(dialogView )
.setTopColorRes(R.color.vimeo)
.setTitle("asd")
.setMessage("asd")
.setIcon(R.drawable.ic_settings_ethernet_white_24dp)
.show();**
Hi,
I have a simple dialog with 2 options, I am saving the selected value so users can change whenever they want.
I want to show the previous selected value
how can i do this ?
How can I change the dialog's colour? Not the top section, but the one containing the list or the message
Hello sir,
I have set initial input to edit text in LovelyTextInputDialog. but when dialog appears, cursor is set to starting of edit text instead of to the end of text content in edit text. Please help me to set text cursor position to the end when using setInitialInput().
Is it possible to use standard
.setPositiveButton() .setNegativeButton() .setNeutralButton()
with LovelyCustomDialog?
When running the App I am getting this error!
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:354) at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:323) at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) at android.support.v7.app.AppCompatDialog.setContentView(AppCompatDialog.java:83) at android.support.v7.app.AlertController.installContent(AlertController.java:226) at android.support.v7.app.AlertDialog.onCreate(AlertDialog.java:260) at android.app.Dialog.dispatchOnCreate(Dialog.java:402) at android.app.Dialog.show(Dialog.java:301) at com.yarolegovich.lovelydialog.AbsLovelyDialog.show(AbsLovelyDialog.java:163) at ytstudios.wall.bucket.MainActivity$checkForAppUpdates.onPostExecute(MainActivity.java:333) at ytstudios.wall.bucket.MainActivity$checkForAppUpdates.onPostExecute(MainActivity.java:286) at android.os.AsyncTask.finish(AsyncTask.java:673) at android.os.AsyncTask.-wrap1(AsyncTask.java) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:690) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6236) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
How should I fix this ?
I have an asynTask on preExecute im showing the dialog, but i need to make it go away on postExecute, any ideas?
Is it possible to show the dialogue in Immersive Mode (without navigation buttons)??
Hello, can we have some way that don't show again is checked by default? I can't seem to find any such option there.
i tried adding textSize in style.xml but it only affect the button (positive, negative & neutral button). The title and description text stay same.
<style name="quitAlert" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:gravity">center</item>
<item name="android:textSize">50sp</item>
</style>
how do i make this dialog to display my custom activity or have a custom look to the display e.g. display an order or checkout form, or a login form? And how is the CustomDalog option used? Any example?
How can i change colot text setTopTitle ?
thanks!
I install LovelyDialog with gradle,and copy your code to my project, but
iconView = findView(R.id.ld_icon);
titleView = findView(R.id.ld_title);
messageView = findView(R.id.ld_message);
topTitleView = findView(R.id.ld_top_title);
iconView,titleView,messageView and topTitleView always is null
And I install LovelyDialog with gradle in a new project,it's normal.
Need to disable auto dismiss /cancel feature for all dialogs :)
When I try to add the setTitle method it returns null and does not show anything on the title section. How can I fix it? Thanks.
Is there a way to trap/prevent confirmation if the number of selected items does not satisfy/meet your required count?
Is it possible to have multiple Text field. I want to use it for adding home address?
Like address 1, address 2, Zip Code
Thanks!
Hi
Is it possible that you will add negative button to LovelyTextInputDialog?
I think the TextInputDialog should have a method that returns the EditText of the dialog itself so we can edit it programmatically Like settings the text change inputType ...etc
In the tutorial you have set the topColor like this
.setTopColor(color(R.color.indigo))
you are sending the color id into some kind of color90 function what is it. And if I try this
setTopColor(R.color.my_custom_color)
it is always showing same dark grey type of color ,
Hi,
Is it possible to change the style of the font? If Yes, How?
Thanks in advance!
Ankur J.
I'm using custom view for displaying two EditTexts.
But i'm unable to dismiss the dialog.
And i'm checking whether they are empty or not. If empty, then an error is displayed on edittext.
And if not empty then performing some task.
But the problem here is after performing the tasks the dialog is not dismissed.
Hello, I have run into 2 issues.
I'm using Fragments to inflate my main_layout because of the way I use a Navigation Drawer on my app.
So while using:
new LovelyStandardDialog(this)
.setTopColor(color(R.color.indigo))
.setButtonsColor(color(R.color.darkDeepOrange))
.setIcon(R.drawable.ic_star_border_white_36dp)
.setTitle(R.string.rate_title)
.setMessage(R.string.rate_message)
.setPositiveButton(android.R.string.ok, new View.OnClickListener() {
@OverRide
public void onClick(View v) {
Toast.makeText(context, "positive clicked", Toast.LENGTH_SHORT).show();
}
})
.setNegativeButton(android.R.string.no, null)
.show();
I ran into an issue where I had to replace the "new LovelyStandardDialog(this)" for "new LovelyStandardDialog(getActivity())" so I could get rid of the errors, but while trying to use both .setTopColor(...) and .setButtonsColor(...) I always get an error message saying "method called expected".
I'm fairly new to using libraries so I'm probably doing something wrong, any suggestions?
Here's my code:
Hello
Thank you for awesome library
How can i set custom type face for title message and buttons
Thx
When I am trying to put listview inside LovelyDialog it is showing nothing?? Why
On thing I've noticed is that the setPositiveButton and related calls use View OnClick instead of the Dialog OnClick, this makes converting existing dialogs more work than they need to be.
How to check if i cancel a dialog ?
Hi,
I tried to do this:
.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD)
But that doesn't work...
Does anyone have an idea of how to use a password mask in this textinput?
Hi there,
Is there any way to set the gravity of the buttons?
I saw that it is possible with the message and title, but not the buttons
Thank you
i am trying to use your custom dialog, but i am having a problem. I cannot access the EditText strings, every time i push it to the database it shows up as an empty string like this "". Will you please help? There is no problem with passing hardcoded strings to the database, the only problem is with converting edittext to string and passing it to the database, it just comes up like this "". I think it is something wrong with how i configured my view, i had to guess because i could not find any examples of the custom dialog. here is my code
public class MainActivity extends AppCompatActivity {
private static final int ID_TEXT_INPUT_DIALOG = R.id.fab;
private String mUsername;
private String mPhotoUrl;
private SharedPreferences mSharedPreferences;
private GoogleSignInClient mSignInClient;
private static final String MESSAGE_URL = "http://pantryapp.firebase.google.com/message/";
public static final String ANONYMOUS = "anonymous";
public static final String FOODS_CHILD = "Pantry2";
private DrawerLayout mDrawerLayout;
private EditText mName, mQuantity, mLifecycle;
// Firebase instance variables
private FirebaseAuth mFirebaseAuth;
private FirebaseUser mFirebaseUser;
private DatabaseReference mFirebaseDatabaseReference;
private View PrivateChatsView;
FirebaseDatabase database = FirebaseDatabase.getInstance();
private DatabaseReference mRef = database.getReference("foods");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//remove below if it breaks
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
// Set default username as anonymous.
mUsername = ANONYMOUS;
// Initialize Firebase Auth
mFirebaseAuth = FirebaseAuth.getInstance();
mFirebaseUser = mFirebaseAuth.getCurrentUser();
if (mFirebaseUser == null) {
// Not signed in, launch the Sign In activity
startActivity(new Intent(this, SignInActivity.class));
finish();
return;
} else {
mUsername = mFirebaseUser.getDisplayName();
if (mFirebaseUser.getPhotoUrl() != null) {
mPhotoUrl = mFirebaseUser.getPhotoUrl().toString();
}
}
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final ActionBar ab = getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
ab.setDisplayHomeAsUpEnabled(true);
//new child entries
mFirebaseDatabaseReference = FirebaseDatabase.getInstance().getReference();
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
if (navigationView != null) {
setupDrawerContent(navigationView);
}
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
if (viewPager != null) {
setupViewPager(viewPager);
}
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
//this is the one with all three fields that works.
showEditDialog();
}
});
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
private void showTextInputDialog(Bundle savedInstanceState) {
new LovelyTextInputDialog(this, R.style.EditTextTintTheme)
.setTopColorRes(R.color.PINK)
.setTitle(R.string.text_input_title)
.setMessage(R.string.text_input_message)
.setIcon(R.drawable.ic_forum)
.setInstanceStateHandler(ID_TEXT_INPUT_DIALOG, new LovelySaveStateHandler())
.setConfirmButton(android.R.string.ok, new LovelyTextInputDialog.OnTextInputConfirmListener() {
@Override
public void onTextInputConfirmed(String text) {
Toast.makeText(MainActivity.this,"Added "+ text, Toast.LENGTH_SHORT).show();
}
})
.setSavedInstanceState(savedInstanceState)
.show();
}
private void showEditDialog(){
final Context context = this;
final LovelyCustomDialog mDialog = new LovelyCustomDialog(context);
mDialog.setView(R.layout.item_donate_option);
LayoutInflater inflater = this.getLayoutInflater();
mDialog.setTopColorRes(R.color.PINK);
mDialog.setTitle(R.string.text_input_title);
mDialog.setInstanceStateHandler(ID_TEXT_INPUT_DIALOG, new LovelySaveStateHandler());
mDialog.show();
mDialog.setListener(R.id.ld_btn_confirm, new View.OnClickListener() {
@Override
public void onClick(View view) {
final View v = getLayoutInflater().inflate(R.layout.item_donate_option, null);
final EditText name = (EditText) v.findViewById(R.id.item_name);
final EditText quantity = (EditText) v.findViewById(R.id.item_quantity);
final EditText lifecycle = (EditText) v.findViewById(R.id.item_lifecycle);
String mName = name.getText().toString().trim();
String mQuantity = quantity.getText().toString().trim();
String mLifecycle = lifecycle.getText().toString().trim();
String id = "1";
Foods food = new Foods(mName, mQuantity, mLifecycle);
String lemon = "lemon";
String quant = "3";
String life = "5";
DatabaseReference foodRef = mRef.child("Pantry");
DatabaseReference newFoodRef = foodRef.push();
newFoodRef.setValue(food);
mRef.child("Pantry").setValue(new Foods(lemon, quant, life));
Snackbar.make(view, "Added a " + food.getmName(), Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
public void writeNewFood(String name, String quantity, String lifecycle) {
Foods foods = new Foods(name, quantity, lifecycle);
mRef.child(name).setValue(foods);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.sample_actions, menu);
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
switch (AppCompatDelegate.getDefaultNightMode()) {
case AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM:
menu.findItem(R.id.menu_night_mode_system).setChecked(true);
break;
case AppCompatDelegate.MODE_NIGHT_AUTO:
menu.findItem(R.id.menu_night_mode_auto).setChecked(true);
break;
case AppCompatDelegate.MODE_NIGHT_YES:
menu.findItem(R.id.menu_night_mode_night).setChecked(true);
break;
case AppCompatDelegate.MODE_NIGHT_NO:
menu.findItem(R.id.menu_night_mode_day).setChecked(true);
break;
}
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.sign_out_menu:
mFirebaseAuth.signOut();
mSignInClient.signOut();
mUsername = ANONYMOUS;
startActivity(new Intent(this, SignInActivity.class));
finish();
return true;
default:
return super.onOptionsItemSelected(item);
case android.R.id.home:
mDrawerLayout.openDrawer(GravityCompat.START);
return true;
case R.id.menu_night_mode_system:
setNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
break;
case R.id.menu_night_mode_day:
setNightMode(AppCompatDelegate.MODE_NIGHT_NO);
break;
case R.id.menu_night_mode_night:
setNightMode(AppCompatDelegate.MODE_NIGHT_YES);
break;
case R.id.menu_night_mode_auto:
setNightMode(AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY);
break;
}
return super.onOptionsItemSelected(item);
}
And here is my layout file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<include layout="@layout/view_color_area" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/texts">
<Space
android:layout_width="wrap_content"
android:layout_height="12dp" />
<include layout="@layout/view_title_and_message" />
<EditText
android:id="@+id/item_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:ems="20"
android:hint="@string/food_name"
android:padding="22dp" />
<EditText
android:id="@+id/item_quantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:ems="20"
android:hint="@string/item_quantity"
android:padding="22dp" />
<EditText
android:id="@+id/item_lifecycle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:ems="20"
android:hint="@string/item_lifecycle_in_days"
android:padding="22dp" />
<Space
android:layout_width="wrap_content"
android:layout_height="8dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:orientation="horizontal">
<Button
android:id="@+id/ld_btn_confirm"
style="@style/DialogButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@android:string/ok"/>
</LinearLayout>
</LinearLayout>
Please can you help me i have been working on this for days. Its my first android project and i really need to figure this out. Thank you for your time, You are my last hope.
Hello! Thanks for the awesome library!
How to check if dialog is open?
how can i call this dialog from thread ??
Is it possible to add a fragment to the view ?
I have tried this :
Dialog showw = new LovelyCustomDialog(this)
.setTopColorRes(R.color.yellow)
.setIcon(R.drawable.ic_menu_camera)
.setView(R.layout.fragment_maps)
.configureView(new LovelyCustomDialog.ViewConfigurator() {
public ImageView mImageView;
@Override
public void configureView(final View v) {
FrameLayout mapContainer= (FrameLayout) v.findViewById(R.id.mapView);
SupportMapFragment fragment = new SupportMapFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.add(mapContainer.getId(), fragment).commit();
}
})
.show();
How i dismiss the dialog....
I'm showing multiple items to choose when the dialog opens, I want to show some of the items pre-selected. How can I do that?
Great library, I will use it for my app. Could you maybe add more color options?
Since my app offers a dark mode, I need to be able to change the color of the background of the dialog and the text colors. Otherwise it's perfect! Thank you very much.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.