Browse Source

Remove buggy menu animation

master
Apostolos Fanakis 6 years ago
parent
commit
114af086e7
  1. 6
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml
  2. 5
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/LoginActivity.java
  3. 6
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/SignUpActivity.java
  4. 55
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/MainActivity.java
  5. 2
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/MainAdapter.java
  6. 4
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/fragments/MainListFragment.java
  7. 2
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/fragments/MainMapFragment.java
  8. 2
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/map_view.xml
  9. 6
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/menu_item_main_map.xml
  10. 3
      UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/menu/main_tollbar_menu.xml

6
UI/AndroidApp/flavoursWithoutBorders/app/src/main/AndroidManifest.xml

@ -16,7 +16,7 @@
android:roundIcon="@drawable/logo_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".LoginActivity">
<activity android:name=".activities.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -24,7 +24,7 @@
</intent-filter>
</activity>
<activity
android:name=".SignUpActivity"
android:name=".activities.SignUpActivity"
android:theme="@style/AppTheme" />
<!--
The API key for Google Maps-based APIs is defined as a string resource.
@ -39,7 +39,7 @@
android:value="@string/google_maps_key" />
<activity
android:name=".main.MainActivity"
android:name=".activities.main.MainActivity"
android:label="@string/title_activity_main"></activity>
</application>

5
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/LoginActivity.java → UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/LoginActivity.java

@ -1,11 +1,12 @@
package gr.auth.databases.flavours;
package gr.auth.databases.flavours.activities;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import gr.auth.databases.flavours.main.MainActivity;
import gr.auth.databases.flavours.R;
import gr.auth.databases.flavours.activities.main.MainActivity;
public class LoginActivity extends AppCompatActivity {

6
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/SignUpActivity.java → UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/SignUpActivity.java

@ -1,7 +1,5 @@
package gr.auth.databases.flavours;
package gr.auth.databases.flavours.activities;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.content.Intent;
@ -17,6 +15,8 @@ import java.util.Objects;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.DialogFragment;
import gr.auth.databases.flavours.R;
import gr.auth.databases.flavours.activities.LoginActivity;
public class SignUpActivity extends AppCompatActivity {

55
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/main/MainActivity.java → UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/MainActivity.java

@ -1,13 +1,8 @@
package gr.auth.databases.flavours.main;
package gr.auth.databases.flavours.activities.main;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import androidx.annotation.NonNull;
@ -19,8 +14,8 @@ import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import gr.auth.databases.flavours.R;
import gr.auth.databases.flavours.main.fragments.MainListFragment;
import gr.auth.databases.flavours.main.fragments.MainMapFragment;
import gr.auth.databases.flavours.activities.main.fragments.MainListFragment;
import gr.auth.databases.flavours.activities.main.fragments.MainMapFragment;
public class MainActivity extends AppCompatActivity {
private static final int NUM_PAGES = 2;
@ -36,44 +31,6 @@ public class MainActivity extends AppCompatActivity {
toolbar.setTitle("Restaurants");
setSupportActionBar(toolbar);
final Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator());
fadeIn.setDuration(700);
fadeIn.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
menuMapItem.setVisible(true);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
menuMapItem.setVisible(true);
}
});
final Animation fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setStartOffset(100);
fadeOut.setDuration(700);
fadeOut.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
menuMapItem.setVisible(false);
}
});
viewPager = findViewById(R.id.main_pager);
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
public void onPageScrollStateChanged(int state) {
@ -89,9 +46,8 @@ public class MainActivity extends AppCompatActivity {
if (position == 0) {
menuMapItem.setVisible(true);
menuMapItem.getActionView().startAnimation(fadeIn);
} else {
menuMapItem.getActionView().startAnimation(fadeOut);
menuMapItem.setVisible(false);
}
}
});
@ -113,9 +69,6 @@ public class MainActivity extends AppCompatActivity {
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_tollbar_menu, menu);
menuMapItem = menu.findItem(R.id.main_toolbar_menu_map);
View view = getLayoutInflater().inflate(R.layout.menu_item_main_map, null);
menuMapItem.setActionView(view);
return true;
}

2
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/main/MainAdapter.java → UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/MainAdapter.java

@ -1,4 +1,4 @@
package gr.auth.databases.flavours.main;
package gr.auth.databases.flavours.activities.main;
import android.content.Context;
import android.view.LayoutInflater;

4
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/main/fragments/MainListFragment.java → UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/fragments/MainListFragment.java

@ -1,4 +1,4 @@
package gr.auth.databases.flavours.main.fragments;
package gr.auth.databases.flavours.activities.main.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
@ -10,7 +10,7 @@ import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import gr.auth.databases.flavours.R;
import gr.auth.databases.flavours.main.MainAdapter;
import gr.auth.databases.flavours.activities.main.MainAdapter;
import gr.auth.databases.flavours.model.Restaurant;
public class MainListFragment extends Fragment {

2
UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/main/fragments/MainMapFragment.java → UI/AndroidApp/flavoursWithoutBorders/app/src/main/java/gr/auth/databases/flavours/activities/main/fragments/MainMapFragment.java

@ -1,4 +1,4 @@
package gr.auth.databases.flavours.main.fragments;
package gr.auth.databases.flavours.activities.main.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;

2
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/map_view.xml

@ -5,4 +5,4 @@
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".main.MainActivity" />
tools:context=".activities.main.MainActivity" />

6
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/layout/menu_item_main_map.xml

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.AppCompatImageButton xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/main_toolbar_menu_map"
android:src="@drawable/ic_map_black_24dp" />

3
UI/AndroidApp/flavoursWithoutBorders/app/src/main/res/menu/main_tollbar_menu.xml

@ -2,7 +2,7 @@
<menu 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"
tools:context=".main.MainActivity">
tools:context=".activities.main.MainActivity">
<item
android:id="@+id/main_toolbar_menu_filter"
android:icon="@drawable/ic_filter_list_black_24dp"
@ -14,6 +14,5 @@
android:icon="@drawable/ic_map_black_24dp"
android:orderInCategory="200"
android:title="@string/main_toolbar_menu_map"
app:actionViewClass="androidx.appcompat.widget.AppCompatImageButton"
app:showAsAction="ifRoom" />
</menu>
Loading…
Cancel
Save