| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 import android.view.ViewGroup.LayoutParams; | 33 import android.view.ViewGroup.LayoutParams; |
| 34 import android.view.Window; | 34 import android.view.Window; |
| 35 import android.widget.Button; | 35 import android.widget.Button; |
| 36 import android.widget.LinearLayout; | 36 import android.widget.LinearLayout; |
| 37 import android.widget.TextView; | 37 import android.widget.TextView; |
| 38 | 38 |
| 39 public class StartPane extends DialogFragment implements OnClickListener, OnKeyL istener | 39 public class StartPane extends DialogFragment implements OnClickListener, OnKeyL istener |
| 40 { | 40 { |
| 41 private static final String TAG = "AdblockBrowser.StartPane"; | 41 private static final String TAG = "AdblockBrowser.StartPane"; |
| 42 private int currentStep = 1; | 42 private int currentStep = 1; |
| 43 private static final int MAXIMUM_STEPS = 3; | 43 private static final int NUMBER_OF_STEPS = 3; |
|
Felix Dahlke
2015/05/06 07:49:37
Nit: NUM_STEPS or something rather? We always have
René Jeschke
2015/05/06 10:41:56
Done.
| |
| 44 | 44 |
| 45 @Override | 45 @Override |
| 46 public void onCreate(Bundle savedInstanceState) | 46 public void onCreate(Bundle savedInstanceState) |
| 47 { | 47 { |
| 48 super.onCreate(savedInstanceState); | 48 super.onCreate(savedInstanceState); |
| 49 this.setStyle(DialogFragment.STYLE_NO_TITLE, 0); | 49 this.setStyle(DialogFragment.STYLE_NO_TITLE, 0); |
| 50 } | 50 } |
| 51 | 51 |
| 52 @Override | 52 @Override |
| 53 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) | 53 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 68 { | 68 { |
| 69 super.onActivityCreated(savedInstanceState); | 69 super.onActivityCreated(savedInstanceState); |
| 70 final Window window = getDialog().getWindow(); | 70 final Window window = getDialog().getWindow(); |
| 71 window.setBackgroundDrawable(null); | 71 window.setBackgroundDrawable(null); |
| 72 window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); | 72 window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); |
| 73 } | 73 } |
| 74 | 74 |
| 75 @Override | 75 @Override |
| 76 public void onClick(View v) | 76 public void onClick(View v) |
| 77 { | 77 { |
| 78 if (this.currentStep < MAXIMUM_STEPS) | 78 if (this.currentStep < NUMBER_OF_STEPS) |
| 79 { | 79 { |
| 80 this.currentStep++; | 80 this.currentStep++; |
| 81 this.updateContents(this.getView()); | 81 this.updateContents(this.getView()); |
| 82 } | 82 } |
| 83 else | 83 else |
| 84 { | 84 { |
| 85 this.dismissAllowingStateLoss(); | 85 this.dismissAllowingStateLoss(); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 final TextView tv = (TextView) view.findViewById(viewId); | 124 final TextView tv = (TextView) view.findViewById(viewId); |
| 125 tv.setText(Html.fromHtml(text)); | 125 tv.setText(Html.fromHtml(text)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 private void setButtonText(final View view, final int viewId, final int resId) | 128 private void setButtonText(final View view, final int viewId, final int resId) |
| 129 { | 129 { |
| 130 final Button button = (Button) view.findViewById(viewId); | 130 final Button button = (Button) view.findViewById(viewId); |
| 131 button.setText(this.getString(resId)); | 131 button.setText(this.getString(resId)); |
| 132 } | 132 } |
| 133 } | 133 } |
| LEFT | RIGHT |