Implementata prima parte del bottomSheet
This commit is contained in:
@@ -14,8 +14,8 @@ public class RESTBuilder {
|
||||
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(new HttpInterceptor()).build();
|
||||
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("http://192.168.2.13:8080/ems-api/")
|
||||
// .baseUrl("http://www2.studioml.it/ems-api/")
|
||||
// .baseUrl("http://192.168.2.13:8080/ems-api/")
|
||||
.baseUrl("http://www2.studioml.it/ems-api/")
|
||||
.client(client)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.build();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -64,10 +65,15 @@ public class MtbColt extends EntityBase{
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataCollo() {
|
||||
public String getDataColloS() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public Date getDataColloD() throws ParseException {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
return sdf.parse(getDataColloS());
|
||||
}
|
||||
|
||||
public MtbColt setDataCollo(String dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
|
||||
@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
|
||||
public class UtilityDimension {
|
||||
@@ -13,7 +14,12 @@ public class UtilityDimension {
|
||||
size,
|
||||
r.getDisplayMetrics()
|
||||
);
|
||||
}
|
||||
|
||||
public static float convertDpToPixel(float dp){
|
||||
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
|
||||
float px = dp * (metrics.densityDpi / 160f);
|
||||
return Math.round(px);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.gest.accettazione;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
@@ -10,12 +11,13 @@ import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.net.SocketException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -121,7 +123,7 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
||||
|
||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
||||
if(errorMessage == null) errorMessage = ex.getMessage();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(getActivity(), errorMessage, null).show();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(getActivity(), new SpannableString(errorMessage), null, null).show();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -241,14 +243,25 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
||||
final ProgressDialog progress = ProgressDialog.show(getActivity(), getText(R.string.waiting),
|
||||
getText(R.string.loading) + " ...", true);
|
||||
|
||||
helper.retrievePiclingList(barcodes, new ILoadPickingListCallback() {
|
||||
helper.retrievePickingList(barcodes, new ILoadPickingListCallback() {
|
||||
@Override
|
||||
public void onLoadSuccess(List<OrdineAccettazioneDTO> ordini) {
|
||||
public void onLoadSuccess(final List<OrdineAccettazioneDTO> ordini) {
|
||||
progress.dismiss();
|
||||
|
||||
Intent myIntent = new Intent(getActivity(), AccettazioneOrdineInevasoActivity.class);
|
||||
myIntent.putExtra("key", (ArrayList<OrdineAccettazioneDTO>) ordini); //Optional parameters
|
||||
getActivity().startActivity(myIntent);
|
||||
DialogSimpleMessageHelper.makeInfoDialog(getActivity(),
|
||||
getText(R.string.orders).toString(),
|
||||
Html.fromHtml(String.format(getText(R.string.loaded_orders_message).toString(), ordini.size())),
|
||||
null,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
|
||||
Intent myIntent = new Intent(getActivity(), AccettazioneOrdineInevasoActivity.class);
|
||||
myIntent.putExtra("key", (ArrayList<OrdineAccettazioneDTO>) ordini); //Optional parameters
|
||||
getActivity().startActivity(myIntent);
|
||||
|
||||
}
|
||||
}).show();
|
||||
|
||||
}
|
||||
|
||||
@@ -259,7 +272,7 @@ public class MainAccettazioneFragment extends Fragment implements ICheckBoxCallb
|
||||
|
||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
||||
if(errorMessage == null) errorMessage = ex.getMessage() + "\n" + ex.getCause().getCause().getMessage();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(getActivity(), errorMessage, null).show();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(getActivity(), new SpannableString(errorMessage), null, null).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class AccettazioneHelper {
|
||||
});
|
||||
}
|
||||
|
||||
public void retrievePiclingList(List<String> barcodeOrdini, final ILoadPickingListCallback callback){
|
||||
public void retrievePickingList(List<String> barcodeOrdini, final ILoadPickingListCallback callback){
|
||||
|
||||
String joinedBarcodes = TextUtils.join(",", barcodeOrdini);
|
||||
|
||||
|
||||
@@ -2,15 +2,20 @@ package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.support.design.widget.BottomSheetBehavior;
|
||||
import android.support.design.widget.BottomSheetDialog;
|
||||
import android.support.v4.widget.NestedScrollView;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.SpannableString;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.clans.fab.FloatingActionButton;
|
||||
@@ -36,6 +41,7 @@ import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core.Accetta
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core.MainListOrdineAccettazioneAdapter;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto.AccettazioneOrdineInevasoOrderBy;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.views.NoteAggiuntiveNuovaULDialog;
|
||||
import it.integry.integrywmsnative.view.ArticoliInColloBottomSheetHelper;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
||||
|
||||
public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
@@ -48,6 +54,8 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
@BindView(R.id.accettazione_ordine_inevaso_fab_item1) FloatingActionButton fabItem1;
|
||||
@BindView(R.id.accettazione_ordine_inevaso_fab_item2) FloatingActionButton fabItem2;
|
||||
|
||||
@BindView(R.id.bottom_sheet1) View layoutBottomSheet;
|
||||
|
||||
|
||||
private MainListOrdineAccettazioneAdapter mAdapter;
|
||||
private RecyclerView.LayoutManager mLayoutManager;
|
||||
@@ -61,6 +69,7 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
private Context mContext = this;
|
||||
private ArticoliInColloBottomSheetHelper mArticoliInColloBottomSheetHelper;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -86,6 +95,8 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
groupedRighe = helper.getOrdiniRaggruppatiPerCodArtForn(groupedOrdini);
|
||||
|
||||
initRecyclerView(groupedRighe);
|
||||
|
||||
initBottomDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,11 +148,15 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
mAdapter = helper.getRightListAdapter(AccettazioneOrdineInevasoOrderBy.Enum.COD_ART_FOR, groupedRighe);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(this, e.toString(), null).show();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(this, new SpannableString(e.toString()), null, null).show();
|
||||
}
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
private void initBottomDialog(){
|
||||
|
||||
mArticoliInColloBottomSheetHelper = new ArticoliInColloBottomSheetHelper(this, layoutBottomSheet);
|
||||
}
|
||||
|
||||
|
||||
private void showOrderDialog() {
|
||||
@@ -215,7 +230,8 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
ColliMagazzinoRESTConsumer.saveCollo(mtbColt, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
DialogSimpleMessageHelper.makeInfoDialog(mContext, "Salvataggio", "Salvataggio collo avvenuto con successo\nNumero collo: " + value.getNumCollo(), null).show();
|
||||
mArticoliInColloBottomSheetHelper.initCollo(value);
|
||||
DialogSimpleMessageHelper.makeInfoDialog(mContext, "Creazione UL",new SpannableString("Salvataggio collo avvenuto con successo"), null, null).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -223,7 +239,7 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
||||
|
||||
if(errorMessage == null) errorMessage = ex.getMessage();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(mContext, errorMessage, null).show();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(mContext, new SpannableString(errorMessage), null, null).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
package it.integry.integrywmsnative.view;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.AppBarLayout;
|
||||
import android.support.design.widget.BottomSheetBehavior;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.AppCompatButton;
|
||||
import android.support.v7.widget.AppCompatTextView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.SpannableString;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
||||
|
||||
|
||||
public class ArticoliInColloBottomSheetHelper extends BottomSheetBehavior.BottomSheetCallback {
|
||||
|
||||
private AppCompatActivity mActivity;
|
||||
|
||||
@BindView(R.id.articoli_in_collo_sheet_button) AppCompatButton mSheetButtonToggle;
|
||||
@BindView(R.id.articoli_in_collo_close_collo) AppCompatButton mCloseULButton;
|
||||
@BindView(R.id.articoli_in_collo_title) AppCompatTextView mTitleTextView;
|
||||
@BindView(R.id.articoli_in_collo_details_date) AppCompatTextView mDetailDateTextView;
|
||||
@BindView(R.id.articoli_in_collo_details_posizione) AppCompatTextView mDetailPosizioneTextView;
|
||||
@BindView(R.id.articoli_in_collo_details_preparatoDa) AppCompatTextView mDetailPreparatoDaTextView;
|
||||
|
||||
@BindView(R.id.appbar_bottom_sheet) AppBarLayout appBarLayoutBottomSheet;
|
||||
@BindView(R.id.toolbar_bottom_sheet) Toolbar toolbarBottomSheet;
|
||||
|
||||
@BindView(R.id.tap_action_layout) RelativeLayout tapActionLayout;
|
||||
private BottomSheetBehavior mBottomSheetBehavior;
|
||||
|
||||
private MtbColt mMtbColt;
|
||||
|
||||
public ArticoliInColloBottomSheetHelper(AppCompatActivity context, View rootView){
|
||||
mActivity = context;
|
||||
|
||||
ButterKnife.bind(this, rootView);
|
||||
|
||||
mBottomSheetBehavior = BottomSheetBehavior.from(rootView);
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
mBottomSheetBehavior.setBottomSheetCallback(this);
|
||||
|
||||
toolbarBottomSheet.setNavigationIcon(R.drawable.ic_close_24dp);
|
||||
toolbarBottomSheet.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(mBottomSheetBehavior.getState()==BottomSheetBehavior.STATE_EXPANDED) {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
tapActionLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(mBottomSheetBehavior.getState()==BottomSheetBehavior.STATE_COLLAPSED) {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mCloseULButton.setText(mActivity.getText(R.string.action_close_ul) + " ");
|
||||
updateRigheNumber(0);
|
||||
|
||||
}
|
||||
|
||||
public void initCollo(MtbColt mtbColt){
|
||||
this.mMtbColt = mtbColt;
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy");
|
||||
|
||||
mTitleTextView.setText(String.format(mActivity.getText(R.string.articoli_in_collo_sheet_title).toString(), mtbColt.getNumCollo()));
|
||||
try {
|
||||
mDetailDateTextView.setText(sdf.format(mtbColt.getDataColloD()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(mActivity, new SpannableString(e.toString()), null, null).show();
|
||||
}
|
||||
|
||||
mDetailPosizioneTextView.setText(mtbColt.getPosizione() != null ? mtbColt.getPosizione() : "N/A");
|
||||
mDetailPreparatoDaTextView.setText(mtbColt.getPreparatoDa() != null ? mtbColt.getPreparatoDa() : "N/A");
|
||||
|
||||
}
|
||||
|
||||
public void updateRigheNumber(int newRigheNumber){
|
||||
mSheetButtonToggle.setText(" " + newRigheNumber + " " + mActivity.getResources().getQuantityString(R.plurals.articles, newRigheNumber));
|
||||
}
|
||||
|
||||
@OnClick(R.id.articoli_in_collo_sheet_button)
|
||||
public void onClick(View view) {
|
||||
if (mBottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
} else {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChanged(@NonNull View bottomSheet, int newState) {
|
||||
switch (newState) {
|
||||
case BottomSheetBehavior.STATE_HIDDEN:
|
||||
// mRootView.scrollTo(0, 0);
|
||||
break;
|
||||
case BottomSheetBehavior.STATE_EXPANDED:
|
||||
break;
|
||||
case BottomSheetBehavior.STATE_COLLAPSED:
|
||||
// mRootView.scrollTo(0, 0);
|
||||
break;
|
||||
case BottomSheetBehavior.STATE_DRAGGING:
|
||||
// mRootView.scrollTo(0, 0);
|
||||
break;
|
||||
case BottomSheetBehavior.STATE_SETTLING:
|
||||
// mRootView.scrollTo(0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
|
||||
appBarLayoutBottomSheet.setAlpha(slideOffset);
|
||||
tapActionLayout.setAlpha(1-slideOffset);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,11 +3,26 @@ package it.integry.integrywmsnative.view.dialogs;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.constraint.ConstraintLayout;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.AppCompatImageView;
|
||||
import android.support.v7.widget.AppCompatTextView;
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import de.hdodenhof.circleimageview.CircleImageView;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDimension;
|
||||
|
||||
/**
|
||||
* Created by GiuseppeS on 22/03/2018.
|
||||
@@ -17,8 +32,9 @@ public class DialogSimpleMessageHelper {
|
||||
|
||||
public enum TYPE {
|
||||
INFO(1),
|
||||
WARNING(2),
|
||||
ERROR(3);
|
||||
SUCCESS(2),
|
||||
WARNING(3),
|
||||
ERROR(4);
|
||||
|
||||
private int value;
|
||||
TYPE(int value) {
|
||||
@@ -36,40 +52,69 @@ public class DialogSimpleMessageHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private static AlertDialog makeBase(TYPE type, Context mContext, String titleText, String messageText, DialogInterface.OnClickListener onPositiveClick, DialogInterface.OnClickListener onNegativeClick){
|
||||
private static AlertDialog makeBase(TYPE type, Context mContext, String titleText, Spanned messageText, HashMap<String, String> hashmapContent, DialogInterface.OnClickListener onPositiveClick, DialogInterface.OnClickListener onNegativeClick){
|
||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||
View titleView = inflater.inflate(R.layout.dialog_custom_header, null);
|
||||
|
||||
int colorBackgroundTitle = -1;
|
||||
int colorTextTitle = -1;
|
||||
Drawable titleIconRes = null;
|
||||
|
||||
switch (type){
|
||||
case INFO:
|
||||
colorBackgroundTitle = mContext.getResources().getColor(R.color.colorPrimary);
|
||||
colorTextTitle = mContext.getResources().getColor(android.R.color.white);
|
||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.colorPrimary);
|
||||
titleIconRes = mContext.getResources().getDrawable(R.drawable.ic_info_24dp);
|
||||
break;
|
||||
|
||||
case SUCCESS:
|
||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.green_500);
|
||||
titleIconRes = mContext.getResources().getDrawable(R.drawable.ic_done_white_24dp);
|
||||
break;
|
||||
|
||||
case WARNING:
|
||||
colorBackgroundTitle = mContext.getResources().getColor(R.color.yellow_600);
|
||||
colorTextTitle = mContext.getResources().getColor(android.R.color.black);
|
||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.yellow_600);
|
||||
titleIconRes = mContext.getResources().getDrawable(R.drawable.ic_warning_white_24dp);
|
||||
break;
|
||||
|
||||
case ERROR:
|
||||
colorBackgroundTitle = mContext.getResources().getColor(R.color.red_600);
|
||||
colorTextTitle = mContext.getResources().getColor(android.R.color.white);
|
||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.red_600);
|
||||
titleIconRes = mContext.getResources().getDrawable(R.drawable.ic_error_white_24dp);
|
||||
break;
|
||||
}
|
||||
|
||||
View backgroundView = titleView.findViewById(R.id.llsubhead);
|
||||
backgroundView.setBackgroundColor(colorBackgroundTitle);
|
||||
TextView title = (TextView) titleView.findViewById(R.id.exemptionSubHeading4);
|
||||
//Title VIEW
|
||||
View titleView = inflater.inflate(R.layout.dialog_custom_header, null);
|
||||
TextView title = titleView.findViewById(R.id.title_text);
|
||||
title.setText(titleText);
|
||||
title.setTextColor(colorTextTitle);
|
||||
|
||||
AppCompatImageView civ = titleView.findViewById(R.id.title_icon);
|
||||
ColorStateList colorStateList = ColorStateList.valueOf(colorBackgroundTitle);
|
||||
civ.setImageTintList(colorStateList);
|
||||
civ.setImageDrawable(titleIconRes);
|
||||
|
||||
//Content View
|
||||
View contentView = inflater.inflate(R.layout.dialog_custom_content, null);
|
||||
TextView contentMessage = contentView.findViewById(R.id.dialog_content_main_message);
|
||||
contentMessage.setText(messageText);
|
||||
|
||||
LinearLayout hashMapContainer = contentView.findViewById(R.id.dialog_content_hashmap);
|
||||
|
||||
if(hashmapContent != null) {
|
||||
for (int i = 0; i < hashmapContent.keySet().size(); i++) {
|
||||
String currentKey = hashmapContent.keySet().toArray()[i].toString();
|
||||
String currentValue = hashmapContent.get(currentKey);
|
||||
|
||||
RelativeLayout singleMapContent = (RelativeLayout) inflater.inflate(R.layout.dialog_custom_content_hashmap_viewmodel, null);
|
||||
((TextView) singleMapContent.findViewById(R.id.dialog_content_hashmap_key)).setText(currentKey);
|
||||
((TextView) singleMapContent.findViewById(R.id.dialog_content_hashmap_value)).setText(currentValue);
|
||||
|
||||
hashMapContainer.addView(singleMapContent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext)
|
||||
.setCustomTitle(titleView)
|
||||
.setMessage(messageText)
|
||||
.setView(contentView)
|
||||
// .setMessage(messageText)
|
||||
.setPositiveButton(mContext.getText(R.string.ok), onPositiveClick);
|
||||
|
||||
if(onNegativeClick != null){
|
||||
@@ -83,31 +128,45 @@ public class DialogSimpleMessageHelper {
|
||||
}
|
||||
|
||||
|
||||
public static AlertDialog makeInfoDialog(Context mContext, String titleText, String messageText, DialogInterface.OnClickListener onPositiveClick){
|
||||
public static AlertDialog makeInfoDialog(Context mContext, String titleText, Spanned messageText, HashMap<String, String> hashmapContent, DialogInterface.OnClickListener onPositiveClick){
|
||||
return makeBase(TYPE.INFO,
|
||||
mContext,
|
||||
titleText,
|
||||
messageText,
|
||||
hashmapContent,
|
||||
onPositiveClick,
|
||||
null);
|
||||
}
|
||||
|
||||
|
||||
public static AlertDialog makeWarningDialog(Context mContext, String messageText, DialogInterface.OnClickListener onPositiveClick){
|
||||
public static AlertDialog makeSuccessDialog(Context mContext, String titleText, Spanned messageText, HashMap<String, String> hashmapContent, DialogInterface.OnClickListener onPositiveClick){
|
||||
return makeBase(TYPE.SUCCESS,
|
||||
mContext,
|
||||
titleText,
|
||||
messageText,
|
||||
hashmapContent,
|
||||
onPositiveClick,
|
||||
null);
|
||||
}
|
||||
|
||||
|
||||
public static AlertDialog makeWarningDialog(Context mContext, Spanned messageText, HashMap<String, String> hashmapContent, DialogInterface.OnClickListener onPositiveClick){
|
||||
return makeBase(TYPE.WARNING,
|
||||
mContext,
|
||||
mContext.getText(R.string.warning).toString(),
|
||||
messageText,
|
||||
hashmapContent,
|
||||
onPositiveClick,
|
||||
null);
|
||||
}
|
||||
|
||||
public static AlertDialog makeErrorDialog(Context mContext, String messageText, DialogInterface.OnClickListener onPositiveClick){
|
||||
public static AlertDialog makeErrorDialog(Context mContext, Spanned messageText, HashMap<String, String> hashmapContent, DialogInterface.OnClickListener onPositiveClick){
|
||||
|
||||
return makeBase(TYPE.ERROR,
|
||||
mContext,
|
||||
mContext.getText(R.string.error).toString(),
|
||||
messageText,
|
||||
hashmapContent,
|
||||
onPositiveClick,
|
||||
null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user