Skip to content

Commit

Permalink
Fixed map, fixed barcode activity, fixed proguard rules
Browse files Browse the repository at this point in the history
  • Loading branch information
AIDEA775 committed Nov 5, 2018
1 parent cfab110 commit 515e704
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 117 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildTypes {
Expand Down
3 changes: 2 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
public <fields>;
private <fields>;
}
-keep class com.uncmorfi.balance.model.UsersContract$* { *; }
-keep class com.uncmorfi.balance.model.UsersContract$* { *; }
-dontwarn java.awt.**
1 change: 0 additions & 1 deletion app/src/main/java/com/uncmorfi/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import com.uncmorfi.faq.FaqFragment
import com.uncmorfi.map.MapFragment
import com.uncmorfi.menu.MenuFragment
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.app_bar_menu.*
import android.support.v4.widget.ViewDragHelper
import com.uncmorfi.helpers.sendEmail
import com.uncmorfi.helpers.openFacebook
Expand Down
9 changes: 3 additions & 6 deletions app/src/main/java/com/uncmorfi/balance/BarcodeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@ class BarcodeActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

setContentView(R.layout.activity_barcode)
setSupportActionBar(toolbar)

if (supportActionBar != null) {
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)
supportActionBar?.setDisplayShowTitleEnabled(false)
}
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)
supportActionBar?.setDisplayShowTitleEnabled(false)

val user = intent.getSerializableExtra(USER_ARG) as User

Expand Down
44 changes: 29 additions & 15 deletions app/src/main/java/com/uncmorfi/map/MapFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,58 @@ import android.os.Bundle
import android.support.v4.app.Fragment
import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.OnMapReadyCallback
import com.google.android.gms.maps.SupportMapFragment
import com.google.android.gms.maps.model.CameraPosition
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.MarkerOptions
import com.uncmorfi.R
import android.view.ViewGroup
import android.view.LayoutInflater
import android.view.View

import com.google.android.gms.maps.MapsInitializer
import kotlinx.android.synthetic.main.fragment_map.*

/**
* Muestra las ubicaciones de los comedores en un GoogleMap.
*/
class MapFragment : Fragment(), OnMapReadyCallback {
class MapFragment : Fragment() {
private lateinit var mMap: GoogleMap

override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_map, container, false)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mapView.onCreate(savedInstanceState)

mapView.onResume()

if (activity != null) {
val mapFragment = activity!!.supportFragmentManager
.findFragmentById(R.id.map) as SupportMapFragment?
mapFragment?.getMapAsync(this)
try {
MapsInitializer.initialize(activity!!.applicationContext)
} catch (e: Exception) {
e.printStackTrace()
}
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_map, container, false)
mapView.getMapAsync { onMapReady(it) }
}

override fun onResume() {
super.onResume()
requireActivity().setTitle(R.string.navigation_map)
mapView.onResume()
}

override fun onPause() {
super.onPause()
mapView.onPause()
}

override fun onLowMemory() {
super.onLowMemory()
mapView.onLowMemory()
}

override fun onMapReady(googleMap: GoogleMap) {
private fun onMapReady(googleMap: GoogleMap) {
mMap = googleMap

mMap.addMarker(MarkerOptions()
Expand Down
101 changes: 53 additions & 48 deletions app/src/main/res/layout/activity_barcode.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.uncmorfi.balance.BarcodeActivity">
tools:context=".balance.BarcodeActivity">

<LinearLayout
<android.support.v7.widget.LinearLayoutCompat
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
Expand All @@ -24,61 +28,62 @@
android:layout_height="wrap_content"
app:popupTheme="@style/AppTheme.PopupOverlay"
android:theme="@style/ToolBarStyle">
</android.support.v7.widget.Toolbar>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/userImage"
android:layout_toEndOf="@+id/userImage"
android:orientation="vertical">

<TextView
android:id="@+id/userName"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:textAllCaps="true"
android:textColor="@color/white"
android:textSize="38sp"
android:textStyle="bold"
tools:text="Alejandro Ismael" />
android:paddingTop="12dp"
android:paddingBottom="12dp" >

<TextView
android:id="@+id/userCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed"
android:gravity="center"
android:paddingBottom="4dp"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold"
tools:text="43217032843" />
<TextView
android:id="@+id/userName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textAllCaps="true"
android:textColor="@color/white"
android:textSize="30sp"
android:textStyle="bold"
tools:text="Alejandro Ismael" />

<TextView
android:id="@+id/userType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:gravity="center"
android:paddingBottom="12dp"
android:textColor="@color/white"
android:textSize="24sp"
tools:text="Estudiante" />
</LinearLayout>
<TextView
android:id="@+id/userCard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/userName"
android:layout_alignStart="@+id/userName"
android:layout_alignLeft="@+id/userName"
android:fontFamily="sans-serif-condensed"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold"
tools:text="43217032843" />

<TextView
android:id="@+id/userType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/userCard"
android:layout_alignStart="@+id/userName"
android:layout_alignLeft="@+id/userName"
android:fontFamily="sans-serif-light"
android:textColor="@color/white"
android:textSize="24sp"
tools:text="Estudiante" />
</RelativeLayout>

</android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

<ImageView
android:id="@+id/barcodeFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:padding="12dp"
tools:ignore="ContentDescription" />
</LinearLayout>

</android.support.design.widget.CoordinatorLayout>
</android.support.v7.widget.LinearLayoutCompat>

</android.support.v4.widget.DrawerLayout>
34 changes: 30 additions & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,37 @@
tools:openDrawer="start"
tools:context=".MainActivity">

<!-- Layout real de la actividad -->
<include
layout="@layout/app_bar_menu"
<android.support.v7.widget.LinearLayoutCompat
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay"
android:theme="@style/ToolBarStyle" />

</android.support.design.widget.AppBarLayout>

<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">

</FrameLayout>

</android.support.v7.widget.LinearLayoutCompat>

<!-- Layout del menu lateral -->
<android.support.design.widget.NavigationView
Expand Down
35 changes: 0 additions & 35 deletions app/src/main/res/layout/app_bar_menu.xml

This file was deleted.

13 changes: 9 additions & 4 deletions app/src/main/res/layout/fragment_map.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent" >

<com.google.android.gms.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</LinearLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
Expand All @@ -24,4 +23,5 @@
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>

0 comments on commit 515e704

Please sign in to comment.