Browse Source

Fixed: header expand/collapse animation, WebView's click handling bug, login focus, password hide/show, eye of the satan error. Created topic package.

pull/24/head
Apostolos Fanakis 8 years ago
parent
commit
0ef0c6158e
  1. 2
      app/src/main/AndroidManifest.xml
  2. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java
  3. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java
  4. 13
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  5. 6
      app/src/main/res/layout/activity_login.xml
  6. 6
      app/src/main/res/layout/activity_topic.xml
  7. 2
      app/src/main/res/values/styles.xml

2
app/src/main/AndroidManifest.xml

@ -39,7 +39,7 @@
android:value=".activities.main.MainActivity"/> android:value=".activities.main.MainActivity"/>
</activity> </activity>
<activity <activity
android:name=".activities.TopicActivity" android:name=".activities.topic.TopicActivity"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:parentActivityName=".activities.main.MainActivity" android:parentActivityName=".activities.main.MainActivity"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">

2
app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java

@ -106,7 +106,7 @@ public class LoginActivity extends BaseActivity {
} }
if (password.isEmpty()) { if (password.isEmpty()) {
inputPassword.setError("Enter a valid password"); inputPassword.setError("Enter a valid password", null);
valid = false; valid = false;
} else { } else {
inputPassword.setError(null); inputPassword.setError(null);

2
app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java

@ -12,7 +12,7 @@ import android.support.v7.widget.Toolbar;
import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.activities.BaseActivity; import gr.thmmy.mthmmy.activities.BaseActivity;
import gr.thmmy.mthmmy.activities.LoginActivity; import gr.thmmy.mthmmy.activities.LoginActivity;
import gr.thmmy.mthmmy.activities.TopicActivity; import gr.thmmy.mthmmy.activities.topic.TopicActivity;
import gr.thmmy.mthmmy.data.TopicSummary; import gr.thmmy.mthmmy.data.TopicSummary;
import gr.thmmy.mthmmy.activities.main.forum.ForumFragment; import gr.thmmy.mthmmy.activities.main.forum.ForumFragment;
import gr.thmmy.mthmmy.activities.main.recent.RecentFragment; import gr.thmmy.mthmmy.activities.main.recent.RecentFragment;

13
app/src/main/java/gr/thmmy/mthmmy/activities/TopicActivity.java → app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java

@ -1,4 +1,4 @@
package gr.thmmy.mthmmy.activities; package gr.thmmy.mthmmy.activities.topic;
import android.animation.Animator; import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
@ -11,7 +11,6 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.CardView; import android.support.v7.widget.CardView;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.TextUtils; import android.text.TextUtils;
@ -46,6 +45,7 @@ import java.util.Objects;
import javax.net.ssl.SSLHandshakeException; import javax.net.ssl.SSLHandshakeException;
import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.activities.BaseActivity;
import gr.thmmy.mthmmy.data.Post; import gr.thmmy.mthmmy.data.Post;
import gr.thmmy.mthmmy.utils.CircularNetworkImageView; import gr.thmmy.mthmmy.utils.CircularNetworkImageView;
import gr.thmmy.mthmmy.utils.ImageController; import gr.thmmy.mthmmy.utils.ImageController;
@ -714,10 +714,9 @@ public class TopicActivity extends BaseActivity {
break; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
fingerState = FINGER_RELEASED;
webViewLongClickHandler.removeCallbacks(WebViewLongClick); webViewLongClickHandler.removeCallbacks(WebViewLongClick);
if(!wasLongClick) { if(!wasLongClick && fingerState != FINGER_DRAGGING) {
//If this was a link don't expand the card //If this was a link don't expand the card
WebView.HitTestResult htResult = post.getHitTestResult(); WebView.HitTestResult htResult = post.getHitTestResult();
if (htResult.getExtra() != null if (htResult.getExtra() != null
@ -728,6 +727,7 @@ public class TopicActivity extends BaseActivity {
} }
else else
wasLongClick = false; wasLongClick = false;
fingerState = FINGER_RELEASED;
break; break;
case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE:
@ -735,9 +735,8 @@ public class TopicActivity extends BaseActivity {
if (((Math.abs(downCoordinateX - motionEvent.getX()) > SCROLL_THRESHOLD || if (((Math.abs(downCoordinateX - motionEvent.getX()) > SCROLL_THRESHOLD ||
Math.abs(downCoordinateY - motionEvent.getY()) > SCROLL_THRESHOLD))) { Math.abs(downCoordinateY - motionEvent.getY()) > SCROLL_THRESHOLD))) {
webViewLongClickHandler.removeCallbacks(WebViewLongClick); webViewLongClickHandler.removeCallbacks(WebViewLongClick);
}
if (fingerState == FINGER_TOUCHED || fingerState == FINGER_DRAGGING)
fingerState = FINGER_DRAGGING; fingerState = FINGER_DRAGGING;
}
else fingerState = FINGER_UNDEFINED; else fingerState = FINGER_UNDEFINED;
break; break;
@ -842,7 +841,6 @@ public class TopicActivity extends BaseActivity {
// Start the animation // Start the animation
userExtra.animate() userExtra.animate()
.translationY(0)
.alpha(1.0f) .alpha(1.0f)
.setDuration(300) .setDuration(300)
.setListener(new AnimatorListenerAdapter() { .setListener(new AnimatorListenerAdapter() {
@ -859,7 +857,6 @@ public class TopicActivity extends BaseActivity {
// Start the animation // Start the animation
userExtra.animate() userExtra.animate()
.translationY(userExtra.getHeight())
.alpha(0.0f) .alpha(0.0f)
.setDuration(300) .setDuration(300)
.setListener(new AnimatorListenerAdapter() { .setListener(new AnimatorListenerAdapter() {

6
app/src/main/res/layout/activity_login.xml

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:fitsSystemWindows="true"> android:fitsSystemWindows="true">
@ -8,6 +9,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="top" android:layout_gravity="top"
android:focusableInTouchMode="true"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="24dp" android:paddingLeft="24dp"
android:paddingRight="24dp"> android:paddingRight="24dp">
@ -57,6 +59,7 @@
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:passwordToggleEnabled="true"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"> android:layout_marginTop="8dp">
@ -76,7 +79,8 @@
android:layout_marginBottom="24dp" android:layout_marginBottom="24dp"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:padding="12dp" android:padding="12dp"
android:text="@string/btn_login"/> android:text="@string/btn_login"
android:textSize="18sp"/>
<Button <Button
android:id="@+id/btnContinueAsGuest" android:id="@+id/btnContinueAsGuest"

6
app/src/main/res/layout/activity_topic.xml

@ -34,7 +34,7 @@
android:layout_marginBottom="50dp" android:layout_marginBottom="50dp"
android:background="@color/background" android:background="@color/background"
android:scrollbars="none" android:scrollbars="none"
tools:context="gr.thmmy.mthmmy.activities.TopicActivity"> tools:context="gr.thmmy.mthmmy.activities.topic.TopicActivity">
<LinearLayout <LinearLayout
android:id="@+id/posts_list" android:id="@+id/posts_list"
@ -61,7 +61,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.8" android:layout_weight="0.8"
android:background="@color/primary"
android:contentDescription="@string/text_first" android:contentDescription="@string/text_first"
app:srcCompat="@drawable/page_first"/> app:srcCompat="@drawable/page_first"/>
@ -70,7 +69,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.8" android:layout_weight="0.8"
android:background="@color/primary"
android:contentDescription="@string/text_previous" android:contentDescription="@string/text_previous"
app:srcCompat="@drawable/page_previous"/> app:srcCompat="@drawable/page_previous"/>
@ -91,7 +89,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.8" android:layout_weight="0.8"
android:background="@color/primary"
android:contentDescription="@string/text_next" android:contentDescription="@string/text_next"
app:srcCompat="@drawable/page_next"/> app:srcCompat="@drawable/page_next"/>
@ -100,7 +97,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.8" android:layout_weight="0.8"
android:background="@color/primary"
android:contentDescription="@string/text_last" android:contentDescription="@string/text_last"
app:srcCompat="@drawable/page_last"/> app:srcCompat="@drawable/page_last"/>
</LinearLayout> </LinearLayout>

2
app/src/main/res/values/styles.xml

@ -16,7 +16,7 @@
<item name="colorControlHighlight">@color/white</item> <item name="colorControlHighlight">@color/white</item>
<item name="android:textColorHint">@color/iron</item> <item name="android:textColorHint">@color/iron</item>
<item name="colorButtonNormal">@color/primary_dark</item> <item name="colorButtonNormal">@color/primary</item>
</style> </style>
<style name="AppTheme.NoActionBar"> <style name="AppTheme.NoActionBar">

Loading…
Cancel
Save