Sherlock -> AppCompat
This commit is contained in:
parent
52ed2d0071
commit
68636d8278
@ -71,40 +71,36 @@
|
|||||||
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-shared-1.0-beta-6" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-shared-1.0-beta-6" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="xercesMinimal-1.9.6.2" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="xercesMinimal-1.9.6.2" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="nekohtml-1.9.6.2" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="nekohtml-1.9.6.2" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="simple-xml-2.6.1" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="simple-xml-2.6.1" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="core" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="commons-cli-1.2" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="commons-cli-1.2" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="annotations-2.0.1" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="annotations-2.0.1" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="core" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="internal_impl-21.0.3" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="stax-1.2.0" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="stax-1.2.0" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-msg-1.0.5" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-msg-1.0.5" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-listeners-1.0.7" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-listeners-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="guava-11.0.2" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="guava-11.0.2" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-text-1.0.7" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-text-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="library-2.4.0" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="library-2.4.0" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="acra-4.5.0" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="acra-4.5.0" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_exploded_aar_com_melnykov_floatingactionbutton_1_1_0_classes_jar" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="internal_impl-21.0.3" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-core-1.0.7" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-core-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="jscl-1.0.8" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="jscl-1.0.8" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="common-security-1.0.7" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="common-security-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_exploded_aar_com_android_support_recyclerview_v7_21_0_0_classes_jar" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_classes_debug" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_dependency_cache_debug" level="project" />
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_classes_debug" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_dependency_cache_debug" level="project" />
|
|
||||||
<orderEntry type="library" exported="" scope="TEST" name="android" level="project" />
|
<orderEntry type="library" exported="" scope="TEST" name="android" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -81,18 +81,15 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Android API 21 Platform (Local)" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" exported="" name="play-services-6.5.87" level="project" />
|
<orderEntry type="library" exported="" name="play-services-6.5.87" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-db-1.1.18" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="acra-4.5.0" level="project" />
|
<orderEntry type="library" exported="" name="acra-4.5.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-security-1.1.18" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="common-core-1.0.7" level="project" />
|
<orderEntry type="library" exported="" name="common-core-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-wizard-1.1.18" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="common-listeners-1.0.7" level="project" />
|
<orderEntry type="library" exported="" name="common-listeners-1.0.7" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="common-text-1.0.7" level="project" />
|
<orderEntry type="library" exported="" name="common-text-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
|
||||||
@ -101,8 +98,8 @@
|
|||||||
<orderEntry type="library" exported="" name="android-common-menus-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-menus-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="recyclerview-v7-21.0.0" level="project" />
|
<orderEntry type="library" exported="" name="recyclerview-v7-21.0.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
||||||
<orderEntry type="library" exported="" name="checkout-0.6.0" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="checkout-0.6.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="common-msg-1.0.5" level="project" />
|
<orderEntry type="library" exported="" name="common-msg-1.0.5" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-other-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-other-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="floatingactionbutton-1.1.0" level="project" />
|
<orderEntry type="library" exported="" name="floatingactionbutton-1.1.0" level="project" />
|
||||||
@ -110,7 +107,6 @@
|
|||||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-lists-1.1.18" level="project" />
|
<orderEntry type="library" exported="" name="android-common-lists-1.1.18" level="project" />
|
||||||
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
|
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-common-sherlock-1.1.18" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
|
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
|
||||||
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />
|
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />
|
||||||
<orderEntry type="module" module-name="core" exported="" />
|
<orderEntry type="module" module-name="core" exported="" />
|
||||||
|
@ -56,16 +56,13 @@ dependencies {
|
|||||||
compile 'org.solovyev:common-text:1.0.7'
|
compile 'org.solovyev:common-text:1.0.7'
|
||||||
compile 'org.solovyev:common-security:1.0.7'
|
compile 'org.solovyev:common-security:1.0.7'
|
||||||
compile 'com.android.support:support-v4:21.0.3'
|
compile 'com.android.support:support-v4:21.0.3'
|
||||||
compile ('ch.acra:acra:4.5.0') {
|
compile 'com.android.support:appcompat-v7:21.0.3'
|
||||||
|
compile('ch.acra:acra:4.5.0') {
|
||||||
exclude group: 'org.json'
|
exclude group: 'org.json'
|
||||||
}
|
}
|
||||||
compile 'org.solovyev.android:android-common-sherlock:1.1.18@aar'
|
|
||||||
compile 'org.solovyev.android:android-common-lists:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-lists:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-wizard:1.1.18@aar'
|
|
||||||
compile 'org.solovyev.android:android-common-core:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-core:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-other:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-other:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-db:1.1.18@aar'
|
|
||||||
compile 'org.solovyev.android:android-common-security:1.1.18@aar'
|
|
||||||
compile 'org.solovyev.android:android-common-views:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-views:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-menus:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-menus:1.1.18@aar'
|
||||||
compile 'org.solovyev.android:android-common-preferences:1.1.18@aar'
|
compile 'org.solovyev.android:android-common-preferences:1.1.18@aar'
|
||||||
@ -73,7 +70,6 @@ dependencies {
|
|||||||
exclude(module: 'xercesImpl')
|
exclude(module: 'xercesImpl')
|
||||||
}
|
}
|
||||||
compile 'org.solovyev.android:checkout:0.6.0@aar'
|
compile 'org.solovyev.android:checkout:0.6.0@aar'
|
||||||
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
|
||||||
compile 'com.google.android.gms:play-services:6.5.87@aar'
|
compile 'com.google.android.gms:play-services:6.5.87@aar'
|
||||||
compile 'com.melnykov:floatingactionbutton:1.1.0'
|
compile 'com.melnykov:floatingactionbutton:1.1.0'
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,9 @@
|
|||||||
-dontwarn com.actionbarsherlock.BuildConfig
|
-dontwarn com.actionbarsherlock.BuildConfig
|
||||||
-dontwarn com.google.android.gms.**
|
-dontwarn com.google.android.gms.**
|
||||||
-dontwarn com.melnykov.fab.**
|
-dontwarn com.melnykov.fab.**
|
||||||
|
-dontwarn android.support.v7.**
|
||||||
|
-keep class android.support.v7.** { *; }
|
||||||
|
-keep interface android.support.v7.** { *; }
|
||||||
|
|
||||||
-keep class org.simpleframework.xml.** { *; }
|
-keep class org.simpleframework.xml.** { *; }
|
||||||
-keep class * implements org.solovyev.android.calculator.model.MathPersistenceEntity
|
-keep class * implements org.solovyev.android.calculator.model.MathPersistenceEntity
|
||||||
|
@ -66,6 +66,9 @@
|
|||||||
-dontwarn com.actionbarsherlock.BuildConfig
|
-dontwarn com.actionbarsherlock.BuildConfig
|
||||||
-dontwarn com.google.android.gms.**
|
-dontwarn com.google.android.gms.**
|
||||||
-dontwarn com.melnykov.fab.**
|
-dontwarn com.melnykov.fab.**
|
||||||
|
-dontwarn android.support.v7.**
|
||||||
|
-keep class android.support.v7.** { *; }
|
||||||
|
-keep interface android.support.v7.** { *; }
|
||||||
|
|
||||||
-keep class org.simpleframework.xml.** { *; }
|
-keep class org.simpleframework.xml.** { *; }
|
||||||
-keep class * implements org.solovyev.android.calculator.model.MathPersistenceEntity
|
-keep class * implements org.solovyev.android.calculator.model.MathPersistenceEntity
|
||||||
|
@ -36,8 +36,8 @@ import android.util.Log;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import com.actionbarsherlock.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import org.solovyev.android.Activities;
|
import org.solovyev.android.Activities;
|
||||||
import org.solovyev.android.Views;
|
import org.solovyev.android.Views;
|
||||||
import org.solovyev.android.sherlock.tabs.ActionBarFragmentTabListener;
|
import org.solovyev.android.sherlock.tabs.ActionBarFragmentTabListener;
|
||||||
@ -111,9 +111,8 @@ public class ActivityUi extends BaseUi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCreate(@Nonnull final SherlockFragmentActivity activity) {
|
public void onCreate(@Nonnull final ActionBarActivity activity) {
|
||||||
onCreate((Activity)activity);
|
onCreate((Activity) activity);
|
||||||
|
|
||||||
final ActionBar actionBar = activity.getSupportActionBar();
|
final ActionBar actionBar = activity.getSupportActionBar();
|
||||||
actionBar.setDisplayUseLogoEnabled(false);
|
actionBar.setDisplayUseLogoEnabled(false);
|
||||||
actionBar.setDisplayHomeAsUpEnabled(homeIcon);
|
actionBar.setDisplayHomeAsUpEnabled(homeIcon);
|
||||||
@ -126,7 +125,7 @@ public class ActivityUi extends BaseUi {
|
|||||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toggleTitle(@Nonnull SherlockFragmentActivity activity, boolean showTitle) {
|
private void toggleTitle(@Nonnull ActionBarActivity activity, boolean showTitle) {
|
||||||
final ActionBar actionBar = activity.getSupportActionBar();
|
final ActionBar actionBar = activity.getSupportActionBar();
|
||||||
|
|
||||||
if (activity instanceof CalculatorActivity) {
|
if (activity instanceof CalculatorActivity) {
|
||||||
@ -140,14 +139,14 @@ public class ActivityUi extends BaseUi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restoreSavedTab(@Nonnull SherlockFragmentActivity activity) {
|
public void restoreSavedTab(@Nonnull ActionBarActivity activity) {
|
||||||
final ActionBar actionBar = activity.getSupportActionBar();
|
final ActionBar actionBar = activity.getSupportActionBar();
|
||||||
if (selectedNavigationIndex >= 0 && selectedNavigationIndex < actionBar.getTabCount()) {
|
if (selectedNavigationIndex >= 0 && selectedNavigationIndex < actionBar.getTabCount()) {
|
||||||
actionBar.setSelectedNavigationItem(selectedNavigationIndex);
|
actionBar.setSelectedNavigationItem(selectedNavigationIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSaveInstanceState(@Nonnull SherlockFragmentActivity activity, @Nonnull Bundle outState) {
|
public void onSaveInstanceState(@Nonnull ActionBarActivity activity, @Nonnull Bundle outState) {
|
||||||
onSaveInstanceState((Activity) activity, outState);
|
onSaveInstanceState((Activity) activity, outState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +165,7 @@ public class ActivityUi extends BaseUi {
|
|||||||
public void onPause(@Nonnull Activity activity) {
|
public void onPause(@Nonnull Activity activity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPause(@Nonnull SherlockFragmentActivity activity) {
|
public void onPause(@Nonnull ActionBarActivity activity) {
|
||||||
onPause((Activity) activity);
|
onPause((Activity) activity);
|
||||||
|
|
||||||
final int selectedNavigationIndex = activity.getSupportActionBar().getSelectedNavigationIndex();
|
final int selectedNavigationIndex = activity.getSupportActionBar().getSelectedNavigationIndex();
|
||||||
@ -193,11 +192,11 @@ public class ActivityUi extends BaseUi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDestroy(@Nonnull SherlockFragmentActivity activity) {
|
public void onDestroy(@Nonnull ActionBarActivity activity) {
|
||||||
this.onDestroy((Activity) activity);
|
this.onDestroy((Activity) activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTab(@Nonnull SherlockFragmentActivity activity,
|
public void addTab(@Nonnull ActionBarActivity activity,
|
||||||
@Nonnull String tag,
|
@Nonnull String tag,
|
||||||
@Nonnull Class<? extends Fragment> fragmentClass,
|
@Nonnull Class<? extends Fragment> fragmentClass,
|
||||||
@Nullable Bundle fragmentArgs,
|
@Nullable Bundle fragmentArgs,
|
||||||
@ -214,11 +213,11 @@ public class ActivityUi extends BaseUi {
|
|||||||
actionBar.addTab(tab);
|
actionBar.addTab(tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTab(@Nonnull SherlockFragmentActivity activity, @Nonnull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) {
|
public void addTab(@Nonnull ActionBarActivity activity, @Nonnull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) {
|
||||||
addTab(activity, fragmentType.getFragmentTag(), fragmentType.getFragmentClass(), fragmentArgs, fragmentType.getDefaultTitleResId(), parentViewId);
|
addTab(activity, fragmentType.getFragmentTag(), fragmentType.getFragmentClass(), fragmentArgs, fragmentType.getDefaultTitleResId(), parentViewId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFragment(@Nonnull SherlockFragmentActivity activity, @Nonnull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) {
|
public void setFragment(@Nonnull ActionBarActivity activity, @Nonnull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) {
|
||||||
final FragmentManager fm = activity.getSupportFragmentManager();
|
final FragmentManager fm = activity.getSupportFragmentManager();
|
||||||
|
|
||||||
Fragment fragment = fm.findFragmentByTag(fragmentType.getFragmentTag());
|
Fragment fragment = fm.findFragmentByTag(fragmentType.getFragmentTag());
|
||||||
@ -237,7 +236,7 @@ public class ActivityUi extends BaseUi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectTab(@Nonnull SherlockFragmentActivity activity, @Nonnull CalculatorFragmentType fragmentType) {
|
public void selectTab(@Nonnull ActionBarActivity activity, @Nonnull CalculatorFragmentType fragmentType) {
|
||||||
final ActionBar actionBar = activity.getSupportActionBar();
|
final ActionBar actionBar = activity.getSupportActionBar();
|
||||||
for (int i = 0; i < actionBar.getTabCount(); i++) {
|
for (int i = 0; i < actionBar.getTabCount(); i++) {
|
||||||
final ActionBar.Tab tab = actionBar.getTabAt(i);
|
final ActionBar.Tab tab = actionBar.getTabAt(i);
|
||||||
@ -262,7 +261,7 @@ public class ActivityUi extends BaseUi {
|
|||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onResume(@Nonnull SherlockFragmentActivity activity) {
|
public void onResume(@Nonnull ActionBarActivity activity) {
|
||||||
onResume((Activity) activity);
|
onResume((Activity) activity);
|
||||||
|
|
||||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||||
|
@ -2,11 +2,11 @@ package org.solovyev.android.calculator;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.LayoutRes;
|
import android.support.annotation.LayoutRes;
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class BaseActivity extends SherlockFragmentActivity {
|
public class BaseActivity extends ActionBarActivity {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
protected final ActivityUi ui;
|
protected final ActivityUi ui;
|
||||||
|
@ -36,8 +36,8 @@ import android.util.Log;
|
|||||||
import android.view.*;
|
import android.view.*;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import com.actionbarsherlock.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import org.solovyev.android.Activities;
|
import org.solovyev.android.Activities;
|
||||||
import org.solovyev.android.Android;
|
import org.solovyev.android.Android;
|
||||||
import org.solovyev.android.Threads;
|
import org.solovyev.android.Threads;
|
||||||
@ -62,7 +62,7 @@ import static org.solovyev.android.calculator.Preferences.Gui.preventScreenFromF
|
|||||||
import static org.solovyev.android.wizard.WizardUi.continueWizard;
|
import static org.solovyev.android.wizard.WizardUi.continueWizard;
|
||||||
import static org.solovyev.android.wizard.WizardUi.startWizard;
|
import static org.solovyev.android.wizard.WizardUi.startWizard;
|
||||||
|
|
||||||
public class CalculatorActivity extends SherlockFragmentActivity implements SharedPreferences.OnSharedPreferenceChangeListener, CalculatorEventListener {
|
public class CalculatorActivity extends ActionBarActivity implements SharedPreferences.OnSharedPreferenceChangeListener, CalculatorEventListener {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static final String TAG = CalculatorActivity.class.getSimpleName();
|
public static final String TAG = CalculatorActivity.class.getSimpleName();
|
||||||
@ -77,6 +77,8 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|
||||||
final Preferences.Gui.Layout layout = Preferences.Gui.layout.getPreferenceNoError(preferences);
|
final Preferences.Gui.Layout layout = Preferences.Gui.layout.getPreferenceNoError(preferences);
|
||||||
@ -85,9 +87,6 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
|
|||||||
activityUi.logDebug("onCreate");
|
activityUi.logDebug("onCreate");
|
||||||
activityUi.onCreate(this);
|
activityUi.onCreate(this);
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
activityUi.logDebug("super.onCreate");
|
|
||||||
|
|
||||||
if (isMultiPane()) {
|
if (isMultiPane()) {
|
||||||
activityUi.addTab(this, CalculatorFragmentType.history, null, R.id.main_second_pane);
|
activityUi.addTab(this, CalculatorFragmentType.history, null, R.id.main_second_pane);
|
||||||
activityUi.addTab(this, CalculatorFragmentType.saved_history, null, R.id.main_second_pane);
|
activityUi.addTab(this, CalculatorFragmentType.saved_history, null, R.id.main_second_pane);
|
||||||
|
@ -32,7 +32,7 @@ import android.preference.PreferenceManager;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import jscl.math.Generic;
|
import jscl.math.Generic;
|
||||||
import org.solovyev.android.Android;
|
import org.solovyev.android.Android;
|
||||||
import org.solovyev.android.calculator.about.CalculatorAboutActivity;
|
import org.solovyev.android.calculator.about.CalculatorAboutActivity;
|
||||||
@ -129,8 +129,8 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
|||||||
final String varValue = viewState.getText();
|
final String varValue = viewState.getText();
|
||||||
if (!Strings.isEmpty(varValue)) {
|
if (!Strings.isEmpty(varValue)) {
|
||||||
if (CalculatorVarsFragment.isValidValue(varValue)) {
|
if (CalculatorVarsFragment.isValidValue(varValue)) {
|
||||||
if (context instanceof SherlockFragmentActivity) {
|
if (context instanceof ActionBarActivity) {
|
||||||
VarEditDialogFragment.showDialog(VarEditDialogFragment.Input.newFromValue(varValue), ((SherlockFragmentActivity) context).getSupportFragmentManager());
|
VarEditDialogFragment.showDialog(VarEditDialogFragment.Input.newFromValue(varValue), ((ActionBarActivity) context).getSupportFragmentManager());
|
||||||
} else {
|
} else {
|
||||||
final Intent intent = new Intent(context, CalculatorVarsActivity.class);
|
final Intent intent = new Intent(context, CalculatorVarsActivity.class);
|
||||||
intent.putExtra(CalculatorVarsFragment.CREATE_VAR_EXTRA_STRING, varValue);
|
intent.putExtra(CalculatorVarsFragment.CREATE_VAR_EXTRA_STRING, varValue);
|
||||||
|
@ -31,7 +31,7 @@ import android.view.View;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -46,7 +46,7 @@ import org.solovyev.common.text.Strings;
|
|||||||
* Date: 1/20/13
|
* Date: 1/20/13
|
||||||
* Time: 12:50 PM
|
* Time: 12:50 PM
|
||||||
*/
|
*/
|
||||||
public class CalculatorDialogActivity extends SherlockFragmentActivity {
|
public class CalculatorDialogActivity extends ActionBarActivity {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private static final String TAG = CalculatorDialogActivity.class.getSimpleName();
|
private static final String TAG = CalculatorDialogActivity.class.getSimpleName();
|
||||||
|
@ -29,7 +29,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ import javax.annotation.Nonnull;
|
|||||||
* Date: 25.09.12
|
* Date: 25.09.12
|
||||||
* Time: 12:03
|
* Time: 12:03
|
||||||
*/
|
*/
|
||||||
public class CalculatorDisplayFragment extends SherlockFragment {
|
public class CalculatorDisplayFragment extends Fragment {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private FragmentUi fragmentHelper;
|
private FragmentUi fragmentHelper;
|
||||||
|
@ -30,29 +30,29 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragment;
|
import android.support.v4.app.Fragment;
|
||||||
import com.actionbarsherlock.view.Menu;
|
import android.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import org.solovyev.android.menu.ActivityMenu;
|
import org.solovyev.android.menu.ActivityMenu;
|
||||||
import org.solovyev.android.menu.ListActivityMenu;
|
import org.solovyev.android.menu.ListActivityMenu;
|
||||||
import org.solovyev.android.sherlock.menu.SherlockMenuHelper;
|
import org.solovyev.android.menu.AndroidMenuHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: Solovyev_S
|
* User: Solovyev_S
|
||||||
* Date: 25.09.12
|
* Date: 25.09.12
|
||||||
* Time: 10:49
|
* Time: 10:49
|
||||||
*/
|
*/
|
||||||
public class CalculatorEditorFragment extends SherlockFragment {
|
public class CalculatorEditorFragment extends Fragment {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private FragmentUi fragmentHelper;
|
private FragmentUi fragmentHelper;
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private ActivityMenu<Menu, MenuItem> menu = ListActivityMenu.fromEnum(CalculatorMenu.class, SherlockMenuHelper.getInstance());
|
private ActivityMenu<Menu, MenuItem> menu = ListActivityMenu.fromEnum(CalculatorMenu.class, AndroidMenuHelper.getInstance());
|
||||||
|
|
||||||
public CalculatorEditorFragment() {
|
public CalculatorEditorFragment() {
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ import javax.annotation.Nonnull;
|
|||||||
* Date: 03.10.12
|
* Date: 03.10.12
|
||||||
* Time: 14:18
|
* Time: 14:18
|
||||||
*/
|
*/
|
||||||
public abstract class CalculatorFragment extends SherlockFragment {
|
public abstract class CalculatorFragment extends Fragment {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private final FragmentUi fragmentHelper;
|
private final FragmentUi fragmentHelper;
|
||||||
|
@ -28,7 +28,7 @@ import android.preference.PreferenceManager;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import com.actionbarsherlock.app.SherlockFragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -44,7 +44,7 @@ import static org.solovyev.android.calculator.model.AndroidCalculatorEngine.Pref
|
|||||||
* Date: 25.09.12
|
* Date: 25.09.12
|
||||||
* Time: 12:25
|
* Time: 12:25
|
||||||
*/
|
*/
|
||||||
public class CalculatorKeyboardFragment extends SherlockFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public class CalculatorKeyboardFragment extends Fragment implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private Preferences.Gui.Theme theme;
|
private Preferences.Gui.Theme theme;
|
||||||
|
@ -28,7 +28,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockListFragment;
|
import android.support.v4.app.ListFragment;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ import javax.annotation.Nonnull;
|
|||||||
* Date: 03.10.12
|
* Date: 03.10.12
|
||||||
* Time: 14:18
|
* Time: 14:18
|
||||||
*/
|
*/
|
||||||
public abstract class CalculatorListFragment extends SherlockListFragment {
|
public abstract class CalculatorListFragment extends ListFragment {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private final FragmentUi fragmentHelper;
|
private final FragmentUi fragmentHelper;
|
||||||
|
@ -26,7 +26,7 @@ import android.app.Activity;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
@ -29,21 +29,17 @@ import android.os.Bundle;
|
|||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockActivity;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import org.solovyev.android.calculator.R;
|
|
||||||
import org.solovyev.common.msg.Message;
|
import org.solovyev.common.msg.Message;
|
||||||
import org.solovyev.common.text.Strings;
|
import org.solovyev.common.text.Strings;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -53,7 +49,7 @@ import java.util.List;
|
|||||||
* Date: 11/17/12
|
* Date: 11/17/12
|
||||||
* Time: 3:37 PM
|
* Time: 3:37 PM
|
||||||
*/
|
*/
|
||||||
public class FixableMessagesDialog extends SherlockActivity {
|
public class FixableMessagesDialog extends ActionBarActivity {
|
||||||
|
|
||||||
private static final String INPUT = "input";
|
private static final String INPUT = "input";
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
|
||||||
import jscl.math.Generic;
|
import jscl.math.Generic;
|
||||||
import jscl.math.function.Constant;
|
import jscl.math.function.Constant;
|
||||||
@ -189,8 +189,8 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public static void showDialog(@Nonnull Input input, @Nonnull Context context) {
|
public static void showDialog(@Nonnull Input input, @Nonnull Context context) {
|
||||||
if (context instanceof SherlockFragmentActivity) {
|
if (context instanceof ActionBarActivity) {
|
||||||
FunctionEditDialogFragment.showDialog(input, ((SherlockFragmentActivity) context).getSupportFragmentManager());
|
FunctionEditDialogFragment.showDialog(input, ((ActionBarActivity) context).getSupportFragmentManager());
|
||||||
} else {
|
} else {
|
||||||
final Intent intent = new Intent(context, CalculatorFunctionsActivity.class);
|
final Intent intent = new Intent(context, CalculatorFunctionsActivity.class);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
@ -35,16 +35,16 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import com.actionbarsherlock.app.SherlockListFragment;
|
import android.support.v4.app.ListFragment;
|
||||||
import com.actionbarsherlock.view.Menu;
|
import android.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import com.melnykov.fab.FloatingActionButton;
|
import com.melnykov.fab.FloatingActionButton;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.calculator.jscl.JsclOperation;
|
import org.solovyev.android.calculator.jscl.JsclOperation;
|
||||||
import org.solovyev.android.menu.*;
|
import org.solovyev.android.menu.*;
|
||||||
import org.solovyev.android.sherlock.menu.SherlockMenuHelper;
|
import org.solovyev.android.menu.AndroidMenuHelper;
|
||||||
import org.solovyev.common.JPredicate;
|
import org.solovyev.common.JPredicate;
|
||||||
import org.solovyev.common.collections.Collections;
|
import org.solovyev.common.collections.Collections;
|
||||||
import org.solovyev.common.equals.Equalizer;
|
import org.solovyev.common.equals.Equalizer;
|
||||||
@ -60,7 +60,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static org.solovyev.android.calculator.CalculatorEventType.clear_history_requested;
|
import static org.solovyev.android.calculator.CalculatorEventType.clear_history_requested;
|
||||||
|
|
||||||
public abstract class BaseHistoryFragment extends SherlockListFragment implements CalculatorEventListener {
|
public abstract class BaseHistoryFragment extends ListFragment implements CalculatorEventListener {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
@ -103,7 +103,7 @@ public abstract class BaseHistoryFragment extends SherlockListFragment implement
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
private FragmentUi fragmentHelper;
|
private FragmentUi fragmentHelper;
|
||||||
|
|
||||||
private final ActivityMenu<Menu, MenuItem> menu = ListActivityMenu.fromResource(R.menu.history_menu, HistoryMenu.class, SherlockMenuHelper.getInstance(), new HistoryMenuFilter());
|
private final ActivityMenu<Menu, MenuItem> menu = ListActivityMenu.fromResource(R.menu.history_menu, HistoryMenu.class, AndroidMenuHelper.getInstance(), new HistoryMenuFilter());
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private final SharedPreferences.OnSharedPreferenceChangeListener preferencesListener = new HistoryOnPreferenceChangeListener();
|
private final SharedPreferences.OnSharedPreferenceChangeListener preferencesListener = new HistoryOnPreferenceChangeListener();
|
||||||
|
@ -58,7 +58,7 @@ import org.solovyev.common.filter.Filter;
|
|||||||
import org.solovyev.common.math.MathEntity;
|
import org.solovyev.common.math.MathEntity;
|
||||||
import org.solovyev.common.text.Strings;
|
import org.solovyev.common.text.Strings;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockListFragment;
|
import android.support.v4.app.ListFragment;
|
||||||
|
|
||||||
import static org.solovyev.android.calculator.CalculatorEventType.show_wiki_description;
|
import static org.solovyev.android.calculator.CalculatorEventType.show_wiki_description;
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ import static org.solovyev.android.calculator.CalculatorEventType.show_wiki_desc
|
|||||||
* Date: 12/21/11
|
* Date: 12/21/11
|
||||||
* Time: 9:24 PM
|
* Time: 9:24 PM
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractMathEntityListFragment<T extends MathEntity> extends SherlockListFragment implements CalculatorEventListener {
|
public abstract class AbstractMathEntityListFragment<T extends MathEntity> extends ListFragment implements CalculatorEventListener {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
@ -28,10 +28,10 @@ import android.os.Bundle;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.text.ClipboardManager;
|
import android.text.ClipboardManager;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import com.actionbarsherlock.view.Menu;
|
import android.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import jscl.math.function.Function;
|
import jscl.math.function.Function;
|
||||||
import jscl.math.function.IFunction;
|
import jscl.math.function.IFunction;
|
||||||
@ -251,7 +251,7 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment<
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(@Nonnull Function function, @Nonnull Context context) {
|
public void onClick(@Nonnull Function function, @Nonnull Context context) {
|
||||||
if (function instanceof IFunction) {
|
if (function instanceof IFunction) {
|
||||||
FunctionEditDialogFragment.showDialog(FunctionEditDialogFragment.Input.newFromFunction((IFunction) function), ((SherlockFragmentActivity) context).getSupportFragmentManager());
|
FunctionEditDialogFragment.showDialog(FunctionEditDialogFragment.Input.newFromFunction((IFunction) function), ((ActionBarActivity) context).getSupportFragmentManager());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -25,10 +25,10 @@ package org.solovyev.android.calculator.math.edit;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import com.actionbarsherlock.view.Menu;
|
import android.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import jscl.math.function.IConstant;
|
import jscl.math.function.IConstant;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.calculator.math.MathType;
|
import org.solovyev.android.calculator.math.MathType;
|
||||||
@ -249,7 +249,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
|
|||||||
edit(R.string.c_edit) {
|
edit(R.string.c_edit) {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(@Nonnull IConstant constant, @Nonnull Context context) {
|
public void onClick(@Nonnull IConstant constant, @Nonnull Context context) {
|
||||||
VarEditDialogFragment.showDialog(VarEditDialogFragment.Input.newFromConstant(constant), ((SherlockFragmentActivity) context).getSupportFragmentManager());
|
VarEditDialogFragment.showDialog(VarEditDialogFragment.Input.newFromConstant(constant), ((ActionBarActivity) context).getSupportFragmentManager());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ import org.solovyev.android.calculator.EmptyActivity;
|
|||||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
|
|
||||||
import static com.actionbarsherlock.app.ActionBar.NAVIGATION_MODE_STANDARD;
|
import static android.support.v7.app.ActionBar.NAVIGATION_MODE_STANDARD;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: Solovyev_S
|
* User: Solovyev_S
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
package org.solovyev.android.calculator.plot;
|
package org.solovyev.android.calculator.plot;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -32,27 +33,21 @@ import android.os.Bundle;
|
|||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
|
||||||
import com.actionbarsherlock.view.Menu;
|
|
||||||
import com.actionbarsherlock.view.MenuInflater;
|
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
|
||||||
|
|
||||||
import org.solovyev.android.Android;
|
import org.solovyev.android.Android;
|
||||||
import org.solovyev.android.Threads;
|
import org.solovyev.android.Threads;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.menu.AMenuItem;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.menu.ActivityMenu;
|
import org.solovyev.android.menu.*;
|
||||||
import org.solovyev.android.menu.IdentifiableMenuItem;
|
|
||||||
import org.solovyev.android.menu.ListActivityMenu;
|
|
||||||
import org.solovyev.android.sherlock.menu.SherlockMenuHelper;
|
|
||||||
import org.solovyev.common.JPredicate;
|
import org.solovyev.common.JPredicate;
|
||||||
import org.solovyev.common.msg.MessageType;
|
import org.solovyev.common.msg.MessageType;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -140,7 +135,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
PreferenceManager.getDefaultSharedPreferences(this.getActivity()).registerOnSharedPreferenceChangeListener(this);
|
PreferenceManager.getDefaultSharedPreferences(this.getActivity()).registerOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
plotData = Locator.getInstance().getPlotter().getPlotData();
|
plotData = Locator.getInstance().getPlotter().getPlotData();
|
||||||
updateChart(plotData, getSherlockActivity());
|
updateChart(plotData, getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -155,7 +150,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
if (Preferences.angleUnit.getKey().equals(key)) {
|
if (Preferences.angleUnit.getKey().equals(key)) {
|
||||||
updateChart(this.plotData, getSherlockActivity());
|
updateChart(this.plotData, getActivity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,11 +171,11 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
private void onNewPlotData(@Nonnull final PlotData plotData) {
|
private void onNewPlotData(@Nonnull final PlotData plotData) {
|
||||||
this.plotData = plotData;
|
this.plotData = plotData;
|
||||||
|
|
||||||
final SherlockFragmentActivity activity = getSherlockActivity();
|
updateChart(plotData, getActivity());
|
||||||
updateChart(plotData, activity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateChart(@Nonnull final PlotData plotData, @Nullable final SherlockFragmentActivity activity) {
|
private void updateChart(@Nonnull final PlotData plotData, @Nullable final Activity activity) {
|
||||||
|
if (!(activity instanceof ActionBarActivity)) throw new AssertionError();
|
||||||
Threads.tryRunOnUiThread(activity, new Runnable() {
|
Threads.tryRunOnUiThread(activity, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -191,8 +186,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
createGraphicalView(view, plotData);
|
createGraphicalView(view, plotData);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activity == null) throw new AssertionError();
|
((ActionBarActivity) activity).supportInvalidateOptionsMenu();
|
||||||
activity.invalidateOptionsMenu();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -320,7 +314,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
final boolean plot2dVisible = plotData.isPlot3d() && Locator.getInstance().getPlotter().is2dPlotPossible();
|
final boolean plot2dVisible = plotData.isPlot3d() && Locator.getInstance().getPlotter().is2dPlotPossible();
|
||||||
final boolean captureScreenshotVisible = isScreenshotSupported();
|
final boolean captureScreenshotVisible = isScreenshotSupported();
|
||||||
final boolean fullscreenVisible = isPaneFragment();
|
final boolean fullscreenVisible = isPaneFragment();
|
||||||
fragmentMenu = ListActivityMenu.fromResource(R.menu.plot_menu, menuItems, SherlockMenuHelper.getInstance(), new JPredicate<AMenuItem<MenuItem>>() {
|
fragmentMenu = ListActivityMenu.fromResource(R.menu.plot_menu, menuItems, AndroidMenuHelper.getInstance(), new JPredicate<AMenuItem<MenuItem>>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(@Nullable AMenuItem<MenuItem> menuItem) {
|
public boolean apply(@Nullable AMenuItem<MenuItem> menuItem) {
|
||||||
if (menuItem == plot3dMenuItem) {
|
if (menuItem == plot3dMenuItem) {
|
||||||
|
@ -32,7 +32,7 @@ import org.solovyev.android.calculator.R;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static com.actionbarsherlock.app.ActionBar.NAVIGATION_MODE_STANDARD;
|
import static android.support.v7.app.ActionBar.NAVIGATION_MODE_STANDARD;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
|
@ -33,7 +33,7 @@ import android.widget.Button;
|
|||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -44,7 +44,7 @@ import org.solovyev.android.calculator.Locator;
|
|||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.fragments.FragmentUtils;
|
import org.solovyev.android.fragments.FragmentUtils;
|
||||||
|
|
||||||
public class CalculatorPlotFunctionSettingsActivity extends SherlockFragmentActivity {
|
public class CalculatorPlotFunctionSettingsActivity extends ActionBarActivity {
|
||||||
|
|
||||||
private static final String INPUT_FUNCTION_ID = "plot-function-id";
|
private static final String INPUT_FUNCTION_ID = "plot-function-id";
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
package org.solovyev.android.calculator.plot;
|
package org.solovyev.android.calculator.plot;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
@ -41,7 +41,7 @@ import java.util.List;
|
|||||||
* Date: 1/13/13
|
* Date: 1/13/13
|
||||||
* Time: 5:05 PM
|
* Time: 5:05 PM
|
||||||
*/
|
*/
|
||||||
public class CalculatorPlotFunctionsActivity extends SherlockFragmentActivity {
|
public class CalculatorPlotFunctionsActivity extends ActionBarActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
@ -26,7 +26,7 @@ import android.os.Bundle;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -43,7 +43,7 @@ import org.solovyev.common.msg.MessageType;
|
|||||||
* Date: 1/19/13
|
* Date: 1/19/13
|
||||||
* Time: 5:14 PM
|
* Time: 5:14 PM
|
||||||
*/
|
*/
|
||||||
public class CalculatorPlotRangeActivity extends SherlockFragmentActivity {
|
public class CalculatorPlotRangeActivity extends ActionBarActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
@ -2,8 +2,8 @@ package org.solovyev.android.calculator.preferences;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceActivity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import com.actionbarsherlock.app.SherlockPreferenceActivity;
|
|
||||||
import org.solovyev.android.calculator.ActivityUi;
|
import org.solovyev.android.calculator.ActivityUi;
|
||||||
import org.solovyev.android.calculator.AdView;
|
import org.solovyev.android.calculator.AdView;
|
||||||
import org.solovyev.android.calculator.App;
|
import org.solovyev.android.calculator.App;
|
||||||
@ -15,7 +15,7 @@ import org.solovyev.android.checkout.ProductTypes;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public abstract class BasePreferencesActivity extends SherlockPreferenceActivity {
|
public abstract class BasePreferencesActivity extends PreferenceActivity {
|
||||||
|
|
||||||
private final ActivityCheckout checkout = Checkout.forActivity(this, App.getBilling(), App.getProducts());
|
private final ActivityCheckout checkout = Checkout.forActivity(this, App.getBilling(), App.getProducts());
|
||||||
private Inventory inventory;
|
private Inventory inventory;
|
||||||
|
@ -28,7 +28,7 @@ import android.os.Bundle;
|
|||||||
import android.text.method.ScrollingMovementMethod;
|
import android.text.method.ScrollingMovementMethod;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.checkout.*;
|
import org.solovyev.android.checkout.*;
|
||||||
import org.solovyev.android.fragments.FragmentUtils;
|
import org.solovyev.android.fragments.FragmentUtils;
|
||||||
@ -41,7 +41,7 @@ import javax.annotation.Nullable;
|
|||||||
* Date: 1/20/13
|
* Date: 1/20/13
|
||||||
* Time: 2:36 PM
|
* Time: 2:36 PM
|
||||||
*/
|
*/
|
||||||
public class PurchaseDialogActivity extends SherlockFragmentActivity {
|
public class PurchaseDialogActivity extends ActionBarActivity {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private final ActivityCheckout checkout = Checkout.forActivity(this, App.getBilling(), App.getProducts());
|
private final ActivityCheckout checkout = Checkout.forActivity(this, App.getBilling(), App.getProducts());
|
||||||
|
@ -27,14 +27,11 @@ import android.support.v4.app.Fragment;
|
|||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import org.solovyev.common.collections.Collections;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.solovyev.common.collections.Collections;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,27 +72,27 @@ public class FragmentUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeFragments(@Nonnull SherlockFragmentActivity activity, @Nonnull String... fragmentTags) {
|
public static void removeFragments(@Nonnull ActionBarActivity activity, @Nonnull String... fragmentTags) {
|
||||||
removeFragments(activity, Collections.asList(fragmentTags));
|
removeFragments(activity, Collections.asList(fragmentTags));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeFragments(@Nonnull SherlockFragmentActivity activity, @Nonnull List<String> fragmentTags) {
|
public static void removeFragments(@Nonnull ActionBarActivity activity, @Nonnull List<String> fragmentTags) {
|
||||||
for (String fragmentTag : fragmentTags) {
|
for (String fragmentTag : fragmentTags) {
|
||||||
removeFragment(activity, fragmentTag);
|
removeFragment(activity, fragmentTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void detachFragments(@Nonnull SherlockFragmentActivity activity, @Nonnull String... fragmentTags) {
|
public static void detachFragments(@Nonnull ActionBarActivity activity, @Nonnull String... fragmentTags) {
|
||||||
detachFragments(activity, Collections.asList(fragmentTags));
|
detachFragments(activity, Collections.asList(fragmentTags));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void detachFragments(@Nonnull SherlockFragmentActivity activity, @Nonnull List<String> fragmentTags) {
|
public static void detachFragments(@Nonnull ActionBarActivity activity, @Nonnull List<String> fragmentTags) {
|
||||||
for (String fragmentTag : fragmentTags) {
|
for (String fragmentTag : fragmentTags) {
|
||||||
detachFragment(activity, fragmentTag);
|
detachFragment(activity, fragmentTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void detachFragment(@Nonnull SherlockFragmentActivity activity, @Nonnull String fragmentTag) {
|
public static void detachFragment(@Nonnull ActionBarActivity activity, @Nonnull String fragmentTag) {
|
||||||
final Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag(fragmentTag);
|
final Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag(fragmentTag);
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
if (!fragment.isDetached()) {
|
if (!fragment.isDetached()) {
|
||||||
@ -106,7 +103,7 @@ public class FragmentUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeFragment(@Nonnull SherlockFragmentActivity activity, @Nonnull String fragmentTag) {
|
public static void removeFragment(@Nonnull ActionBarActivity activity, @Nonnull String fragmentTag) {
|
||||||
final Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag(fragmentTag);
|
final Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag(fragmentTag);
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
if (fragment.isAdded()) {
|
if (fragment.isAdded()) {
|
||||||
|
@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 serso aka se.solovyev
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
* Contact details
|
||||||
|
*
|
||||||
|
* Email: se.solovyev@gmail.com
|
||||||
|
* Site: http://se.solovyev.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.solovyev.android.sherlock;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: serso
|
||||||
|
* Date: 8/13/12
|
||||||
|
* Time: 2:04 AM
|
||||||
|
*/
|
||||||
|
public final class AndroidSherlockUtils {
|
||||||
|
|
||||||
|
private AndroidSherlockUtils() {
|
||||||
|
throw new AssertionError("Not intended for instantiation!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
public static ActionBar getSupportActionBar(@Nonnull Activity activity) {
|
||||||
|
if (activity instanceof ActionBarActivity) {
|
||||||
|
return ((ActionBarActivity) activity).getSupportActionBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new IllegalArgumentException(activity.getClass() + " is not supported!");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ActionBar getSupportActionBar(@Nonnull Fragment fragment) {
|
||||||
|
return ((ActionBarActivity) fragment.getActivity()).getSupportActionBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
public static MenuInflater getSupportMenuInflater(@Nonnull Activity activity) {
|
||||||
|
return activity.getMenuInflater();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showDialog(@Nonnull DialogFragment dialogFragment,
|
||||||
|
@Nonnull String fragmentTag,
|
||||||
|
@Nonnull FragmentManager fm) {
|
||||||
|
final FragmentTransaction ft = fm.beginTransaction();
|
||||||
|
|
||||||
|
Fragment prev = fm.findFragmentByTag(fragmentTag);
|
||||||
|
if (prev != null) {
|
||||||
|
ft.remove(prev);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create and show the dialog.
|
||||||
|
dialogFragment.show(ft, fragmentTag);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 serso aka se.solovyev
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
* Contact details
|
||||||
|
*
|
||||||
|
* Email: se.solovyev@gmail.com
|
||||||
|
* Site: http://se.solovyev.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.solovyev.android.sherlock;
|
||||||
|
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: serso
|
||||||
|
* Date: 8/7/12
|
||||||
|
* Time: 11:57 AM
|
||||||
|
*/
|
||||||
|
public interface FragmentItem {
|
||||||
|
|
||||||
|
public void onSelected(@Nonnull FragmentTransaction ft);
|
||||||
|
|
||||||
|
public void onUnselected(@Nonnull FragmentTransaction ft);
|
||||||
|
}
|
@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 serso aka se.solovyev
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
* Contact details
|
||||||
|
*
|
||||||
|
* Email: se.solovyev@gmail.com
|
||||||
|
* Site: http://se.solovyev.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.solovyev.android.sherlock;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: serso
|
||||||
|
* Date: 8/7/12
|
||||||
|
* Time: 11:55 AM
|
||||||
|
*/
|
||||||
|
public class FragmentItemImpl implements FragmentItem {
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private final ActionBarActivity activity;
|
||||||
|
|
||||||
|
// Fragment
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private final String tag;
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private final Class<? extends Fragment> fragmentClass;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private Bundle fragmentArgs;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private Fragment fragment;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private final Integer parentViewId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor used each time a new tab is created.
|
||||||
|
*
|
||||||
|
* @param activity The host Activity, used to instantiate the fragment
|
||||||
|
* @param tag The identifier tag for the fragment
|
||||||
|
* @param fragmentClass The fragment's Class, used to instantiate the fragment
|
||||||
|
* @param fragmentArgs arguments to be passed to fragment
|
||||||
|
* @param parentViewId parent view id
|
||||||
|
*/
|
||||||
|
|
||||||
|
public FragmentItemImpl(@Nonnull ActionBarActivity activity,
|
||||||
|
@Nonnull String tag,
|
||||||
|
@Nonnull Class<? extends Fragment> fragmentClass,
|
||||||
|
@Nullable Bundle fragmentArgs,
|
||||||
|
@Nullable Integer parentViewId) {
|
||||||
|
this.activity = activity;
|
||||||
|
this.tag = tag;
|
||||||
|
this.fragmentClass = fragmentClass;
|
||||||
|
this.fragmentArgs = fragmentArgs;
|
||||||
|
this.parentViewId = parentViewId;
|
||||||
|
|
||||||
|
final FragmentManager supportFragmentManager = activity.getSupportFragmentManager();
|
||||||
|
this.fragment = supportFragmentManager.findFragmentByTag(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelected(@Nonnull FragmentTransaction ft) {
|
||||||
|
if (fragment == null) {
|
||||||
|
fragment = activity.getSupportFragmentManager().findFragmentByTag(this.tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the fragment is already initialized
|
||||||
|
if (fragment == null) {
|
||||||
|
// If not, instantiate and add it to the activity
|
||||||
|
fragment = Fragment.instantiate(activity, fragmentClass.getName(), fragmentArgs);
|
||||||
|
if (parentViewId != null) {
|
||||||
|
ft.add(parentViewId, fragment, tag);
|
||||||
|
} else {
|
||||||
|
ft.add(fragment, tag);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (fragment.isDetached()) {
|
||||||
|
// If it exists, simply attach it in order to show it
|
||||||
|
ft.attach(fragment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUnselected(@Nonnull FragmentTransaction ft) {
|
||||||
|
if (fragment != null) {
|
||||||
|
ft.detach(fragment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package org.solovyev.android.sherlock;
|
||||||
|
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class Fragments extends org.solovyev.android.Fragments {
|
||||||
|
|
||||||
|
private Fragments() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showDialog(@Nonnull DialogFragment dialogFragment,
|
||||||
|
@Nonnull String fragmentTag,
|
||||||
|
@Nonnull FragmentManager fm) {
|
||||||
|
showDialog(dialogFragment, fragmentTag, fm, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showDialog(DialogFragment dialogFragment, String fragmentTag, FragmentManager fm, boolean useExisting) {
|
||||||
|
Fragment prev = fm.findFragmentByTag(fragmentTag);
|
||||||
|
if (prev != null) {
|
||||||
|
if (!useExisting) {
|
||||||
|
final FragmentTransaction ft = fm.beginTransaction();
|
||||||
|
ft.remove(prev);
|
||||||
|
ft.addToBackStack(null);
|
||||||
|
|
||||||
|
// Create and show the dialog.
|
||||||
|
dialogFragment.show(ft, fragmentTag);
|
||||||
|
fm.executePendingTransactions();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final FragmentTransaction ft = fm.beginTransaction();
|
||||||
|
|
||||||
|
ft.addToBackStack(null);
|
||||||
|
|
||||||
|
// Create and show the dialog.
|
||||||
|
dialogFragment.show(ft, fragmentTag);
|
||||||
|
fm.executePendingTransactions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 serso aka se.solovyev
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
* Contact details
|
||||||
|
*
|
||||||
|
* Email: se.solovyev@gmail.com
|
||||||
|
* Site: http://se.solovyev.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.solovyev.android.sherlock.tabs;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
import org.solovyev.android.sherlock.FragmentItem;
|
||||||
|
import org.solovyev.android.sherlock.FragmentItemImpl;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: serso
|
||||||
|
* Date: 8/4/12
|
||||||
|
* Time: 12:42 PM
|
||||||
|
*/
|
||||||
|
public class ActionBarFragmentTabListener implements ActionBar.TabListener {
|
||||||
|
|
||||||
|
private final FragmentItem fragmentItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor used each time a new tab is created.
|
||||||
|
*
|
||||||
|
* @param activity The host Activity, used to instantiate the fragment
|
||||||
|
* @param tag The identifier tag for the fragment
|
||||||
|
* @param fragmentClass The fragment's Class, used to instantiate the fragment
|
||||||
|
* @param fragmentArgs arguments to be passed to fragment
|
||||||
|
* @param parentViewId parent view id
|
||||||
|
*/
|
||||||
|
|
||||||
|
public ActionBarFragmentTabListener(@Nonnull ActionBarActivity activity,
|
||||||
|
@Nonnull String tag,
|
||||||
|
@Nonnull Class<? extends Fragment> fragmentClass,
|
||||||
|
@Nullable Bundle fragmentArgs,
|
||||||
|
@Nullable Integer parentViewId) {
|
||||||
|
this.fragmentItem = new FragmentItemImpl(activity, tag, fragmentClass, fragmentArgs, parentViewId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* The following are each of the ActionBar.TabListener callbacks */
|
||||||
|
|
||||||
|
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
|
||||||
|
this.fragmentItem.onSelected(ft);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
|
||||||
|
this.fragmentItem.onUnselected(ft);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,95 @@
|
|||||||
|
package org.solovyev.android.wizard;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import static android.preference.PreferenceManager.getDefaultSharedPreferences;
|
||||||
|
|
||||||
|
public class BaseWizard implements Wizard {
|
||||||
|
|
||||||
|
static final String FLOW = "flow";
|
||||||
|
static final String FLOW_FINISHED = "flow_finished";
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private final Context context;
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private final WizardFlow flow;
|
||||||
|
|
||||||
|
public BaseWizard(@Nonnull String name,
|
||||||
|
@Nonnull Context context,
|
||||||
|
@Nonnull WizardFlow flow) {
|
||||||
|
this.name = name;
|
||||||
|
this.context = context;
|
||||||
|
this.flow = flow;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveLastStep(@Nonnull WizardStep step) {
|
||||||
|
final SharedPreferences preferences = getPreferences();
|
||||||
|
final SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
|
||||||
|
editor.putString(makeLastStepPreferenceKey(name), step.getName());
|
||||||
|
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveFinished(@Nonnull WizardStep step, boolean forceFinish) {
|
||||||
|
final SharedPreferences preferences = getPreferences();
|
||||||
|
final SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
|
||||||
|
editor.putBoolean(makeFinishedPreferenceKey(name), forceFinish || flow.getNextStep(step) == null);
|
||||||
|
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private SharedPreferences getPreferences() {
|
||||||
|
return getDefaultSharedPreferences(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public String getLastSavedStepName() {
|
||||||
|
return getPreferences().getString(makeLastStepPreferenceKey(name), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return getPreferences().getBoolean(makeFinishedPreferenceKey(name), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isStarted() {
|
||||||
|
return getLastSavedStepName() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
static String makeFinishedPreferenceKey(@Nonnull String flowName) {
|
||||||
|
return FLOW_FINISHED + ":" + flowName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
static String makeLastStepPreferenceKey(@Nonnull String flowName) {
|
||||||
|
return FLOW + ":" + flowName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nonnull
|
||||||
|
public WizardFlow getFlow() {
|
||||||
|
return flow;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package org.solovyev.android.wizard;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public abstract class BaseWizardActivity extends ActionBarActivity implements WizardsAware, FinishWizardConfirmationDialog.Listener {
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private WizardUi ui;
|
||||||
|
|
||||||
|
protected BaseWizardActivity(int layoutResId) {
|
||||||
|
ui = new WizardUi<BaseWizardActivity>(this, this, layoutResId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
ui.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(Bundle out) {
|
||||||
|
super.onSaveInstanceState(out);
|
||||||
|
ui.onSaveInstanceState(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
ui.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
ui.onBackPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishWizardAbruptly() {
|
||||||
|
ui.finishWizardAbruptly();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 serso aka se.solovyev
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
* Contact details
|
||||||
|
*
|
||||||
|
* Email: se.solovyev@gmail.com
|
||||||
|
* Site: http://se.solovyev.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.solovyev.android.wizard;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
import org.solovyev.android.calculator.R;
|
||||||
|
import org.solovyev.android.sherlock.AndroidSherlockUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class FinishWizardConfirmationDialog extends DialogFragment {
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
final AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
|
||||||
|
b.setMessage(R.string.acl_wizard_finish_confirmation);
|
||||||
|
b.setPositiveButton(R.string.acl_yes, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
((Listener) getActivity()).finishWizardAbruptly();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
b.setNegativeButton(R.string.acl_no, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return b.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <A extends FragmentActivity & Listener> void show(@Nonnull A activity) {
|
||||||
|
if (!(activity instanceof Listener)) {
|
||||||
|
throw new IllegalArgumentException("Activity should implement " + Listener.class);
|
||||||
|
}
|
||||||
|
AndroidSherlockUtils.showDialog(new FinishWizardConfirmationDialog(), FinishWizardConfirmationDialog.class.getSimpleName(), activity.getSupportFragmentManager());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface Listener {
|
||||||
|
void finishWizardAbruptly();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 serso aka se.solovyev
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
* Contact details
|
||||||
|
*
|
||||||
|
* Email: se.solovyev@gmail.com
|
||||||
|
* Site: http://se.solovyev.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.solovyev.android.wizard;
|
||||||
|
|
||||||
|
import org.solovyev.common.JPredicate;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.solovyev.common.collections.Collections.find;
|
||||||
|
|
||||||
|
public final class ListWizardFlow implements WizardFlow {
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private final List<WizardStep> steps;
|
||||||
|
|
||||||
|
public ListWizardFlow(@Nonnull List<WizardStep> steps) {
|
||||||
|
this.steps = steps;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public WizardStep getStepByName(@Nonnull final String name) {
|
||||||
|
return find(steps, new JPredicate<WizardStep>() {
|
||||||
|
@Override
|
||||||
|
public boolean apply(@Nullable WizardStep step) {
|
||||||
|
assert step != null;
|
||||||
|
return step.getName().equals(name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public WizardStep getNextStep(@Nonnull WizardStep step) {
|
||||||
|
final int i = steps.indexOf(step);
|
||||||
|
if (i >= 0 && i + 1 < steps.size()) {
|
||||||
|
return steps.get(i + 1);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public WizardStep getPrevStep(@Nonnull WizardStep step) {
|
||||||
|
final int i = steps.indexOf(step);
|
||||||
|
if (i >= 1) {
|
||||||
|
return steps.get(i - 1);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public WizardStep getFirstStep() {
|
||||||
|
return steps.get(0);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package org.solovyev.android.wizard;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public interface Wizard {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
String getLastSavedStepName();
|
||||||
|
|
||||||
|
boolean isFinished();
|
||||||
|
|
||||||
|
boolean isStarted();
|
||||||
|
|
||||||
|
void saveLastStep(@Nonnull WizardStep step);
|
||||||
|
|
||||||
|
void saveFinished(@Nonnull WizardStep step, boolean forceFinish);
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
WizardFlow getFlow();
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
String getName();
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 serso aka se.solovyev
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
* Contact details
|
||||||
|
*
|
||||||
|
* Email: se.solovyev@gmail.com
|
||||||
|
* Site: http://se.solovyev.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.solovyev.android.wizard;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public interface WizardFlow {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
WizardStep getStepByName(@Nonnull String name);
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
WizardStep getNextStep(@Nonnull WizardStep step);
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
WizardStep getPrevStep(@Nonnull WizardStep step);
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
WizardStep getFirstStep();
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package org.solovyev.android.wizard;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public interface WizardStep {
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
String getFragmentTag();
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
Class<? extends Fragment> getFragmentClass();
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
Bundle getFragmentArgs();
|
||||||
|
|
||||||
|
int getTitleResId();
|
||||||
|
|
||||||
|
int getNextButtonTitleResId();
|
||||||
|
|
||||||
|
boolean onNext(@Nonnull Fragment fragment);
|
||||||
|
|
||||||
|
boolean onPrev(@Nonnull Fragment fragment);
|
||||||
|
|
||||||
|
boolean isVisible();
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
String getName();
|
||||||
|
}
|
@ -0,0 +1,333 @@
|
|||||||
|
package org.solovyev.android.wizard;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import org.solovyev.android.calculator.R;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import static android.view.View.GONE;
|
||||||
|
import static android.view.View.VISIBLE;
|
||||||
|
|
||||||
|
public class WizardUi<A extends FragmentActivity & FinishWizardConfirmationDialog.Listener> {
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
*
|
||||||
|
* CONSTANTS
|
||||||
|
*
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
private static final String FLOW = "flow";
|
||||||
|
private static final String STEP = "step";
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
*
|
||||||
|
* FIELDS
|
||||||
|
*
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
private WizardStep step;
|
||||||
|
|
||||||
|
private Wizard wizard;
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
*
|
||||||
|
* VIEWS
|
||||||
|
*
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private View prevButton;
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private Button nextButton;
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private final A activity;
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private final WizardsAware wizardsAware;
|
||||||
|
|
||||||
|
private final int layoutResId;
|
||||||
|
|
||||||
|
public WizardUi(@Nonnull A activity, @Nonnull WizardsAware wizardsAware, int layoutResId) {
|
||||||
|
this.activity = activity;
|
||||||
|
this.wizardsAware = wizardsAware;
|
||||||
|
this.layoutResId = layoutResId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
*
|
||||||
|
* LIFECYCLE
|
||||||
|
*
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
activity.setContentView(layoutResId);
|
||||||
|
|
||||||
|
prevButton = activity.findViewById(R.id.acl_wizard_prev_button);
|
||||||
|
nextButton = (Button) activity.findViewById(R.id.acl_wizard_next_button);
|
||||||
|
|
||||||
|
String wizardName = activity.getIntent().getStringExtra(FLOW);
|
||||||
|
String stepName = activity.getIntent().getStringExtra(STEP);
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
wizardName = savedInstanceState.getString(FLOW);
|
||||||
|
stepName = savedInstanceState.getString(STEP);
|
||||||
|
}
|
||||||
|
|
||||||
|
wizard = wizardsAware.getWizards().getWizard(wizardName);
|
||||||
|
|
||||||
|
WizardStep step = null;
|
||||||
|
if (stepName != null) {
|
||||||
|
step = wizard.getFlow().getStepByName(stepName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step == null) {
|
||||||
|
step = wizard.getFlow().getFirstStep();
|
||||||
|
}
|
||||||
|
|
||||||
|
setStep(step);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setStep(@Nonnull WizardStep step) {
|
||||||
|
if (this.step == null || !this.step.equals(step)) {
|
||||||
|
hideFragment();
|
||||||
|
this.step = step;
|
||||||
|
showFragment();
|
||||||
|
|
||||||
|
initTitle();
|
||||||
|
initNextButton();
|
||||||
|
initPrevButton();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initTitle() {
|
||||||
|
activity.setTitle(step.getTitleResId());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initPrevButton() {
|
||||||
|
if (prevButton != null) {
|
||||||
|
final WizardStep prevStep = wizard.getFlow().getPrevStep(step);
|
||||||
|
if (prevStep == null) {
|
||||||
|
prevButton.setVisibility(GONE);
|
||||||
|
prevButton.setOnClickListener(null);
|
||||||
|
} else {
|
||||||
|
prevButton.setVisibility(VISIBLE);
|
||||||
|
prevButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (tryGoPrev()) {
|
||||||
|
setStep(prevStep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initNextButton() {
|
||||||
|
final WizardStep nextStep = wizard.getFlow().getNextStep(step);
|
||||||
|
if (nextStep == null) {
|
||||||
|
nextButton.setText(R.string.acl_wizard_finish);
|
||||||
|
nextButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (tryGoNext()) {
|
||||||
|
finishWizard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
nextButton.setText(step.getNextButtonTitleResId());
|
||||||
|
nextButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (tryGoNext()) {
|
||||||
|
setStep(nextStep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishWizardAbruptly() {
|
||||||
|
finishWizard(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishWizard() {
|
||||||
|
finishWizard(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void finishWizard(boolean forceFinish) {
|
||||||
|
if (wizard != null && step != null) {
|
||||||
|
wizard.saveFinished(step, forceFinish);
|
||||||
|
}
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean tryGoPrev() {
|
||||||
|
if (step == null) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
final Fragment fragment = getFragmentManager().findFragmentByTag(step.getFragmentTag());
|
||||||
|
return fragment == null || step.onPrev(fragment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private FragmentManager getFragmentManager() {
|
||||||
|
return activity.getSupportFragmentManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean tryGoNext() {
|
||||||
|
if (step == null) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
final Fragment fragment = getFragmentManager().findFragmentByTag(step.getFragmentTag());
|
||||||
|
return fragment == null || step.onNext(fragment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private Fragment showFragment() {
|
||||||
|
final FragmentManager fm = getFragmentManager();
|
||||||
|
final FragmentTransaction ft = fm.beginTransaction();
|
||||||
|
|
||||||
|
Fragment newFragment = fm.findFragmentByTag(step.getFragmentTag());
|
||||||
|
|
||||||
|
if (newFragment == null) {
|
||||||
|
newFragment = Fragment.instantiate(activity, step.getFragmentClass().getName(), step.getFragmentArgs());
|
||||||
|
ft.add(R.id.acl_wizard_content, newFragment, step.getFragmentTag());
|
||||||
|
}
|
||||||
|
|
||||||
|
ft.commit();
|
||||||
|
fm.executePendingTransactions();
|
||||||
|
|
||||||
|
return newFragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideFragment() {
|
||||||
|
final FragmentManager fm = getFragmentManager();
|
||||||
|
final FragmentTransaction ft = fm.beginTransaction();
|
||||||
|
|
||||||
|
if (step != null) {
|
||||||
|
hideFragmentByTag(fm, ft, step.getFragmentTag());
|
||||||
|
}
|
||||||
|
|
||||||
|
ft.commit();
|
||||||
|
fm.executePendingTransactions();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideFragmentByTag(@Nonnull FragmentManager fm, @Nonnull FragmentTransaction ft, @Nonnull String fragmentTag) {
|
||||||
|
final Fragment oldFragment = fm.findFragmentByTag(fragmentTag);
|
||||||
|
if (oldFragment != null) {
|
||||||
|
ft.remove(oldFragment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSaveInstanceState(@Nonnull Bundle out) {
|
||||||
|
out.putString(FLOW, wizard.getName());
|
||||||
|
out.putString(STEP, step.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPause() {
|
||||||
|
if (wizard != null && step != null) {
|
||||||
|
wizard.saveLastStep(step);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onBackPressed() {
|
||||||
|
FinishWizardConfirmationDialog.show(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
*
|
||||||
|
* GETTERS
|
||||||
|
*
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
public WizardStep getStep() {
|
||||||
|
return step;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WizardFlow getFlow() {
|
||||||
|
return wizard.getFlow();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Wizard getWizard() {
|
||||||
|
return wizard;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public View getPrevButton() {
|
||||||
|
return prevButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public View getNextButton() {
|
||||||
|
return nextButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
*
|
||||||
|
* STATIC
|
||||||
|
*
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static void startWizard(@Nonnull Wizards wizards, @Nonnull Context context) {
|
||||||
|
context.startActivity(createLaunchIntent(wizards, null, context));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void startWizard(@Nonnull Wizards wizards, @Nullable String name, @Nonnull Context context) {
|
||||||
|
context.startActivity(createLaunchIntent(wizards, name, context));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void continueWizard(@Nonnull Wizards wizards, @Nonnull String name, @Nonnull Context context) {
|
||||||
|
final Intent intent = createLaunchIntent(wizards, name, context);
|
||||||
|
|
||||||
|
final Wizard wizard = wizards.getWizard(name);
|
||||||
|
final String step = wizard.getLastSavedStepName();
|
||||||
|
tryPutStep(intent, step);
|
||||||
|
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void tryPutStep(@Nonnull Intent intent, @Nullable WizardStep step) {
|
||||||
|
tryPutStep(intent, step != null ? step.getName() : null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void tryPutStep(@Nonnull Intent intent, @Nullable String step) {
|
||||||
|
if (step != null) {
|
||||||
|
intent.putExtra(STEP, step);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
private static Intent createLaunchIntent(@Nonnull Wizards wizards, @Nullable String name, @Nonnull Context context) {
|
||||||
|
final Intent intent = new Intent(context, wizards.getActivityClassName());
|
||||||
|
intent.putExtra(FLOW, name);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.solovyev.android.wizard;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public interface Wizards {
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
Class<? extends Activity> getActivityClassName();
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
public Wizard getWizard(@Nullable String name) throws IllegalArgumentException;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package org.solovyev.android.wizard;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public interface WizardsAware {
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
Wizards getWizards();
|
||||||
|
}
|
@ -23,10 +23,11 @@
|
|||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
|
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
|
||||||
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true"
|
<!-- todo serso: fix me-->
|
||||||
|
<!-- <item android:state_focused="true" android:state_enabled="false" android:state_pressed="true"
|
||||||
android:drawable="@drawable/abs__list_selector_disabled_holo_dark"/>
|
android:drawable="@drawable/abs__list_selector_disabled_holo_dark"/>
|
||||||
<item android:state_focused="true" android:state_enabled="false"
|
<item android:state_focused="true" android:state_enabled="false"
|
||||||
android:drawable="@drawable/abs__list_selector_disabled_holo_dark"/>
|
android:drawable="@drawable/abs__list_selector_disabled_holo_dark"/>-->
|
||||||
<item android:state_focused="true" android:state_pressed="true"
|
<item android:state_focused="true" android:state_pressed="true"
|
||||||
android:drawable="@drawable/default_abs__list_selector_background_transition_holo_dark"/>
|
android:drawable="@drawable/default_abs__list_selector_background_transition_holo_dark"/>
|
||||||
<item android:state_focused="false" android:state_pressed="true"
|
<item android:state_focused="false" android:state_pressed="true"
|
||||||
|
@ -25,10 +25,11 @@
|
|||||||
<item android:state_window_focused="false" android:drawable="@android:color/transparent"/>
|
<item android:state_window_focused="false" android:drawable="@android:color/transparent"/>
|
||||||
|
|
||||||
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
|
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
|
||||||
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true"
|
<!-- todo serso: fix me-->
|
||||||
|
<!-- <item android:state_focused="true" android:state_enabled="false" android:state_pressed="true"
|
||||||
android:drawable="@drawable/abs__list_selector_disabled_holo_dark"/>
|
android:drawable="@drawable/abs__list_selector_disabled_holo_dark"/>
|
||||||
<item android:state_focused="true" android:state_enabled="false"
|
<item android:state_focused="true" android:state_enabled="false"
|
||||||
android:drawable="@drawable/abs__list_selector_disabled_holo_dark"/>
|
android:drawable="@drawable/abs__list_selector_disabled_holo_dark"/>-->
|
||||||
<item android:state_focused="true" android:state_pressed="true"
|
<item android:state_focused="true" android:state_pressed="true"
|
||||||
android:drawable="@drawable/default_abs__list_selector_background_transition_holo_dark"/>
|
android:drawable="@drawable/default_abs__list_selector_background_transition_holo_dark"/>
|
||||||
<item android:state_focused="false" android:state_pressed="true"
|
<item android:state_focused="false" android:state_pressed="true"
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?><!--
|
|
||||||
~ Copyright 2013 serso aka se.solovyev
|
|
||||||
~
|
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
~ you may not use this file except in compliance with the License.
|
|
||||||
~ You may obtain a copy of the License at
|
|
||||||
~
|
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
~
|
|
||||||
~ Unless required by applicable law or agreed to in writing, software
|
|
||||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
~ See the License for the specific language governing permissions and
|
|
||||||
~ limitations under the License.
|
|
||||||
~
|
|
||||||
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
~ Contact details
|
|
||||||
~
|
|
||||||
~ Email: se.solovyev@gmail.com
|
|
||||||
~ Site: http://se.solovyev.org
|
|
||||||
-->
|
|
||||||
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:state_enabled="false" android:drawable="@drawable/abs__spinner_ab_disabled_holo_dark"/>
|
|
||||||
<item android:state_pressed="true" android:drawable="@drawable/default_abs__spinner_ab_pressed_holo_dark"/>
|
|
||||||
<item android:state_pressed="false" android:state_focused="true"
|
|
||||||
android:drawable="@drawable/default_abs__spinner_ab_focused_holo_dark"/>
|
|
||||||
<item android:drawable="@drawable/abs__spinner_ab_default_holo_dark"/>
|
|
||||||
</selector>
|
|
8
android-app/src/main/res/values-de/strings.xml
Normal file
8
android-app/src/main/res/values-de/strings.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="acl_wizard_finish_confirmation">Wollen Sie den Assistenten wirklich beenden?</string>
|
||||||
|
<string name="acl_wizard_next">Weiter</string>
|
||||||
|
<string name="acl_wizard_back">Zurück</string>
|
||||||
|
<string name="acl_wizard_finish">Beenden</string>
|
||||||
|
<string name="acl_wizard_start">Wizard starten</string>
|
||||||
|
</resources>
|
8
android-app/src/main/res/values-es/strings.xml
Normal file
8
android-app/src/main/res/values-es/strings.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="acl_wizard_finish_confirmation">¿Realmente quiere finalizar el asistente?</string>
|
||||||
|
<string name="acl_wizard_next">Siguiente</string>
|
||||||
|
<string name="acl_wizard_back">Atrás</string>
|
||||||
|
<string name="acl_wizard_finish">Finalizar</string>
|
||||||
|
<string name="acl_wizard_start">Iniciar el asistente</string>
|
||||||
|
</resources>
|
8
android-app/src/main/res/values-fr/strings.xml
Normal file
8
android-app/src/main/res/values-fr/strings.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="acl_wizard_finish_confirmation">Quitter l\'assistant ?</string>
|
||||||
|
<string name="acl_wizard_next">Suivant</string>
|
||||||
|
<string name="acl_wizard_back">Retour</string>
|
||||||
|
<string name="acl_wizard_finish">Terminer</string>
|
||||||
|
<string name="acl_wizard_start">Commencer l\'assistant</string>
|
||||||
|
</resources>
|
8
android-app/src/main/res/values-it/strings.xml
Normal file
8
android-app/src/main/res/values-it/strings.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="acl_wizard_finish_confirmation">Vuoi veramente terminare la procedura guidata?</string>
|
||||||
|
<string name="acl_wizard_next">Successivo</string>
|
||||||
|
<string name="acl_wizard_back">Indietro</string>
|
||||||
|
<string name="acl_wizard_finish">Termina</string>
|
||||||
|
<string name="acl_wizard_start">Avvia la procedura guidata</string>
|
||||||
|
</resources>
|
8
android-app/src/main/res/values-pl/strings.xml
Normal file
8
android-app/src/main/res/values-pl/strings.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="acl_wizard_finish_confirmation">Czy na pewno chcesz zakończyć konfigurację programu?</string>
|
||||||
|
<string name="acl_wizard_next">Następny</string>
|
||||||
|
<string name="acl_wizard_back">Wstecz</string>
|
||||||
|
<string name="acl_wizard_finish">Koniec</string>
|
||||||
|
<string name="acl_wizard_start">Zacznij konfigurację</string>
|
||||||
|
</resources>
|
8
android-app/src/main/res/values-pt-rBR/strings.xml
Normal file
8
android-app/src/main/res/values-pt-rBR/strings.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="acl_wizard_finish_confirmation">Parar a configuração da aplicação?</string>
|
||||||
|
<string name="acl_wizard_next">Avançar</string>
|
||||||
|
<string name="acl_wizard_back">Voltar</string>
|
||||||
|
<string name="acl_wizard_finish">Terminar</string>
|
||||||
|
<string name="acl_wizard_start">Iniciar assistente de configuração</string>
|
||||||
|
</resources>
|
8
android-app/src/main/res/values-ru/strings.xml
Normal file
8
android-app/src/main/res/values-ru/strings.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="acl_wizard_finish_confirmation">Вы действительно хотите завершить визард?</string>
|
||||||
|
<string name="acl_wizard_next">Далее</string>
|
||||||
|
<string name="acl_wizard_back">Назад</string>
|
||||||
|
<string name="acl_wizard_finish">Завершить</string>
|
||||||
|
<string name="acl_wizard_start">Начать визард</string>
|
||||||
|
</resources>
|
8
android-app/src/main/res/values-uk/strings.xml
Normal file
8
android-app/src/main/res/values-uk/strings.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="acl_wizard_finish_confirmation">Ви дійсно бажаєте вийти з майстра?</string>
|
||||||
|
<string name="acl_wizard_next">Далі</string>
|
||||||
|
<string name="acl_wizard_back">Назад</string>
|
||||||
|
<string name="acl_wizard_finish">Завершити</string>
|
||||||
|
<string name="acl_wizard_start">Запустити майстер</string>
|
||||||
|
</resources>
|
8
android-app/src/main/res/values/strings.xml
Normal file
8
android-app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="acl_wizard_finish_confirmation">Do you really want to finish wizard?</string>
|
||||||
|
<string name="acl_wizard_next">Next</string>
|
||||||
|
<string name="acl_wizard_back">Back</string>
|
||||||
|
<string name="acl_wizard_finish">Finish</string>
|
||||||
|
<string name="acl_wizard_start">Start wizard</string>
|
||||||
|
</resources>
|
@ -115,32 +115,32 @@
|
|||||||
<item name="android:layout_width">match_parent</item>
|
<item name="android:layout_width">match_parent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="cpp_default_actionbar_style" parent="@style/Widget.Sherlock.ActionBar">
|
<style name="cpp_default_actionbar_style" parent="@style/Widget.AppCompat.ActionBar">
|
||||||
<item name="background">@drawable/default_abs__ab_transparent_dark_holo</item>
|
<item name="background">@drawable/default_abs__ab_transparent_dark_holo</item>
|
||||||
<item name="android:background">@drawable/default_abs__ab_transparent_dark_holo</item>
|
<item name="android:background">@drawable/default_abs__ab_transparent_dark_holo</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="cpp_default_actionbar_tab_style" parent="@style/Widget.Sherlock.ActionBar.TabView">
|
<style name="cpp_default_actionbar_tab_style" parent="@style/Widget.AppCompat.ActionBar.TabView">
|
||||||
<item name="background">@drawable/default_abs__tab_indicator_ab_holo</item>
|
<item name="background">@drawable/default_abs__tab_indicator_ab_holo</item>
|
||||||
<item name="android:background">@drawable/default_abs__tab_indicator_ab_holo</item>
|
<item name="android:background">@drawable/default_abs__tab_indicator_ab_holo</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="cpp_default_actionbar_close_button_style" parent="@style/Widget.Sherlock.ActionButton.CloseMode">
|
<style name="cpp_default_actionbar_close_button_style" parent="@style/Widget.AppCompat.ActionButton.CloseMode">
|
||||||
<item name="android:background">@drawable/default_abs__btn_cab_done_holo_dark</item>
|
<item name="android:background">@drawable/default_abs__btn_cab_done_holo_dark</item>
|
||||||
<item name="background">@drawable/default_abs__btn_cab_done_holo_dark</item>
|
<item name="background">@drawable/default_abs__btn_cab_done_holo_dark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="cpp_default_actionbar_dropdown_style" parent="@style/Widget.Sherlock.Spinner.DropDown.ActionBar">
|
<style name="cpp_default_actionbar_dropdown_style" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar">
|
||||||
<item name="android:background">@drawable/default_abs__spinner_ab_holo_dark</item>
|
<!--<item name="android:background">@drawable/default_abs__spinner_ab_holo_dark</item>
|
||||||
<item name="background">@drawable/default_abs__spinner_ab_holo_dark</item>
|
<item name="background">@drawable/default_abs__spinner_ab_holo_dark</item>-->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="cpp_default_actionbar_dropdown_listview_style" parent="@style/Widget.Sherlock.ListView.DropDown">
|
<style name="cpp_default_actionbar_dropdown_listview_style" parent="@style/Widget.AppCompat.ListView.DropDown">
|
||||||
<item name="android:listSelector">@drawable/default_abs__list_selector_holo_dark</item>
|
<item name="android:listSelector">@drawable/default_abs__list_selector_holo_dark</item>
|
||||||
<!--<item name="listSelector">@drawable/default_abs__list_selector_holo_dark</item>-->
|
<!--<item name="listSelector">@drawable/default_abs__list_selector_holo_dark</item>-->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="cpp_gray_theme" parent="Theme.Sherlock">
|
<style name="cpp_gray_theme" parent="@style/Theme.AppCompat">
|
||||||
<item name="android:windowBackground">@color/cpp_default_background</item>
|
<item name="android:windowBackground">@color/cpp_default_background</item>
|
||||||
|
|
||||||
<!-- buttons -->
|
<!-- buttons -->
|
||||||
@ -166,7 +166,7 @@
|
|||||||
<item name="cpp_pane_style_transparent">@style/cpp_default_pane_style_transparent</item>
|
<item name="cpp_pane_style_transparent">@style/cpp_default_pane_style_transparent</item>
|
||||||
|
|
||||||
<!-- action bar-->
|
<!-- action bar-->
|
||||||
<item name="actionBarTabStyle">@style/cpp_default_actionbar_tab_style</item>
|
<!--<item name="actionBarTabStyle">@style/cpp_default_actionbar_tab_style</item>
|
||||||
<item name="android:actionBarTabStyle">@style/cpp_default_actionbar_tab_style</item>
|
<item name="android:actionBarTabStyle">@style/cpp_default_actionbar_tab_style</item>
|
||||||
|
|
||||||
<item name="actionBarStyle">@style/cpp_default_actionbar_style</item>
|
<item name="actionBarStyle">@style/cpp_default_actionbar_style</item>
|
||||||
@ -182,10 +182,10 @@
|
|||||||
<item name="android:actionDropDownStyle">@style/cpp_default_actionbar_dropdown_style</item>
|
<item name="android:actionDropDownStyle">@style/cpp_default_actionbar_dropdown_style</item>
|
||||||
|
|
||||||
<item name="dropDownListViewStyle">@style/cpp_default_actionbar_dropdown_listview_style</item>
|
<item name="dropDownListViewStyle">@style/cpp_default_actionbar_dropdown_listview_style</item>
|
||||||
<item name="android:dropDownListViewStyle">@style/cpp_default_actionbar_dropdown_listview_style</item>
|
<item name="android:dropDownListViewStyle">@style/cpp_default_actionbar_dropdown_listview_style</item>-->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="cpp_gray_dialog_theme" parent="@android:style/Theme.Dialog">
|
<style name="cpp_gray_dialog_theme" parent="@style/Theme.AppCompat.Dialog">
|
||||||
<item name="android:windowCloseOnTouchOutside">false</item>
|
<item name="android:windowCloseOnTouchOutside">false</item>
|
||||||
<!-- buttons -->
|
<!-- buttons -->
|
||||||
<item name="cpp_digit_button_style">@style/cpp_default_digit_button_style</item>
|
<item name="cpp_digit_button_style">@style/cpp_default_digit_button_style</item>
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
<item name="android:background">@drawable/metro_blue_list_item</item>
|
<item name="android:background">@drawable/metro_blue_list_item</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="metro_blue_actionbar_style" parent="@style/Widget.Sherlock.ActionBar">
|
<style name="metro_blue_actionbar_style" parent="@style/Widget.AppCompat.ActionBar">
|
||||||
<item name="background">@drawable/metro_blue_abs__ab_transparent_dark_holo</item>
|
<item name="background">@drawable/metro_blue_abs__ab_transparent_dark_holo</item>
|
||||||
<item name="android:background">@drawable/metro_blue_abs__ab_transparent_dark_holo</item>
|
<item name="android:background">@drawable/metro_blue_abs__ab_transparent_dark_holo</item>
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user