-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepared a template for displaying details of a message. Described on…
…ly logic. No design.
- Loading branch information
Showing
21 changed files
with
619 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
FlowCrypt/src/main/java/com/flowcrypt/email/api/email/model/MessageInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package com.flowcrypt.email.api.email.model; | ||
|
||
import android.os.Parcel; | ||
import android.os.Parcelable; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Date; | ||
|
||
/** | ||
* Simple POJO class which describe a message model. | ||
* | ||
* @author DenBond7 | ||
* Date: 04.05.2017 | ||
* Time: 9:57 | ||
* E-mail: DenBond7@gmail.com | ||
*/ | ||
|
||
public class MessageInfo implements Parcelable { | ||
public static final Creator<MessageInfo> CREATOR = new Creator<MessageInfo>() { | ||
@Override | ||
public MessageInfo createFromParcel(Parcel source) { | ||
return new MessageInfo(source); | ||
} | ||
|
||
@Override | ||
public MessageInfo[] newArray(int size) { | ||
return new MessageInfo[size]; | ||
} | ||
}; | ||
|
||
private String subject; | ||
private ArrayList<String> from; | ||
private String message; | ||
private Date receiveDate; | ||
|
||
public MessageInfo() { | ||
} | ||
|
||
protected MessageInfo(Parcel in) { | ||
this.subject = in.readString(); | ||
this.from = in.createStringArrayList(); | ||
this.message = in.readString(); | ||
long tmpReceiveDate = in.readLong(); | ||
this.receiveDate = tmpReceiveDate == -1 ? null : new Date(tmpReceiveDate); | ||
} | ||
|
||
@Override | ||
public int describeContents() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void writeToParcel(Parcel dest, int flags) { | ||
dest.writeString(this.subject); | ||
dest.writeStringList(this.from); | ||
dest.writeString(this.message); | ||
dest.writeLong(this.receiveDate != null ? this.receiveDate.getTime() : -1); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "MessageInfo{" + | ||
"subject='" + subject + '\'' + | ||
", from=" + from + | ||
", message='" + message + '\'' + | ||
", receiveDate=" + receiveDate + | ||
'}'; | ||
} | ||
|
||
public String getSubject() { | ||
return subject; | ||
} | ||
|
||
public void setSubject(String subject) { | ||
this.subject = subject; | ||
} | ||
|
||
public ArrayList<String> getFrom() { | ||
return from; | ||
} | ||
|
||
public void setFrom(ArrayList<String> from) { | ||
this.from = from; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
public Date getReceiveDate() { | ||
return receiveDate; | ||
} | ||
|
||
public void setReceiveDate(Date receiveDate) { | ||
this.receiveDate = receiveDate; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/MessageDetailsActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.flowcrypt.email.ui.activity; | ||
|
||
import android.accounts.Account; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v7.widget.Toolbar; | ||
import android.text.TextUtils; | ||
import android.view.View; | ||
|
||
import com.flowcrypt.email.BuildConfig; | ||
import com.flowcrypt.email.R; | ||
import com.flowcrypt.email.api.email.model.GeneralMessageDetails; | ||
import com.flowcrypt.email.ui.activity.base.BaseAuthenticationActivity; | ||
import com.flowcrypt.email.ui.activity.fragment.MessageDetailsFragment; | ||
import com.flowcrypt.email.util.UIUtil; | ||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount; | ||
import com.google.android.gms.auth.api.signin.GoogleSignInResult; | ||
|
||
/** | ||
* This activity describe details of some message. | ||
* | ||
* @author DenBond7 | ||
* Date: 03.05.2017 | ||
* Time: 16:29 | ||
* E-mail: DenBond7@gmail.com | ||
*/ | ||
public class MessageDetailsActivity extends BaseAuthenticationActivity { | ||
public static final String EXTRA_KEY_GENERAL_MESSAGE_DETAILS = BuildConfig.APPLICATION_ID + "" + | ||
".EXTRA_KEY_GENERAL_MESSAGE_DETAILS"; | ||
|
||
private GeneralMessageDetails generalMessageDetails; | ||
|
||
public static Intent getIntent(Context context, GeneralMessageDetails generalMessageDetails) { | ||
Intent intent = new Intent(context, MessageDetailsActivity.class); | ||
intent.putExtra(EXTRA_KEY_GENERAL_MESSAGE_DETAILS, generalMessageDetails); | ||
return intent; | ||
} | ||
|
||
@Override | ||
public View getRootView() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void handleSignInResult(GoogleSignInResult googleSignInResult, boolean isOnStartCall) { | ||
if (googleSignInResult.isSuccess()) { | ||
GoogleSignInAccount googleSignInAccount = googleSignInResult.getSignInAccount(); | ||
if (googleSignInAccount != null) { | ||
updateMessageDetailsFragment(googleSignInAccount.getAccount()); | ||
} | ||
} else if (!TextUtils.isEmpty(googleSignInResult.getStatus().getStatusMessage())) { | ||
UIUtil.showInfoSnackbar(getRootView(), googleSignInResult.getStatus() | ||
.getStatusMessage()); | ||
} | ||
} | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
initViews(); | ||
if (getIntent() != null && getIntent().hasExtra(EXTRA_KEY_GENERAL_MESSAGE_DETAILS)) { | ||
this.generalMessageDetails = getIntent().getParcelableExtra | ||
(EXTRA_KEY_GENERAL_MESSAGE_DETAILS); | ||
} | ||
} | ||
|
||
private void updateMessageDetailsFragment(Account account) { | ||
MessageDetailsFragment messageDetailsFragment = (MessageDetailsFragment) | ||
getSupportFragmentManager() | ||
.findFragmentById(R.id.messageDetailsFragment); | ||
|
||
if (messageDetailsFragment != null) { | ||
messageDetailsFragment.setGeneralMessageDetails(generalMessageDetails); | ||
messageDetailsFragment.updateAccount(account); | ||
} | ||
} | ||
|
||
private void initViews() { | ||
setContentView(R.layout.activity_message_details); | ||
|
||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
setSupportActionBar(toolbar); | ||
|
||
if (getSupportActionBar() != null) { | ||
getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.