-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added badges in profile screen + Fixes
- Loading branch information
1 parent
344731d
commit 31d0649
Showing
44 changed files
with
486 additions
and
39 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
Empty file.
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
18 changes: 17 additions & 1 deletion
18
app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/glide/GlideModule.kt
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 |
---|---|---|
@@ -1,7 +1,23 @@ | ||
package io.github.feelfreelinux.wykopmobilny.glide | ||
|
||
import android.content.Context | ||
import com.bumptech.glide.Glide | ||
import com.bumptech.glide.Registry | ||
import com.bumptech.glide.annotation.GlideModule | ||
import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader | ||
import com.bumptech.glide.load.model.GlideUrl | ||
import com.bumptech.glide.module.AppGlideModule | ||
import okhttp3.OkHttpClient | ||
import java.io.InputStream | ||
import java.util.concurrent.TimeUnit | ||
|
||
@GlideModule | ||
class GlideModule : AppGlideModule() | ||
class GlideModule : AppGlideModule() { | ||
override fun registerComponents(context: Context?, glide: Glide?, registry: Registry?) { | ||
val builder = OkHttpClient.Builder() | ||
builder.readTimeout(15, TimeUnit.SECONDS) | ||
builder.writeTimeout(15, TimeUnit.SECONDS) | ||
builder.connectTimeout(15, TimeUnit.SECONDS) | ||
registry?.append(GlideUrl::class.java, InputStream::class.java, OkHttpUrlLoader.Factory(builder.build())) | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
.../kotlin/io/github/feelfreelinux/wykopmobilny/models/pojo/apiv2/responses/BadgeResponse.kt
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,17 @@ | ||
package io.github.feelfreelinux.wykopmobilny.models.pojo.apiv2.responses | ||
|
||
import com.squareup.moshi.Json | ||
|
||
data class BadgeResponse( | ||
@Json(name = "name") | ||
val name : String, | ||
|
||
@Json(name = "date") | ||
val date : String, | ||
|
||
@Json(name = "description") | ||
val description : String, | ||
|
||
@Json(name = "icon") | ||
val icon : String | ||
) |
21 changes: 21 additions & 0 deletions
21
app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/BadgeListAdapter.kt
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,21 @@ | ||
package io.github.feelfreelinux.wykopmobilny.ui.adapters | ||
|
||
import android.support.v7.widget.RecyclerView | ||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import io.github.feelfreelinux.wykopmobilny.R | ||
import io.github.feelfreelinux.wykopmobilny.base.adapter.SimpleBaseProgressAdapter | ||
import io.github.feelfreelinux.wykopmobilny.models.dataclass.Upvoter | ||
import io.github.feelfreelinux.wykopmobilny.models.pojo.apiv2.responses.BadgeResponse | ||
import io.github.feelfreelinux.wykopmobilny.ui.adapters.viewholders.BadgeViewHolder | ||
import io.github.feelfreelinux.wykopmobilny.ui.adapters.viewholders.UpvoterViewHolder | ||
import javax.inject.Inject | ||
|
||
class BadgeListAdapter : SimpleBaseProgressAdapter<BadgeViewHolder, BadgeResponse>() { | ||
override fun createViewHolder(parent: ViewGroup): BadgeViewHolder | ||
= BadgeViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.badge_list_item, parent, false)) | ||
|
||
override fun bindHolder(holder: BadgeViewHolder, position: Int) { | ||
holder.bindView(data[position]) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...in/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/viewholders/BadgeViewHolder.kt
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 io.github.feelfreelinux.wykopmobilny.ui.adapters.viewholders | ||
|
||
import android.support.v7.widget.RecyclerView | ||
import android.view.View | ||
import io.github.feelfreelinux.wykopmobilny.models.dataclass.Author | ||
import io.github.feelfreelinux.wykopmobilny.models.pojo.apiv2.responses.BadgeResponse | ||
import io.github.feelfreelinux.wykopmobilny.utils.loadImage | ||
import io.github.feelfreelinux.wykopmobilny.utils.toPrettyDate | ||
import kotlinx.android.synthetic.main.badge_list_item.view.* | ||
|
||
class BadgeViewHolder(val view: View) : RecyclerView.ViewHolder(view) { | ||
fun bindView(badge : BadgeResponse) { | ||
view.badgeTitle.text = badge.name | ||
view.badgeImg.loadImage(badge.icon) | ||
view.description.text = badge.description | ||
view.date.text = badge.date.toPrettyDate() | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,5 +55,4 @@ class LinkViewHolder(val view: View) : RecyclableViewHolder(view) { | |
GlideApp.with(this).clear(image) | ||
} | ||
} | ||
|
||
} |
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
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
45 changes: 45 additions & 0 deletions
45
...thub/feelfreelinux/wykopmobilny/ui/modules/notificationslist/NotificationsListActivity.kt
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,45 @@ | ||
package io.github.feelfreelinux.wykopmobilny.ui.modules.notificationslist | ||
|
||
import android.app.Activity | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.view.Menu | ||
import android.view.MenuItem | ||
import io.github.feelfreelinux.wykopmobilny.R | ||
import io.github.feelfreelinux.wykopmobilny.base.BaseActivity | ||
import kotlinx.android.synthetic.main.activity_notifications.* | ||
import kotlinx.android.synthetic.main.toolbar.* | ||
|
||
|
||
class NotificationsListActivity : BaseActivity() { | ||
companion object { | ||
val EXTRA_PRESELECT_INDEX = "PRESELECT_INDEX" | ||
val PRESELECT_NOTIFICATIONS = 0 | ||
val PRESELECT_HASHTAGS = 1 | ||
fun createIntent(context : Context, currentIndex : Int = PRESELECT_NOTIFICATIONS) : Intent { | ||
val intent = Intent(context, NotificationsListActivity::class.java) | ||
intent.putExtra(EXTRA_PRESELECT_INDEX, currentIndex) | ||
return intent | ||
} | ||
} | ||
val pagerAdapter by lazy { NotificationsListViewPagerAdapter(resources, supportFragmentManager) } | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_notifications) | ||
setSupportActionBar(toolbar) | ||
supportActionBar?.setTitle(R.string.notifications_title) | ||
supportActionBar?.setDisplayHomeAsUpEnabled(true) | ||
pager.offscreenPageLimit = 1 | ||
pager.adapter = pagerAdapter | ||
pager.setCurrentItem(intent.getIntExtra(EXTRA_PRESELECT_INDEX, 0), false) | ||
tabLayout.setupWithViewPager(pager) | ||
} | ||
|
||
override fun onOptionsItemSelected(item: MenuItem): Boolean { | ||
when(item.itemId) { | ||
android.R.id.home -> { finish() } | ||
} | ||
return true | ||
} | ||
} |
Oops, something went wrong.