-
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
1 parent
059aaba
commit 6c65eca
Showing
10 changed files
with
260 additions
and
321 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
90 changes: 0 additions & 90 deletions
90
app/src/main/java/com/example/mapsassignment/LocationModel.java
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
app/src/main/java/com/example/mapsassignment/LocationModel.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,48 @@ | ||
package com.example.mapsassignment | ||
|
||
import android.view.View | ||
import android.widget.ImageView | ||
import android.widget.TextView | ||
import butterknife.BindView | ||
import butterknife.ButterKnife | ||
import com.mikepenz.fastadapter.FastAdapter | ||
import com.mikepenz.fastadapter.items.AbstractItem | ||
import com.mikepenz.materialize.holder.StringHolder | ||
|
||
class LocationModel(var name: String, var icon: String, var lat: String, var lng: String) : AbstractItem<LocationModel?, LocationModel.ViewHolder>() { | ||
|
||
override fun getViewHolder(v: View): ViewHolder { | ||
return ViewHolder(v) | ||
} | ||
|
||
override fun getType(): Int { | ||
return R.id.framelayoutparent | ||
} | ||
|
||
override fun getLayoutRes(): Int { | ||
return R.layout.card | ||
} | ||
|
||
class ViewHolder(view: View?) : FastAdapter.ViewHolder<LocationModel>(view) { | ||
@JvmField | ||
@BindView(R.id.name) | ||
var name: TextView? = null | ||
|
||
@JvmField | ||
@BindView(R.id.icon) | ||
var icon: ImageView? = null | ||
override fun bindView(item: LocationModel, payloads: List<Any>) { | ||
StringHolder.applyTo(StringHolder(item.name), name) | ||
if (item.icon == "fuel") icon!!.setImageResource(R.drawable.ic_fuel_white) else icon!!.setImageResource(R.drawable.ic_restaurant_white) | ||
} | ||
|
||
override fun unbindView(item: LocationModel) { | ||
name!!.text = "" | ||
} | ||
|
||
init { | ||
ButterKnife.bind(this, view!!) | ||
} | ||
} | ||
|
||
} |
30 changes: 0 additions & 30 deletions
30
app/src/main/java/com/example/mapsassignment/MainActivity.java
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/example/mapsassignment/MainActivity.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,25 @@ | ||
package com.example.mapsassignment | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.view.View | ||
import android.widget.Button | ||
import android.widget.EditText | ||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
class MainActivity : AppCompatActivity() { | ||
var TAG = this.javaClass.simpleName | ||
var editText: EditText? = null | ||
var button: Button? = null | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
editText = findViewById(R.id.editText) | ||
button = findViewById(R.id.button) | ||
button!!.setOnClickListener(View.OnClickListener { v: View? -> | ||
val intent = Intent(this@MainActivity, ResultsActivity::class.java) | ||
intent.putExtra("location", editText!!.getText().toString()) | ||
startActivity(intent) | ||
}) | ||
} | ||
} |
139 changes: 0 additions & 139 deletions
139
app/src/main/java/com/example/mapsassignment/MasterFragment.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.