forked from sockeqwe/mosby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
567 additions
and
7 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
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
50 changes: 50 additions & 0 deletions
50
.../main/java/com/hannesdorfmann/mosby/sample/mail/model/mail/statistics/MailStatistics.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,50 @@ | ||
package com.hannesdorfmann.mosby.sample.mail.model.mail.statistics; | ||
|
||
import android.os.Parcel; | ||
import android.os.Parcelable; | ||
import com.hannesdorfmann.parcelableplease.annotation.ParcelablePlease; | ||
import java.util.ArrayList; | ||
|
||
/** | ||
* @author Hannes Dorfmann | ||
*/ | ||
@ParcelablePlease | ||
public class MailStatistics implements Parcelable { | ||
|
||
ArrayList<MailsCount> mailsCounts; | ||
|
||
public MailStatistics(ArrayList<MailsCount> mailsCounts) { | ||
this.mailsCounts = mailsCounts; | ||
} | ||
|
||
public MailStatistics() { | ||
} | ||
|
||
@Override public int describeContents() { | ||
return 0; | ||
} | ||
|
||
@Override public void writeToParcel(Parcel dest, int flags) { | ||
MailStatisticsParcelablePlease.writeToParcel(this, dest, flags); | ||
} | ||
|
||
public static final Creator<MailStatistics> CREATOR = new Creator<MailStatistics>() { | ||
public MailStatistics createFromParcel(Parcel source) { | ||
MailStatistics target = new MailStatistics(); | ||
MailStatisticsParcelablePlease.readFromParcel(target, source); | ||
return target; | ||
} | ||
|
||
public MailStatistics[] newArray(int size) { | ||
return new MailStatistics[size]; | ||
} | ||
}; | ||
|
||
public ArrayList<MailsCount> getMailsCounts() { | ||
return mailsCounts; | ||
} | ||
|
||
public void setMailsCounts(ArrayList<MailsCount> mailsCounts) { | ||
this.mailsCounts = mailsCounts; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
.../src/main/java/com/hannesdorfmann/mosby/sample/mail/model/mail/statistics/MailsCount.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,55 @@ | ||
package com.hannesdorfmann.mosby.sample.mail.model.mail.statistics; | ||
|
||
import android.os.Parcel; | ||
import android.os.Parcelable; | ||
import com.hannesdorfmann.parcelableplease.annotation.ParcelablePlease; | ||
|
||
/** | ||
* @author Hannes Dorfmann | ||
*/ | ||
@ParcelablePlease public class MailsCount implements Parcelable { | ||
|
||
String label; | ||
int mailsCount; | ||
|
||
public MailsCount(String label, int mailsCount) { | ||
this.label = label; | ||
this.mailsCount = mailsCount; | ||
} | ||
|
||
private MailsCount() { | ||
} | ||
|
||
public String getLabel() { | ||
return label; | ||
} | ||
|
||
public int getMailsCount() { | ||
return mailsCount; | ||
} | ||
|
||
public void incrementCount(){ | ||
mailsCount++; | ||
} | ||
|
||
@Override public int describeContents() { | ||
return 0; | ||
} | ||
|
||
@Override public void writeToParcel(Parcel dest, int flags) { | ||
MailsCountParcelablePlease.writeToParcel(this, dest, flags); | ||
} | ||
|
||
|
||
public static final Creator<MailsCount> CREATOR = new Creator<MailsCount>() { | ||
public MailsCount createFromParcel(Parcel source) { | ||
MailsCount target = new MailsCount(); | ||
MailsCountParcelablePlease.readFromParcel(target, source); | ||
return target; | ||
} | ||
|
||
public MailsCount[] newArray(int size) { | ||
return new MailsCount[size]; | ||
} | ||
}; | ||
} |
32 changes: 32 additions & 0 deletions
32
...mail/src/main/java/com/hannesdorfmann/mosby/sample/mail/statistics/StatisticsAdapter.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,32 @@ | ||
package com.hannesdorfmann.mosby.sample.mail.statistics; | ||
|
||
import android.content.Context; | ||
import android.widget.TextView; | ||
import com.hannesdorfmann.annotatedadapter.annotation.Field; | ||
import com.hannesdorfmann.annotatedadapter.annotation.ViewType; | ||
import com.hannesdorfmann.mosby.sample.mail.R; | ||
import com.hannesdorfmann.mosby.sample.mail.base.view.ListAdapter; | ||
import com.hannesdorfmann.mosby.sample.mail.model.mail.statistics.MailsCount; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Hannes Dorfmann | ||
*/ | ||
public class StatisticsAdapter extends ListAdapter<List<MailsCount>> | ||
implements StatisticsAdapterBinder { | ||
|
||
@ViewType( | ||
layout = R.layout.list_statistics, | ||
fields = @Field(id = R.id.text, name = "text", type = TextView.class)) public final int | ||
statisticItem = 0; | ||
|
||
public StatisticsAdapter(Context context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
public void bindViewHolder(StatisticsAdapterHolders.StatisticItemViewHolder vh, int position) { | ||
MailsCount count = items.get(position); | ||
vh.text.setText(count.getMailsCount() + " mails in " + count.getLabel()); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...il/src/main/java/com/hannesdorfmann/mosby/sample/mail/statistics/StatisticsComponent.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,18 @@ | ||
package com.hannesdorfmann.mosby.sample.mail.statistics; | ||
|
||
import com.hannesdorfmann.mosby.sample.mail.dagger.MailAppComponent; | ||
import com.hannesdorfmann.mosby.sample.mail.dagger.MailModule; | ||
import dagger.Component; | ||
import javax.inject.Singleton; | ||
|
||
/** | ||
* @author Hannes Dorfmann | ||
*/ | ||
@Singleton | ||
@Component( | ||
modules = MailModule.class, | ||
dependencies = MailAppComponent.class) | ||
public interface StatisticsComponent { | ||
|
||
public StatisticsPresenter presenter(); | ||
} |
Oops, something went wrong.