Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

Commit

Permalink
fix(PalmCalcActivity): use androidx everywhere where possible
Browse files Browse the repository at this point in the history
this fixes crash caused by theme in manifest

(cherry picked from commit 02a7e69)
  • Loading branch information
medavox committed Jun 9, 2019
1 parent c04f846 commit 6c4cce0
Showing 1 changed file with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* <Palmcalc is a multipurpose application consisting of calculators, converters
* and world clock> Copyright (C) <2013> <Cybrosys Technologies pvt. ltd.>
*
Expand Down Expand Up @@ -30,12 +30,28 @@
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;

//import com.actionbarsherlock.app.ActionBar;
import androidx.appcompat.app.ActionBar;
//import com.actionbarsherlock.app.SherlockFragmentActivity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentActivity;
//import androidx.appcompat.app.AppCompatActivity;
//import com.actionbarsherlock.app.ActionBar.Tab;
import androidx.appcompat.app.ActionBar.Tab;
//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 androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentStatePagerAdapter;
import android.app.FragmentTransaction;
import androidx.fragment.app.FragmentTransaction;
import androidx.viewpager.widget.ViewPager;

import android.util.DisplayMetrics;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
Expand All @@ -44,11 +60,6 @@
import android.widget.TextView;
import android.widget.Toast;

import android.app.ActionBar;
import androidx.fragment.app.FragmentActivity;
import android.app.ActionBar.Tab;
import android.view.Menu;
import android.view.MenuInflater;
import com.github.palmcalc2019.bmi.bmiactivity;
import com.github.palmcalc2019.clock.GlobalClockActivity;
import com.github.palmcalc2019.scientific.ScientificActivity;
Expand Down Expand Up @@ -76,7 +87,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
**/

public class PalmCalcActivity extends FragmentActivity implements
public class PalmCalcActivity extends AppCompatActivity implements
android.view.View.OnClickListener {

Button btnClear, btnSend;
Expand Down Expand Up @@ -132,7 +143,7 @@ public void init() {
mViewPager.setId(R.id.pager);
showUserSettings();
setContentView(mViewPager);
bar = getActionBar();//getSupportActionBar();
bar = getSupportActionBar();
getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

Expand Down Expand Up @@ -362,11 +373,11 @@ static final class TabInfo {
}
}

public TabsAdapter(FragmentActivity activity, ViewPager pager) {
public TabsAdapter(AppCompatActivity activity, ViewPager pager) {
super(activity.getSupportFragmentManager());

mContext = activity;
mActionBar = activity.getActionBar();
mActionBar = activity.getSupportActionBar();
mViewPager = pager;
mViewPager.setAdapter(this);
mViewPager.setOnPageChangeListener(this);
Expand Down

0 comments on commit 6c4cce0

Please sign in to comment.