Skip to content

Commit

Permalink
Ajuste de layout, tratamento de erros de atualização de pessoas e ati…
Browse files Browse the repository at this point in the history
…vidades e mudança nos momentos de captura de dados
  • Loading branch information
SampaioFelipe committed Aug 14, 2017
1 parent f5f7c93 commit 6d5ce7b
Show file tree
Hide file tree
Showing 32 changed files with 564 additions and 361 deletions.
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

<!-- Declaração das atividades -->


<!-- Splash Screen -->
<activity
android:name=".SplashScreen"
Expand Down Expand Up @@ -113,7 +112,7 @@
See README(https://goo.gl/l4GJaQ) for more. -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@android:drawable/ic_dialog_alert" />
android:resource="@drawable/ic_icon" />
<!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
notification message. See README(https://goo.gl/6BKBk7) for more. -->
<meta-data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import android.webkit.WebView;
import android.webkit.WebViewClient;

import br.com.secompufscar.secomp_ufscar.utilities.NetworkUtils;

public class AreaDoParticipante extends AppCompatActivity {
private WebView areaParticipante;

Expand All @@ -24,16 +26,18 @@ protected void onCreate(Bundle savedInstanceState) {
areaParticipante.getSettings().setJavaScriptEnabled(true);
areaParticipante.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

areaParticipante.loadUrl("https://secompufscar.com.br/2016/areadoparticipante/");
areaParticipante.loadUrl(NetworkUtils.BASE_URL+"area-do-participante/");
}
}

class MyBrowser extends WebViewClient {
class MyBrowser extends WebViewClient {

@SuppressWarnings("deprecation")
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
@SuppressWarnings("deprecation")
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,17 @@ protected void onCreate(Bundle savedInstanceState) {

atividadeAtual = DatabaseHandler.getDB().getDetalheAtividade(id);

ministranteList.clear();
ministranteList.addAll(atividadeAtual.getMinistrantes());

setContentView(R.layout.activity_atividade_detalhes);

contentView = findViewById(R.id.atividade_detalhes_scroll);
loadingView = findViewById(R.id.loading_spinner_atividade);

if(savedInstanceState == null){
if (savedInstanceState == null) {
contentView.setVisibility(View.GONE);
new UpdateDetalhes().execute(id);
new UpdateDetalhes().execute();
} else {
loadingView.setVisibility(View.GONE);
}
Expand Down Expand Up @@ -182,18 +185,16 @@ protected void onSaveInstanceState(Bundle outState) {
// outState.putInt(STATE_COUNTER, mCounter);
}

private class UpdateDetalhes extends AsyncTask<Integer, Void, Atividade> {
private class UpdateDetalhes extends AsyncTask<Void, Void, Atividade> {
@Override
protected Atividade doInBackground(Integer... params) {
protected Atividade doInBackground(Void... params) {

return Atividade.getDetalheAtividadeFromHTTP(params[0], getBaseContext());
return Atividade.getDetalheAtividadeFromHTTP(atividadeAtual, getBaseContext());
}

@Override
protected void onPostExecute(Atividade atividadeAtualizada) {

DatabaseHandler.getDB().getMinistrantes(atividadeAtual);

if (atividadeAtualizada != null) {
boolean favorito = atividadeAtual.isFavorito();

Expand Down Expand Up @@ -254,22 +255,22 @@ protected void onPostExecute(Boolean resultado) {
}
}

public void EnviarDadosMapa (View view){

Bundle params = new Bundle();
switch(local.getText().toString()) {
case "Auditório Mauro Biajiz":
params.putInt("Local", 1);
break;
case "Anfiteatro Bento Prado Jr.":
params.putInt("Local", 2);
break;
default:
params.putInt("Local", 0);
}
Intent i = new Intent(this, MapsActivity.class);
i.putExtras(params);
public void EnviarDadosMapa(View view) {

startActivityForResult(i, TELA_DETALHES_ATIVIDADE);
Bundle params = new Bundle();
switch (atividadeAtual.getPredio()) {
case "Auditório Mauro Biajiz":
params.putInt("Local", 1);
break;
case "Anfiteatro Bento Prado Jr.":
params.putInt("Local", 2);
break;
default:
params.putInt("Local", 0);
}
Intent i = new Intent(this, MapsActivity.class);
i.putExtras(params);

startActivityForResult(i, TELA_DETALHES_ATIVIDADE);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package br.com.secompufscar.secomp_ufscar;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
Expand All @@ -13,6 +16,7 @@
import java.util.ArrayList;
import java.util.List;

import br.com.secompufscar.secomp_ufscar.data.Atividade;
import br.com.secompufscar.secomp_ufscar.listaAtividades.ListaQuarta;
import br.com.secompufscar.secomp_ufscar.listaAtividades.ListaQuinta;
import br.com.secompufscar.secomp_ufscar.listaAtividades.ListaSegunda;
Expand All @@ -24,13 +28,19 @@ public class Cronograma extends Fragment {
private TabLayout tabLayout;
private ViewPager viewPager;

private View loadingView;

private GetDataTask getDataTask;

public Cronograma() {
// Required empty public constructor
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

getDataTask = new GetDataTask();
}

@Override
Expand All @@ -39,14 +49,17 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_cronograma, container, false);

loadingView = view.findViewById(R.id.loading_spinner_cronograma);
loadingView.setVisibility(View.GONE);

viewPager = (ViewPager) view.findViewById(R.id.viewpager);
setupViewPager(viewPager);

tabLayout = (TabLayout) view.findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);

// getDataTask.execute();
return view;

}

private void setupViewPager(ViewPager viewPager) {
Expand Down Expand Up @@ -114,4 +127,32 @@ public CharSequence getPageTitle(int position) {
return fragmentTitleList.get(position);
}
}

private class GetDataTask extends AsyncTask<Void, Void, Void> {
@Override
protected void onPreExecute() {
loadingView.setVisibility(View.VISIBLE);
viewPager.setVisibility(View.GONE);
}

@Override
protected Void doInBackground(Void... params) {
Atividade.getAtividadesFromHTTP(getActivity());
return null;
}

@Override
protected void onPostExecute(Void s) {
loadingView.animate()
.alpha(0f)
.setDuration(getResources().getInteger(
android.R.integer.config_longAnimTime))
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
loadingView.setVisibility(View.GONE);
}
});
}
}
}
7 changes: 2 additions & 5 deletions app/src/main/java/br/com/secompufscar/secomp_ufscar/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ protected String doInBackground(String... params) {
// Se a timeline não for nula então
if (user.getStatus() != null) {


//Pega a timeline
ResponseList<twitter4j.Status> statusess = twitter.getUserTimeline(twitters[0]);

Expand All @@ -240,12 +239,13 @@ protected String doInBackground(String... params) {
//Agora ficou show
if (tweets.get(i).trim().contains(getString(R.string.now))) {
tweets.set(i, tweets.get(i).replace(getString(R.string.now), ""));
if (now == "") {
if (now.isEmpty()) {
now = tweets.get(i);
tweets.remove(i);
}
}
}

tweetsArray = new String[tweets.size()];
for (int i = 0; i < tweets.size(); i++) {
tweetsArray[i] = tweets.get(i);
Expand All @@ -254,15 +254,12 @@ protected String doInBackground(String... params) {
} catch (Exception e) {
ok = false;
return "";

}
return now;
}

@Override
protected void onPostExecute(String s) {


if (s != "") {
hn.setText(now);
}
Expand Down
Loading

0 comments on commit 6d5ce7b

Please sign in to comment.