Merge branch 'ubilabs--rcapp--bug-2777-cleanup' into ubilabs--rcapp--develop
No files matched your search
|
Before Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 930 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 632 B |
|
Before Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 853 B |
@@ -86,6 +86,20 @@
|
||||
android:src="@drawable/ic_info_outline_white_48dp"
|
||||
tools:alpha="1"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/refresh_data"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="@dimen/default_margin"
|
||||
android:layout_marginRight="@dimen/default_margin_half"
|
||||
android:layout_toLeftOf="@id/technical_info"
|
||||
android:alpha="0"
|
||||
android:background="@drawable/round_button"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_refresh_white_48dp"
|
||||
tools:alpha="1"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/view"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/login_view_backdrop"
|
||||
@@ -16,5 +19,25 @@
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:background="?sap_gray_black_30"
|
||||
tools:layout="@layout/login_listviews"/>
|
||||
</merge>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/progress_spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#c8000000"
|
||||
android:clickable="true"/>
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminate="true"/>
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto" >
|
||||
|
||||
<item
|
||||
android:id="@+id/options_menu_reload"
|
||||
android:icon="@drawable/ic_menu_info_details"
|
||||
android:title="@string/options_menu_reload"
|
||||
android:visible="true"/>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/options_menu_reset"
|
||||
@@ -14,11 +7,9 @@
|
||||
|
||||
<item
|
||||
android:id="@+id/options_menu_settings"
|
||||
android:icon="@drawable/settings_grey"
|
||||
android:title="@string/options_menu_settings"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/options_menu_info"
|
||||
android:icon="@drawable/ic_menu_info_details"
|
||||
android:title="@string/options_menu_info"/>
|
||||
</menu>
|
||||
@@ -101,7 +101,6 @@
|
||||
<string name="availableFinishingCompetitors">Segler</string>
|
||||
<string name="choose_blue_flag_finishing">Rennen beenden</string>
|
||||
<string name="drag_handle_description">Cursor</string>
|
||||
<string name="options_menu_reload">Neuladen</string>
|
||||
<string name="options_menu_settings">Einstellungen</string>
|
||||
<string name="results_capturing_title">Ergebnislisten</string>
|
||||
<string name="results_capturing_view_subject">E-Mail Betreff</string>
|
||||
|
||||
@@ -110,7 +110,6 @@
|
||||
<string name="availableFinishingCompetitors">Competitors</string>
|
||||
<string name="choose_blue_flag_finishing">Finish race</string>
|
||||
<string name="drag_handle_description">Drag handle</string>
|
||||
<string name="options_menu_reload">Reload</string>
|
||||
<string name="options_menu_settings">Settings</string>
|
||||
<string name="results_capturing_title">Race Results</string>
|
||||
<string name="results_capturing_view_subject">Mail subject</string>
|
||||
|
||||
@@ -15,9 +15,9 @@ import com.sap.sailing.racecommittee.app.data.DataManager;
|
||||
*/
|
||||
public class BaseActivity extends SendingServiceAwareActivity {
|
||||
private static final String TAG = BaseActivity.class.getName();
|
||||
|
||||
|
||||
protected AppPreferences preferences;
|
||||
|
||||
|
||||
@Override
|
||||
protected int getOptionsMenuResId() {
|
||||
return R.menu.options_menu;
|
||||
@@ -32,30 +32,25 @@ public class BaseActivity extends SendingServiceAwareActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
this.preferences = AppPreferences.on(getApplicationContext());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
Intent intent;
|
||||
switch (item.getItemId()) {
|
||||
case R.id.options_menu_settings:
|
||||
ExLog.i(this, TAG, "Clicked SETTINGS");
|
||||
intent = new Intent(this, PreferenceActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.options_menu_settings:
|
||||
ExLog.i(this, TAG, "Clicked SETTINGS");
|
||||
intent = new Intent(this, PreferenceActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
|
||||
case R.id.options_menu_reload:
|
||||
ExLog.i(this, TAG, "Clicked RESET");
|
||||
final boolean result = onReset();
|
||||
return result;
|
||||
case R.id.options_menu_info:
|
||||
ExLog.i(this, TAG, "Clicked INFO");
|
||||
intent = new Intent(this, SystemInformationActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
|
||||
case R.id.options_menu_info:
|
||||
ExLog.i(this, TAG, "Clicked INFO");
|
||||
intent = new Intent(this, SystemInformationActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,10 +59,10 @@ public class BaseActivity extends SendingServiceAwareActivity {
|
||||
super.onPause();
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@link #resetDataManager() Resets the data manager} (which all redefinitions must do) and then
|
||||
* fades this activity.
|
||||
* fades this activity.
|
||||
*/
|
||||
protected boolean onReset() {
|
||||
resetDataManager();
|
||||
@@ -83,7 +78,7 @@ public class BaseActivity extends SendingServiceAwareActivity {
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
|
||||
preferences = AppPreferences.on(this);
|
||||
if (preferences.wakelockEnabled()) {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.activities;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.app.LoaderManager.LoaderCallbacks;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -55,6 +56,8 @@ import com.sap.sailing.racecommittee.app.utils.autoupdate.AutoUpdater;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LoginActivity extends BaseActivity
|
||||
@@ -65,8 +68,6 @@ public class LoginActivity extends BaseActivity
|
||||
|
||||
private final static String TAG = LoginActivity.class.getName();
|
||||
|
||||
private final int RQS_GooglePlayServices = 1;
|
||||
|
||||
private final PositionListFragment positionFragment;
|
||||
private View backdrop;
|
||||
private LoginListViews loginListViews = null;
|
||||
@@ -82,10 +83,8 @@ public class LoginActivity extends BaseActivity
|
||||
private UUID mSelectedCourseAreaUUID;
|
||||
|
||||
private IntentReceiver mReceiver;
|
||||
|
||||
private ProgressDialog progressDialog;
|
||||
|
||||
private ReadonlyDataManager dataManager;
|
||||
private View progressSpinner;
|
||||
|
||||
private ItemSelectedListener<EventBase> eventSelectionListener = new ItemSelectedListener<EventBase>() {
|
||||
|
||||
@@ -156,7 +155,7 @@ public class LoginActivity extends BaseActivity
|
||||
switchToRacingActivity();
|
||||
}
|
||||
|
||||
private void switchToRacingActivity(){
|
||||
private void switchToRacingActivity() {
|
||||
Intent intent = new Intent(LoginActivity.this, RacingActivity.class);
|
||||
intent.putExtra(AppConstants.COURSE_AREA_UUID_KEY, mSelectedCourseAreaUUID);
|
||||
intent.putExtra(AppConstants.EventIdTag, mSelectedEventId);
|
||||
@@ -327,7 +326,6 @@ public class LoginActivity extends BaseActivity
|
||||
updateSignInButtonState();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@@ -336,15 +334,14 @@ public class LoginActivity extends BaseActivity
|
||||
filter.addAction(AppConstants.INTENT_ACTION_RESET);
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filter);
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(AppConstants.INTENT_ACTION_RESET);
|
||||
Intent intent = new Intent(AppConstants.INTENT_ACTION_RESET);
|
||||
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
|
||||
|
||||
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
|
||||
|
||||
if (!BuildConfig.DEBUG) {
|
||||
if (resultCode != ConnectionResult.SUCCESS) {
|
||||
GooglePlayServicesUtil.getErrorDialog(resultCode, this, RQS_GooglePlayServices).show();
|
||||
GooglePlayServicesUtil.getErrorDialog(resultCode, this, 1).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -359,11 +356,11 @@ public class LoginActivity extends BaseActivity
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
dismissProgressDialog();
|
||||
dismissProgressSpinner();
|
||||
}
|
||||
|
||||
private void setupDataManager() {
|
||||
showProgressDialog();
|
||||
showProgressSpinner();
|
||||
|
||||
DeviceConfigurationIdentifier identifier = new DeviceConfigurationIdentifierImpl(AppPreferences.on(getApplicationContext())
|
||||
.getDeviceIdentifier());
|
||||
@@ -372,7 +369,8 @@ public class LoginActivity extends BaseActivity
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(Exception reason) {
|
||||
dismissProgressDialog();
|
||||
dismissProgressSpinner();
|
||||
|
||||
if (reason instanceof FileNotFoundException) {
|
||||
Toast.makeText(getApplicationContext(), getString(R.string.loading_configuration_not_found), Toast.LENGTH_LONG).show();
|
||||
ExLog.w(LoginActivity.this, TAG, String.format("There seems to be no configuration for this device: %s", reason.toString()));
|
||||
@@ -381,21 +379,17 @@ public class LoginActivity extends BaseActivity
|
||||
ExLog.ex(LoginActivity.this, TAG, reason);
|
||||
}
|
||||
|
||||
// Slide up, if events are available
|
||||
if (!dataManager.getDataStore().getEvents().isEmpty()) {
|
||||
slideUpBackdropDelayed();
|
||||
}
|
||||
slideUpBackdropDelayed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadSucceeded(DeviceConfiguration configuration, boolean isCached) {
|
||||
dismissProgressDialog();
|
||||
dismissProgressSpinner();
|
||||
|
||||
// this is our 'global' configuration, let's store it in app preferences
|
||||
PreferencesDeviceConfigurationLoader.wrap(configuration, preferences).store();
|
||||
|
||||
Toast.makeText(LoginActivity.this, getString(R.string.loading_configuration_succeded), Toast.LENGTH_LONG).show();
|
||||
// showCourseAreaListFragment(eventId);
|
||||
slideUpBackdropDelayed();
|
||||
}
|
||||
});
|
||||
@@ -404,23 +398,22 @@ public class LoginActivity extends BaseActivity
|
||||
// always reload the configuration...
|
||||
getLoaderManager().restartLoader(0, null, configurationLoader).forceLoad();
|
||||
} else {
|
||||
dismissProgressDialog();
|
||||
dismissProgressSpinner();
|
||||
}
|
||||
}
|
||||
|
||||
private void showProgressDialog() {
|
||||
if (progressDialog == null) {
|
||||
progressDialog = new ProgressDialog(this);
|
||||
progressDialog.setMessage(getString(R.string.loading_configuration));
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.setIndeterminate(true);
|
||||
private void showProgressSpinner() {
|
||||
if (progressSpinner == null) {
|
||||
progressSpinner = findViewById(R.id.progress_spinner);
|
||||
}
|
||||
if (progressSpinner != null) {
|
||||
progressSpinner.setVisibility(View.VISIBLE);
|
||||
}
|
||||
progressDialog.show();
|
||||
}
|
||||
|
||||
private void dismissProgressDialog() {
|
||||
if (progressDialog != null && progressDialog.isShowing()) {
|
||||
progressDialog.dismiss();
|
||||
private void dismissProgressSpinner() {
|
||||
if (progressSpinner != null && progressSpinner.getVisibility() == View.VISIBLE) {
|
||||
progressSpinner.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,26 +443,13 @@ public class LoginActivity extends BaseActivity
|
||||
if (backdrop.getY() != 0) {
|
||||
return;
|
||||
}
|
||||
long aniTime = getResources().getInteger(android.R.integer.config_longAnimTime);
|
||||
final View bottomView = findViewById(R.id.login_listview);
|
||||
|
||||
View title = findViewById(R.id.backdrop_title);
|
||||
View subTitle = findViewById(R.id.backdrop_subtitle);
|
||||
View info = findViewById(R.id.technical_info);
|
||||
View settings = findViewById(R.id.settings_button);
|
||||
|
||||
subTitle.setAlpha(0f);
|
||||
|
||||
ObjectAnimator frameAnimation = ObjectAnimator.ofFloat(backdrop, "y", 0, -backdrop.getHeight() + (backdrop.getHeight() / 5));
|
||||
ObjectAnimator titleAnimation = ObjectAnimator.ofFloat(title, "alpha", 1f, 0f);
|
||||
ObjectAnimator subTitleAnimation = ObjectAnimator.ofFloat(subTitle, "alpha", 0f, 1f);
|
||||
ObjectAnimator infoAnimation = ObjectAnimator.ofFloat(info, "alpha", 0f, 1f);
|
||||
ObjectAnimator settingsAnimation = ObjectAnimator.ofFloat(settings, "alpha", 0f, 1f);
|
||||
|
||||
ValueAnimator heightAnimation = ValueAnimator.ofInt(0, backdrop.getHeight() - (backdrop.getHeight() / 5));
|
||||
heightAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator valueAnimator) {
|
||||
View bottomView = findViewById(R.id.login_listview);
|
||||
int val = (Integer) valueAnimator.getAnimatedValue();
|
||||
ViewGroup.LayoutParams layoutParams = bottomView.getLayoutParams();
|
||||
layoutParams.height = val;
|
||||
@@ -477,13 +457,30 @@ public class LoginActivity extends BaseActivity
|
||||
}
|
||||
});
|
||||
|
||||
Collection<Animator> animators = new ArrayList<>();
|
||||
animators.add(heightAnimation);
|
||||
animators.add(frameAnimation);
|
||||
animators.add(getAlphaRevAnimator(findViewById(R.id.backdrop_title)));
|
||||
animators.add(getAlphaAnimator(findViewById(R.id.backdrop_subtitle)));
|
||||
animators.add(getAlphaAnimator(findViewById(R.id.refresh_data)));
|
||||
animators.add(getAlphaAnimator(findViewById(R.id.technical_info)));
|
||||
animators.add(getAlphaAnimator(findViewById(R.id.settings_button)));
|
||||
|
||||
AnimatorSet animatorSet = new AnimatorSet();
|
||||
animatorSet.playTogether(heightAnimation, frameAnimation, titleAnimation, subTitleAnimation, infoAnimation, settingsAnimation);
|
||||
animatorSet.setDuration(aniTime);
|
||||
animatorSet.playTogether(animators);
|
||||
animatorSet.setDuration(getResources().getInteger(android.R.integer.config_longAnimTime));
|
||||
animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
animatorSet.start();
|
||||
}
|
||||
|
||||
private ObjectAnimator getAlphaAnimator(@Nullable Object target) {
|
||||
return ObjectAnimator.ofFloat(target, "alpha", 0f, 1f);
|
||||
}
|
||||
|
||||
private ObjectAnimator getAlphaRevAnimator(@Nullable Object target) {
|
||||
return ObjectAnimator.ofFloat(target, "alpha", 1f, 0f);
|
||||
}
|
||||
|
||||
private class BackdropClick implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.sap.sailing.racecommittee.app.ui.fragments;
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.ui.activities.PreferenceActivity;
|
||||
import com.sap.sailing.racecommittee.app.ui.activities.SystemInformationActivity;
|
||||
@@ -22,7 +24,7 @@ public class LoginBackdrop extends Fragment {
|
||||
ImageView button = (ImageView) layout.findViewById(R.id.settings_button);
|
||||
if (button != null) {
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(), PreferenceActivity.class);
|
||||
@@ -44,6 +46,17 @@ public class LoginBackdrop extends Fragment {
|
||||
});
|
||||
}
|
||||
|
||||
ImageView refresh = (ImageView) layout.findViewById(R.id.refresh_data);
|
||||
if (refresh != null) {
|
||||
refresh.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(AppConstants.INTENT_ACTION_RESET);
|
||||
LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return layout;
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,6 @@ public abstract class NamedListFragment<T extends Named> extends LoggableListFra
|
||||
protected abstract LoaderCallbacks<DataLoaderResult<Collection<T>>> createLoaderCallbacks(ReadonlyDataManager manager);
|
||||
|
||||
private void loadItems() {
|
||||
setListShown(false);
|
||||
setupLoader();
|
||||
}
|
||||
|
||||
@@ -98,7 +97,6 @@ public abstract class NamedListFragment<T extends Named> extends LoggableListFra
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(Exception reason) {
|
||||
setListShown(true);
|
||||
namedList.clear();
|
||||
listAdapter.notifyDataSetChanged();
|
||||
|
||||
@@ -113,7 +111,6 @@ public abstract class NamedListFragment<T extends Named> extends LoggableListFra
|
||||
|
||||
@Override
|
||||
public void onLoadSucceeded(Collection<T> data, boolean isCached) {
|
||||
setListShown(true);
|
||||
namedList.clear();
|
||||
//TODO: Quickfix for 2889
|
||||
if (data != null) {
|
||||
|
||||