Commit 9a6bc052 authored by Amit Kumar's avatar Amit Kumar
Browse files

tag point with some fixes

parent c79a932c
package org.indin.blisslaunchero.framework.customviews;
import android.content.Context;
import android.util.AttributeSet;
import android.view.DragEvent;
import android.widget.AutoCompleteTextView;
public class BlissAutoCompleteTextView extends AutoCompleteTextView{
public BlissAutoCompleteTextView(Context context) {
super(context);
}
public BlissAutoCompleteTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public BlissAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public BlissAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
public boolean onDragEvent(DragEvent event) {
// Without this drag/drop apps won't work on API <24.
// EditTexts seem to interfere with drag/drop.
return false;
}
}
...@@ -77,7 +77,6 @@ public class BlissFrameLayout extends FrameLayout { ...@@ -77,7 +77,6 @@ public class BlissFrameLayout extends FrameLayout {
@Override @Override
protected void dispatchDraw(Canvas canvas) { protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas); super.dispatchDraw(canvas);
Log.d(TAG, "dispatchDraw() called with: canvas = [" + canvas + "]");
drawBadgeIfNecessary(canvas); drawBadgeIfNecessary(canvas);
} }
...@@ -103,12 +102,10 @@ public class BlissFrameLayout extends FrameLayout { ...@@ -103,12 +102,10 @@ public class BlissFrameLayout extends FrameLayout {
int left = (getWidth() - mIconSize) / 2; int left = (getWidth() - mIconSize) / 2;
int right = left + mIconSize; int right = left + mIconSize;
int bottom = top + mIconSize; int bottom = top + mIconSize;
Log.i(TAG, "top: " + top + " left: " + left + " right: " + right + " bottom: " + bottom);
outBounds.set(left, top, right, bottom); outBounds.set(left, top, right, bottom);
} }
public void applyBadge(boolean isBadge, boolean withText) { public void applyBadge(boolean isBadge, boolean withText) {
Log.d(TAG, "applyBadge() called with: isBadge = [" + isBadge + "]");
mWithText = withText; mWithText = withText;
boolean wasBadged = hasBadge; boolean wasBadged = hasBadge;
hasBadge = isBadge; hasBadge = isBadge;
......
...@@ -423,7 +423,7 @@ public class HorizontalPager extends ViewGroup { ...@@ -423,7 +423,7 @@ public class HorizontalPager extends ViewGroup {
snapToPage(whichPage); snapToPage(whichPage);
} }
public void snapToPage(int whichPage) { public void snapToPage(int whichPage, int duration) {
enableChildrenCache(); enableChildrenCache();
boolean changingPages = whichPage != currentPage; boolean changingPages = whichPage != currentPage;
...@@ -442,6 +442,10 @@ public class HorizontalPager extends ViewGroup { ...@@ -442,6 +442,10 @@ public class HorizontalPager extends ViewGroup {
invalidate(); invalidate();
} }
public void snapToPage(int whichPage) {
snapToPage(whichPage, 400);
}
@Override @Override
protected Parcelable onSaveInstanceState() { protected Parcelable onSaveInstanceState() {
final SavedState state = new SavedState(super.onSaveInstanceState()); final SavedState state = new SavedState(super.onSaveInstanceState());
...@@ -464,6 +468,12 @@ public class HorizontalPager extends ViewGroup { ...@@ -464,6 +468,12 @@ public class HorizontalPager extends ViewGroup {
} }
} }
public void scrollLeft(int duration) {
if (nextPage == INVALID_SCREEN && currentPage > 0 && mScroller.isFinished()) {
snapToPage(currentPage - 1, duration);
}
}
public void scrollRight() { public void scrollRight() {
if (nextPage == INVALID_SCREEN && currentPage < getChildCount() - 1 if (nextPage == INVALID_SCREEN && currentPage < getChildCount() - 1
&& mScroller.isFinished()) { && mScroller.isFinished()) {
...@@ -471,6 +481,13 @@ public class HorizontalPager extends ViewGroup { ...@@ -471,6 +481,13 @@ public class HorizontalPager extends ViewGroup {
} }
} }
public void scrollRight(int duration) {
if (nextPage == INVALID_SCREEN && currentPage < getChildCount() - 1
&& mScroller.isFinished()) {
snapToPage(currentPage + 1, duration);
}
}
public int getScreenForView(View v) { public int getScreenForView(View v) {
int result = -1; int result = -1;
if (v != null) { if (v != null) {
......
package org.indin.blisslaunchero.framework.network;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
public class RetrofitService {
private static OkHttpClient sOkHttpClient;
private static GsonConverterFactory sGsonConverterFactory = GsonConverterFactory.create();
private static RxJava2CallAdapterFactory sRxJava2CallAdapterFactory = RxJava2CallAdapterFactory.create();
static {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
sOkHttpClient = new OkHttpClient.Builder()
.addInterceptor(logging)
.build();
}
public static Retrofit getInstance(String url) {
return new Retrofit.Builder()
.baseUrl(url)
.client(sOkHttpClient)
.addCallAdapterFactory(sRxJava2CallAdapterFactory)
.addConverterFactory(sGsonConverterFactory).build();
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment