Skip to content

Commit

Permalink
removed unnecessary layouts, made the sample app simpler.
Browse files Browse the repository at this point in the history
  • Loading branch information
luca committed Nov 28, 2019
1 parent 3b6836b commit 7a0d321
Show file tree
Hide file tree
Showing 26 changed files with 40 additions and 208 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.kirkbushman.sampleapp.R
import com.kirkbushman.sampleapp.SampleApplication
import com.kirkbushman.sampleapp.doAsync
import com.kirkbushman.zammad.models.TicketArticle
import kotlinx.android.synthetic.main.activity_article.*
import kotlinx.android.synthetic.main.activity_detail.*

class ArticleActivity : AppCompatActivity() {

Expand All @@ -30,15 +30,15 @@ class ArticleActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_article)
setContentView(R.layout.activity_detail)

var newArticle: TicketArticle? = null
doAsync(doWork = {

newArticle = client?.ticketArticle(article.id, true)
}, onPost = {

article_text.text = newArticle.toString()
model_text.text = newArticle.toString()
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.kirkbushman.sampleapp.doAsync
import com.kirkbushman.zammad.models.ArticleAttachment
import com.kirkbushman.zammad.models.Ticket
import com.kirkbushman.zammad.models.TicketArticle
import kotlinx.android.synthetic.main.activity_attachment.*
import kotlinx.android.synthetic.main.activity_detail.*

class AttachmentActivity : AppCompatActivity() {

Expand Down Expand Up @@ -39,15 +39,15 @@ class AttachmentActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_attachment)
setContentView(R.layout.activity_detail)

var fileContent = ""
doAsync(doWork = {

fileContent = client?.ticketArticleAttachment(ticket, article, attachment) ?: ""
}, onPost = {

attachment_text.text = fileContent
model_text.text = fileContent
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.kirkbushman.sampleapp.R
import com.kirkbushman.sampleapp.SampleApplication
import com.kirkbushman.sampleapp.doAsync
import com.kirkbushman.zammad.models.Group
import kotlinx.android.synthetic.main.activity_group.*
import kotlinx.android.synthetic.main.activity_detail.*

class GroupActivity : AppCompatActivity() {

Expand All @@ -30,15 +30,15 @@ class GroupActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_group)
setContentView(R.layout.activity_detail)

var newGroup: Group? = null
doAsync(doWork = {

newGroup = client?.group(group.id, true)
}, onPost = {

group_text.text = newGroup.toString()
model_text.text = newGroup.toString()
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ import com.kirkbushman.sampleapp.R
import com.kirkbushman.sampleapp.SampleApplication
import com.kirkbushman.sampleapp.doAsync
import com.kirkbushman.zammad.models.User
import kotlinx.android.synthetic.main.activity_me.*
import kotlinx.android.synthetic.main.activity_detail.*

class MeActivity : AppCompatActivity() {

private val client by lazy { SampleApplication.instance.getClient() }

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_me)
setContentView(R.layout.activity_detail)

var me: User? = null
doAsync(doWork = {

me = client?.me()
}, onPost = {

me_text.text = me.toString()
model_text.text = me.toString()
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.kirkbushman.sampleapp.R
import com.kirkbushman.sampleapp.SampleApplication
import com.kirkbushman.sampleapp.doAsync
import com.kirkbushman.zammad.models.OnlineNotification
import kotlinx.android.synthetic.main.activity_notification.*
import kotlinx.android.synthetic.main.activity_detail.*

class NotificationActivity : AppCompatActivity() {

Expand All @@ -30,15 +30,15 @@ class NotificationActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_notification)
setContentView(R.layout.activity_detail)

var newNotification: OnlineNotification? = null
doAsync(doWork = {

newNotification = client?.onlineNotification(notification.id, true)
}, onPost = {

notification_text.text = newNotification.toString()
model_text.text = newNotification.toString()
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.kirkbushman.sampleapp.R
import com.kirkbushman.sampleapp.SampleApplication
import com.kirkbushman.sampleapp.doAsync
import com.kirkbushman.zammad.models.Object
import kotlinx.android.synthetic.main.activity_object.*
import kotlinx.android.synthetic.main.activity_detail.*

class ObjectActivity : AppCompatActivity() {

Expand All @@ -30,15 +30,15 @@ class ObjectActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_object)
setContentView(R.layout.activity_detail)

var newObject: Object? = null
doAsync(doWork = {

newObject = client?.`object`(`object`.id)
}, onPost = {

object_text.text = newObject.toString()
model_text.text = newObject.toString()
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.kirkbushman.sampleapp.R
import com.kirkbushman.sampleapp.SampleApplication
import com.kirkbushman.sampleapp.doAsync
import com.kirkbushman.zammad.models.Organization
import kotlinx.android.synthetic.main.activity_organization.*
import kotlinx.android.synthetic.main.activity_detail.*

class OrganizationActivity : AppCompatActivity() {

Expand All @@ -30,15 +30,15 @@ class OrganizationActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_organization)
setContentView(R.layout.activity_detail)

var newOrganization: Organization? = null
doAsync(doWork = {

newOrganization = client?.organization(organization.id, true)
}, onPost = {

organization_text.text = newOrganization.toString()
model_text.text = newOrganization.toString()
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.kirkbushman.sampleapp.R
import com.kirkbushman.sampleapp.SampleApplication
import com.kirkbushman.sampleapp.doAsync
import com.kirkbushman.zammad.models.Overview
import kotlinx.android.synthetic.main.activity_overview.*
import kotlinx.android.synthetic.main.activity_detail.*

class OverviewActivity : AppCompatActivity() {

Expand All @@ -30,15 +30,15 @@ class OverviewActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_overview)
setContentView(R.layout.activity_detail)

var newOverview: Overview? = null
doAsync(doWork = {

newOverview = client?.overview(overview.id, true)
}, onPost = {

overview_text.text = newOverview.toString()
model_text.text = newOverview.toString()
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.kirkbushman.sampleapp.R
import com.kirkbushman.sampleapp.SampleApplication
import com.kirkbushman.sampleapp.doAsync
import com.kirkbushman.zammad.models.TicketPriority
import kotlinx.android.synthetic.main.activity_priority.*
import kotlinx.android.synthetic.main.activity_detail.*

class PriorityActivity : AppCompatActivity() {

Expand All @@ -30,15 +30,15 @@ class PriorityActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_priority)
setContentView(R.layout.activity_detail)

var newPriority: TicketPriority? = null
doAsync(doWork = {

newPriority = client?.ticketPriority(priority.id, true)
}, onPost = {

priority_text.text = newPriority.toString()
model_text.text = newPriority.toString()
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.kirkbushman.sampleapp.R
import com.kirkbushman.sampleapp.SampleApplication
import com.kirkbushman.sampleapp.doAsync
import com.kirkbushman.zammad.models.Role
import kotlinx.android.synthetic.main.activity_role.*
import kotlinx.android.synthetic.main.activity_detail.*

class RoleActivity : AppCompatActivity() {

Expand All @@ -30,15 +30,15 @@ class RoleActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_role)
setContentView(R.layout.activity_detail)

var newRole: Role? = null
doAsync(doWork = {

newRole = client?.role(role.id, true)
}, onPost = {

role_text.text = newRole.toString()
model_text.text = newRole.toString()
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.kirkbushman.sampleapp.R
import com.kirkbushman.sampleapp.SampleApplication
import com.kirkbushman.sampleapp.doAsync
import com.kirkbushman.zammad.models.TicketState
import kotlinx.android.synthetic.main.activity_state.*
import kotlinx.android.synthetic.main.activity_detail.*

class StateActivity : AppCompatActivity() {

Expand All @@ -30,15 +30,15 @@ class StateActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_state)
setContentView(R.layout.activity_detail)

var newState: TicketState? = null
doAsync(doWork = {

newState = client?.ticketState(state.id, true)
}, onPost = {

state_text.text = newState.toString()
model_text.text = newState.toString()
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.kirkbushman.sampleapp.R
import com.kirkbushman.sampleapp.SampleApplication
import com.kirkbushman.sampleapp.doAsync
import com.kirkbushman.zammad.models.Ticket
import kotlinx.android.synthetic.main.activity_ticket.*
import kotlinx.android.synthetic.main.activity_detail.*

class TicketActivity : AppCompatActivity() {

Expand All @@ -30,15 +30,15 @@ class TicketActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_ticket)
setContentView(R.layout.activity_detail)

var newTicket: Ticket? = null
doAsync(doWork = {

newTicket = client?.ticket(ticket.id, true)
}, onPost = {

ticket_text.text = newTicket.toString()
model_text.text = newTicket.toString()
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.kirkbushman.sampleapp.R
import com.kirkbushman.sampleapp.SampleApplication
import com.kirkbushman.sampleapp.doAsync
import com.kirkbushman.zammad.models.User
import kotlinx.android.synthetic.main.activity_user.*
import kotlinx.android.synthetic.main.activity_detail.*

class UserActivity : AppCompatActivity() {

Expand All @@ -30,15 +30,15 @@ class UserActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_user)
setContentView(R.layout.activity_detail)

var newUser: User? = null
doAsync(doWork = {

newUser = client?.user(user.id, true)
}, onPost = {

user_text.text = newUser.toString()
model_text.text = newUser.toString()
})
}
}
14 changes: 0 additions & 14 deletions sampleapp/src/main/res/layout/activity_attachment.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:layout_height="match_parent">

<TextView
android:id="@+id/article_text"
android:id="@+id/model_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
Expand Down
14 changes: 0 additions & 14 deletions sampleapp/src/main/res/layout/activity_group.xml

This file was deleted.

Loading

0 comments on commit 7a0d321

Please sign in to comment.