Commit d0793d2216dd1b72c237ed5a2b8eb12af8a3c6a4
1 parent
92296cd5
Exists in
master
home e avaliacao de vereador implementado
Showing
29 changed files
with
1071 additions
and
532 deletions
Show diff stats
app/build.gradle
app/src/main/java/com/monitorabrasil/monitoralegislativo/ComentarioActivity.java
| 1 | 1 | package com.monitorabrasil.monitoralegislativo; |
| 2 | 2 | |
| 3 | -import android.content.Intent; | |
| 4 | 3 | import android.os.Build; |
| 5 | -import android.support.design.widget.Snackbar; | |
| 6 | -import android.support.v7.app.ActionBarActivity; | |
| 7 | 4 | import android.os.Bundle; |
| 5 | +import android.support.design.widget.Snackbar; | |
| 8 | 6 | import android.support.v7.app.AppCompatActivity; |
| 9 | 7 | import android.support.v7.widget.LinearLayoutManager; |
| 10 | 8 | import android.support.v7.widget.RecyclerView; |
| ... | ... | @@ -19,10 +17,7 @@ import android.widget.Button; |
| 19 | 17 | import android.widget.EditText; |
| 20 | 18 | import android.widget.ProgressBar; |
| 21 | 19 | |
| 22 | -import com.google.gson.Gson; | |
| 23 | -import com.monitorabrasil.monitoralegislativo.R; | |
| 24 | 20 | import com.monitorabrasil.monitoralegislativo.adapters.ComentarioAdapter; |
| 25 | -import com.monitorabrasil.monitoralegislativo.application.MyApp; | |
| 26 | 21 | import com.parse.FindCallback; |
| 27 | 22 | import com.parse.GetCallback; |
| 28 | 23 | import com.parse.ParseException; |
| ... | ... | @@ -36,6 +31,7 @@ import java.util.List; |
| 36 | 31 | public class ComentarioActivity extends AppCompatActivity { |
| 37 | 32 | |
| 38 | 33 | private ParseObject projeto; |
| 34 | + private ParseObject politico; | |
| 39 | 35 | private Toolbar mToolbar; |
| 40 | 36 | private RecyclerView mRecyclerView; |
| 41 | 37 | private ComentarioAdapter mAdapter; |
| ... | ... | @@ -46,21 +42,7 @@ public class ComentarioActivity extends AppCompatActivity { |
| 46 | 42 | protected void onCreate(Bundle savedInstanceState) { |
| 47 | 43 | super.onCreate(savedInstanceState); |
| 48 | 44 | setContentView(R.layout.activity_comentario); |
| 49 | - Gson gson =new Gson(); | |
| 50 | - Intent bundle = getIntent(); | |
| 51 | 45 | |
| 52 | - ParseQuery<ParseObject> query = ParseQuery.getQuery("Projeto"); | |
| 53 | - query.getInBackground(getIntent().getStringExtra("projeto"), new GetCallback<ParseObject>() { | |
| 54 | - public void done(ParseObject object, ParseException e) { | |
| 55 | - if (e == null) { | |
| 56 | - projeto = object; | |
| 57 | - mToolbar.setTitle(projeto.get("classificacao").toString()); | |
| 58 | - buscaComentarios(); | |
| 59 | - } else { | |
| 60 | - // something went wrong | |
| 61 | - } | |
| 62 | - } | |
| 63 | - }); | |
| 64 | 46 | |
| 65 | 47 | |
| 66 | 48 | // TOOLBAR |
| ... | ... | @@ -71,6 +53,36 @@ public class ComentarioActivity extends AppCompatActivity { |
| 71 | 53 | setSupportActionBar(mToolbar); |
| 72 | 54 | mToolbar.setTitleTextColor(getResources().getColor(R.color.md_white_1000)); |
| 73 | 55 | |
| 56 | + pb = (ProgressBar) findViewById(R.id.progressBar); | |
| 57 | + | |
| 58 | + | |
| 59 | + //tableview | |
| 60 | + mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view); | |
| 61 | + | |
| 62 | + | |
| 63 | + //verifica se eh comentario de projeto ou politico | |
| 64 | + if (getIntent().getStringExtra("projeto")!= null){ | |
| 65 | + ParseQuery<ParseObject> query = ParseQuery.getQuery("Projeto"); | |
| 66 | + query.getInBackground(getIntent().getStringExtra("projeto"), new GetCallback<ParseObject>() { | |
| 67 | + public void done(ParseObject object, ParseException e) { | |
| 68 | + if (e == null) { | |
| 69 | + projeto = object; | |
| 70 | + mToolbar.setTitle(projeto.get("classificacao").toString()); | |
| 71 | + setTitle(projeto.get("classificacao").toString()); | |
| 72 | + buscaComentarios("Comentario"); | |
| 73 | + } else { | |
| 74 | + // something went wrong | |
| 75 | + } | |
| 76 | + } | |
| 77 | + }); | |
| 78 | + }else{ | |
| 79 | + //busca comentario de politico | |
| 80 | + buscaPolitico(getIntent().getStringExtra("politico")); | |
| 81 | + } | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 74 | 86 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ |
| 75 | 87 | //fazer a animacao |
| 76 | 88 | TransitionInflater inflater = TransitionInflater.from(this); |
| ... | ... | @@ -88,12 +100,8 @@ public class ComentarioActivity extends AppCompatActivity { |
| 88 | 100 | } |
| 89 | 101 | }); |
| 90 | 102 | |
| 91 | - pb = (ProgressBar) findViewById(R.id.progressBar); | |
| 92 | 103 | |
| 93 | 104 | |
| 94 | - //tableview | |
| 95 | - mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view); | |
| 96 | - | |
| 97 | 105 | // use this setting to improve performance if you know that changes |
| 98 | 106 | // in content do not change the layout size of the RecyclerView |
| 99 | 107 | mRecyclerView.setHasFixedSize(true); |
| ... | ... | @@ -106,10 +114,29 @@ public class ComentarioActivity extends AppCompatActivity { |
| 106 | 114 | |
| 107 | 115 | } |
| 108 | 116 | |
| 109 | - public void buscaComentarios(){ | |
| 117 | + private ParseObject buscaPolitico(String id) { | |
| 118 | + | |
| 119 | + ParseQuery<ParseObject> query = ParseQuery.getQuery("Politico"); | |
| 120 | + query.fromLocalDatastore(); | |
| 121 | + try { | |
| 122 | + politico = query.get(id); | |
| 123 | + mToolbar.setTitle(politico.get("nome").toString()); | |
| 124 | + buscaComentarios("ComentarioPolitico"); | |
| 125 | + } catch (com.parse.ParseException e) { | |
| 126 | + e.printStackTrace(); | |
| 127 | + } | |
| 128 | + return null; | |
| 129 | + } | |
| 130 | + | |
| 131 | + public void buscaComentarios(String tipo){ | |
| 110 | 132 | pb.setVisibility(View.VISIBLE); |
| 111 | - ParseQuery<ParseObject> query = ParseQuery.getQuery("Comentario"); | |
| 112 | - query.whereEqualTo("projeto",projeto); | |
| 133 | + ParseQuery<ParseObject> query = ParseQuery.getQuery(tipo); | |
| 134 | + if(tipo.equals("Comentario")){ | |
| 135 | + query.whereEqualTo("projeto",projeto); | |
| 136 | + }else{ | |
| 137 | + query.whereEqualTo("politico",politico); | |
| 138 | + } | |
| 139 | + | |
| 113 | 140 | query.addAscendingOrder("createdAt"); |
| 114 | 141 | //query.whereEqualTo("playerName", "Dan Stemkoski"); |
| 115 | 142 | query.findInBackground(new FindCallback<ParseObject>() { |
| ... | ... | @@ -128,7 +155,7 @@ public class ComentarioActivity extends AppCompatActivity { |
| 128 | 155 | } |
| 129 | 156 | public void carregaList(List<ParseObject> list){ |
| 130 | 157 | mAdapter = new ComentarioAdapter(list); |
| 131 | - // mAdapter.setRecyclerViewOnClickListenerHack(this); | |
| 158 | + // mAdapter.setRecyclerViewOnClickListenerHack(this); | |
| 132 | 159 | mRecyclerView.setAdapter(mAdapter); |
| 133 | 160 | pb.setVisibility(View.INVISIBLE); |
| 134 | 161 | } |
| ... | ... | @@ -138,12 +165,22 @@ public class ComentarioActivity extends AppCompatActivity { |
| 138 | 165 | final EditText txtMensagem = (EditText)findViewById(R.id.mensagem); |
| 139 | 166 | String mensagem = txtMensagem.getText().toString(); |
| 140 | 167 | ParseUser user = ParseUser.getCurrentUser(); |
| 168 | + final String tipo; | |
| 141 | 169 | if(user!= null){ |
| 142 | - ParseObject comentario = new ParseObject("Comentario"); | |
| 170 | + ParseObject comentario; | |
| 171 | + if(politico != null){ | |
| 172 | + tipo = "ComentarioPolitico"; | |
| 173 | + comentario = new ParseObject("ComentarioPolitico"); | |
| 174 | + comentario.put("politico",politico); | |
| 175 | + }else{ | |
| 176 | + tipo ="Comentario"; | |
| 177 | + comentario = new ParseObject("Comentario"); | |
| 178 | + comentario.put("projeto",projeto); | |
| 179 | + } | |
| 143 | 180 | comentario.put("mensagem",mensagem); |
| 144 | - comentario.put("user",user); | |
| 145 | - comentario.put("nome",user.getString("nome")); | |
| 146 | - comentario.put("projeto",projeto); | |
| 181 | + comentario.put("user", user); | |
| 182 | + comentario.put("nome", user.getString("nome")); | |
| 183 | + | |
| 147 | 184 | comentario.saveInBackground(new SaveCallback() { |
| 148 | 185 | @Override |
| 149 | 186 | public void done(ParseException e) { |
| ... | ... | @@ -151,11 +188,17 @@ public class ComentarioActivity extends AppCompatActivity { |
| 151 | 188 | .setAction("Action", null).show(); |
| 152 | 189 | |
| 153 | 190 | //recarregar lista |
| 154 | - buscaComentarios(); | |
| 191 | + buscaComentarios(tipo); | |
| 155 | 192 | } |
| 156 | 193 | }); |
| 157 | - projeto.increment("nr_comentarios"); | |
| 158 | - projeto.saveInBackground(); | |
| 194 | + if(politico != null){ | |
| 195 | + politico.increment("nr_comentarios"); | |
| 196 | + politico.saveInBackground(); | |
| 197 | + }else{ | |
| 198 | + projeto.increment("nr_comentarios"); | |
| 199 | + projeto.saveInBackground(); | |
| 200 | + } | |
| 201 | + | |
| 159 | 202 | |
| 160 | 203 | }else{ |
| 161 | 204 | Snackbar.make(v, "Para comentar é necessário estar logado", Snackbar.LENGTH_LONG) | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/MainActivity.java
| ... | ... | @@ -72,9 +72,6 @@ public class MainActivity extends AppCompatActivity implements HomeFragment.OnFr |
| 72 | 72 | super.onCreate(savedInstanceState); |
| 73 | 73 | setContentView(R.layout.activity_main); |
| 74 | 74 | |
| 75 | - | |
| 76 | - | |
| 77 | - | |
| 78 | 75 | //FRAGMENT |
| 79 | 76 | HomeFragment homeFragment = (HomeFragment) getSupportFragmentManager().findFragmentByTag("homeFrag"); |
| 80 | 77 | if(homeFragment == null) { |
| ... | ... | @@ -84,13 +81,6 @@ public class MainActivity extends AppCompatActivity implements HomeFragment.OnFr |
| 84 | 81 | ft.commit(); |
| 85 | 82 | } |
| 86 | 83 | |
| 87 | - | |
| 88 | - | |
| 89 | - | |
| 90 | - | |
| 91 | - | |
| 92 | - | |
| 93 | - | |
| 94 | 84 | // TOOLBAR |
| 95 | 85 | mToolbar = (Toolbar) findViewById(R.id.tb_main); |
| 96 | 86 | mToolbar.setTitle(getString(R.string.app_name)); | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/PoliticoFichaActivity.java
| 1 | 1 | package com.monitorabrasil.monitoralegislativo; |
| 2 | 2 | |
| 3 | +import android.content.Intent; | |
| 3 | 4 | import android.content.res.Configuration; |
| 5 | +import android.os.Bundle; | |
| 4 | 6 | import android.support.design.widget.CollapsingToolbarLayout; |
| 5 | 7 | import android.support.design.widget.CoordinatorLayout; |
| 6 | 8 | import android.support.design.widget.FloatingActionButton; |
| 7 | -import android.support.design.widget.Snackbar; | |
| 8 | -import android.support.v4.app.FragmentTransaction; | |
| 9 | -import android.support.v4.widget.DrawerLayout; | |
| 10 | -import android.support.v7.app.ActionBarDrawerToggle; | |
| 9 | +import android.support.design.widget.TabLayout; | |
| 10 | +import android.support.v4.app.Fragment; | |
| 11 | +import android.support.v4.app.FragmentManager; | |
| 12 | +import android.support.v4.app.FragmentStatePagerAdapter; | |
| 13 | +import android.support.v4.view.ViewPager; | |
| 11 | 14 | import android.support.v7.app.AppCompatActivity; |
| 12 | -import android.os.Bundle; | |
| 13 | 15 | import android.support.v7.widget.Toolbar; |
| 14 | 16 | import android.view.Menu; |
| 15 | 17 | import android.view.MenuItem; |
| 16 | 18 | import android.view.View; |
| 17 | 19 | |
| 18 | -import com.monitorabrasil.monitoralegislativo.R; | |
| 20 | +import com.monitorabrasil.monitoralegislativo.application.MyApp; | |
| 19 | 21 | import com.monitorabrasil.monitoralegislativo.fragments.GastosFragment; |
| 22 | +import com.monitorabrasil.monitoralegislativo.fragments.ListaProjetosFragment; | |
| 23 | +import com.monitorabrasil.monitoralegislativo.fragments.PoliticoFichaFragment; | |
| 20 | 24 | import com.parse.ParseObject; |
| 21 | 25 | import com.parse.ParseQuery; |
| 22 | 26 | |
| 27 | +import java.util.ArrayList; | |
| 28 | +import java.util.List; | |
| 29 | + | |
| 23 | 30 | public class PoliticoFichaActivity extends AppCompatActivity { |
| 24 | 31 | |
| 25 | 32 | Toolbar toolbar; |
| 26 | 33 | CollapsingToolbarLayout collapsingToolbarLayout; |
| 34 | + TabLayout tabLayout; | |
| 35 | + String idPolitico; | |
| 36 | + | |
| 27 | 37 | |
| 28 | 38 | |
| 29 | 39 | // ActionBarDrawerToggle drawerToggle; |
| 30 | 40 | |
| 31 | 41 | CoordinatorLayout rootLayout; |
| 32 | - FloatingActionButton fabBtn; | |
| 33 | 42 | |
| 34 | 43 | @Override |
| 35 | 44 | protected void onCreate(Bundle savedInstanceState) { |
| 36 | 45 | super.onCreate(savedInstanceState); |
| 37 | 46 | setContentView(R.layout.activity_politico_ficha); |
| 38 | 47 | |
| 39 | - initToolbar(); | |
| 48 | + | |
| 40 | 49 | initInstances(); |
| 50 | + initToolbar(); | |
| 41 | 51 | |
| 42 | 52 | Bundle bundle = getIntent().getExtras(); |
| 43 | - buscaPolitico(bundle.getString("politico")) ; | |
| 53 | + idPolitico = bundle.getString("politico"); | |
| 54 | + buscaPolitico(idPolitico) ; | |
| 55 | + | |
| 56 | + // buscaGrafico(); | |
| 57 | + //montaFicha(); | |
| 58 | + | |
| 59 | + ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); | |
| 60 | + if (viewPager != null) { | |
| 61 | + setupViewPager(viewPager); | |
| 62 | + } | |
| 63 | + | |
| 64 | + setSupportActionBar(toolbar); | |
| 65 | + getSupportActionBar().setDisplayHomeAsUpEnabled(true); | |
| 66 | + | |
| 67 | + FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | |
| 68 | + fab.setOnClickListener(new View.OnClickListener() { | |
| 69 | + @Override | |
| 70 | + public void onClick(View view) { | |
| 71 | + Intent mIntent = new Intent(MyApp.getInstance().getApplicationContext(), ComentarioActivity.class); | |
| 72 | + mIntent.putExtra("politico", idPolitico); | |
| 73 | + | |
| 74 | + mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
| 75 | + | |
| 76 | + MyApp.getInstance().startActivity(mIntent); | |
| 77 | + | |
| 78 | + } | |
| 79 | + }); | |
| 44 | 80 | |
| 45 | - buscaGrafico(); | |
| 46 | 81 | |
| 47 | 82 | |
| 48 | 83 | |
| 49 | 84 | } |
| 50 | 85 | |
| 51 | - private void buscaGrafico() { | |
| 86 | + private void setupViewPager(ViewPager viewPager) { | |
| 87 | + Adapter adapter = new Adapter(getSupportFragmentManager()); | |
| 88 | + PoliticoFichaFragment ficha = new PoliticoFichaFragment(); | |
| 89 | + ficha.setArguments(getIntent().getExtras()); | |
| 90 | + adapter.addFragment(ficha, "Ficha"); | |
| 52 | 91 | GastosFragment gastos = new GastosFragment(); |
| 53 | 92 | gastos.setArguments(getIntent().getExtras()); |
| 54 | - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); | |
| 55 | - ft.add(R.id.rl_fragment_container, gastos, "politicoFrag"); | |
| 56 | - ft.commit(); | |
| 93 | + adapter.addFragment(gastos, "Gastos"); | |
| 94 | + | |
| 95 | + //projetos | |
| 96 | + ListaProjetosFragment listaProjetosFragment = new ListaProjetosFragment(); | |
| 97 | + listaProjetosFragment.setArguments(getIntent().getExtras()); | |
| 98 | + adapter.addFragment(listaProjetosFragment, "Projetos"); | |
| 99 | + | |
| 100 | + //adapter.addFragment(new CheeseListFragment(), "Category 3"); | |
| 101 | + viewPager.setAdapter(adapter); | |
| 102 | + viewPager.getAdapter().notifyDataSetChanged(); | |
| 103 | + | |
| 104 | + tabLayout = (TabLayout) findViewById(R.id.tabLayout); | |
| 105 | + tabLayout.setupWithViewPager(viewPager); | |
| 57 | 106 | } |
| 58 | 107 | |
| 108 | + | |
| 109 | + | |
| 59 | 110 | private ParseObject buscaPolitico(String id) { |
| 60 | 111 | |
| 61 | 112 | ParseQuery<ParseObject> query = ParseQuery.getQuery("Politico"); |
| 62 | 113 | query.fromLocalDatastore(); |
| 63 | 114 | try { |
| 64 | 115 | ParseObject politico = query.get(id); |
| 65 | - collapsingToolbarLayout.setTitle(politico.get("nome").toString()); | |
| 116 | + setTitle(politico.get("nome").toString()); | |
| 117 | +// collapsingToolbarLayout.setTitle(politico.get("nome").toString()); | |
| 66 | 118 | } catch (com.parse.ParseException e) { |
| 67 | 119 | e.printStackTrace(); |
| 68 | 120 | } |
| ... | ... | @@ -79,27 +131,19 @@ public class PoliticoFichaActivity extends AppCompatActivity { |
| 79 | 131 | // drawerToggle = new ActionBarDrawerToggle(PoliticoFichaActivity.this, drawerLayout, R.string.hello_world, R.string.hello_world); |
| 80 | 132 | // drawerLayout.setDrawerListener(drawerToggle); |
| 81 | 133 | |
| 82 | - getSupportActionBar().setHomeButtonEnabled(true); | |
| 83 | - getSupportActionBar().setDisplayHomeAsUpEnabled(true); | |
| 134 | +// getSupportActionBar().setHomeButtonEnabled(true); | |
| 135 | +// getSupportActionBar().setDisplayHomeAsUpEnabled(true); | |
| 136 | + | |
| 137 | + rootLayout = (CoordinatorLayout) findViewById(R.id.main_content); | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + //collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); | |
| 143 | + | |
| 84 | 144 | |
| 85 | - rootLayout = (CoordinatorLayout) findViewById(R.id.rootLayout); | |
| 86 | 145 | |
| 87 | - fabBtn = (FloatingActionButton) findViewById(R.id.fabBtn); | |
| 88 | - fabBtn.setOnClickListener(new View.OnClickListener() { | |
| 89 | - @Override | |
| 90 | - public void onClick(View v) { | |
| 91 | - Snackbar.make(rootLayout, "Hello. I am Snackbar!", Snackbar.LENGTH_SHORT) | |
| 92 | - .setAction("Undo", new View.OnClickListener() { | |
| 93 | - @Override | |
| 94 | - public void onClick(View v) { | |
| 95 | - | |
| 96 | - } | |
| 97 | - }) | |
| 98 | - .show(); | |
| 99 | - } | |
| 100 | - }); | |
| 101 | 146 | |
| 102 | - collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsingToolbarLayout); | |
| 103 | 147 | |
| 104 | 148 | } |
| 105 | 149 | |
| ... | ... | @@ -139,4 +183,35 @@ public class PoliticoFichaActivity extends AppCompatActivity { |
| 139 | 183 | |
| 140 | 184 | return super.onOptionsItemSelected(item); |
| 141 | 185 | } |
| 186 | + | |
| 187 | + static class Adapter extends FragmentStatePagerAdapter { | |
| 188 | + private final List<Fragment> mFragments = new ArrayList<>(); | |
| 189 | + private final List<String> mFragmentTitles = new ArrayList<>(); | |
| 190 | + | |
| 191 | + public Adapter(FragmentManager fm) { | |
| 192 | + super(fm); | |
| 193 | + } | |
| 194 | + | |
| 195 | + public void addFragment(Fragment fragment, String title) { | |
| 196 | + mFragments.add(fragment); | |
| 197 | + mFragmentTitles.add(title); | |
| 198 | + } | |
| 199 | + | |
| 200 | + @Override | |
| 201 | + public Fragment getItem(int position) { | |
| 202 | + | |
| 203 | + return mFragments.get(position); | |
| 204 | + } | |
| 205 | + | |
| 206 | + | |
| 207 | + @Override | |
| 208 | + public int getCount() { | |
| 209 | + return mFragments.size(); | |
| 210 | + } | |
| 211 | + | |
| 212 | + @Override | |
| 213 | + public CharSequence getPageTitle(int position) { | |
| 214 | + return mFragmentTitles.get(position); | |
| 215 | + } | |
| 216 | + } | |
| 142 | 217 | } | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/adapters/VereadorAdapter.java
| ... | ... | @@ -4,9 +4,12 @@ import android.support.v7.widget.RecyclerView; |
| 4 | 4 | import android.view.LayoutInflater; |
| 5 | 5 | import android.view.View; |
| 6 | 6 | import android.view.ViewGroup; |
| 7 | +import android.widget.ImageView; | |
| 8 | +import android.widget.RatingBar; | |
| 7 | 9 | import android.widget.TextView; |
| 8 | 10 | |
| 9 | 11 | import com.monitorabrasil.monitoralegislativo.R; |
| 12 | +import com.monitorabrasil.monitoralegislativo.application.MyApp; | |
| 10 | 13 | import com.monitorabrasil.monitoralegislativo.interfaces.RecyclerViewOnClickListenerHack; |
| 11 | 14 | import com.parse.ParseObject; |
| 12 | 15 | |
| ... | ... | @@ -27,10 +30,14 @@ public class VereadorAdapter extends RecyclerView.Adapter<VereadorAdapter.ViewHo |
| 27 | 30 | // each data item is just a string in this case |
| 28 | 31 | public TextView mTextView; |
| 29 | 32 | public TextView txtPartido; |
| 33 | + public ImageView foto; | |
| 34 | + public RatingBar rb; | |
| 30 | 35 | public ViewHolder(View v) { |
| 31 | 36 | super(v); |
| 32 | 37 | mTextView = (TextView) v.findViewById(R.id.txtNome); |
| 33 | 38 | txtPartido = (TextView) v.findViewById(R.id.txtPartido); |
| 39 | + foto = (ImageView)v.findViewById(R.id.foto); | |
| 40 | + rb = (RatingBar)v.findViewById(R.id.ratingBar); | |
| 34 | 41 | |
| 35 | 42 | itemView.setOnClickListener(this); |
| 36 | 43 | } |
| ... | ... | @@ -66,6 +73,9 @@ public class VereadorAdapter extends RecyclerView.Adapter<VereadorAdapter.ViewHo |
| 66 | 73 | vereador.pinInBackground(); |
| 67 | 74 | viewHolder.mTextView.setText(vereador.get("nome").toString()); |
| 68 | 75 | viewHolder.txtPartido.setText(vereador.get("partido").toString()); |
| 76 | + viewHolder.rb.setRating((float)vereador.getDouble("avaliacao")); | |
| 77 | + MyApp.getInstance().getmImagemLoader().displayImage(MyApp.URL_FOTO + vereador.get("cpf") + ".jpg", viewHolder.foto); | |
| 78 | + | |
| 69 | 79 | } |
| 70 | 80 | |
| 71 | 81 | @Override | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/application/MyApp.java
app/src/main/java/com/monitorabrasil/monitoralegislativo/dialogs/DialogAvaliacao.java
0 → 100644
| ... | ... | @@ -0,0 +1,166 @@ |
| 1 | +package com.monitorabrasil.monitoralegislativo.dialogs; | |
| 2 | + | |
| 3 | +import android.annotation.SuppressLint; | |
| 4 | +import android.app.Dialog; | |
| 5 | +import android.app.DialogFragment; | |
| 6 | +import android.content.Context; | |
| 7 | +import android.content.DialogInterface; | |
| 8 | +import android.os.AsyncTask; | |
| 9 | +import android.os.Bundle; | |
| 10 | +import android.support.design.widget.Snackbar; | |
| 11 | +import android.view.LayoutInflater; | |
| 12 | +import android.view.View; | |
| 13 | +import android.view.View.OnClickListener; | |
| 14 | +import android.view.ViewGroup; | |
| 15 | +import android.widget.Button; | |
| 16 | +import android.widget.RatingBar; | |
| 17 | +import android.widget.Toast; | |
| 18 | + | |
| 19 | + | |
| 20 | +import com.monitorabrasil.monitoralegislativo.R; | |
| 21 | +import com.monitorabrasil.monitoralegislativo.application.MyApp; | |
| 22 | +import com.parse.ParseException; | |
| 23 | +import com.parse.ParseObject; | |
| 24 | +import com.parse.ParseQuery; | |
| 25 | +import com.parse.ParseUser; | |
| 26 | +import com.parse.SaveCallback; | |
| 27 | + | |
| 28 | +@SuppressLint("ValidFragment") | |
| 29 | +public class DialogAvaliacao extends DialogFragment { | |
| 30 | + | |
| 31 | + int idUser; | |
| 32 | + int idPolitico; | |
| 33 | + private String titulo; | |
| 34 | + private ParseObject mPolitico; | |
| 35 | + private ParseObject mAvaliacao; | |
| 36 | + | |
| 37 | + private DialogInterface.OnDismissListener onDismissListener; | |
| 38 | + | |
| 39 | + private boolean jaVotou; | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + public DialogAvaliacao(ParseObject politico, String titulo) { | |
| 44 | + this.titulo=titulo; | |
| 45 | + this.mPolitico = politico; | |
| 46 | + } | |
| 47 | + | |
| 48 | + @Override | |
| 49 | + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |
| 50 | + final View view = inflater.inflate(R.layout.dialog_avaliacao, container, false); | |
| 51 | + | |
| 52 | + final RatingBar rb = (RatingBar) view.findViewById(R.id.ratingBar1); | |
| 53 | + | |
| 54 | + jaVotou = false; | |
| 55 | + | |
| 56 | + // setar avaliacao feita | |
| 57 | + ParseQuery<ParseObject> query = ParseQuery.getQuery("Avaliacao"); | |
| 58 | + query.fromLocalDatastore(); | |
| 59 | + try { | |
| 60 | + query.whereEqualTo("politico", mPolitico); | |
| 61 | + mAvaliacao = query.getFirst(); | |
| 62 | + if(mAvaliacao != null){ | |
| 63 | + jaVotou = true; | |
| 64 | + rb.setRating((float)mAvaliacao.getDouble("avaliacao")); | |
| 65 | + } | |
| 66 | + } catch (Exception e) { | |
| 67 | + e.printStackTrace(); | |
| 68 | + } | |
| 69 | + | |
| 70 | + //rb.setRating(new UserDAO(getActivity()).buscaAvaliacaoSalva(idPolitico)); | |
| 71 | + | |
| 72 | + Button btnCancelar = (Button) view.findViewById(R.id.cancel); | |
| 73 | + btnCancelar.setOnClickListener(new OnClickListener() { | |
| 74 | + | |
| 75 | + @Override | |
| 76 | + public void onClick(View v) { | |
| 77 | + getDialog().dismiss(); | |
| 78 | + | |
| 79 | + } | |
| 80 | + }); | |
| 81 | + | |
| 82 | + Button btnOk = (Button) view.findViewById(R.id.ok); | |
| 83 | + btnOk.setOnClickListener(new OnClickListener() { | |
| 84 | + | |
| 85 | + @Override | |
| 86 | + public void onClick(final View v) { | |
| 87 | + if(ParseUser.getCurrentUser()!= null){ | |
| 88 | + double ultimaAvaliacao=0; | |
| 89 | + //salva a avaliacao | |
| 90 | + if(!jaVotou){ | |
| 91 | + mAvaliacao = new ParseObject("Avaliacao"); | |
| 92 | + mAvaliacao.put("politico",mPolitico); | |
| 93 | + mAvaliacao.put("user", ParseUser.getCurrentUser()); | |
| 94 | + }else{ | |
| 95 | + //guardar a ultima valor da avaliacao anterior | |
| 96 | + ultimaAvaliacao = mAvaliacao.getDouble("avaliacao"); | |
| 97 | + } | |
| 98 | + | |
| 99 | + mAvaliacao.put("avaliacao", rb.getRating()); | |
| 100 | + mAvaliacao.saveInBackground(new SaveCallback() { | |
| 101 | + @Override | |
| 102 | + public void done(ParseException e) { | |
| 103 | + | |
| 104 | + } | |
| 105 | + }); | |
| 106 | + mAvaliacao.pinInBackground(); | |
| 107 | + try { | |
| 108 | + mPolitico.fetchFromLocalDatastore(); | |
| 109 | + } catch (ParseException e) { | |
| 110 | + e.printStackTrace(); | |
| 111 | + } | |
| 112 | + int nrAvalicao = mPolitico.getInt("qtd_avaliacao"); | |
| 113 | + double media = mPolitico.getDouble("avaliacao"); | |
| 114 | + double total = nrAvalicao*media; | |
| 115 | + if(jaVotou){ | |
| 116 | + total = total - ultimaAvaliacao; | |
| 117 | + }else{ | |
| 118 | + nrAvalicao++; | |
| 119 | + mPolitico.increment("qtd_avaliacao"); | |
| 120 | + } | |
| 121 | + | |
| 122 | + mPolitico.put("avaliacao", (rb.getRating() + total) / nrAvalicao); | |
| 123 | + | |
| 124 | + mPolitico.saveInBackground(); | |
| 125 | + mPolitico.pinInBackground(); | |
| 126 | + } | |
| 127 | + | |
| 128 | + getDialog().dismiss(); | |
| 129 | + } | |
| 130 | + }); | |
| 131 | + return view; | |
| 132 | + } | |
| 133 | + | |
| 134 | + @Override | |
| 135 | + public Dialog onCreateDialog(Bundle savedInstanceState) { | |
| 136 | + | |
| 137 | + Dialog dialog = super.onCreateDialog(savedInstanceState); | |
| 138 | + // dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); | |
| 139 | + dialog.setTitle(titulo); | |
| 140 | + | |
| 141 | + // WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); | |
| 142 | + // lp.copyFrom(dialog.getWindow().getAttributes()); | |
| 143 | + // lp.width = WindowManager.LayoutParams.MATCH_PARENT-20; | |
| 144 | + // dialog.show(); | |
| 145 | + // dialog.getWindow().setAttributes(lp); | |
| 146 | + | |
| 147 | + return dialog; | |
| 148 | + } | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + public void setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) { | |
| 153 | + this.onDismissListener = onDismissListener; | |
| 154 | + } | |
| 155 | + | |
| 156 | + @Override | |
| 157 | + public void onDismiss(DialogInterface dialog) { | |
| 158 | + super.onDismiss(dialog); | |
| 159 | + if (onDismissListener != null) { | |
| 160 | + onDismissListener.onDismiss(dialog); | |
| 161 | + } | |
| 162 | + } | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | +} | |
| 0 | 167 | \ No newline at end of file | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/fragments/GastosCamaraFragment.java
| ... | ... | @@ -127,7 +127,6 @@ public class GastosCamaraFragment extends Fragment { |
| 127 | 127 | |
| 128 | 128 | private ParseObject buscaGastos() { |
| 129 | 129 | |
| 130 | - | |
| 131 | 130 | ParseQuery<ParseObject> query = ParseQuery.getQuery("DespesaCamara"); |
| 132 | 131 | query.setLimit(200); |
| 133 | 132 | //query.whereEqualTo("politico",politico); |
| ... | ... | @@ -259,109 +258,6 @@ public class GastosCamaraFragment extends Fragment { |
| 259 | 258 | |
| 260 | 259 | |
| 261 | 260 | |
| 262 | - private void buildGraph() { | |
| 263 | - | |
| 264 | -// mChart.set | |
| 265 | - | |
| 266 | - mChart.setDrawBarShadow(false); | |
| 267 | - mChart.setDrawValueAboveBar(true); | |
| 268 | - | |
| 269 | - mChart.setDescription(""); | |
| 270 | - | |
| 271 | - // if more than 60 entries are displayed in the chart, no values will be | |
| 272 | - // drawn | |
| 273 | - mChart.setMaxVisibleValueCount(60); | |
| 274 | - | |
| 275 | - // scaling can now only be done on x- and y-axis separately | |
| 276 | - mChart.setPinchZoom(false); | |
| 277 | - | |
| 278 | - // draw shadows for each bar that show the maximum value | |
| 279 | - // mChart.setDrawBarShadow(true); | |
| 280 | - | |
| 281 | - // mChart.setDrawXLabels(false); | |
| 282 | - | |
| 283 | - mChart.setDrawGridBackground(false); | |
| 284 | - // mChart.setDrawYLabels(false); | |
| 285 | - | |
| 286 | -// mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf"); | |
| 287 | - | |
| 288 | - XAxis xAxis = mChart.getXAxis(); | |
| 289 | - xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); | |
| 290 | -// xAxis.setTypeface(mTf); | |
| 291 | - xAxis.setDrawGridLines(false); | |
| 292 | - xAxis.setSpaceBetweenLabels(2); | |
| 293 | - | |
| 294 | - ValueFormatter custom = new MyValueFormatter(); | |
| 295 | - | |
| 296 | - YAxis leftAxis = mChart.getAxisLeft(); | |
| 297 | -// leftAxis.setTypeface(mTf); | |
| 298 | - leftAxis.setLabelCount(8); | |
| 299 | - leftAxis.setValueFormatter(custom); | |
| 300 | - leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART); | |
| 301 | - leftAxis.setSpaceTop(15f); | |
| 302 | - | |
| 303 | - mChart.getAxisRight().setEnabled(false); | |
| 304 | - YAxis rightAxis = mChart.getAxisRight(); | |
| 305 | - rightAxis.setDrawGridLines(false); | |
| 306 | -// rightAxis.setTypeface(mTf); | |
| 307 | - rightAxis.setLabelCount(8); | |
| 308 | - rightAxis.setValueFormatter(custom); | |
| 309 | - rightAxis.setSpaceTop(15f); | |
| 310 | - | |
| 311 | - Legend l = mChart.getLegend(); | |
| 312 | - l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT); | |
| 313 | - l.setForm(Legend.LegendForm.SQUARE); | |
| 314 | - l.setFormSize(9f); | |
| 315 | - l.setTextSize(11f); | |
| 316 | - l.setXEntrySpace(4f); | |
| 317 | - // l.setExtra(ColorTemplate.VORDIPLOM_COLORS, new String[] { "abc", | |
| 318 | - // "def", "ghj", "ikl", "mno" }); | |
| 319 | - // l.setCustom(ColorTemplate.VORDIPLOM_COLORS, new String[] { "abc", | |
| 320 | - // "def", "ghj", "ikl", "mno" }); | |
| 321 | - | |
| 322 | - | |
| 323 | - | |
| 324 | - // setting data | |
| 325 | -// mSeekBarY.setProgress(50); | |
| 326 | -// mSeekBarX.setProgress(12); | |
| 327 | -// | |
| 328 | -// mSeekBarY.setOnSeekBarChangeListener(this); | |
| 329 | -// mSeekBarX.setOnSeekBarChangeListener(this); | |
| 330 | - | |
| 331 | - // mChart.setDrawLegend(false); | |
| 332 | - | |
| 333 | - } | |
| 334 | - | |
| 335 | - private void setData() { | |
| 336 | - | |
| 337 | - | |
| 338 | - | |
| 339 | - BarDataSet set1 = new BarDataSet(yVals1, "Gastos Totais"); | |
| 340 | - set1.setBarSpacePercent(35f); | |
| 341 | - | |
| 342 | - ArrayList<BarDataSet> dataSets = new ArrayList<BarDataSet>(); | |
| 343 | - dataSets.add(set1); | |
| 344 | - try{ | |
| 345 | - set1.setColor(getActivity().getResources().getColor(R.color.colorPrimaryLight)); | |
| 346 | - | |
| 347 | - BarData data = new BarData(xVals, dataSets); | |
| 348 | - // data.setValueFormatter(new MyValueFormatter()); | |
| 349 | - data.setValueTextSize(10f); | |
| 350 | -// data.setValueTypeface(mTf); | |
| 351 | - | |
| 352 | - mChart.setData(data); | |
| 353 | - mChart.animateX(2500, Easing.EasingOption.EaseInOutQuart); | |
| 354 | - mChart.notifyDataSetChanged(); | |
| 355 | - | |
| 356 | -// pb.setVisibility(View.GONE); | |
| 357 | - mChart.setVisibility(View.VISIBLE); | |
| 358 | - }catch (Exception e){ | |
| 359 | - Crashlytics.log("GastosCamaraFragment "+e.toString()); | |
| 360 | - } | |
| 361 | - | |
| 362 | - } | |
| 363 | - | |
| 364 | - | |
| 365 | 261 | // TODO: Rename method, update argument and hook method into UI event |
| 366 | 262 | public void onButtonPressed(Uri uri) { |
| 367 | 263 | if (mListener != null) { | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/fragments/HomeFragment.java
| 1 | 1 | package com.monitorabrasil.monitoralegislativo.fragments; |
| 2 | 2 | |
| 3 | 3 | import android.app.Activity; |
| 4 | +import android.content.Intent; | |
| 4 | 5 | import android.net.Uri; |
| 5 | 6 | import android.os.Bundle; |
| 6 | 7 | import android.support.v4.app.Fragment; |
| 8 | +import android.support.v7.widget.LinearLayoutManager; | |
| 9 | +import android.support.v7.widget.RecyclerView; | |
| 10 | +import android.util.Log; | |
| 7 | 11 | import android.view.LayoutInflater; |
| 8 | 12 | import android.view.View; |
| 9 | 13 | import android.view.ViewGroup; |
| 10 | 14 | |
| 15 | +import com.crashlytics.android.Crashlytics; | |
| 16 | +import com.github.mikephil.charting.animation.Easing; | |
| 17 | +import com.github.mikephil.charting.charts.BarChart; | |
| 18 | +import com.github.mikephil.charting.components.Legend; | |
| 19 | +import com.github.mikephil.charting.components.XAxis; | |
| 20 | +import com.github.mikephil.charting.components.YAxis; | |
| 21 | +import com.github.mikephil.charting.data.BarData; | |
| 22 | +import com.github.mikephil.charting.data.BarDataSet; | |
| 23 | +import com.github.mikephil.charting.data.BarEntry; | |
| 24 | +import com.github.mikephil.charting.data.Entry; | |
| 25 | +import com.github.mikephil.charting.utils.ValueFormatter; | |
| 26 | +import com.monitorabrasil.monitoralegislativo.PoliticoFichaActivity; | |
| 11 | 27 | import com.monitorabrasil.monitoralegislativo.R; |
| 28 | +import com.monitorabrasil.monitoralegislativo.adapters.VereadorAdapter; | |
| 29 | +import com.monitorabrasil.monitoralegislativo.application.MyApp; | |
| 30 | +import com.monitorabrasil.monitoralegislativo.classes.Grafico; | |
| 31 | +import com.monitorabrasil.monitoralegislativo.interfaces.RecyclerViewOnClickListenerHack; | |
| 32 | +import com.monitorabrasil.monitoralegislativo.util.MyValueFormatter; | |
| 33 | +import com.parse.FindCallback; | |
| 34 | +import com.parse.ParseException; | |
| 35 | +import com.parse.ParseObject; | |
| 36 | +import com.parse.ParseQuery; | |
| 37 | + | |
| 38 | +import java.util.ArrayList; | |
| 39 | +import java.util.HashMap; | |
| 40 | +import java.util.Iterator; | |
| 41 | +import java.util.List; | |
| 12 | 42 | |
| 13 | 43 | /** |
| 14 | 44 | * A simple {@link Fragment} subclass. |
| ... | ... | @@ -18,10 +48,18 @@ import com.monitorabrasil.monitoralegislativo.R; |
| 18 | 48 | * Use the {@link HomeFragment#newInstance} factory method to |
| 19 | 49 | * create an instance of this fragment. |
| 20 | 50 | */ |
| 21 | -public class HomeFragment extends Fragment { | |
| 51 | +public class HomeFragment extends Fragment implements RecyclerViewOnClickListenerHack { | |
| 22 | 52 | |
| 23 | 53 | |
| 24 | 54 | private OnFragmentInteractionListener mListener; |
| 55 | + private RecyclerView mRecyclerView; | |
| 56 | + private VereadorAdapter mAdapter; | |
| 57 | + private List<ParseObject> ob; | |
| 58 | + private HashMap<String,Float> valorTotal = new HashMap<String,Float>(); | |
| 59 | + ArrayList<String> xVals = new ArrayList<String>(); | |
| 60 | + ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>(); | |
| 61 | + | |
| 62 | + public BarChart mChart; | |
| 25 | 63 | |
| 26 | 64 | /** |
| 27 | 65 | * Use this factory method to create a new instance of |
| ... | ... | @@ -51,7 +89,186 @@ public class HomeFragment extends Fragment { |
| 51 | 89 | public View onCreateView(LayoutInflater inflater, ViewGroup container, |
| 52 | 90 | Bundle savedInstanceState) { |
| 53 | 91 | // Inflate the layout for this fragment |
| 54 | - return inflater.inflate(R.layout.fragment_home, container, false); | |
| 92 | + View view = inflater.inflate(R.layout.fragment_home, container, false); | |
| 93 | + //tableview | |
| 94 | + mRecyclerView = (RecyclerView) view.findViewById(R.id.my_recycler_view); | |
| 95 | + | |
| 96 | + | |
| 97 | + // use this setting to improve performance if you know that changes | |
| 98 | + // in content do not change the layout size of the RecyclerView | |
| 99 | + mRecyclerView.setHasFixedSize(true); | |
| 100 | + | |
| 101 | + LinearLayoutManager llm = new LinearLayoutManager(getActivity()); | |
| 102 | + llm.setOrientation(LinearLayoutManager.VERTICAL); | |
| 103 | + mRecyclerView.setLayoutManager(llm); | |
| 104 | + | |
| 105 | + //buscar os vereadores | |
| 106 | + buscaVereadores(); | |
| 107 | + | |
| 108 | + //buscar o grafico de gastos | |
| 109 | + mChart = (BarChart)view.findViewById(R.id.chart1); | |
| 110 | + buscaGastos(); | |
| 111 | + | |
| 112 | + | |
| 113 | + return view; | |
| 114 | + } | |
| 115 | + | |
| 116 | + private ParseObject buscaGastos() { | |
| 117 | + | |
| 118 | + ParseQuery<ParseObject> query = ParseQuery.getQuery("DespesaCamara"); | |
| 119 | + query.setLimit(200); | |
| 120 | + //query.whereEqualTo("politico",politico); | |
| 121 | + | |
| 122 | + query.addAscendingOrder("mes_numero"); | |
| 123 | + query.findInBackground(new FindCallback<ParseObject>() { | |
| 124 | + public void done(List<ParseObject> gastos, ParseException e) { | |
| 125 | + | |
| 126 | + Iterator<ParseObject> gastoIt = gastos.iterator(); | |
| 127 | + | |
| 128 | + while (gastoIt.hasNext()) { | |
| 129 | + | |
| 130 | + ParseObject g = gastoIt.next(); | |
| 131 | + String mes = g.getString("mes"); | |
| 132 | + Float novoValor = Float.valueOf(g.getString("valor")); | |
| 133 | + Float valor = valorTotal.get(mes); | |
| 134 | + if (valor != null) { | |
| 135 | + valor = valor + novoValor; | |
| 136 | + valorTotal.remove(mes); | |
| 137 | + valorTotal.put(mes, valor); | |
| 138 | + } else { | |
| 139 | + valorTotal.put(mes, novoValor); | |
| 140 | + } | |
| 141 | + if (!xVals.contains(mes)) { | |
| 142 | + xVals.add(mes); | |
| 143 | + } | |
| 144 | + | |
| 145 | + // | |
| 146 | + | |
| 147 | + | |
| 148 | + } | |
| 149 | + for (int j = 0; j < xVals.size(); j++) { | |
| 150 | + Float val = valorTotal.get(xVals.get(j)); | |
| 151 | + yVals1.add(new BarEntry(val, j)); | |
| 152 | + } | |
| 153 | + Grafico grafico = new Grafico("Todos", yVals1, xVals, R.color.cor10); | |
| 154 | + buildGraph(grafico); | |
| 155 | +// pb.setVisibility(View.INVISIBLE); | |
| 156 | + | |
| 157 | + // setData(); | |
| 158 | + | |
| 159 | + } | |
| 160 | + }); | |
| 161 | + | |
| 162 | + | |
| 163 | + return null; | |
| 164 | + } | |
| 165 | + | |
| 166 | + private void buildGraph(Grafico grafico) { | |
| 167 | + | |
| 168 | +// mChart.set | |
| 169 | + | |
| 170 | + mChart.setDrawBarShadow(false); | |
| 171 | + mChart.setDrawValueAboveBar(true); | |
| 172 | + | |
| 173 | + mChart.setDescription(""); | |
| 174 | + | |
| 175 | + // if more than 60 entries are displayed in the chart, no values will be | |
| 176 | + // drawn | |
| 177 | + mChart.setMaxVisibleValueCount(60); | |
| 178 | + | |
| 179 | + // scaling can now only be done on x- and y-axis separately | |
| 180 | + mChart.setPinchZoom(false); | |
| 181 | + | |
| 182 | + // draw shadows for each bar that show the maximum value | |
| 183 | + // mChart.setDrawBarShadow(true); | |
| 184 | + | |
| 185 | + // mChart.setDrawXLabels(false); | |
| 186 | + | |
| 187 | + mChart.setDrawGridBackground(false); | |
| 188 | + // mChart.setDrawYLabels(false); | |
| 189 | + | |
| 190 | +// mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf"); | |
| 191 | + | |
| 192 | + XAxis xAxis = mChart.getXAxis(); | |
| 193 | + xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); | |
| 194 | +// xAxis.setTypeface(mTf); | |
| 195 | + xAxis.setDrawGridLines(false); | |
| 196 | + xAxis.setSpaceBetweenLabels(2); | |
| 197 | + | |
| 198 | + ValueFormatter custom = new MyValueFormatter(); | |
| 199 | + | |
| 200 | + YAxis leftAxis = mChart.getAxisLeft(); | |
| 201 | +// leftAxis.setTypeface(mTf); | |
| 202 | + leftAxis.setLabelCount(8); | |
| 203 | + leftAxis.setValueFormatter(custom); | |
| 204 | + leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART); | |
| 205 | + leftAxis.setSpaceTop(15f); | |
| 206 | + | |
| 207 | + mChart.getAxisRight().setEnabled(false); | |
| 208 | + YAxis rightAxis = mChart.getAxisRight(); | |
| 209 | + rightAxis.setDrawGridLines(false); | |
| 210 | +// rightAxis.setTypeface(mTf); | |
| 211 | + rightAxis.setLabelCount(8); | |
| 212 | + rightAxis.setValueFormatter(custom); | |
| 213 | + rightAxis.setSpaceTop(15f); | |
| 214 | + | |
| 215 | + Legend l = mChart.getLegend(); | |
| 216 | + l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT); | |
| 217 | + l.setForm(Legend.LegendForm.SQUARE); | |
| 218 | + l.setFormSize(9f); | |
| 219 | + l.setTextSize(11f); | |
| 220 | + l.setXEntrySpace(4f); | |
| 221 | + // l.setExtra(ColorTemplate.VORDIPLOM_COLORS, new String[] { "abc", | |
| 222 | + // "def", "ghj", "ikl", "mno" }); | |
| 223 | + // l.setCustom(ColorTemplate.VORDIPLOM_COLORS, new String[] { "abc", | |
| 224 | + // "def", "ghj", "ikl", "mno" }); | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + // setting data | |
| 229 | +// mSeekBarY.setProgress(50); | |
| 230 | +// mSeekBarX.setProgress(12); | |
| 231 | +// | |
| 232 | +// mSeekBarY.setOnSeekBarChangeListener(this); | |
| 233 | +// mSeekBarX.setOnSeekBarChangeListener(this); | |
| 234 | + | |
| 235 | + // mChart.setDrawLegend(false); | |
| 236 | + | |
| 237 | + | |
| 238 | + //setdata | |
| 239 | + | |
| 240 | + setData(grafico); | |
| 241 | + | |
| 242 | + mChart.animateX(2500, Easing.EasingOption.EaseInOutQuart); | |
| 243 | + mChart.notifyDataSetChanged(); | |
| 244 | + | |
| 245 | + } | |
| 246 | + | |
| 247 | + private void setData(Grafico grafico) { | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + BarDataSet set1 = new BarDataSet(grafico.getyAxis(), "Gastos Totais"); | |
| 252 | + set1.setBarSpacePercent(35f); | |
| 253 | + | |
| 254 | + ArrayList<BarDataSet> dataSets = new ArrayList<BarDataSet>(); | |
| 255 | + dataSets.add(set1); | |
| 256 | + try{ | |
| 257 | + set1.setColor(MyApp.getInstance().getResources().getColor(grafico.getCor())); | |
| 258 | + | |
| 259 | + BarData data = new BarData(grafico.getxVals(), dataSets); | |
| 260 | + // data.setValueFormatter(new MyValueFormatter()); | |
| 261 | + data.setValueTextSize(10f); | |
| 262 | +// data.setValueTypeface(mTf); | |
| 263 | + mChart.setVisibility(View.VISIBLE); | |
| 264 | + mChart.setData(data); | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + }catch (Exception e){ | |
| 269 | + Crashlytics.log("GastosCamaraFragment " + e.toString()); | |
| 270 | + } | |
| 271 | + | |
| 55 | 272 | } |
| 56 | 273 | |
| 57 | 274 | // TODO: Rename method, update argument and hook method into UI event |
| ... | ... | @@ -61,6 +278,41 @@ public class HomeFragment extends Fragment { |
| 61 | 278 | } |
| 62 | 279 | } |
| 63 | 280 | |
| 281 | + //busca objetos | |
| 282 | + public void buscaVereadores(){ | |
| 283 | + ParseQuery<ParseObject> query = ParseQuery.getQuery("Politico"); | |
| 284 | + query.addDescendingOrder("avaliacao"); | |
| 285 | + //query.whereEqualTo("playerName", "Dan Stemkoski"); | |
| 286 | + query.findInBackground(new FindCallback<ParseObject>() { | |
| 287 | + @Override | |
| 288 | + public void done(List<ParseObject> list, com.parse.ParseException e) { | |
| 289 | + if (e == null) { | |
| 290 | + ob = list; | |
| 291 | + carregaList(list); | |
| 292 | + } else { | |
| 293 | + Log.d("score", "Error: " + e.getMessage()); | |
| 294 | + } | |
| 295 | + } | |
| 296 | + | |
| 297 | + | |
| 298 | + }); | |
| 299 | + } | |
| 300 | + | |
| 301 | + public void carregaList(List<ParseObject> list){ | |
| 302 | + mAdapter = new VereadorAdapter(list); | |
| 303 | + mAdapter.setRecyclerViewOnClickListenerHack(this); | |
| 304 | + mRecyclerView.setAdapter(mAdapter); | |
| 305 | + //pb.setVisibility(View.INVISIBLE); | |
| 306 | + } | |
| 307 | + | |
| 308 | + @Override | |
| 309 | + public void onClickListener(View view, int position) { | |
| 310 | + Intent intent = new Intent(getActivity(),PoliticoFichaActivity.class); | |
| 311 | + intent.putExtra("politico", ob.get(position).getObjectId()); | |
| 312 | + startActivity(intent); | |
| 313 | + | |
| 314 | + } | |
| 315 | + | |
| 64 | 316 | @Override |
| 65 | 317 | public void onAttach(Activity activity) { |
| 66 | 318 | super.onAttach(activity); | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/fragments/ListaPoliticoFragment.java
| ... | ... | @@ -47,6 +47,7 @@ public class ListaPoliticoFragment extends Fragment implements RecyclerViewOnCli |
| 47 | 47 | //tableview |
| 48 | 48 | mRecyclerView = (RecyclerView) view.findViewById(R.id.my_recycler_view); |
| 49 | 49 | |
| 50 | + | |
| 50 | 51 | // use this setting to improve performance if you know that changes |
| 51 | 52 | // in content do not change the layout size of the RecyclerView |
| 52 | 53 | mRecyclerView.setHasFixedSize(true); |
| ... | ... | @@ -96,11 +97,11 @@ public class ListaPoliticoFragment extends Fragment implements RecyclerViewOnCli |
| 96 | 97 | |
| 97 | 98 | // PoliticoFragment frag = new PoliticoFragment(); |
| 98 | 99 | // Bundle bundle = new Bundle(); |
| 99 | - try { | |
| 100 | - ob.get(position).pin(); | |
| 101 | - } catch (ParseException e) { | |
| 102 | - e.printStackTrace(); | |
| 103 | - } | |
| 100 | +// try { | |
| 101 | +// ob.get(position).pin(); | |
| 102 | +// } catch (ParseException e) { | |
| 103 | +// e.printStackTrace(); | |
| 104 | +// } | |
| 104 | 105 | // bundle.putString("politico", ob.get(position).getObjectId()); |
| 105 | 106 | // frag.setArguments(bundle); |
| 106 | 107 | // FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction(); | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/fragments/ListaProjetosFragment.java
| ... | ... | @@ -32,9 +32,6 @@ public class ListaProjetosFragment extends Fragment implements RecyclerViewOnCli |
| 32 | 32 | private ProjetoAdapter mAdapter; |
| 33 | 33 | private List<ParseObject> ob; |
| 34 | 34 | private ProgressBar pb; |
| 35 | - public ListaProjetosFragment() { | |
| 36 | - // Required empty public constructor | |
| 37 | - } | |
| 38 | 35 | |
| 39 | 36 | |
| 40 | 37 | @Override |
| ... | ... | @@ -64,7 +61,14 @@ public class ListaProjetosFragment extends Fragment implements RecyclerViewOnCli |
| 64 | 61 | public void buscaProjetos(){ |
| 65 | 62 | ParseQuery<ParseObject> query = ParseQuery.getQuery("Projeto"); |
| 66 | 63 | query.addDescendingOrder("createdAt"); |
| 67 | - //query.whereEqualTo("playerName", "Dan Stemkoski"); | |
| 64 | + Bundle bundle = getArguments(); | |
| 65 | + if(bundle != null){ | |
| 66 | + if(bundle.get("politico") != null){ | |
| 67 | + query.whereEqualTo("politico", buscaPolitico(bundle.getString("politico"))); | |
| 68 | + } | |
| 69 | + } | |
| 70 | + | |
| 71 | + | |
| 68 | 72 | query.findInBackground(new FindCallback<ParseObject>() { |
| 69 | 73 | @Override |
| 70 | 74 | public void done(List<ParseObject> list, com.parse.ParseException e) { |
| ... | ... | @@ -79,6 +83,19 @@ public class ListaProjetosFragment extends Fragment implements RecyclerViewOnCli |
| 79 | 83 | |
| 80 | 84 | }); |
| 81 | 85 | } |
| 86 | + | |
| 87 | + private ParseObject buscaPolitico(String id) { | |
| 88 | + | |
| 89 | + ParseQuery<ParseObject> query = ParseQuery.getQuery("Politico"); | |
| 90 | + query.fromLocalDatastore(); | |
| 91 | + try { | |
| 92 | + return query.get(id); | |
| 93 | + } catch (com.parse.ParseException e) { | |
| 94 | + e.printStackTrace(); | |
| 95 | + } | |
| 96 | + return null; | |
| 97 | + } | |
| 98 | + | |
| 82 | 99 | public void carregaList(List<ParseObject> list){ |
| 83 | 100 | mAdapter = new ProjetoAdapter(list,getActivity()); |
| 84 | 101 | mAdapter.setRecyclerViewOnClickListenerHack(this); |
| ... | ... | @@ -90,8 +107,8 @@ public class ListaProjetosFragment extends Fragment implements RecyclerViewOnCli |
| 90 | 107 | public void onClickListener(View view, int position) { |
| 91 | 108 | |
| 92 | 109 | |
| 93 | - PoliticoFragment frag = new PoliticoFragment(); | |
| 94 | - Bundle bundle = new Bundle(); | |
| 110 | +// PoliticoFragment frag = new PoliticoFragment(); | |
| 111 | +// Bundle bundle = new Bundle(); | |
| 95 | 112 | // try { |
| 96 | 113 | // ob.get(position).pin(); |
| 97 | 114 | // } catch (ParseException e) { | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/fragments/PoliticoFichaFragment.java
| 1 | 1 | package com.monitorabrasil.monitoralegislativo.fragments; |
| 2 | 2 | |
| 3 | +import android.content.DialogInterface; | |
| 4 | +import android.graphics.PorterDuff; | |
| 5 | +import android.graphics.drawable.LayerDrawable; | |
| 3 | 6 | import android.os.Bundle; |
| 7 | +import android.support.design.widget.Snackbar; | |
| 4 | 8 | import android.support.v4.app.Fragment; |
| 5 | 9 | import android.util.Log; |
| 6 | 10 | import android.view.LayoutInflater; |
| 7 | 11 | import android.view.View; |
| 8 | 12 | import android.view.ViewGroup; |
| 13 | +import android.widget.Button; | |
| 14 | +import android.widget.ImageView; | |
| 15 | +import android.widget.RatingBar; | |
| 9 | 16 | import android.widget.TextView; |
| 10 | 17 | |
| 11 | 18 | import com.monitorabrasil.monitoralegislativo.R; |
| 19 | +import com.monitorabrasil.monitoralegislativo.application.MyApp; | |
| 20 | +import com.monitorabrasil.monitoralegislativo.dialogs.DialogAvaliacao; | |
| 21 | +import com.parse.ParseException; | |
| 12 | 22 | import com.parse.ParseObject; |
| 13 | 23 | import com.parse.ParseQuery; |
| 14 | 24 | |
| ... | ... | @@ -19,15 +29,62 @@ public class PoliticoFichaFragment extends Fragment { |
| 19 | 29 | |
| 20 | 30 | |
| 21 | 31 | private ParseObject politico; |
| 22 | - View mView; | |
| 32 | + private View mView; | |
| 33 | + private RatingBar mRatingBar; | |
| 34 | + private Button btnAvaliar; | |
| 35 | + | |
| 36 | + | |
| 23 | 37 | public View onCreateView(LayoutInflater inflater, |
| 24 | 38 | ViewGroup container, |
| 25 | 39 | Bundle savedInstanceState) { |
| 26 | 40 | View view = inflater.inflate(R.layout.fragment_politico_detalhe, container, false); |
| 27 | 41 | mView=view; |
| 42 | + mRatingBar = (RatingBar)view.findViewById(R.id.ratingBar); | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 28 | 47 | |
| 29 | 48 | Bundle bundle = getArguments(); |
| 30 | 49 | politico = buscaPolitico(bundle.getString("politico")) ; |
| 50 | + | |
| 51 | + mRatingBar.setRating((float) politico.getDouble("avaliacao")); | |
| 52 | + | |
| 53 | + LayerDrawable stars = (LayerDrawable) mRatingBar.getProgressDrawable(); | |
| 54 | + stars.getDrawable(2).setColorFilter(getResources().getColor(R.color.colorAccent), PorterDuff.Mode.SRC_ATOP); | |
| 55 | + stars.getDrawable(1).setColorFilter(getResources().getColor(R.color.colorAccent), PorterDuff.Mode.SRC_ATOP); | |
| 56 | + stars.getDrawable(0).setColorFilter(getResources().getColor(R.color.coloLink), PorterDuff.Mode.SRC_ATOP); | |
| 57 | + | |
| 58 | + //btnAvaliar | |
| 59 | + btnAvaliar = (Button) view.findViewById(R.id.btnAvalie); | |
| 60 | + btnAvaliar.setOnClickListener(new View.OnClickListener() { | |
| 61 | + @Override | |
| 62 | + public void onClick(final View v) { | |
| 63 | + DialogAvaliacao avaliacao =new DialogAvaliacao(politico, "Avalie"); | |
| 64 | + | |
| 65 | + avaliacao.setOnDismissListener(new DialogInterface.OnDismissListener() { | |
| 66 | + @Override | |
| 67 | + public void onDismiss(DialogInterface dialog) { | |
| 68 | + //atualizar a avaliacao | |
| 69 | + try { | |
| 70 | + politico.fetchFromLocalDatastore(); | |
| 71 | + mRatingBar.setRating((float) politico.getDouble("avaliacao")); | |
| 72 | + Snackbar.make(v, "Avaliação salva.", Snackbar.LENGTH_LONG) | |
| 73 | + .setAction("Action", null).show(); | |
| 74 | + } catch (ParseException e) { | |
| 75 | + e.printStackTrace(); | |
| 76 | + } | |
| 77 | + | |
| 78 | + } | |
| 79 | + }); | |
| 80 | + avaliacao.show(getActivity().getFragmentManager(), "dialogAvaliar"); | |
| 81 | + } | |
| 82 | + }); | |
| 83 | + | |
| 84 | + //foto | |
| 85 | + ImageView foto = (ImageView)view.findViewById(R.id.foto); | |
| 86 | + MyApp.getInstance().getmImagemLoader().displayImage(MyApp.URL_FOTO+politico.get("cpf")+".jpg",foto); | |
| 87 | + | |
| 31 | 88 | //nome |
| 32 | 89 | TextView txtNome = (TextView) view.findViewById(R.id.txtNome); |
| 33 | 90 | txtNome.setText(politico.get("nome").toString()); | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/fragments/PoliticoFragment.java
| ... | ... | @@ -1,148 +0,0 @@ |
| 1 | -package com.monitorabrasil.monitoralegislativo.fragments; | |
| 2 | - | |
| 3 | -import android.app.ActionBar; | |
| 4 | -import android.os.Bundle; | |
| 5 | -import android.support.design.widget.FloatingActionButton; | |
| 6 | -import android.support.design.widget.Snackbar; | |
| 7 | -import android.support.design.widget.TabLayout; | |
| 8 | -import android.support.v4.app.Fragment; | |
| 9 | -import android.support.v4.app.FragmentManager; | |
| 10 | -import android.support.v4.app.FragmentPagerAdapter; | |
| 11 | -import android.support.v4.app.FragmentStatePagerAdapter; | |
| 12 | -import android.support.v4.app.FragmentTransaction; | |
| 13 | -import android.support.v4.view.ViewPager; | |
| 14 | -import android.support.v4.widget.DrawerLayout; | |
| 15 | -import android.support.v7.widget.Toolbar; | |
| 16 | -import android.view.LayoutInflater; | |
| 17 | -import android.view.View; | |
| 18 | -import android.view.ViewGroup; | |
| 19 | -import android.widget.TableLayout; | |
| 20 | -import android.widget.TextView; | |
| 21 | - | |
| 22 | -import com.google.gson.Gson; | |
| 23 | -import com.monitorabrasil.monitoralegislativo.PoliticosActivity; | |
| 24 | -import com.monitorabrasil.monitoralegislativo.R; | |
| 25 | -import com.parse.GetCallback; | |
| 26 | -import com.parse.ParseObject; | |
| 27 | -import com.parse.ParseQuery; | |
| 28 | - | |
| 29 | -import java.text.ParseException; | |
| 30 | -import java.util.ArrayList; | |
| 31 | -import java.util.List; | |
| 32 | - | |
| 33 | -/** | |
| 34 | - * Created by geraugu on 6/10/15. | |
| 35 | - */ | |
| 36 | -public class PoliticoFragment extends Fragment { | |
| 37 | - | |
| 38 | - | |
| 39 | - private DrawerLayout mDrawerLayout; | |
| 40 | - private ParseObject politico; | |
| 41 | - | |
| 42 | - @Override | |
| 43 | - public View onCreateView(LayoutInflater inflater, | |
| 44 | - ViewGroup container, | |
| 45 | - Bundle savedInstanceState) { | |
| 46 | - View view = inflater.inflate(R.layout.fragment_politico_tabs, container, false); | |
| 47 | - | |
| 48 | - //TABS | |
| 49 | - final ActionBar actionBar = getActivity().getActionBar(); | |
| 50 | - // Create a tab listener that is called when the user changes tabs. | |
| 51 | - | |
| 52 | - ViewPager viewPager = (ViewPager) view.findViewById(R.id.viewpager); | |
| 53 | - if (viewPager != null) { | |
| 54 | - setupViewPager(viewPager); | |
| 55 | - } | |
| 56 | - | |
| 57 | - FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab); | |
| 58 | - fab.setOnClickListener(new View.OnClickListener() { | |
| 59 | - @Override | |
| 60 | - public void onClick(View view) { | |
| 61 | - Snackbar.make(view, "Here's a Snackbar", Snackbar.LENGTH_LONG) | |
| 62 | - .setAction("Action", null).show(); | |
| 63 | - } | |
| 64 | - }); | |
| 65 | - | |
| 66 | - TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tabs); | |
| 67 | - tabLayout.setupWithViewPager(viewPager); | |
| 68 | - | |
| 69 | - | |
| 70 | - // getActivity() .setSupportActionBar(toolbar); | |
| 71 | - | |
| 72 | -// TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tabLayout); | |
| 73 | -// tabLayout.addTab(tabLayout.newTab().setText("Ficha")); | |
| 74 | -// tabLayout.addTab(tabLayout.newTab().setText("Gastos")); | |
| 75 | - | |
| 76 | - | |
| 77 | - | |
| 78 | - Bundle bundle = getArguments(); | |
| 79 | - politico = buscaPolitico(bundle.getString("politico")) ; | |
| 80 | - | |
| 81 | - | |
| 82 | - // TextView txtNome = (TextView) view.findViewById(R.id.txtNome); | |
| 83 | - // txtNome.setText(politico.get("nome").toString()); | |
| 84 | - | |
| 85 | - | |
| 86 | - | |
| 87 | - return view; | |
| 88 | - } | |
| 89 | - | |
| 90 | - private void setupViewPager(ViewPager viewPager) { | |
| 91 | - Adapter adapter = new Adapter(getActivity().getSupportFragmentManager()); | |
| 92 | - PoliticoFichaFragment ficha = new PoliticoFichaFragment(); | |
| 93 | - ficha.setArguments(getArguments()); | |
| 94 | - adapter.addFragment(ficha, "Ficha"); | |
| 95 | - GastosFragment gastos = new GastosFragment(); | |
| 96 | - gastos.setArguments(getArguments()); | |
| 97 | - adapter.addFragment(gastos, "Gastos"); | |
| 98 | - //adapter.addFragment(new CheeseListFragment(), "Category 3"); | |
| 99 | - viewPager.setAdapter(adapter); | |
| 100 | - viewPager.getAdapter().notifyDataSetChanged(); | |
| 101 | - } | |
| 102 | - | |
| 103 | - private ParseObject buscaPolitico(String id) { | |
| 104 | - | |
| 105 | - ParseQuery<ParseObject> query = ParseQuery.getQuery("Politico"); | |
| 106 | - query.fromLocalDatastore(); | |
| 107 | - try { | |
| 108 | - return query.get(id); | |
| 109 | - } catch (com.parse.ParseException e) { | |
| 110 | - e.printStackTrace(); | |
| 111 | - } | |
| 112 | - return null; | |
| 113 | - } | |
| 114 | - | |
| 115 | - static class Adapter extends FragmentStatePagerAdapter { | |
| 116 | - private final List<Fragment> mFragments = new ArrayList<>(); | |
| 117 | - private final List<String> mFragmentTitles = new ArrayList<>(); | |
| 118 | - | |
| 119 | - public Adapter(FragmentManager fm) { | |
| 120 | - super(fm); | |
| 121 | - } | |
| 122 | - | |
| 123 | - public void addFragment(Fragment fragment, String title) { | |
| 124 | - mFragments.add(fragment); | |
| 125 | - mFragmentTitles.add(title); | |
| 126 | - } | |
| 127 | - | |
| 128 | - @Override | |
| 129 | - public Fragment getItem(int position) { | |
| 130 | - | |
| 131 | - return mFragments.get(position); | |
| 132 | - } | |
| 133 | - | |
| 134 | - | |
| 135 | - @Override | |
| 136 | - public int getCount() { | |
| 137 | - return mFragments.size(); | |
| 138 | - } | |
| 139 | - | |
| 140 | - @Override | |
| 141 | - public CharSequence getPageTitle(int position) { | |
| 142 | - return mFragmentTitles.get(position); | |
| 143 | - } | |
| 144 | - } | |
| 145 | - | |
| 146 | - | |
| 147 | - | |
| 148 | -} |
app/src/main/res/layout/activity_politico_ficha.xml
| 1 | -<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 1 | +<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | 2 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 3 | - xmlns:tools="http://schemas.android.com/tools" | |
| 4 | - android:id="@+id/drawerLayout" | |
| 5 | - android:layout_width="match_parent" | |
| 6 | - android:layout_height="match_parent" | |
| 7 | - tools:context="com.monitorabrasil.monitoralegislativo.PoliticoFichaActivity"> | |
| 8 | - | |
| 9 | -<android.support.design.widget.CoordinatorLayout | |
| 10 | - android:id="@+id/rootLayout" | |
| 3 | + android:id="@+id/main_content" | |
| 11 | 4 | android:layout_width="match_parent" |
| 12 | 5 | android:layout_height="match_parent"> |
| 13 | 6 | |
| 7 | + | |
| 14 | 8 | <android.support.design.widget.AppBarLayout |
| 9 | + android:id="@+id/appbar" | |
| 15 | 10 | android:layout_width="match_parent" |
| 16 | - android:layout_height="@dimen/app_bar_height" | |
| 17 | - android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> | |
| 18 | - | |
| 19 | - <android.support.design.widget.CollapsingToolbarLayout | |
| 20 | - android:id="@+id/collapsingToolbarLayout" | |
| 11 | + android:layout_height="156dp" | |
| 12 | + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" | |
| 13 | + android:fitsSystemWindows="true"> | |
| 14 | + | |
| 15 | + <android.support.v7.widget.Toolbar | |
| 16 | + android:id="@+id/toolbar" | |
| 17 | + android:layout_height="92dp" | |
| 18 | + android:gravity="bottom" | |
| 19 | + android:paddingBottom="12dp" | |
| 20 | + android:paddingTop="16dp" | |
| 21 | + android:minHeight="?attr/actionBarSize" | |
| 22 | + app:layout_scrollFlags="scroll|exitUntilCollapsed" | |
| 21 | 23 | android:layout_width="match_parent" |
| 22 | - android:layout_height="match_parent" | |
| 23 | - app:contentScrim="?attr/colorPrimary" | |
| 24 | - app:expandedTitleMarginStart="@dimen/expanded_toolbar_title_margin_start" | |
| 25 | - app:layout_scrollFlags="scroll|exitUntilCollapsed"> | |
| 24 | + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" | |
| 25 | + app:layout_collapseMode="pin" /> | |
| 26 | 26 | |
| 27 | - <ImageView | |
| 28 | - android:layout_width="match_parent" | |
| 29 | - android:layout_height="match_parent" | |
| 30 | - android:scaleType="centerCrop" | |
| 31 | - android:src="@drawable/pattern1" | |
| 32 | - app:layout_collapseMode="parallax" | |
| 33 | - app:layout_collapseParallaxMultiplier="0.7" /> | |
| 34 | - | |
| 35 | - <android.support.v7.widget.Toolbar | |
| 36 | - android:id="@+id/toolbar" | |
| 37 | - android:layout_width="match_parent" | |
| 38 | - android:layout_height="?attr/actionBarSize" | |
| 39 | - app:layout_collapseMode="pin" | |
| 40 | - app:popupTheme="@style/ThemeOverlay.AppCompat.Light" | |
| 41 | - app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> | |
| 42 | - | |
| 43 | - </android.support.design.widget.CollapsingToolbarLayout> | |
| 44 | - | |
| 45 | - </android.support.design.widget.AppBarLayout> | |
| 46 | 27 | |
| 47 | - <android.support.v4.widget.NestedScrollView | |
| 48 | - android:layout_width="match_parent" | |
| 49 | - android:layout_height="match_parent" | |
| 50 | - app:layout_behavior="@string/appbar_scrolling_view_behavior"> | |
| 51 | - | |
| 52 | - <LinearLayout | |
| 28 | + <android.support.design.widget.TabLayout | |
| 29 | + android:id="@+id/tabLayout" | |
| 53 | 30 | android:layout_width="match_parent" |
| 54 | - android:layout_height="match_parent" | |
| 55 | - android:orientation="vertical"> | |
| 31 | + android:layout_height="wrap_content" | |
| 32 | + app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> | |
| 56 | 33 | |
| 57 | 34 | |
| 58 | - <include layout="@layout/fragment_politico_detalhe"/> | |
| 59 | - <RelativeLayout | |
| 60 | - android:id="@+id/rl_fragment_container" | |
| 61 | - android:layout_width="match_parent" | |
| 62 | - android:layout_height="400dp"> | |
| 63 | 35 | |
| 64 | - </RelativeLayout> | |
| 36 | + </android.support.design.widget.AppBarLayout> | |
| 65 | 37 | |
| 66 | - </LinearLayout> | |
| 67 | 38 | |
| 68 | - </android.support.v4.widget.NestedScrollView> | |
| 39 | + <android.support.v4.view.ViewPager | |
| 40 | + android:id="@+id/viewpager" | |
| 41 | + android:layout_width="match_parent" | |
| 42 | + android:layout_height="match_parent" | |
| 43 | + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> | |
| 69 | 44 | |
| 70 | 45 | <android.support.design.widget.FloatingActionButton |
| 71 | - android:id="@+id/fabBtn" | |
| 46 | + android:id="@+id/fab" | |
| 72 | 47 | android:layout_width="wrap_content" |
| 73 | 48 | android:layout_height="wrap_content" |
| 74 | - android:layout_gravity="bottom|right" | |
| 75 | - android:layout_marginBottom="@dimen/fab_margin_bottom" | |
| 76 | - android:layout_marginRight="@dimen/fab_margin_right" | |
| 77 | - android:src="@drawable/ic_done" | |
| 78 | - app:borderWidth="0dp" | |
| 79 | - app:fabSize="normal" /> | |
| 80 | - | |
| 81 | -</android.support.design.widget.CoordinatorLayout> | |
| 49 | + android:layout_gravity="end|bottom" | |
| 50 | + android:layout_margin="@dimen/fab_margin" | |
| 51 | + android:src="@android:drawable/stat_notify_chat" /> | |
| 82 | 52 | |
| 83 | - </android.support.v4.widget.DrawerLayout> | |
| 84 | 53 | \ No newline at end of file |
| 54 | +</android.support.design.widget.CoordinatorLayout> | |
| 85 | 55 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,53 @@ |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:layout_width="wrap_content" | |
| 4 | + android:layout_height="200dp" | |
| 5 | + android:layout_marginLeft="5dp" | |
| 6 | + android:layout_marginRight="5dp" | |
| 7 | + android:orientation="vertical" > | |
| 8 | + | |
| 9 | + <RatingBar | |
| 10 | + android:id="@+id/ratingBar1" | |
| 11 | + android:layout_width="wrap_content" | |
| 12 | + android:layout_height="wrap_content" | |
| 13 | + android:layout_alignParentTop="true" | |
| 14 | + android:layout_centerHorizontal="true" | |
| 15 | + android:layout_marginTop="16dp" /> | |
| 16 | + | |
| 17 | + <LinearLayout | |
| 18 | + style="?android:attr/buttonBarStyle" | |
| 19 | + android:layout_width="fill_parent" | |
| 20 | + android:layout_height="wrap_content" | |
| 21 | + android:layout_alignParentLeft="true" | |
| 22 | + android:layout_below="@+id/ratingBar1" | |
| 23 | + android:measureWithLargestChild="true" | |
| 24 | + android:orientation="horizontal" | |
| 25 | + android:paddingLeft="2dip" | |
| 26 | + android:paddingRight="2dip" | |
| 27 | + android:paddingTop="0dip" > | |
| 28 | + | |
| 29 | + <Button | |
| 30 | + android:id="@+id/cancel" | |
| 31 | + style="?android:attr/buttonBarButtonStyle" | |
| 32 | + android:layout_width="0dip" | |
| 33 | + android:layout_height="wrap_content" | |
| 34 | + android:layout_weight="1" | |
| 35 | + android:text="@android:string/cancel" /> | |
| 36 | + | |
| 37 | + <Button | |
| 38 | + android:id="@+id/ok" | |
| 39 | + style="?android:attr/buttonBarButtonStyle" | |
| 40 | + android:layout_width="0dip" | |
| 41 | + android:layout_height="wrap_content" | |
| 42 | + android:layout_weight="1" | |
| 43 | + android:text="@android:string/ok" /> | |
| 44 | + </LinearLayout> | |
| 45 | + | |
| 46 | + <View | |
| 47 | + android:layout_width="fill_parent" | |
| 48 | + android:layout_height="1dip" | |
| 49 | + android:layout_alignBottom="@+id/ratingBar1" | |
| 50 | + android:layout_alignParentLeft="true" | |
| 51 | + android:background="?android:attr/dividerHorizontal" /> | |
| 52 | + | |
| 53 | +</RelativeLayout> | |
| 0 | 54 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/fragment_home.xml
| ... | ... | @@ -2,9 +2,81 @@ |
| 2 | 2 | xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" |
| 3 | 3 | android:layout_height="match_parent" |
| 4 | 4 | tools:context="com.monitorabrasil.monitoralegislativo.fragments.HomeFragment"> |
| 5 | + <android.support.v4.widget.NestedScrollView | |
| 5 | 6 | |
| 6 | - <!-- TODO: Update blank fragment layout --> | |
| 7 | - <TextView android:layout_width="match_parent" android:layout_height="match_parent" | |
| 8 | - android:text="@string/hello_blank_fragment" /> | |
| 7 | + android:layout_width="match_parent" | |
| 8 | + android:layout_height="wrap_content"> | |
| 9 | 9 | |
| 10 | + <!-- TODO: Update blank fragment layout --> | |
| 11 | + <LinearLayout | |
| 12 | + android:orientation="vertical" | |
| 13 | + android:layout_width="match_parent" | |
| 14 | + android:layout_height="match_parent"> | |
| 15 | + | |
| 16 | + <android.support.v7.widget.CardView | |
| 17 | + android:layout_width="match_parent" | |
| 18 | + android:layout_height="300dp" | |
| 19 | + android:layout_margin="@dimen/card_margin"> | |
| 20 | + | |
| 21 | + | |
| 22 | + <LinearLayout | |
| 23 | + android:layout_width="match_parent" | |
| 24 | + android:layout_height="match_parent" | |
| 25 | + android:orientation="vertical" > | |
| 26 | + | |
| 27 | + <TextView | |
| 28 | + android:layout_width="wrap_content" | |
| 29 | + android:layout_height="wrap_content" | |
| 30 | + android:textAppearance="@style/Base.TextAppearance.Widget.AppCompat.Toolbar.Subtitle" | |
| 31 | + android:text="Ranking" | |
| 32 | + android:id="@+id/textView4" | |
| 33 | + android:paddingTop="8dp" | |
| 34 | + android:paddingLeft="16dp" | |
| 35 | + android:paddingBottom="10dp" /> | |
| 36 | + | |
| 37 | + <android.support.v7.widget.RecyclerView | |
| 38 | + android:id="@+id/my_recycler_view" | |
| 39 | + android:layout_width="wrap_content" | |
| 40 | + android:layout_height="250dp" | |
| 41 | + android:paddingTop="5dp" | |
| 42 | + android:paddingLeft="@dimen/activity_horizontal_margin" | |
| 43 | + android:paddingRight="4dp"> | |
| 44 | + | |
| 45 | + </android.support.v7.widget.RecyclerView> | |
| 46 | + | |
| 47 | + </LinearLayout> | |
| 48 | + | |
| 49 | + </android.support.v7.widget.CardView> | |
| 50 | + | |
| 51 | + <android.support.v7.widget.CardView | |
| 52 | + android:layout_width="match_parent" | |
| 53 | + android:layout_height="420dp" | |
| 54 | + android:layout_margin="@dimen/card_margin"> | |
| 55 | + <LinearLayout | |
| 56 | + android:orientation="vertical" | |
| 57 | + android:layout_width="match_parent" | |
| 58 | + android:layout_height="match_parent"> | |
| 59 | + <TextView | |
| 60 | + android:layout_width="wrap_content" | |
| 61 | + android:layout_height="wrap_content" | |
| 62 | + android:textAppearance="@style/Base.TextAppearance.Widget.AppCompat.Toolbar.Subtitle" | |
| 63 | + android:text="Despesas Câmara" | |
| 64 | + android:id="@+id/textView5" | |
| 65 | + android:paddingTop="8dp" | |
| 66 | + android:paddingLeft="16dp" | |
| 67 | + android:paddingBottom="10dp" /> | |
| 68 | + | |
| 69 | + <com.github.mikephil.charting.charts.BarChart | |
| 70 | + android:id="@+id/chart1" | |
| 71 | + android:layout_width="match_parent" | |
| 72 | + android:layout_height="400dp" /> | |
| 73 | + </LinearLayout> | |
| 74 | + </android.support.v7.widget.CardView> | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + </LinearLayout> | |
| 80 | + | |
| 81 | + </android.support.v4.widget.NestedScrollView> | |
| 10 | 82 | </FrameLayout> | ... | ... |
app/src/main/res/layout/fragment_politico_detalhe.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | - android:orientation="vertical" android:layout_width="match_parent" | |
| 4 | - android:layout_height="match_parent" | |
| 5 | - android:paddingLeft="@dimen/activity_vertical_margin" | |
| 6 | - android:paddingTop="5dp"> | |
| 7 | - | |
| 8 | - | |
| 9 | - <ImageView | |
| 10 | - android:layout_width="150dp" | |
| 11 | - android:layout_height="150dp" | |
| 12 | - android:id="@+id/imageView" | |
| 13 | - android:layout_gravity="center_horizontal" | |
| 14 | - android:src="@drawable/person_1" | |
| 15 | - android:layout_marginTop="60dp" /> | |
| 16 | - | |
| 17 | - <TextView | |
| 18 | - android:layout_width="wrap_content" | |
| 19 | - android:layout_height="wrap_content" | |
| 20 | - android:textAppearance="?android:attr/textAppearanceLarge" | |
| 21 | - android:text="Nome" | |
| 22 | - android:id="@+id/txtNome" | |
| 23 | - android:layout_gravity="center_horizontal" /> | |
| 24 | - | |
| 25 | - <TextView | |
| 26 | - android:layout_width="wrap_content" | |
| 27 | - android:layout_height="wrap_content" | |
| 28 | - android:textAppearance="?android:attr/textAppearanceMedium" | |
| 29 | - android:text="Partido" | |
| 30 | - android:id="@+id/txtPartido" /> | |
| 31 | - | |
| 32 | - <TextView | |
| 33 | - android:layout_width="wrap_content" | |
| 34 | - android:layout_height="wrap_content" | |
| 35 | - android:textAppearance="?android:attr/textAppearanceMedium" | |
| 36 | - android:text="Telefone" | |
| 37 | - android:id="@+id/txtTelefone" /> | |
| 38 | - | |
| 39 | - <TextView | |
| 40 | - android:layout_width="wrap_content" | |
| 41 | - android:layout_height="wrap_content" | |
| 42 | - android:textAppearance="?android:attr/textAppearanceMedium" | |
| 43 | - android:text="Email" | |
| 44 | - android:id="@+id/email" /> | |
| 45 | - | |
| 46 | - <TextView | |
| 47 | - android:layout_width="wrap_content" | |
| 48 | - android:layout_height="wrap_content" | |
| 49 | - android:textAppearance="?android:attr/textAppearanceMedium" | |
| 50 | - android:text="Facebook" | |
| 51 | - android:id="@+id/facebook" /> | |
| 52 | - | |
| 53 | - <TextView | |
| 54 | - android:layout_width="wrap_content" | |
| 55 | - android:layout_height="wrap_content" | |
| 56 | - android:textAppearance="?android:attr/textAppearanceMedium" | |
| 57 | - android:text="Gastos na campanha" | |
| 58 | - android:id="@+id/gastos" /> | |
| 59 | - | |
| 60 | - <TextView | |
| 61 | - android:layout_width="wrap_content" | |
| 62 | - android:layout_height="wrap_content" | |
| 63 | - android:textAppearance="?android:attr/textAppearanceMedium" | |
| 64 | - android:text="Bens Declarados" | |
| 65 | - android:id="@+id/bens" /> | |
| 66 | -</LinearLayout> | |
| 67 | 2 | \ No newline at end of file |
| 3 | +<android.support.v4.widget.NestedScrollView | |
| 4 | + | |
| 5 | + android:layout_width="match_parent" | |
| 6 | + android:layout_height="wrap_content" | |
| 7 | + xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 8 | + <LinearLayout | |
| 9 | + android:orientation="vertical" android:layout_width="match_parent" | |
| 10 | + android:layout_height="match_parent" | |
| 11 | + android:paddingLeft="@dimen/activity_vertical_margin" | |
| 12 | + android:paddingTop="5dp" | |
| 13 | + android:paddingBottom="25dp"> | |
| 14 | + | |
| 15 | + | |
| 16 | + <ImageView | |
| 17 | + android:layout_width="150dp" | |
| 18 | + android:layout_height="150dp" | |
| 19 | + android:id="@+id/foto" | |
| 20 | + android:layout_gravity="center_horizontal" | |
| 21 | + android:src="@android:drawable/ic_menu_help" | |
| 22 | + android:layout_marginTop="20dp" /> | |
| 23 | + | |
| 24 | + <TextView | |
| 25 | + android:layout_width="wrap_content" | |
| 26 | + android:layout_height="wrap_content" | |
| 27 | + android:text="Nome" | |
| 28 | + android:id="@+id/txtNome" | |
| 29 | + android:layout_gravity="center_horizontal" | |
| 30 | + android:textSize="16dp" /> | |
| 31 | + | |
| 32 | + <TextView | |
| 33 | + android:layout_width="wrap_content" | |
| 34 | + android:layout_height="wrap_content" | |
| 35 | + android:textAppearance="?android:attr/textAppearanceSmall" | |
| 36 | + android:text="Partido" | |
| 37 | + android:id="@+id/txtPartido" | |
| 38 | + android:layout_gravity="center_horizontal" /> | |
| 39 | + | |
| 40 | + | |
| 41 | + <LinearLayout | |
| 42 | + android:orientation="horizontal" | |
| 43 | + android:layout_width="match_parent" | |
| 44 | + android:layout_height="0dp" | |
| 45 | + android:layout_weight="1"> | |
| 46 | + | |
| 47 | + <RatingBar | |
| 48 | + android:layout_width="wrap_content" | |
| 49 | + android:layout_height="wrap_content" | |
| 50 | + android:id="@+id/ratingBar" | |
| 51 | + android:isIndicator="true" | |
| 52 | + style="@style/Widget.AppCompat.RatingBar" | |
| 53 | + android:layout_gravity="center_horizontal" /> | |
| 54 | + | |
| 55 | + <Button | |
| 56 | + style="@style/Base.Widget.AppCompat.ButtonBar" | |
| 57 | + android:layout_width="match_parent" | |
| 58 | + android:layout_height="wrap_content" | |
| 59 | + android:text="Avalie" | |
| 60 | + android:id="@+id/btnAvalie" | |
| 61 | + android:layout_gravity="right" /> | |
| 62 | + </LinearLayout> | |
| 63 | + | |
| 64 | + <TextView | |
| 65 | + android:layout_width="wrap_content" | |
| 66 | + android:layout_height="wrap_content" | |
| 67 | + android:text="Telefone: " | |
| 68 | + android:id="@+id/textView2" | |
| 69 | + android:textColor="@color/colorPrimarytext" | |
| 70 | + android:textSize="12dp" /> | |
| 71 | + | |
| 72 | + <TextView | |
| 73 | + android:layout_width="wrap_content" | |
| 74 | + android:layout_height="wrap_content" | |
| 75 | + android:textAppearance="?android:attr/textAppearanceMedium" | |
| 76 | + android:text="Telefone" | |
| 77 | + android:autoLink="phone" | |
| 78 | + android:id="@+id/txtTelefone" | |
| 79 | + android:paddingBottom="4dp" /> | |
| 80 | + | |
| 81 | + | |
| 82 | + <TextView | |
| 83 | + android:layout_width="wrap_content" | |
| 84 | + android:layout_height="wrap_content" | |
| 85 | + android:text="Email: " | |
| 86 | + android:id="@+id/textView3" | |
| 87 | + android:textColor="@color/colorPrimarytext" | |
| 88 | + android:textSize="12dp" /> | |
| 89 | + | |
| 90 | + <TextView | |
| 91 | + android:layout_width="wrap_content" | |
| 92 | + android:layout_height="wrap_content" | |
| 93 | + android:textAppearance="?android:attr/textAppearanceMedium" | |
| 94 | + android:text="Email" | |
| 95 | + android:autoLink="email" | |
| 96 | + android:id="@+id/email" | |
| 97 | + android:paddingBottom="4dp" /> | |
| 98 | + | |
| 99 | + | |
| 100 | + <TextView | |
| 101 | + android:layout_width="wrap_content" | |
| 102 | + android:layout_height="wrap_content" | |
| 103 | + android:text="Facebook: " | |
| 104 | + android:textColor="@color/colorPrimarytext" | |
| 105 | + android:textSize="12dp" /> | |
| 106 | + | |
| 107 | + <TextView | |
| 108 | + android:layout_width="wrap_content" | |
| 109 | + android:layout_height="wrap_content" | |
| 110 | + android:autoLink="web" | |
| 111 | + android:textAppearance="?android:attr/textAppearanceMedium" | |
| 112 | + android:text="Facebook" | |
| 113 | + android:id="@+id/facebook" | |
| 114 | + android:paddingBottom="4dp" /> | |
| 115 | + | |
| 116 | + | |
| 117 | + <TextView | |
| 118 | + android:layout_width="wrap_content" | |
| 119 | + android:layout_height="wrap_content" | |
| 120 | + android:text="Gastos na campanha: " | |
| 121 | + android:textColor="@color/colorPrimarytext" | |
| 122 | + android:textSize="12dp" /> | |
| 123 | + | |
| 124 | + <TextView | |
| 125 | + android:layout_width="wrap_content" | |
| 126 | + android:layout_height="wrap_content" | |
| 127 | + android:textAppearance="?android:attr/textAppearanceMedium" | |
| 128 | + android:text="Gastos na campanha" | |
| 129 | + android:id="@+id/gastos" | |
| 130 | + android:paddingBottom="4dp" /> | |
| 131 | + | |
| 132 | + <TextView | |
| 133 | + android:layout_width="wrap_content" | |
| 134 | + android:layout_height="wrap_content" | |
| 135 | + android:text="Bens Declarados: " | |
| 136 | + android:textColor="@color/colorPrimarytext" | |
| 137 | + android:textSize="12dp" /> | |
| 138 | + <TextView | |
| 139 | + android:layout_width="wrap_content" | |
| 140 | + android:layout_height="wrap_content" | |
| 141 | + android:textAppearance="?android:attr/textAppearanceMedium" | |
| 142 | + android:text="Bens Declarados" | |
| 143 | + android:id="@+id/bens" /> | |
| 144 | + </LinearLayout> | |
| 145 | +</android.support.v4.widget.NestedScrollView> | |
| 68 | 146 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/fragment_politico_gastos.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | + | |
| 2 | 3 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | - android:orientation="vertical" android:layout_width="match_parent" | |
| 4 | + android:orientation="vertical" | |
| 5 | + android:layout_width="match_parent" | |
| 4 | 6 | android:paddingTop="50dp" |
| 5 | 7 | android:layout_height="match_parent"> |
| 6 | 8 | |
| 9 | + <TextView | |
| 10 | + android:layout_width="wrap_content" | |
| 11 | + android:layout_height="wrap_content" | |
| 12 | + android:text="Verbas Indenizatórias"/> | |
| 13 | + | |
| 7 | 14 | <com.github.mikephil.charting.charts.LineChart |
| 8 | 15 | android:id="@+id/chart1" |
| 9 | 16 | android:layout_width="match_parent" |
| 10 | - android:layout_height="match_parent" /> | |
| 17 | + android:layout_height="match_parent" | |
| 18 | + android:padding="5dp"/> | |
| 11 | 19 | |
| 12 | 20 | </LinearLayout> |
| 13 | 21 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/fragment_politico_tabs.xml
| ... | ... | @@ -1,30 +0,0 @@ |
| 1 | -<?xml version="1.0" encoding="utf-8"?> | |
| 2 | -<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | - xmlns:app="http://schemas.android.com/apk/res-auto" | |
| 4 | - android:id="@+id/main_content" | |
| 5 | - android:layout_width="match_parent" | |
| 6 | - android:layout_height="match_parent"> | |
| 7 | - | |
| 8 | - | |
| 9 | - | |
| 10 | - <android.support.design.widget.TabLayout | |
| 11 | - android:id="@+id/tabs" | |
| 12 | - android:layout_width="match_parent" | |
| 13 | - android:layout_height="wrap_content" /> | |
| 14 | - | |
| 15 | - | |
| 16 | - <android.support.v4.view.ViewPager | |
| 17 | - android:id="@+id/viewpager" | |
| 18 | - android:layout_width="match_parent" | |
| 19 | - android:layout_height="match_parent" | |
| 20 | - app:layout_behavior="@string/appbar_scrolling_view_behavior" /> | |
| 21 | - | |
| 22 | - <android.support.design.widget.FloatingActionButton | |
| 23 | - android:id="@+id/fab" | |
| 24 | - android:layout_width="wrap_content" | |
| 25 | - android:layout_height="wrap_content" | |
| 26 | - android:layout_gravity="end|bottom" | |
| 27 | - android:layout_margin="@dimen/fab_margin" | |
| 28 | - android:src="@drawable/ic_done" /> | |
| 29 | - | |
| 30 | -</android.support.design.widget.CoordinatorLayout> | |
| 31 | 0 | \ No newline at end of file |
app/src/main/res/layout/item_comentario.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | 3 | android:orientation="vertical" android:layout_width="match_parent" |
| 4 | - android:layout_height="match_parent" | |
| 5 | - android:paddingTop="3dp" | |
| 6 | - android:paddingBottom="3dp"> | |
| 4 | + android:layout_height="match_parent"> | |
| 5 | + <android.support.v7.widget.CardView | |
| 6 | + android:layout_width="match_parent" | |
| 7 | + android:layout_height="wrap_content" | |
| 8 | + android:layout_margin="@dimen/card_margin"> | |
| 7 | 9 | |
| 10 | + <LinearLayout | |
| 11 | + style="@style/Widget.CardContent" | |
| 12 | + android:layout_width="match_parent" | |
| 13 | + android:layout_height="wrap_content"> | |
| 8 | 14 | <TextView |
| 9 | 15 | android:layout_width="wrap_content" |
| 10 | 16 | android:layout_height="wrap_content" |
| ... | ... | @@ -24,4 +30,6 @@ |
| 24 | 30 | android:id="@+id/txtComentario" |
| 25 | 31 | android:layout_marginLeft="20dp" |
| 26 | 32 | android:textColor="@color/colorPrimarytext" /> |
| 33 | + </LinearLayout> | |
| 34 | + </android.support.v7.widget.CardView> | |
| 27 | 35 | </LinearLayout> |
| 28 | 36 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/item_politico.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | - android:orientation="vertical" android:layout_width="match_parent" | |
| 3 | + android:orientation="horizontal" | |
| 4 | + android:layout_width="match_parent" | |
| 4 | 5 | android:layout_height="match_parent" |
| 5 | 6 | android:paddingTop="3dp" |
| 6 | - android:paddingBottom="3dp"> | |
| 7 | + android:paddingBottom="10dp"> | |
| 8 | + | |
| 9 | + <ImageView | |
| 10 | + android:layout_width="60dp" | |
| 11 | + android:layout_height="60dp" | |
| 12 | + android:id="@+id/foto" /> | |
| 13 | + | |
| 14 | + <LinearLayout | |
| 15 | + android:orientation="vertical" | |
| 16 | + android:layout_width="match_parent" | |
| 17 | + android:layout_height="match_parent"> | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 7 | 21 | |
| 8 | 22 | <TextView |
| 9 | 23 | android:layout_width="wrap_content" |
| 10 | 24 | android:layout_height="wrap_content" |
| 11 | 25 | android:text="Vereador XXXXXX" |
| 12 | 26 | android:id="@+id/txtNome" |
| 13 | - android:textSize="22dp" | |
| 27 | + android:textSize="16dp" | |
| 14 | 28 | android:textColor="@color/black" |
| 15 | 29 | android:textStyle="bold" |
| 16 | - android:layout_marginLeft="@dimen/activity_horizontal_margin" | |
| 17 | - android:layout_marginTop="3dp" /> | |
| 30 | + android:layout_marginLeft="10dp" | |
| 31 | + android:layout_marginTop="3dp" | |
| 32 | + android:maxLines="1" /> | |
| 18 | 33 | |
| 19 | 34 | <TextView |
| 20 | 35 | android:layout_width="wrap_content" |
| 21 | 36 | android:layout_height="wrap_content" |
| 22 | - android:textAppearance="?android:attr/textAppearanceMedium" | |
| 23 | 37 | android:text="Partido" |
| 24 | 38 | android:id="@+id/txtPartido" |
| 25 | - android:layout_marginLeft="20dp" /> | |
| 39 | + android:layout_marginLeft="14dp" | |
| 40 | + android:textSize="14dp" /> | |
| 41 | + | |
| 42 | + <RatingBar | |
| 43 | + android:layout_width="wrap_content" | |
| 44 | + android:layout_height="wrap_content" | |
| 45 | + style="?android:attr/ratingBarStyleSmall" | |
| 46 | + android:layout_marginLeft="14dp" | |
| 47 | + android:isIndicator="true" | |
| 48 | + android:id="@+id/ratingBar" /> | |
| 49 | + </LinearLayout> | |
| 26 | 50 | </LinearLayout> |
| 27 | 51 | \ No newline at end of file | ... | ... |
app/src/main/res/menu/menu_camara.xml
| ... | ... | @@ -2,6 +2,5 @@ |
| 2 | 2 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 3 | 3 | xmlns:tools="http://schemas.android.com/tools" |
| 4 | 4 | tools:context="com.monitorabrasil.monitoralegislativo.CamaraActivity"> |
| 5 | - <item android:id="@+id/action_settings" android:title="@string/action_settings" | |
| 6 | - android:orderInCategory="100" app:showAsAction="never" /> | |
| 5 | + | |
| 7 | 6 | </menu> | ... | ... |
app/src/main/res/menu/menu_comentario.xml
| ... | ... | @@ -2,6 +2,5 @@ |
| 2 | 2 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 3 | 3 | xmlns:tools="http://schemas.android.com/tools" |
| 4 | 4 | tools:context="com.monitorabrasil.monitoralegislativo.ComentarioActivity"> |
| 5 | - <item android:id="@+id/action_settings" android:title="@string/action_settings" | |
| 6 | - android:orderInCategory="100" app:showAsAction="never" /> | |
| 5 | + | |
| 7 | 6 | </menu> | ... | ... |
app/src/main/res/menu/menu_main.xml
| 1 | 1 | <menu xmlns:android="http://schemas.android.com/apk/res/android" |
| 2 | 2 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 3 | 3 | xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity"> |
| 4 | - <item android:id="@+id/action_settings" android:title="@string/action_settings" | |
| 4 | + <item android:id="@+id/action_settings" android:title="@string/action_sobre" | |
| 5 | 5 | android:orderInCategory="100" app:showAsAction="never" /> |
| 6 | 6 | </menu> | ... | ... |
app/src/main/res/menu/menu_politico_ficha.xml
| ... | ... | @@ -2,6 +2,5 @@ |
| 2 | 2 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 3 | 3 | xmlns:tools="http://schemas.android.com/tools" |
| 4 | 4 | tools:context="com.monitorabrasil.monitoralegislativo.PoliticoFichaActivity"> |
| 5 | - <item android:id="@+id/action_settings" android:title="@string/action_settings" | |
| 6 | - android:orderInCategory="100" app:showAsAction="never" /> | |
| 5 | + | |
| 7 | 6 | </menu> | ... | ... |
app/src/main/res/menu/menu_politicos.xml
| ... | ... | @@ -2,6 +2,5 @@ |
| 2 | 2 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 3 | 3 | xmlns:tools="http://schemas.android.com/tools" |
| 4 | 4 | tools:context="com.monitorabrasil.monitoralegislativo.PoliticosActivity"> |
| 5 | - <item android:id="@+id/action_settings" android:title="@string/action_settings" | |
| 6 | - android:orderInCategory="100" app:showAsAction="never" /> | |
| 5 | + | |
| 7 | 6 | </menu> | ... | ... |
app/src/main/res/menu/menu_projetos.xml
| ... | ... | @@ -2,6 +2,5 @@ |
| 2 | 2 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 3 | 3 | xmlns:tools="http://schemas.android.com/tools" |
| 4 | 4 | tools:context="com.monitorabrasil.monitoralegislativo.ProjetosActivity"> |
| 5 | - <item android:id="@+id/action_settings" android:title="@string/action_settings" | |
| 6 | - android:orderInCategory="100" app:showAsAction="never" /> | |
| 5 | + | |
| 7 | 6 | </menu> | ... | ... |
app/src/main/res/values/strings.xml
| 1 | 1 | <resources> |
| 2 | 2 | <string name="app_name">Participa Cidadão</string> |
| 3 | 3 | |
| 4 | - <string name="hello_world">Hello world!</string> | |
| 5 | 4 | <string name="action_settings">Settings</string> |
| 5 | + <string name="action_sobre">Sobre</string> | |
| 6 | 6 | |
| 7 | 7 | <!-- TODO: Remove or change this placeholder text --> |
| 8 | - <string name="hello_blank_fragment">Hello blank fragment</string> | |
| 9 | 8 | <string name="navigation_drawer_open">opened</string> |
| 10 | 9 | <string name="navigation_drawer_close">closed</string> |
| 11 | 10 | <string name="title_activity_car">CarActivity</string> | ... | ... |