|
@@ -14,36 +14,37 @@ import android.widget.Toast;
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.Nullable;
|
|
-import androidx.fragment.app.Fragment;
|
|
|
|
|
|
+import androidx.fragment.app.DialogFragment;
|
|
import androidx.lifecycle.Observer;
|
|
import androidx.lifecycle.Observer;
|
|
import androidx.lifecycle.ViewModelProvider;
|
|
import androidx.lifecycle.ViewModelProvider;
|
|
|
|
|
|
import com.noahvogt.miniprojekt.R;
|
|
import com.noahvogt.miniprojekt.R;
|
|
|
|
+import com.noahvogt.miniprojekt.ui.DataBase.Message;
|
|
|
|
+import com.noahvogt.miniprojekt.ui.home.CustomAdapter;
|
|
|
|
+import com.noahvogt.miniprojekt.ui.slideshow.EmailViewModel;
|
|
|
|
|
|
|
|
|
|
-public class MessageShowFragment extends Fragment implements PopupMenu.OnMenuItemClickListener {
|
|
|
|
|
|
+public class MessageShowFragment extends DialogFragment implements PopupMenu.OnMenuItemClickListener {
|
|
|
|
|
|
|
|
|
|
- public TextView sendingAddressObject;
|
|
|
|
|
|
+ public TextView showTo;
|
|
public TextView receivingAddressObject;
|
|
public TextView receivingAddressObject;
|
|
public TextView subjectObject;
|
|
public TextView subjectObject;
|
|
public TextView messageBodyObject;
|
|
public TextView messageBodyObject;
|
|
|
|
|
|
- private MessageShowViewModel messageShowViewModel;
|
|
|
|
|
|
+ private static Message mCurrent;
|
|
|
|
+ private EmailViewModel mEmailViewModel;
|
|
|
|
+ public static MessageShowFragment newInstance(com.noahvogt.miniprojekt.ui.DataBase.Message current) {
|
|
|
|
+ mCurrent = current;
|
|
|
|
+ return new MessageShowFragment();}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // set theming style
|
|
|
|
- /*@Override
|
|
|
|
|
|
+ /* set theming style */
|
|
|
|
+ @Override
|
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
setStyle(DialogFragment.STYLE_NORMAL, R.style.messageCreateTheme);
|
|
setStyle(DialogFragment.STYLE_NORMAL, R.style.messageCreateTheme);
|
|
}
|
|
}
|
|
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-
|
|
|
|
@Nullable
|
|
@Nullable
|
|
@Override
|
|
@Override
|
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
@@ -52,10 +53,10 @@ public class MessageShowFragment extends Fragment implements PopupMenu.OnMenuIte
|
|
|
|
|
|
// init vars
|
|
// init vars
|
|
|
|
|
|
- messageShowViewModel =
|
|
|
|
|
|
+ MessageShowViewModel messageShowViewModel =
|
|
new ViewModelProvider(this).get(MessageShowViewModel.class);
|
|
new ViewModelProvider(this).get(MessageShowViewModel.class);
|
|
View root = inflater.inflate(R.layout.message_show_fragment, container, false);
|
|
View root = inflater.inflate(R.layout.message_show_fragment, container, false);
|
|
- final TextView textView = root.findViewById(R.id.show_message_receiving_address_layout);
|
|
|
|
|
|
+ final TextView textView = root.findViewById(R.id.show_To);
|
|
messageShowViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
|
|
messageShowViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
|
|
@Override
|
|
@Override
|
|
public void onChanged(@Nullable String s) {
|
|
public void onChanged(@Nullable String s) {
|
|
@@ -64,24 +65,19 @@ public class MessageShowFragment extends Fragment implements PopupMenu.OnMenuIte
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
ImageButton closeButton = view.findViewById(R.id.show_message_close_button);
|
|
ImageButton closeButton = view.findViewById(R.id.show_message_close_button);
|
|
ImageButton dotButton = view.findViewById(R.id.show_message_dots_button);
|
|
ImageButton dotButton = view.findViewById(R.id.show_message_dots_button);
|
|
ImageButton attachButton = view.findViewById(R.id.show_message_attach_button);
|
|
ImageButton attachButton = view.findViewById(R.id.show_message_attach_button);
|
|
|
|
|
|
- sendingAddressObject = (EditText) view.findViewById(R.id.create_message_sending_address_text);
|
|
|
|
|
|
+ showTo = (TextView) view.findViewById(R.id.show_To);
|
|
receivingAddressObject = (EditText) view.findViewById(R.id.create_message_receiving_address_text);
|
|
receivingAddressObject = (EditText) view.findViewById(R.id.create_message_receiving_address_text);
|
|
subjectObject = (EditText) view.findViewById(R.id.create_message_subject_text);
|
|
subjectObject = (EditText) view.findViewById(R.id.create_message_subject_text);
|
|
messageBodyObject = (EditText) view.findViewById(R.id.create_message_body_text);
|
|
messageBodyObject = (EditText) view.findViewById(R.id.create_message_body_text);
|
|
|
|
|
|
- // get string vars, MAYBE NOT HERE
|
|
|
|
- String sendingAddress = sendingAddressObject.getText().toString();
|
|
|
|
- String receivingAddress = receivingAddressObject.getText().toString();
|
|
|
|
- //String subject = subjectObject.getText().toString();
|
|
|
|
- String messageBody = messageBodyObject.getText().toString();
|
|
|
|
|
|
+ showTo.setText(mCurrent.getFrom());
|
|
|
|
|
|
|
|
|
|
- /* dosen't wotk cause Activity is not extendet and used as variable */
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -94,7 +90,7 @@ public class MessageShowFragment extends Fragment implements PopupMenu.OnMenuIte
|
|
closeButton.setOnClickListener(new View.OnClickListener() {
|
|
closeButton.setOnClickListener(new View.OnClickListener() {
|
|
@Override
|
|
@Override
|
|
public void onClick(View v) {
|
|
public void onClick(View v) {
|
|
-
|
|
|
|
|
|
+ dismiss();
|
|
}
|
|
}
|
|
|
|
|
|
});
|
|
});
|
|
@@ -116,7 +112,7 @@ public class MessageShowFragment extends Fragment implements PopupMenu.OnMenuIte
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- return root;
|
|
|
|
|
|
+ return view;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|