mirror of https://github.com/readrops/Readrops.git
Changed from DialogFragment to MaterialDialog
This commit is contained in:
parent
f70a0551b4
commit
6b56e914b3
|
@ -1,7 +1,6 @@
|
|||
package com.readrops.app.activities;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.DialogFragment;
|
||||
import android.app.DownloadManager;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
|
@ -40,7 +39,6 @@ import com.google.android.material.appbar.AppBarLayout;
|
|||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.readrops.app.R;
|
||||
import com.readrops.app.fragments.ImageCaptionFragment;
|
||||
import com.readrops.readropsdb.entities.Item;
|
||||
import com.readrops.readropsdb.pojo.ItemWithFeed;
|
||||
import com.readrops.app.utils.DateUtils;
|
||||
|
@ -315,9 +313,10 @@ public class ItemActivity extends AppCompatActivity {
|
|||
imageTitle = "";
|
||||
}
|
||||
}
|
||||
|
||||
DialogFragment newFragment = ImageCaptionFragment.newInstance(urlToDownload, imageTitle);
|
||||
newFragment.show(getFragmentManager(), "dialog");
|
||||
MaterialDialog.Builder captionBuilder = new MaterialDialog.Builder(this);
|
||||
captionBuilder.title(urlToDownload);
|
||||
captionBuilder.content(imageTitle);
|
||||
captionBuilder.show();
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + position);
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
package com.readrops.app.fragments;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.readrops.app.R;
|
||||
|
||||
public class ImageCaptionFragment extends DialogFragment {
|
||||
|
||||
public static ImageCaptionFragment newInstance(CharSequence title, CharSequence message) {
|
||||
ImageCaptionFragment f = new ImageCaptionFragment();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putCharSequence("title", title);
|
||||
args.putCharSequence("message", message);
|
||||
f.setArguments(args);
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
CharSequence title = getArguments().getCharSequence("title");
|
||||
CharSequence message = getArguments().getCharSequence("message");
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setTitle(title);
|
||||
builder.setMessage(message);
|
||||
builder.setNegativeButton(R.string.back, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
// User cancelled the dialog
|
||||
}
|
||||
});
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue