android.app.LocalActivityManager Java Examples

The following examples show how to use android.app.LocalActivityManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GosMainActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
@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();


}
 
Example #2
Source File: MainTabActivity.java    From coolreader with MIT License 5 votes vote down vote up
@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();
	}
	
}
 
Example #3
Source File: TabHost.java    From OpenMemories-AppStore with MIT License 4 votes vote down vote up
@Override
public void setup(LocalActivityManager m) {
    super.setup(m);
    this.localActivityManager = m;
}
 
Example #4
Source File: DSL.java    From anvil with MIT License 4 votes vote down vote up
public static Void up(LocalActivityManager arg) {
  return BaseDSL.attr("up", arg);
}
 
Example #5
Source File: DSL.java    From anvil with MIT License 4 votes vote down vote up
public static Void up(LocalActivityManager arg) {
  return BaseDSL.attr("up", arg);
}
 
Example #6
Source File: DisplayNovelPagerActivity.java    From coolreader with MIT License 4 votes vote down vote up
@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");
}
 
Example #7
Source File: DisplayAlternativeNovelPagerActivity.java    From coolreader with MIT License 4 votes vote down vote up
@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();
}
 
Example #8
Source File: LocalActivityManagerAssert.java    From assertj-android with Apache License 2.0 4 votes vote down vote up
public LocalActivityManagerAssert(LocalActivityManager actual) {
  super(actual, LocalActivityManagerAssert.class);
}
 
Example #9
Source File: TabHost.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #10
Source File: LocalActivityManagerProxy.java    From GPT with Apache License 2.0 2 votes vote down vote up
/**
 * 构造方法
 *
 * @param localActivityManager LocalActivityManager
 * @param packageName          包名
 */
public LocalActivityManagerProxy(LocalActivityManager localActivityManager, String packageName) {
    super(null, false);
    mTargetLocalActivityManager = localActivityManager;
    mTargetPackageName = packageName;
}