use of android.support.v7.widget.LinearLayoutCompat in project ChatExchange by HueToYou.
the class TutorialStuff method chatsExplorationTutorial.
public static void chatsExplorationTutorial(final Activity activity, final LinearLayoutCompat hueLayout) {
PreferencesManager manager = new PreferencesManager(activity);
if (!manager.isDisplayed(SE_ROOMS_TAB)) {
ChatroomsExplorationActivity.touchesBlocked = true;
}
if (mCategoryConfig == null) {
setCategoryConfig(activity);
}
ArrayList<View> seTxtView = new ArrayList<>();
final ArrayList<View> soTxtView = new ArrayList<>();
hueLayout.getChildAt(0).findViewsWithText(seTxtView, "SE", View.FIND_VIEWS_WITH_TEXT);
hueLayout.getChildAt(1).findViewsWithText(soTxtView, "SO", View.FIND_VIEWS_WITH_TEXT);
SpotlightView SErooms = new SpotlightView.Builder(activity).target(seTxtView.get(0)).usageId(SE_ROOMS_TAB).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.CEA_SErooms_tab_tutorial_heading)).subHeadingTvText(activity.getResources().getString(R.string.CEA_SErooms_tab_tutorial_text)).show();
final SpotlightView.Builder SOrooms = new SpotlightView.Builder(activity).setConfiguration(mCategoryConfig).headingTvText(activity.getResources().getString(R.string.CEA_SOrooms_tab_tutorial_heading)).subHeadingTvText(activity.getResources().getString(R.string.CEA_SOrooms_tab_tutorial_text)).usageId(SO_ROOMS_TAB);
SpotlightListener listener = new SpotlightListener() {
@Override
public void onUserClicked(String s) {
switch(s) {
case SE_ROOMS_TAB:
ChatroomsExplorationActivity.touchesBlocked = true;
SOrooms.target(soTxtView.get(0)).show();
break;
case SO_ROOMS_TAB:
ChatroomsExplorationActivity.touchesBlocked = false;
break;
}
}
@Override
public void onFinishedDrawingSpotlight() {
ChatroomsExplorationActivity.touchesBlocked = false;
}
@Override
public void onStartedDrawingSpotlight() {
ChatroomsExplorationActivity.touchesBlocked = false;
}
};
SErooms.setListener(listener);
SOrooms.setListener(listener);
}
use of android.support.v7.widget.LinearLayoutCompat in project ChatExchange by HueToYou.
the class ChatroomsExplorationActivity method normalOnCreate.
private void normalOnCreate() {
hueNetworkStatusChanged = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
new RequestFactory().get("http://www.google.com/", true, new RequestFactory.Listener() {
@Override
public void onSucceeded(URL url, String data) {
}
@Override
public void onFailed(String message) {
Intent hueIntent = new Intent(ChatroomsExplorationActivity.this, OfflineActivity.class);
startActivity(hueIntent);
finish();
}
});
}
}
};
this.registerReceiver(hueNetworkStatusChanged, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
setContentView(R.layout.activity_chatrooms_exploration);
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
// Set up the action bar.
final android.support.v7.app.ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(android.support.v7.app.ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayHomeAsUpEnabled(true);
// When swiping between different sections, select the corresponding
// tab. We can also use ActionBar.Tab#select() to do this if we have
// a reference to the Tab.
mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
actionBar.setSelectedNavigationItem(position);
}
});
// For each of the sections in the app, add a tab to the action bar.
for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
// Create a tab with text corresponding to the page title defined by
// the adapter. Also specify this Activity object, which implements
// the TabListener interface, as the callback (listener) for when
// this tab is selected.
actionBar.addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
}
ActionBarHue.setActionBarColorToSharedPrefsValue(this);
ActionBarHue.setTabBarColorToSharedPrefsValue(this);
ViewGroup viewGroup = (ViewGroup) getWindow().getDecorView();
LinearLayout testb = (LinearLayout) viewGroup.getChildAt(0);
FrameLayout testc = (FrameLayout) testb.getChildAt(1);
ActionBarOverlayLayout testd = (ActionBarOverlayLayout) testc.getChildAt(0);
ActionBarContainer teste = (ActionBarContainer) testd.getChildAt(1);
LinearLayoutCompat testg;
if (getResources().getConfiguration().orientation == ORIENTATION_PORTRAIT) {
ScrollingTabContainerView testf = (ScrollingTabContainerView) teste.getChildAt(2);
testg = (LinearLayoutCompat) testf.getChildAt(0);
} else // Landscape
{
Toolbar teste2 = (Toolbar) teste.getChildAt(0);
ScrollingTabContainerView testf = (ScrollingTabContainerView) teste2.getChildAt(0);
testg = (LinearLayoutCompat) testf.getChildAt(0);
}
testg.setId(android.R.id.tabcontent);
// String IdAsString = testg.getResources().getResourceName(testg.getId());
// Log.e("TestG", IdAsString);
TutorialStuff.chatsExplorationTutorial(this, testg);
}
Aggregations