Skip to content

Commit

Permalink
fix swipeback bug and launcher icon bug
Browse files Browse the repository at this point in the history
  • Loading branch information
djj0809 committed Sep 25, 2013
1 parent f25fb83 commit a5c177f
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package me.imid.swipebacklayout.lib.app;

import me.imid.swipebacklayout.lib.SwipeBackLayout;
/**
* @author Yrom
*/
public interface SwipeBackActivityBase {
/**
* @return the SwipeBackLayout associated with this activity.
*/
public abstract SwipeBackLayout getSwipeBackLayout();

public abstract void setSwipeBackEnable(boolean enable);

/**
* Scroll out contentView and finish the activity
*/
public abstract void scrollToFinishActivity();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package me.imid.swipebacklayout.lib.app;

import me.imid.swipebacklayout.lib.SwipeBackLayout;
import android.app.Activity;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;

/**
* @author Yrom
*
*/
public class SwipeBackActivityHelper {
private Activity mActivity;
private SwipeBackLayout mSwipeBackLayout;

public SwipeBackActivityHelper(Activity activity) {
mActivity = activity;
}

@SuppressWarnings("deprecation")
public void onActivtyCreate(){
mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(0));
mActivity.getWindow().getDecorView().setBackgroundDrawable(null);
mSwipeBackLayout = (SwipeBackLayout) LayoutInflater.from(mActivity).inflate(me.imid.swipebacklayout.lib.R.layout.swipeback_layout,null);
}

public void onPostCreate(){
mSwipeBackLayout.attachToActivity(mActivity);
}

public View findViewById(int id) {
if (mSwipeBackLayout != null) {
return mSwipeBackLayout.findViewById(id);
}
return null;
}

public SwipeBackLayout getSwipeBackLayout() {
return mSwipeBackLayout;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

package me.imid.swipebacklayout.lib.app;

import me.imid.swipebacklayout.lib.SwipeBackLayout;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.View;

import com.github.rtyley.android.sherlock.roboguice.activity.RoboSherlockPreferenceActivity;

public class SwipeBackPreferenceActivity extends RoboSherlockPreferenceActivity implements SwipeBackActivityBase {
private SwipeBackActivityHelper mHelper;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mHelper = new SwipeBackActivityHelper(this);
mHelper.onActivtyCreate();
}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mHelper.onPostCreate();
}

@Override
public View findViewById(int id) {
View v = super.findViewById(id);
if (v == null && mHelper != null)
return mHelper.findViewById(id);
return v;
}

@Override
public SwipeBackLayout getSwipeBackLayout() {
return mHelper.getSwipeBackLayout();
}
@Override
public void setSwipeBackEnable(boolean enable) {
getSwipeBackLayout().setEnableGesture(enable);
}

@Override
public void scrollToFinishActivity() {
getSwipeBackLayout().scrollToFinishActivity();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<me.imid.swipebacklayout.lib.SwipeBackLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe"
android:layout_width="match_parent"
android:layout_height="match_parent" />

Binary file added app/src/main/res/drawable/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a5c177f

Please sign in to comment.