WIP: Refactored start swap fragment into a view.
Added a SwapWorkflowActivity to re-implement the SwapActivity. Once all the fragments have been refactored into views, then the SwapActivity will be removed.
This commit is contained in:
parent
f298ed7156
commit
b6415dadb4
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<RelativeLayout
|
<org.fdroid.fdroid.views.swap.views.StartSwapView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -18,7 +18,6 @@
|
|||||||
android:text="@string/swap_start"
|
android:text="@string/swap_start"
|
||||||
style="@style/SwapTheme.StartSwap.StartButton"
|
style="@style/SwapTheme.StartSwap.StartButton"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_below="@+id/text_description"
|
android:layout_height="wrap_content"/>
|
||||||
android:layout_centerHorizontal="true"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</org.fdroid.fdroid.views.swap.views.StartSwapView>
|
@ -13,27 +13,10 @@ import org.fdroid.fdroid.R;
|
|||||||
|
|
||||||
public class StartSwapFragment extends Fragment {
|
public class StartSwapFragment extends Fragment {
|
||||||
|
|
||||||
private SwapProcessManager manager;
|
|
||||||
|
|
||||||
public void onAttach(Activity activity) {
|
|
||||||
super.onAttach(activity);
|
|
||||||
manager = (SwapProcessManager)activity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
|
||||||
LayoutInflater themedInflater = (LayoutInflater)new ContextThemeWrapper(inflater.getContext(), R.style.SwapTheme_StartSwap).getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater themedInflater = (LayoutInflater)new ContextThemeWrapper(inflater.getContext(), R.style.SwapTheme_StartSwap).getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
return themedInflater.inflate(R.layout.swap_blank, container, false);
|
||||||
View view = themedInflater.inflate(R.layout.swap_blank, container, false);
|
|
||||||
view.findViewById(R.id.button_start_swap).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
manager.nextStep();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ public class SwapActivity extends ActionBarActivity implements SwapProcessManage
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showSelectApps() {
|
public void showSelectApps() {
|
||||||
|
|
||||||
showFragment(new SelectAppsFragment(), STATE_SELECT_APPS);
|
showFragment(new SelectAppsFragment(), STATE_SELECT_APPS);
|
||||||
|
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
package org.fdroid.fdroid.views.swap.views;
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.ContextThemeWrapper;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import org.fdroid.fdroid.FDroidApp;
|
||||||
|
import org.fdroid.fdroid.R;
|
||||||
|
import org.fdroid.fdroid.views.swap.SwapActivity;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class StartSwapView extends LinearLayout {
|
||||||
|
|
||||||
|
public StartSwapView(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StartSwapView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
public StartSwapView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
public StartSwapView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private SwapActivity getActivity() {
|
||||||
|
// TODO: Try and find a better way to get to the SwapActivity, which makes less asumptions.
|
||||||
|
return (SwapActivity)((ContextThemeWrapper)getContext()).getBaseContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onFinishInflate() {
|
||||||
|
super.onFinishInflate();
|
||||||
|
|
||||||
|
findViewById(R.id.button_start_swap).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
getActivity().showSelectApps();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user