ActionBarActivity -> AppCompatActivity

This commit is contained in:
serso 2016-01-10 12:40:34 +01:00
parent 4a7f44b864
commit 00f75ce825
4 changed files with 19 additions and 19 deletions

View File

@ -33,7 +33,8 @@ import android.support.v4.app.Fragment;
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.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AppCompatActivity;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -125,7 +126,7 @@ public class ActivityUi extends BaseUi {
} }
} }
public void onCreate(@Nonnull final ActionBarActivity activity) { public void onCreate(@Nonnull final AppCompatActivity activity) {
onCreate((Activity) activity); onCreate((Activity) activity);
final ActionBar actionBar = activity.getSupportActionBar(); final ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) { if (actionBar != null) {
@ -161,7 +162,7 @@ public class ActivityUi extends BaseUi {
} }
} }
public void restoreSavedTab(@Nonnull ActionBarActivity activity) { public void restoreSavedTab(@Nonnull AppCompatActivity activity) {
final ActionBar actionBar = activity.getSupportActionBar(); final ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) { if (actionBar != null) {
if (selectedNavigationIndex >= 0 && selectedNavigationIndex < actionBar.getTabCount()) { if (selectedNavigationIndex >= 0 && selectedNavigationIndex < actionBar.getTabCount()) {
@ -170,7 +171,7 @@ public class ActivityUi extends BaseUi {
} }
} }
public void onSaveInstanceState(@Nonnull ActionBarActivity activity, @Nonnull Bundle outState) { public void onSaveInstanceState(@Nonnull AppCompatActivity activity, @Nonnull Bundle outState) {
onSaveInstanceState((Activity) activity, outState); onSaveInstanceState((Activity) activity, outState);
} }
@ -186,7 +187,7 @@ public class ActivityUi extends BaseUi {
public void onPause(@Nonnull Activity activity) { public void onPause(@Nonnull Activity activity) {
} }
public void onPause(@Nonnull ActionBarActivity activity) { public void onPause(@Nonnull AppCompatActivity activity) {
onPause((Activity) activity); onPause((Activity) activity);
final ActionBar actionBar = activity.getSupportActionBar(); final ActionBar actionBar = activity.getSupportActionBar();
@ -215,11 +216,11 @@ public class ActivityUi extends BaseUi {
} }
} }
public void onDestroy(@Nonnull ActionBarActivity activity) { public void onDestroy(@Nonnull AppCompatActivity activity) {
this.onDestroy((Activity) activity); this.onDestroy((Activity) activity);
} }
public void addTab(@Nonnull ActionBarActivity activity, public void addTab(@Nonnull AppCompatActivity activity,
@Nonnull String tag, @Nonnull String tag,
@Nonnull Class<? extends Fragment> fragmentClass, @Nonnull Class<? extends Fragment> fragmentClass,
@Nullable Bundle fragmentArgs, @Nullable Bundle fragmentArgs,
@ -236,11 +237,11 @@ public class ActivityUi extends BaseUi {
actionBar.addTab(tab); actionBar.addTab(tab);
} }
public void addTab(@Nonnull ActionBarActivity activity, @Nonnull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) { public void addTab(@Nonnull AppCompatActivity 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 ActionBarActivity activity, @Nonnull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) { public void setFragment(@Nonnull AppCompatActivity 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());
@ -259,7 +260,7 @@ public class ActivityUi extends BaseUi {
} }
} }
public void selectTab(@Nonnull ActionBarActivity activity, @Nonnull CalculatorFragmentType fragmentType) { public void selectTab(@Nonnull AppCompatActivity 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);
@ -293,7 +294,7 @@ public class ActivityUi extends BaseUi {
return layout; return layout;
} }
public void onResume(@Nonnull ActionBarActivity activity) { public void onResume(@Nonnull AppCompatActivity activity) {
onResume((Activity) activity); onResume((Activity) activity);
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);

View File

@ -2,13 +2,13 @@ package org.solovyev.android.calculator;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.LayoutRes; import android.support.annotation.LayoutRes;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MenuItem; import android.view.MenuItem;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public class BaseActivity extends ActionBarActivity { public class BaseActivity extends AppCompatActivity {
@Nonnull @Nonnull
protected final ActivityUi ui; protected final ActivityUi ui;

View File

@ -26,7 +26,7 @@ import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
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 android.support.v7.app.AppCompatActivity;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -39,7 +39,7 @@ import javax.annotation.Nullable;
public class FragmentItemImpl implements FragmentItem { public class FragmentItemImpl implements FragmentItem {
@Nonnull @Nonnull
private final ActionBarActivity activity; private final AppCompatActivity activity;
// Fragment // Fragment
@ -65,7 +65,7 @@ public class FragmentItemImpl implements FragmentItem {
* @param parentViewId parent view id * @param parentViewId parent view id
*/ */
public FragmentItemImpl(@Nonnull ActionBarActivity activity, public FragmentItemImpl(@Nonnull AppCompatActivity activity,
@Nonnull String tag, @Nonnull String tag,
@Nonnull Class<? extends Fragment> fragmentClass, @Nonnull Class<? extends Fragment> fragmentClass,
@Nullable Bundle fragmentArgs, @Nullable Bundle fragmentArgs,

View File

@ -26,8 +26,7 @@ import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.AppCompatActivity;
import org.solovyev.android.sherlock.FragmentItem; import org.solovyev.android.sherlock.FragmentItem;
import org.solovyev.android.sherlock.FragmentItemImpl; import org.solovyev.android.sherlock.FragmentItemImpl;
@ -53,7 +52,7 @@ public class ActionBarFragmentTabListener implements ActionBar.TabListener {
* @param parentViewId parent view id * @param parentViewId parent view id
*/ */
public ActionBarFragmentTabListener(@Nonnull ActionBarActivity activity, public ActionBarFragmentTabListener(@Nonnull AppCompatActivity activity,
@Nonnull String tag, @Nonnull String tag,
@Nonnull Class<? extends Fragment> fragmentClass, @Nonnull Class<? extends Fragment> fragmentClass,
@Nullable Bundle fragmentArgs, @Nullable Bundle fragmentArgs,