Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8ff826106 | ||
|
|
dfb0469fa6 | ||
|
|
d293bd66ef |
@@ -88,7 +88,7 @@ android {
|
||||
applicationId "com.mowesta.android.app"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 29
|
||||
versionCode 3
|
||||
versionCode 4
|
||||
versionName "${version}"
|
||||
buildConfigField "long", "BUILD_TIME", System.currentTimeMillis() + "L"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -17,6 +17,9 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.PermissionChecker;
|
||||
import androidx.navigation.NavDeepLinkBuilder;
|
||||
import androidx.navigation.NavDirections;
|
||||
import androidx.navigation.Navigation;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.android.material.snackbar.BaseTransientBottomBar;
|
||||
@@ -113,6 +116,13 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
installHttpCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
// got to navigation drawer when user presses notification
|
||||
setIntent(intent);
|
||||
Navigation.findNavController(this, R.id.navigation_app).navigate(R.id.action_drawer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
@@ -26,6 +27,7 @@ import com.mowesta.android.app.databinding.ViewConditionBinding;
|
||||
import com.mowesta.android.app.model.CityViewModel;
|
||||
import com.mowesta.android.app.model.ConditionViewModel;
|
||||
import com.mowesta.android.app.model.SummaryViewModel;
|
||||
import com.mowesta.android.app.util.TabletUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -118,12 +120,15 @@ public class CityForecastFragment extends CityFragment.ChildFragment {
|
||||
int page = getArguments().getInt("page");
|
||||
switch (page) {
|
||||
case 0:
|
||||
TabletUtil.setGridLayout(recyclerView, 400);
|
||||
recyclerView.setAdapter(new SummaryAdapter(getViewLifecycleOwner(), getCityViewModel().getDay()));
|
||||
break;
|
||||
case 1:
|
||||
TabletUtil.setGridLayout(recyclerView, 400);
|
||||
recyclerView.setAdapter(new SummaryAdapter(getViewLifecycleOwner(), getCityViewModel().getTime()));
|
||||
break;
|
||||
default:
|
||||
TabletUtil.setGridLayout(recyclerView, 250);
|
||||
recyclerView.setAdapter(new ConditionAdapter(getViewLifecycleOwner(), getCityViewModel().getHour()));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.mowesta.android.app.R;
|
||||
import com.mowesta.android.app.databinding.ViewVideoBinding;
|
||||
import com.mowesta.android.app.model.CityViewModel;
|
||||
import com.mowesta.android.app.model.VideoViewModel;
|
||||
import com.mowesta.android.app.util.TabletUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -105,6 +106,7 @@ public class CityVideoFragment extends CityFragment.ChildFragment {
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
RecyclerView recyclerView = getView().findViewById(R.id.recycler);
|
||||
TabletUtil.setGridLayout(recyclerView, 600);
|
||||
CityViewModel model = getCityViewModel();
|
||||
int page = getArguments().getInt("page");
|
||||
VideoViewModel.OnVideoSelectedListener listener = (video) -> {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mowesta.android.app.fragment;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -13,6 +15,8 @@ import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.view.animation.OvershootInterpolator;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -23,7 +27,9 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.cursoradapter.widget.CursorAdapter;
|
||||
import androidx.customview.widget.Openable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.NavController;
|
||||
@@ -41,6 +47,7 @@ import com.mowesta.android.app.model.AbstractNetworkViewModel;
|
||||
import com.mowesta.android.app.model.DrawerViewModel;
|
||||
import com.mowesta.android.app.model.LocationViewModel;
|
||||
import com.mowesta.android.app.repository.UserCredentials;
|
||||
import com.mowesta.android.app.util.DisplayUtils;
|
||||
import com.mowesta.android.feign.model.LocationHierarchy;
|
||||
import com.mowesta.android.feign.model.LocationHierarchyPage;
|
||||
|
||||
@@ -75,6 +82,28 @@ public class DrawerFragment extends AbstractNetworkFragment {
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// navigate to settings, if user pressed notification
|
||||
handleNotificationIntent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the intent was generated by the background service and
|
||||
* opens the settings screen, if this is the case
|
||||
*/
|
||||
private void handleNotificationIntent() {
|
||||
Intent intent = getActivity().getIntent();
|
||||
if (intent.hasExtra(getString(R.string.mowesta_sdk_notification_activity_extra_name))) {
|
||||
String value = intent.getStringExtra(getString(R.string.mowesta_sdk_notification_activity_extra_name));
|
||||
if (value != null && value.equals(getString(R.string.mowesta_sdk_notification_activity_extra_value))) {
|
||||
Navigation.findNavController(getView().findViewById(R.id.navigation_drawer)).navigate(R.id.destination_settings);
|
||||
getActivity().setIntent(new Intent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
@@ -155,7 +184,18 @@ public class DrawerFragment extends AbstractNetworkFragment {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
NavController navController = Navigation.findNavController(view.findViewById(R.id.navigation_drawer));
|
||||
AppBarConfiguration.Builder builder = new AppBarConfiguration.Builder(R.id.destination_favorites);
|
||||
builder.setOpenableLayout(view.findViewById(R.id.layout_drawer));
|
||||
View drawer = view.findViewById(R.id.layout_drawer);
|
||||
if (drawer != null) builder.setOpenableLayout((Openable)drawer);
|
||||
View sun = view.findViewById(R.id.logo_sun);
|
||||
AnimatorSet set = new AnimatorSet();
|
||||
ObjectAnimator first = ObjectAnimator.ofFloat(sun, "translationY", DisplayUtils.dpToPixels(getContext(), 120), 0f);
|
||||
first.setDuration(750);
|
||||
first.setInterpolator(new OvershootInterpolator());
|
||||
ObjectAnimator last = ObjectAnimator.ofFloat(sun, "translationX", DisplayUtils.dpToPixels(getContext(), 120), 0f);
|
||||
last.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
last.setDuration(750);
|
||||
set.playTogether(first, last);
|
||||
set.start();
|
||||
Toolbar toolbar = view.findViewById(R.id.toolbar);
|
||||
CollapsingToolbarLayout layout = view.findViewById(R.id.layout_toolbar);
|
||||
NavigationUI.setupWithNavController(layout, toolbar, navController, builder.build());
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.mowesta.android.app.database.Favorite;
|
||||
import com.mowesta.android.app.databinding.ViewFavoriteEntryBinding;
|
||||
import com.mowesta.android.app.model.FavoritesViewModel;
|
||||
import com.mowesta.android.app.model.FavoritesViewModel.OnFavoriteSelectedListener;
|
||||
import com.mowesta.android.app.util.TabletUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -51,6 +52,7 @@ public class FavoritesFragment extends Fragment {
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
RecyclerView recyclerView = view.findViewById(R.id.recycler);
|
||||
TabletUtil.setGridLayout(recyclerView, 300);
|
||||
SwipeRefreshLayout swipeRefreshLayout = view.findViewById(R.id.swipe_refresh);
|
||||
FavoritesViewModel model = new ViewModelProvider(getActivity()).get(FavoritesViewModel.class);
|
||||
model.getRefreshing().observe(getViewLifecycleOwner(), (refreshing) -> {
|
||||
|
||||
@@ -2,6 +2,11 @@ package com.mowesta.android.app.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Display;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* Utility to detect tablets running in landscape mode.
|
||||
@@ -42,4 +47,25 @@ public class TabletUtil {
|
||||
return isLandscape(context) && isTablet(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the screen width in dp.
|
||||
*
|
||||
* @param context The context.
|
||||
* @return The screen width in dp.
|
||||
*/
|
||||
public static float getScreenWidthDp(Context context) {
|
||||
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
|
||||
return displayMetrics.widthPixels / displayMetrics.density;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a grid layout such that the items have at least the configured size.
|
||||
*
|
||||
* @param view The view.
|
||||
* @param itemWidthDp The item width in dp.
|
||||
*/
|
||||
public static void setGridLayout(RecyclerView view, int itemWidthDp) {
|
||||
int cols = Math.max(1, (int)(getScreenWidthDp(view.getContext()) / itemWidthDp));
|
||||
view.setLayoutManager(new GridLayoutManager(view.getContext(), cols));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/navigation_view"
|
||||
android:layout_width="210dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
app:itemTextAppearance="?attr/textAppearanceBody1"
|
||||
app:headerLayout="@layout/view_drawer_header"
|
||||
app:menu="@menu/menu_drawer"/>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_drawer"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:defaultNavHost="true"
|
||||
app:navGraph="@navigation/navigation_drawer" />
|
||||
|
||||
|
||||
<include layout="@layout/layout_logobar" />
|
||||
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
||||
<include layout="@layout/view_progress" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data>
|
||||
<variable name="model" type="com.mowesta.android.app.model.CityViewModel" />
|
||||
<variable name="stationListener" type="com.mowesta.android.app.model.CityViewModel.OnStationSelectedListener" />
|
||||
<variable name="condition" type="com.mowesta.android.app.model.ConditionViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:fillViewport="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_margin="@dimen/space_medium"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/view_city_detail"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
app:model="@{model}"
|
||||
app:stationListener="@{stationListener}" />
|
||||
|
||||
<Space
|
||||
android:layout_width="@dimen/space_medium"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
<include
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
layout="@layout/view_condition"
|
||||
app:model="@{condition}" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</layout>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include layout="@layout/fragment_recycler"/>
|
||||
<include layout="@layout/fragment_recycler" android:layout_width="match_parent" android:layout_height="match_parent"/>
|
||||
|
||||
<include layout="@layout/view_progress"/>
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="@dimen/space_medium"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
style="@style/match_parent_limit"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include layout="@layout/fragment_recycler" />
|
||||
<include layout="@layout/fragment_recycler" android:layout_height="match_parent" android:layout_width="match_parent"/>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
android:layout_height="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
style="@style/match_parent_limit"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/space_medium"
|
||||
android:orientation="vertical">
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
style="@style/match_parent_limit"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="300dp">
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
@@ -30,32 +30,31 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/margin_default">
|
||||
android:padding="@dimen/space_medium">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
style="@style/match_parent_limit"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginBottom="6dp">
|
||||
|
||||
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/permission_checkbox_start"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:checked="@={ model.accepted }"
|
||||
tools:targetApi="21"
|
||||
android:buttonTint="@color/primary"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/terms_checkbox_permission"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.1"/>
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:enabled="@{ model.accepted }"
|
||||
android:id="@+id/start_button_continue"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_gravity="center"
|
||||
style="@style/match_parent_limit"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="@{ () -> continueListener.run() }"
|
||||
android:text="@string/terms_button_accept" />
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap|snapMargins">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/header"
|
||||
android:id="@+id/logo_sun"
|
||||
android:contentDescription="@null"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
favoriteIcon="@{model}"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_width="80dp"
|
||||
android:layout_width="70dp"
|
||||
android:padding="4dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
@@ -64,6 +64,9 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<Space
|
||||
android:layout_width="@dimen/space_medium"
|
||||
android:layout_height="0dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View android:layout_width="match_parent"
|
||||
@@ -76,7 +79,7 @@
|
||||
favoriteShowCondition="@{model}"
|
||||
android:orientation="horizontal">
|
||||
<com.mowesta.android.app.view.WeatherView
|
||||
android:layout_width="80dp"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:gravity="center"
|
||||
@@ -130,6 +133,9 @@
|
||||
android:textAppearance="?attr/textAppearanceBody1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<Space
|
||||
android:layout_width="@dimen/space_medium"
|
||||
android:layout_height="0dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
@@ -9,10 +9,15 @@
|
||||
name="listener"
|
||||
type="com.mowesta.android.app.model.VideoViewModel.OnVideoSelectedListener" />
|
||||
</data>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_margin="8dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
@@ -37,4 +42,6 @@
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?attr/textAppearanceCaption" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</layout>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
android:id="@+id/destination_login"
|
||||
android:name="com.mowesta.android.app.fragment.LoginFragment"
|
||||
android:label="@string/navigation_login"
|
||||
android:layout="@layout/fragment_login">
|
||||
tools:layout="@layout/fragment_login">
|
||||
<action
|
||||
android:id="@+id/action_login_collection"
|
||||
app:popUpTo="@id/destination_login"
|
||||
@@ -74,7 +74,7 @@
|
||||
android:id="@+id/destination_collection"
|
||||
android:name="com.mowesta.android.app.fragment.CollectionFragment"
|
||||
android:label="@string/navigation_login"
|
||||
android:layout="@layout/fragment_login">
|
||||
tools:layout="@layout/fragment_login">
|
||||
<action
|
||||
android:id="@+id/action_collection_drawer"
|
||||
app:popUpTo="@id/destination_collection"
|
||||
@@ -117,26 +117,41 @@
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/destination_city"
|
||||
tools:layout="@layout/fragment_city"
|
||||
android:name="com.mowesta.android.app.fragment.CityFragment"
|
||||
android:label="@string/navigation_city"/>
|
||||
<fragment
|
||||
android:id="@+id/destination_country"
|
||||
tools:layout="@layout/fragment_country"
|
||||
android:name="com.mowesta.android.app.fragment.CountryFragment"
|
||||
android:label="@string/navigation_country"/>
|
||||
<fragment
|
||||
android:id="@+id/destination_state"
|
||||
tools:layout="@layout/fragment_state"
|
||||
android:name="com.mowesta.android.app.fragment.StateFragment"
|
||||
android:label="@string/navigation_state"/>
|
||||
<fragment
|
||||
android:id="@+id/destination_station"
|
||||
tools:layout="@layout/fragment_station"
|
||||
android:name="com.mowesta.android.app.fragment.StationFragment"
|
||||
android:label="@string/navigation_station" />
|
||||
<fragment
|
||||
android:id="@+id/destination_device"
|
||||
tools:layout="@layout/fragment_device"
|
||||
android:name="com.mowesta.android.app.fragment.DeviceFragment"
|
||||
android:label="@string/navigation_device" />
|
||||
<fragment
|
||||
android:id="@+id/destination_video"
|
||||
tools:layout="@layout/fragment_video"
|
||||
android:name="com.mowesta.android.app.fragment.VideoFragment" />
|
||||
|
||||
<include app:graph="@navigation/navigation_drawer" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_drawer"
|
||||
app:popUpTo="@id/destination_drawer"
|
||||
app:popUpToInclusive="true"
|
||||
app:enterAnim="@anim/slide_in_right"
|
||||
app:exitAnim="@anim/slide_out_left"
|
||||
app:destination="@id/destination_drawer" />
|
||||
</navigation>
|
||||
@@ -2,26 +2,32 @@
|
||||
<navigation
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/navigation_drawer"
|
||||
app:startDestination="@id/destination_favorites">
|
||||
<fragment
|
||||
android:id="@+id/destination_favorites"
|
||||
tools:layout="@layout/fragment_favorites"
|
||||
android:name="com.mowesta.android.app.fragment.FavoritesFragment"
|
||||
android:label="@string/navigation_favorites" />
|
||||
<fragment
|
||||
android:id="@+id/destination_cities"
|
||||
tools:layout="@layout/fragment_cities"
|
||||
android:name="com.mowesta.android.app.fragment.CitiesFragment"
|
||||
android:label="@string/navigation_cities" />
|
||||
<fragment
|
||||
android:id="@+id/destination_stations"
|
||||
tools:layout="@layout/fragment_stations"
|
||||
android:name="com.mowesta.android.app.fragment.StationsFragment"
|
||||
android:label="@string/navigation_stations" />
|
||||
<fragment
|
||||
android:id="@+id/destination_devices"
|
||||
tools:layout="@layout/fragment_devices"
|
||||
android:name="com.mowesta.android.app.fragment.DevicesFragment"
|
||||
android:label="@string/navigation_devices" />
|
||||
<fragment
|
||||
android:id="@+id/destination_account"
|
||||
tools:layout="@layout/fragment_login"
|
||||
android:name="com.mowesta.android.app.fragment.LoginFragment"
|
||||
android:label="@string/navigation_account" />
|
||||
<fragment
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="match_parent_limit">
|
||||
<item name="android:layout_width">390dp</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="match_parent_limit">
|
||||
<item name="android:layout_width">520dp</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -14,7 +14,7 @@
|
||||
<string name="message_no_browser">Unable to open your web browser.</string>
|
||||
<string name="message_no_permission">The app is missing a required permission.</string>
|
||||
<string name="message_configure_failed">Could not open the app settings.</string>
|
||||
<string name="button_configure">Con-\figure</string>
|
||||
<string name="button_configure">Con-\nfigure</string>
|
||||
|
||||
<!-- video controls -->
|
||||
<string name="button_fit_screen">Match screen</string>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- text styles -->
|
||||
|
||||
|
||||
|
||||
<style name="match_parent_limit">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
|
||||
@@ -132,17 +132,22 @@ public abstract class SdkService extends Service {
|
||||
* A listener that deactivates the service when the upload completes.
|
||||
*/
|
||||
public Observer<Boolean> uploadListener = new Observer<Boolean>() {
|
||||
/** The previous state of the upload. */
|
||||
private boolean initialized = false;
|
||||
@Override
|
||||
public void onChanged(Boolean uploading) {
|
||||
if (currentState == State.IDLE) {
|
||||
if (uploading) {
|
||||
channelManager.updateNotification(R.string.mowesta_sdk_notification_content_upload);
|
||||
} else {
|
||||
} else if (initialized) {
|
||||
channelManager.updateNotification(R.string.mowesta_sdk_notification_content_idle);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
// shutdown the service, the alarm manager will do the rest
|
||||
Log.d(TAG, "Stopping service and let alarm manager do the rest.");
|
||||
stopSelf();
|
||||
}
|
||||
} else {
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,9 @@ public class MeasureTask extends AsyncTask<Void, Void, Void> {
|
||||
public void execute() {
|
||||
start = SystemClock.elapsedRealtime();
|
||||
readBattery();
|
||||
System.out.println("Battery");
|
||||
readScreen();
|
||||
System.out.println("Screen");
|
||||
// add sensor listeners
|
||||
SensorManager manager = (SensorManager)context.getApplicationContext().getSystemService(Context.SENSOR_SERVICE);
|
||||
if (manager != null) {
|
||||
@@ -147,6 +149,7 @@ public class MeasureTask extends AsyncTask<Void, Void, Void> {
|
||||
registerSensor(manager, Sensor.TYPE_PRESSURE, "SENSOR_PRESSURE");
|
||||
registerSensor(manager, Sensor.TYPE_RELATIVE_HUMIDITY, "SENSOR_HUMIDITY");
|
||||
}
|
||||
System.out.println("Manager");
|
||||
this.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ allprojects {
|
||||
|
||||
// set version for our project
|
||||
group = 'com.mowesta'
|
||||
version = '1.0.1-SNAPSHOT'
|
||||
version = '1.0.4'
|
||||
|
||||
// set versions for our libraries
|
||||
ext {
|
||||
|
||||
Reference in New Issue
Block a user