-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix swipeback bug and launcher icon bug
- Loading branch information
Showing
5 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...ackLayoutLibrary/src/main/java/me/imid/swipebacklayout/lib/app/SwipeBackActivityBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
...kLayoutLibrary/src/main/java/me/imid/swipebacklayout/lib/app/SwipeBackActivityHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
...outLibrary/src/main/java/me/imid/swipebacklayout/lib/app/SwipeBackPreferenceActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
SwipeBackLayoutLibrary/src/main/res/layout/swipeback_layout.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" /> | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.