mirror of
https://github.com/leanote/leanote-android.git
synced 2026-01-13 07:03:54 +08:00
replace android.app.Fragment with android.support.v4.app.Fragment
This commit is contained in:
@@ -93,9 +93,9 @@ public class MainActivity extends BaseActivity implements NotebookAdapter.Notebo
|
||||
CrashReport.setUserId(AccountService.getCurrent().getUserId());
|
||||
if (savedInstanceState == null) {
|
||||
mNoteFragment = NoteFragment.newInstance(getIntent().getBooleanExtra(EXT_SHOULD_RELOAD, false));
|
||||
getFragmentManager().beginTransaction().add(R.id.container, mNoteFragment, TAG_NOTE_FRAGMENT).commit();
|
||||
getSupportFragmentManager().beginTransaction().add(R.id.container, mNoteFragment, TAG_NOTE_FRAGMENT).commit();
|
||||
} else {
|
||||
mNoteFragment = (NoteFragment) getFragmentManager().findFragmentByTag(TAG_NOTE_FRAGMENT);
|
||||
mNoteFragment = (NoteFragment) getSupportFragmentManager().findFragmentByTag(TAG_NOTE_FRAGMENT);
|
||||
}
|
||||
mNoteFragment.setSyncFinishListener(this);
|
||||
mEmailTv.setText(AccountService.getCurrent().getEmail());
|
||||
|
||||
@@ -2,10 +2,10 @@ package org.houxg.leamonax.ui;
|
||||
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Fragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.widget.DefaultItemAnimator;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class NotePreviewActivity extends BaseActivity implements EditorFragment.
|
||||
mNote = AppDataBase.getNoteByLocalId(noteLocalId);
|
||||
|
||||
mEditorFragment = EditorFragment.getNewInstance(mNote.isMarkDown(), false);
|
||||
getFragmentManager().beginTransaction().add(R.id.container, mEditorFragment).commit();
|
||||
getSupportFragmentManager().beginTransaction().add(R.id.container, mEditorFragment).commit();
|
||||
}
|
||||
|
||||
public static Intent getOpenIntent(Context context, long noteLocalId) {
|
||||
|
||||
@@ -2,12 +2,12 @@ package org.houxg.leamonax.ui.edit;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -97,6 +97,12 @@ public class EditorFragment extends Fragment implements Editor.EditorListener {
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity context) {
|
||||
super.onAttach(context);
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package org.houxg.leamonax.ui.edit;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v13.app.FragmentPagerAdapter;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -65,12 +64,12 @@ public class NoteEditActivity extends BaseActivity implements EditorFragment.Edi
|
||||
initToolBar((Toolbar) findViewById(R.id.toolbar), true);
|
||||
mPager = (LeaViewPager) findViewById(R.id.pager);
|
||||
mPager.setPagingEnabled(false);
|
||||
mPager.setAdapter(new SectionAdapter(getFragmentManager()));
|
||||
mPager.setAdapter(new SectionAdapter(getSupportFragmentManager()));
|
||||
mPager.setOffscreenPageLimit(2);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
mEditorFragment = (EditorFragment) getFragmentManager().findFragmentByTag(savedInstanceState.getString(TAG_EDITOR));
|
||||
mSettingsFragment = (SettingFragment) getFragmentManager().findFragmentByTag(savedInstanceState.getString(TAG_SETTING));
|
||||
mEditorFragment = (EditorFragment) getSupportFragmentManager().findFragmentByTag(savedInstanceState.getString(TAG_EDITOR));
|
||||
mSettingsFragment = (SettingFragment) getSupportFragmentManager().findFragmentByTag(savedInstanceState.getString(TAG_SETTING));
|
||||
}
|
||||
|
||||
long noteLocalId = getIntent().getLongExtra(EXT_NOTE_LOCAL_ID, -1);
|
||||
@@ -326,7 +325,8 @@ public class NoteEditActivity extends BaseActivity implements EditorFragment.Edi
|
||||
|
||||
private class SectionAdapter extends FragmentPagerAdapter {
|
||||
|
||||
public SectionAdapter(FragmentManager fm) {
|
||||
|
||||
public SectionAdapter(android.support.v4.app.FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.houxg.leamonax.ui.edit;
|
||||
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.Editable;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
|
||||
Reference in New Issue
Block a user