Java 类android.app.LocalActivityManager 实例源码

项目:GizOpenSource_AppKit_Android    文件:GosMainActivity.java   
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gos_main);

    context = GosMainActivity.this;
    manager = new LocalActivityManager(this, true);
    manager.dispatchCreate(savedInstanceState);
    instance = this;
    InitImageView();
    initTextView();
    initPagerViewer();
    initHandler();





}
项目:appcan-plugin-pdfreader-android    文件:EUExPdf.java   
public void close(String[] args)
{
    LocalActivityManager mgr = ((ActivityGroup) mContext)
            .getLocalActivityManager();
    ViewerActivity viewerActivity = (ViewerActivity) mgr.getActivity(TAG);
    if(viewerActivity != null){
        View view = viewerActivity.getWindow().getDecorView();
        removeViewFromCurrentWindow(view);
        viewerActivity.finish();
        viewerActivity = null;
        view = null;
    }


    if(isOpen){
        isOpen=!isOpen;
    }

}
项目:route-monitor-for-geoevent    文件:TabGroupActivity.java   
/**
   * This is called when a child activity of this one calls its finish method. 
   * This implementation calls {@link LocalActivityManager#destroyActivity} on the child activity
   * and starts the previous activity.
   * If the last child activity just called finish(),this activity (the parent),
   * calls finish to finish the entire group.
   */
@Override
public void finishFromChild(Activity child) {
    LocalActivityManager manager = getLocalActivityManager();
    int index = mIdList.size()-1;

    if (index < 1) {
        finish();
        return;
    }

    manager.destroyActivity(mIdList.get(index), true);
    mIdList.remove(index); index--;
    String lastId = mIdList.get(index);
    Intent lastIntent = manager.getActivity(lastId).getIntent();
    Window newWindow = manager.startActivity(lastId, lastIntent);
    setContentView(newWindow.getDecorView());
}
项目:appez-android    文件:SmartActivityGroup.java   
/**
 * This is called when a child activity of this one calls its finish method.
 * This implementation calls {@link LocalActivityManager#destroyActivity} on
 * the child activity and starts the previous activity. If the last child
 * activity just called finish(),this activity (the parent), calls finish to
 * finish the entire group.
 * 
 * @param child
 *            : Instance of the child activity which needs to be finished.
 */
@Override
public void finishFromChild(Activity child) {
    Log.d(SmartConstants.APP_NAME, "SmartActivityGroup->finishFromChild");
    LocalActivityManager manager = getLocalActivityManager();
    int index = mIdList.size() - 1;
    Log.d(SmartConstants.APP_NAME, "SmartActivityGroup->finishFromChild->index:" + index + ",mIdList.get(index):" + mIdList.get(index));

    // TODO remove the boolean flag 'doExitApplication' and instead use a
    // mechanism by which Android system does not call the 'finish()' of the
    // next Activity in the stack

    // The conditions for 'index > 0' and 'index == 0' needed to be
    // separated because in some cases system automatically calls 'finish'
    // for activity at 0th index(even if user hasn't pressed BACK key) and
    // thus the application activity stack gets cleared leading to closing
    // of application

    if (index > 0) {
        manager.destroyActivity(mIdList.get(index), true);
        mIdList.remove(index);
        index--;

        String lastId = mIdList.get(index);
        Intent lastIntent = manager.getActivity(lastId).getIntent();
        Window newWindow = manager.startActivity(lastId, lastIntent);
        setContentView(newWindow.getDecorView());

        // 'doExitApplication' flag helps in exiting application when user
        // wants it to exit and not because of random internal system call
        // for 'finish' leading to unintended finishing of activity. Set by
        // the user in the application

    } else if (index == 0 && this.doExitApplication) {
        finish();
    }

}
项目:truth-android    文件:LocalActivityManagerSubject.java   
public static SubjectFactory<LocalActivityManagerSubject, LocalActivityManager> type() {
  return new SubjectFactory<LocalActivityManagerSubject, LocalActivityManager>() {
    @Override
    public LocalActivityManagerSubject getSubject(FailureStrategy fs, LocalActivityManager that) {
      return new LocalActivityManagerSubject(fs, that);
    }
  };
}
项目:GOpenSource_AppKit_Android_AS    文件:GosMainActivity.java   
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gos_main);

    context = GosMainActivity.this;
    manager = new LocalActivityManager(this, true);
    manager.dispatchCreate(savedInstanceState);
    instance = this;
    InitImageView();
    initTextView();
    initPagerViewer();
    initHandler();


    AndPermission.with(this)
            .requestCode(REQUEST_CODE_SETTING)
            .permission(Manifest.permission.ACCESS_FINE_LOCATION).rationale(new RationaleListener() {

        @Override
        public void showRequestPermissionRationale(int arg0, Rationale arg1) {
            AndPermission.rationaleDialog(GosMainActivity.this, arg1).show();
        }
    })
            .send();


}
项目:FullRobolectricTestSample    文件:LocalActivityManagerContainer.java   
private void init() {
  LocalActivityManager lam = new LocalActivityManager((Activity) getContext(), true);
  lam.dispatchCreate(null);
  final Window window = lam.startActivity("foo", new Intent(getContext(), InnerActivity.class));
  // Add the decorView's child to this LinearLayout's children.
  final View innerContents = window.getDecorView().findViewById(R.id.lam_inner_contents);
  ((ViewGroup) innerContents.getParent()).removeView(innerContents);
  addView(innerContents);
}
项目:route-monitor-for-geoevent    文件:MessagesTabGroupActivity.java   
public void returnToDefaultActivity()
{
  LocalActivityManager manager = getLocalActivityManager();
  Activity activity = manager.getCurrentActivity();
  if(activity instanceof DispatchActivity)
  {
    if(((DispatchActivity)activity).isNeedToClose())
    {
      String id = manager.getCurrentId();
      manager.destroyActivity(id, false);
      startChildActivity("MessagesActivity", new Intent(this,MessagesActivity.class));
    }
  }
}
项目:route-monitor-for-geoevent    文件:WorkOrdersTabGroupActivity.java   
public void returnToDefaultActivity()
{
  LocalActivityManager manager = getLocalActivityManager();
  Activity activity = manager.getCurrentActivity();
  if(activity instanceof WorkOrderDetailActivity)
  {
    if(((WorkOrderDetailActivity)activity).isNeedToClose())
    {
      String id = manager.getCurrentId();
      manager.destroyActivity(id, false);
      startChildActivity("WorkOrdersActivity", new Intent(this,WorkOrdersActivity.class));
    }
  }
}
项目:coolreader    文件:MainTabActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.tab_main);
    LocalActivityManager lam = new LocalActivityManager(this, true);  
       lam.dispatchCreate(savedInstanceState);  

    thMain = (TabHost)findViewById(android.R.id.tabhost);
    thMain.setup(lam);
    thMain.addTab(newTabSpec(TAB_BOOKSHELF, R.string.tab_bookshelf, R.drawable.tab_bookshelf, new Intent(this,BookshelfActivity.class)));
    thMain.addTab(newTabSpec(TAB_BOOKMARK, R.string.tab_bookmark, R.drawable.tab_bookmark, new Intent(this,BookmarkActivity.class)));
    thMain.addTab(newTabSpec(TAB_BOOK_ONLINE, R.string.tab_book_online, R.drawable.tab_book_online, new Intent(this,MainActivity.class)));

    rbtnBookshelf = (RadioButton)findViewById(R.id.radio_button0);
    rbtnbookmark = (RadioButton)findViewById(R.id.radio_button1);
    rbtnBookOnline = (RadioButton)findViewById(R.id.radio_button2);

    rbtnBookshelf.setOnCheckedChangeListener(this);
    rbtnbookmark.setOnCheckedChangeListener(this);
    rbtnBookOnline.setOnCheckedChangeListener(this);

    File file = new File("/mnt/sdcard/DotcoolReader");
    if(!file.exists()){
        file.mkdir();
    }

}
项目:ZalartAndroid    文件:LocalActivityManagerFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle state = null;
    if (savedInstanceState != null) {
        state = savedInstanceState.getBundle(KEY_STATE_BUNDLE);
    }

    mLocalActivityManager = new LocalActivityManager(getActivity(), true);
    mLocalActivityManager.dispatchCreate(state);
}
项目:Joszolgalat_Android_App    文件:LocalActivityManagerFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle state = null;
    if (savedInstanceState != null) {
        state = savedInstanceState.getBundle(KEY_STATE_BUNDLE);
    }

    mLocalActivityManager = new LocalActivityManager(getActivity(), true);
    mLocalActivityManager.dispatchCreate(state);
}
项目:AURHelperDroid    文件:LocalActivityManagerFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (DEBUG)
        Log.d(TAG, "onCreate(): " + getClass().getSimpleName());

    Bundle state = null;
    if (savedInstanceState != null) {
        state = savedInstanceState.getBundle(KEY_STATE_BUNDLE);
    }

    mLocalActivityManager = new LocalActivityManager(getActivity(), true);
    mLocalActivityManager.dispatchCreate(state);
}
项目:OpenMemories-AppStore    文件:TabHost.java   
@Override
public void setup(LocalActivityManager m) {
    super.setup(m);
    this.localActivityManager = m;
}
项目:truth-android    文件:LocalActivityManagerSubject.java   
protected LocalActivityManagerSubject(FailureStrategy failureStrategy, LocalActivityManager subject) {
  super(failureStrategy, subject);
}
项目:coolreader    文件:DisplayNovelPagerActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        UIHelper.SetTheme(this, R.layout.activity_display_novel_pager);
        UIHelper.SetActionBarDisplayHomeAsUp(this, true);
        setContentView(R.layout.activity_display_novel_pager);
    } else {
        UIHelper.SetTheme(this, R.layout.activity_display_novel_pager_fix);
        UIHelper.SetActionBarDisplayHomeAsUp(this, true);
        setContentView(R.layout.activity_display_novel_pager_fix);
    }
    tabHost = (TabHost) findViewById(android.R.id.tabhost);
    lam = new LocalActivityManager(this, false);
    lam.dispatchCreate(savedInstanceState);
    tabHost.setup(lam);
    isInverted = UIHelper.getColorPreferences(this);

    // First Tab - Normal Novels
    TabSpec firstSpec = tabHost.newTabSpec(MAIN_SPEC);
    firstSpec.setIndicator(MAIN_SPEC);
    Intent firstIntent = new Intent(this, DisplayLightNovelListActivity.class);
    firstIntent.putExtra(Constants.EXTRA_ONLY_WATCHED, false);
    firstSpec.setContent(firstIntent);

    // Second Tab - Teasers
    TabSpec secondSpec = tabHost.newTabSpec(TEASER_SPEC);
    secondSpec.setIndicator(TEASER_SPEC);
    Intent secondIntent = new Intent(this, DisplayTeaserListActivity.class);
    secondSpec.setContent(secondIntent);

    // Third Tab - Original
    TabSpec thirdSpec = tabHost.newTabSpec(ORIGINAL_SPEC);
    thirdSpec.setIndicator(ORIGINAL_SPEC);
    Intent thirdIntent = new Intent(this, DisplayOriginalListActivity.class);
    thirdSpec.setContent(thirdIntent);

    // Adding all TabSpec to TabHost
    tabHost.addTab(firstSpec); // Adding First tab
    tabHost.addTab(secondSpec); // Adding Second tab
    tabHost.addTab(thirdSpec); // Adding third tab
    //setTabColor();

    tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
        public void onTabChanged(String tabId) {
            //setTabColor();
            currentActivity = lam.getActivity(tabId);
        }
    });

    // Cheap preload list hack.
    tabHost.setCurrentTabByTag(TEASER_SPEC);
    tabHost.setCurrentTabByTag(ORIGINAL_SPEC);
    tabHost.setCurrentTabByTag(MAIN_SPEC);

    Log.d(TAG, "Created");
}
项目:coolreader    文件:DisplayAlternativeNovelPagerActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        UIHelper.SetTheme(this, R.layout.activity_display_novel_pager);
        UIHelper.SetActionBarDisplayHomeAsUp(this, true);
        setContentView(R.layout.activity_display_novel_pager);
    } else {
        UIHelper.SetTheme(this, R.layout.activity_display_novel_pager_fix);
        UIHelper.SetActionBarDisplayHomeAsUp(this, true);
        setContentView(R.layout.activity_display_novel_pager_fix);
    }
    tabHost = (TabHost) findViewById(android.R.id.tabhost);
    lam = new LocalActivityManager(this, false);
    lam.dispatchCreate(savedInstanceState);
    tabHost.setup(lam);
    isInverted = UIHelper.getColorPreferences(this);

    tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
        public void onTabChanged(String tabId) {
            setTabColor();
            currentActivity = lam.getActivity(tabId);
        }
    });

    /* Dynamically add Tabs */
    ArrayList<String> Choice = new ArrayList<String>();

    Iterator<Entry<String, AlternativeLanguageInfo>> it = AlternativeLanguageInfo.getAlternativeLanguageInfo().entrySet().iterator();
    while (it.hasNext()) {
        AlternativeLanguageInfo info = it.next().getValue();
        boolean isChosen = PreferenceManager.getDefaultSharedPreferences(this).getBoolean(info.getLanguage(), true);
        if (isChosen) {
            Choice.add(info.getLanguage());
            Log.d("Language Added: ", info.getLanguage());
        }
        it.remove();
    }

    TabSpec[] allSpec = new TabSpec[Choice.size()];
    for (int i = 0; i < Choice.size(); i++) {
        allSpec[i] = tabHost.newTabSpec(Choice.get(i));
        allSpec[i].setIndicator(Choice.get(i));
        Intent firstIntent = new Intent(this, DisplayAlternativeNovelListActivity.class);
        firstIntent.putExtra("LANG", Choice.get(i));
        allSpec[i].setContent(firstIntent);

        // Adding all TabSpec to TabHost
        tabHost.addTab(allSpec[i]);

        // Cheap preload list hack.
        tabHost.setCurrentTabByTag(Choice.get(i));
    }

    // Tab color
    setTabColor();
}
项目:ZalartAndroid    文件:LocalActivityManagerFragment.java   
protected LocalActivityManager getLocalActivityManager() {
    return mLocalActivityManager;
}
项目:Joszolgalat_Android_App    文件:LocalActivityManagerFragment.java   
protected LocalActivityManager getLocalActivityManager() {
    return mLocalActivityManager;
}
项目:AURHelperDroid    文件:LocalActivityManagerFragment.java   
protected LocalActivityManager getLocalActivityManager() {
    return mLocalActivityManager;
}
项目:assertj-android    文件:LocalActivityManagerAssert.java   
public LocalActivityManagerAssert(LocalActivityManager actual) {
  super(actual, LocalActivityManagerAssert.class);
}
项目:flingtap-done    文件:TabHost.java   
/**
 * If you are using {@link TabSpec#setContent(android.content.Intent)}, this
 * must be called since the activityGroup is needed to launch the local activity.
 *
 * This is done for you if you extend {@link android.app.TabActivity}.
 * @param activityGroup Used to launch activities for tab content.
 */
public void setup(LocalActivityManager activityGroup) {
    setup();
    mLocalActivityManager = activityGroup;
}