move NfcView to pure XML view
This commit is contained in:
		
							parent
							
								
									a9aafa080d
								
							
						
					
					
						commit
						5ddc287ab3
					
				@ -1,42 +0,0 @@
 | 
			
		||||
package org.fdroid.fdroid.views.swap;
 | 
			
		||||
 | 
			
		||||
import android.annotation.TargetApi;
 | 
			
		||||
import android.content.Context;
 | 
			
		||||
import android.util.AttributeSet;
 | 
			
		||||
import android.widget.CheckBox;
 | 
			
		||||
import android.widget.CompoundButton;
 | 
			
		||||
import org.fdroid.fdroid.Preferences;
 | 
			
		||||
import org.fdroid.fdroid.R;
 | 
			
		||||
import org.fdroid.fdroid.localrepo.SwapView;
 | 
			
		||||
 | 
			
		||||
public class NfcView extends SwapView {
 | 
			
		||||
 | 
			
		||||
    public NfcView(Context context) {
 | 
			
		||||
        super(context);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public NfcView(Context context, AttributeSet attrs) {
 | 
			
		||||
        super(context, attrs);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public NfcView(Context context, AttributeSet attrs, int defStyleAttr) {
 | 
			
		||||
        super(context, attrs, defStyleAttr);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @TargetApi(21)
 | 
			
		||||
    public NfcView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
 | 
			
		||||
        super(context, attrs, defStyleAttr, defStyleRes);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void onFinishInflate() {
 | 
			
		||||
        super.onFinishInflate();
 | 
			
		||||
        CheckBox dontShowAgain = (CheckBox) findViewById(R.id.checkbox_dont_show);
 | 
			
		||||
        dontShowAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
 | 
			
		||||
                Preferences.get().setShowNfcDuringSwap(!isChecked);
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -506,6 +506,9 @@ public class SwapWorkflowActivity extends AppCompatActivity {
 | 
			
		||||
                setUpFromWifi();
 | 
			
		||||
                setUpQrScannerButton();
 | 
			
		||||
                break;
 | 
			
		||||
            case R.layout.swap_nfc:
 | 
			
		||||
                setUpNfcView();
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return currentView;
 | 
			
		||||
@ -1051,4 +1054,15 @@ public class SwapWorkflowActivity extends AppCompatActivity {
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void setUpNfcView() {
 | 
			
		||||
        CheckBox dontShowAgain = container.findViewById(R.id.checkbox_dont_show);
 | 
			
		||||
        dontShowAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
 | 
			
		||||
                Preferences.get().setShowNfcDuringSwap(!isChecked);
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
 | 
			
		||||
<org.fdroid.fdroid.views.swap.NfcView
 | 
			
		||||
<org.fdroid.fdroid.localrepo.SwapView
 | 
			
		||||
        xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
        xmlns:swap="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
        swap:toolbarTitle="@string/swap_nfc_title"
 | 
			
		||||
@ -35,4 +35,4 @@
 | 
			
		||||
            android:layout_below="@+id/text_description"
 | 
			
		||||
            android:layout_centerHorizontal="true"/>
 | 
			
		||||
 | 
			
		||||
</org.fdroid.fdroid.views.swap.NfcView>
 | 
			
		||||
</org.fdroid.fdroid.localrepo.SwapView>
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user