android.support.v7.app.ActionBarActivity Java Examples

The following examples show how to use android.support.v7.app.ActionBarActivity. 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: MovieLibraryOverviewFragment.java    From Mizuu with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.viewpager_with_tabs, container, false);

    if (MizLib.hasLollipop())
        ((ActionBarActivity) getActivity()).getSupportActionBar().setElevation(0);

    mViewPager = (ViewPager) v.findViewById(R.id.awesomepager);
    mViewPager.setPageMargin(MizLib.convertDpToPixels(getActivity(), 16));

    mTabs = (PagerSlidingTabStrip) v.findViewById(R.id.tabs);

    mViewPager.setAdapter(new PagerAdapter(getChildFragmentManager()));
    mTabs.setViewPager(mViewPager);
    mTabs.setVisibility(View.VISIBLE);

    // Work-around a bug that sometimes happens with the tabs
    mViewPager.setCurrentItem(0);

    if (MizLib.hasLollipop())
        mTabs.setElevation(1f);

    return v;
}
 
Example #2
Source File: LoginFragment.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityResult(final int requestCode, final int resultCode,
                             final Intent data) {

    if (requestCode == AppConstants.RequestCodes.RESET_PASSWORD && resultCode ==
            ActionBarActivity.RESULT_OK) {

        getActivity().setResult(ActionBarActivity.RESULT_OK, data);
        getActivity().finish();
    } else {
        super.onActivityResult(requestCode, resultCode, data);
    }
    Session.getActiveSession()
           .onActivityResult(getActivity(), requestCode, resultCode, data);


}
 
Example #3
Source File: Drawer.java    From Ti.DrawerLayout with MIT License 6 votes vote down vote up
/**
* centerView 변경
*/
private void replaceCenterView(TiViewProxy viewProxy) {
	if (viewProxy == this.centerView) {
		Log.d(TAG, "centerView was not changed");
		return;
	}
	if (viewProxy == null) {
		return;
	}
	
	// update the main content by replacing fragments
	View contentView = viewProxy.getOrCreateView().getOuterView();
	Fragment fragment = new ContentWrapperFragment(contentView);
	
	FragmentManager fragmentManager = ((ActionBarActivity)proxy.getActivity()).getSupportFragmentManager();
	fragmentManager.beginTransaction().replace(id_content_frame, fragment).commit();
	// fragmentManager.beginTransaction().replace(id_content_frame, fragment).commitAllowingStateLoss();
	
	this.centerView = viewProxy;
}
 
Example #4
Source File: TvShowLibraryOverviewFragment.java    From Mizuu with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.viewpager_with_tabs, container, false);

    if (MizLib.hasLollipop())
        ((ActionBarActivity) getActivity()).getSupportActionBar().setElevation(0);

    mViewPager = (ViewPager) v.findViewById(R.id.awesomepager);
    mViewPager.setPageMargin(MizLib.convertDpToPixels(getActivity(), 16));

    mTabs = (PagerSlidingTabStrip) v.findViewById(R.id.tabs);

    mViewPager.setAdapter(new PagerAdapter(getChildFragmentManager()));
    mTabs.setViewPager(mViewPager);
    mTabs.setVisibility(View.VISIBLE);

    // Work-around a bug that sometimes happens with the tabs
    mViewPager.setCurrentItem(0);

    if (MizLib.hasLollipop())
        mTabs.setElevation(1f);

    return v;
}
 
Example #5
Source File: ContentFragment.java    From droid-stealth with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Starts the multi selection mode with given files
 *
 * @param withItemIds the items to select
 */
public void startMultiSelection(final int[] withItemIds) {
	if (mMode != null) {
		mMode.finish();
	}

	mGridView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

	for (int id : withItemIds) {
		mGridView.setItemChecked(id, true);
	}

	mMultiModeListener = new ContentShareMultiModeListener();
	mMode = ((ActionBarActivity) getActivity()).startSupportActionMode(mMultiModeListener);

	showMultiSelectionFeedback();
}
 
Example #6
Source File: ActivityHelper.java    From android-atleap with Apache License 2.0 6 votes vote down vote up
/**
 * Change title in the Action Bar
 * @param activity activity
 * @param title title of Action Bar
 * @param typefaceName the full path to font in the assets
 */
public static void changeActionBarTitle(Activity activity, String title, String typefaceName) {
    if (activity == null)
        return;

    if (!(activity instanceof ActionBarActivity))
        return;

    ActionBar actionBar = ((ActionBarActivity) activity).getSupportActionBar();
    if (actionBar != null) {
        if (title != null) {
            if (!TextUtils.isEmpty(typefaceName)) {
                SpannableString spannableTitle = new SpannableString(title);
                spannableTitle.setSpan(new TypefaceSpan(activity, typefaceName), 0, spannableTitle.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                actionBar.setTitle(spannableTitle);
            } else {
                actionBar.setTitle(title);
            }
        }
    }
}
 
Example #7
Source File: ChannelListFragment.java    From Plumble with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onChannelClick(IChannel channel) {
    if (mTargetProvider.getChatTarget() != null &&
            channel.equals(mTargetProvider.getChatTarget().getChannel()) &&
            mActionMode != null) {
        // Dismiss action mode if double pressed. FIXME: use list view selection instead?
        mActionMode.finish();
    } else {
        ActionMode.Callback cb = new ChatTargetActionModeCallback(mTargetProvider, new ChatTargetProvider.ChatTarget(channel)) {
            @Override
            public void onDestroyActionMode(ActionMode actionMode) {
                super.onDestroyActionMode(actionMode);
                mActionMode = null;
            }
        };
        mActionMode = ((ActionBarActivity)getActivity()).startSupportActionMode(cb);
    }
}
 
Example #8
Source File: PreferencesFragment.java    From Android-PreferencesManager with Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == CODE_EDIT_FILE && resultCode == ActionBarActivity.RESULT_OK) {
        loadingView.setVisibility(View.VISIBLE);
        gridView.setVisibility(View.GONE);

        if (getActivity() != null) {
            Animation fadeInAnim = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in);
            if (fadeInAnim != null) {
                loadingView.startAnimation(fadeInAnim);
            }
            Animation fadeOutAnim = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out);
            if (fadeOutAnim != null) {
                gridView.startAnimation(fadeOutAnim);
            }
        }
        launchTask();
    }
    super.onActivityResult(requestCode, resultCode, data);
}
 
Example #9
Source File: FilesListFragment.java    From secrecy with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.list_file, container, false);
    addFilepBar = (ProgressBar) view.findViewById(R.id.progressBar);
    recyclerView = (RecyclerView) view.findViewById(R.id.file_list_recycler_view);
    mTag = (TextView) view.findViewById(R.id.tag);

    linearLayout = new LinearLayoutManager(context);
    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(linearLayout);
    recyclerView.setAdapter(mAdapter);

    ActionBar ab = ((ActionBarActivity) getActivity()).getSupportActionBar();
    if (ab != null) {
        ab.setTitle(vault);
    }

    return view;
}
 
Example #10
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, String color, String unit, String prop, int seekBarMax, int seekBarProgress, ActionBarActivity fa, SeekBar.OnSeekBarChangeListener seekBarChangeListener) {
    this.title = title;
    this.desc = desc;
    this.color = color;
    this.unit = unit;
    this.prop = prop;
    this.seekBarMax = seekBarMax;
    this.seekBarProgress = seekBarProgress;
    this.fa = fa;
    this.listener = seekBarChangeListener;
}
 
Example #11
Source File: UIHelper.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * help to add fragment
 *
 * @param act
 * @param fragment
 */
public static void addFragment(ActionBarActivity act, Fragment fragment){

    FragmentTransaction ft = act.getSupportFragmentManager().beginTransaction();
    ft.add(R.id.main_fragment, fragment, "fragment");
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    ft.addToBackStack(null);
    ft.commit();

}
 
Example #12
Source File: FileImportFragment.java    From secrecy with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    addFilepBar = (ProgressBar) view.findViewById(R.id.progressBar);

    ActionBar ab = ((ActionBarActivity) getActivity()).getSupportActionBar();
    if (ab != null)
        ab.setTitle(R.string.Dialog_header__import_files);

    return view;
}
 
Example #13
Source File: MainActivity.java    From checkey with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    // Start the CAB using the ActionMode.Callback defined above
    ActionBarActivity activity = (ActionBarActivity) getActivity();
    selectedItem = position;
    AppEntry appEntry = (AppEntry) adapter.getItem(selectedItem);
    showCertificateInfo(activity, appEntry.getPackageName());
}
 
Example #14
Source File: BaseFragment.java    From Yahala-Messenger with MIT License 5 votes vote down vote up
public void setParentActivity(ActionBarActivity activity) {
    if (parentActivity != activity) {
        parentActivity = activity;
        if (fragmentView != null) {
            ViewGroup parent = (ViewGroup) fragmentView.getParent();
            if (parent != null) {
                parent.removeView(fragmentView);
            }
            fragmentView = null;
        }
        if (parentActivity != null) {

        }
    }
}
 
Example #15
Source File: EditDetailsFragment.java    From ADP with MIT License 5 votes vote down vote up
@SuppressLint("CommitPrefEdits")
@OnClick(R.id.ok)
public void onSubmitClicked(View v){
    preferences.edit()
            .putString(Config.PREF_URL, mURL.getText().toString())
            .putString(Config.PREF_TOKEN, mToken.getText().toString())
            .commit();

    if(getActivity() instanceof EditDetailsActivity) {
        getActivity().setResult(Activity.RESULT_OK);
        getActivity().finish();
    }else
        VersionsLoadingFragment.replace((ActionBarActivity) getActivity());

}
 
Example #16
Source File: BaseDrawerFragment.java    From android-atleap with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    if (!(activity instanceof ActionBarActivity)) {
        throw new ClassCastException("Activity must extend ActionBarActivity");
    }

    if (activity instanceof NavigationDrawerCallbacks) {
        mCallbacks = (NavigationDrawerCallbacks) activity;
    }

    getActivity().getSupportFragmentManager().addOnBackStackChangedListener(this);
}
 
Example #17
Source File: FilesListFragment.java    From secrecy with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);
    Bundle extras = getActivity().getIntent().getExtras();

    vault = extras.getString(Config.vault_extra);
    password = extras.getString(Config.password_extra);

    if (!EventBus.getDefault().isRegistered(this)) {
        EventBus.getDefault().register(this);
    }
    setRetainInstance(true);

    context = (ActionBarActivity) getActivity();
    if (context == null) {
        return;
    }
    context.getSupportActionBar().setTitle(vault);

    gridLayout = new GridLayoutManager(context, 3);
    listAdapter = new FilesListAdapter(context, false);
    galleryAdapter = new FilesListAdapter(context, true);
    mAdapter = listAdapter;

    if (secret == null) {
        mInitializeDialog = new ProgressDialog(context);
        mInitializeDialog.setIndeterminate(true);
        mInitializeDialog.setMessage(context.getString(R.string.Vault__initializing));
        mInitializeDialog.setCancelable(false);
        mInitializeDialog.show();

        CustomApp.jobManager.addJobInBackground(new InitializeVaultJob(vault, password));
    }
}
 
Example #18
Source File: DownloadingFragment.java    From ADP with MIT License 5 votes vote down vote up
public static void show(ActionBarActivity activity, String fileID) {
    DownloadingFragment f = DownloadingFragment.newInstance(fileID);

    activity.getSupportFragmentManager().beginTransaction()
            .replace(R.id.container, f, TAG)
            .addToBackStack(TAG)
            .commit();
}
 
Example #19
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, String titleColor, int imageRes, ActionBarActivity fa) {
    this.title = title;
    this.desc = desc;
    this.imageRes = imageRes;
    this.titleColor = titleColor;
    this.fa = fa;
}
 
Example #20
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, String unit, int seekBarMax, int seekBarProgress, ActionBarActivity fa, ActionMode.Callback callback) {
    this.title = title;
    this.desc = desc;
    this.unit = unit;
    this.seekBarMax = seekBarMax;
    this.seekBarProgress = seekBarProgress;
    this.fa = fa;
    this.callback = callback;
}
 
Example #21
Source File: UIHelper.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * help to add fragment
 * @param act
 * @param fragment
 */
public static void startFragment(ActionBarActivity act, Fragment fragment, String tag){
    deAttachAllFragments(act);
    FragmentTransaction ft = act.getSupportFragmentManager().beginTransaction();
    Fragment _fragment = act.getSupportFragmentManager().findFragmentByTag(tag);
    if (_fragment != null) {
        ft.show(_fragment);
    }else {
        ft.add(R.id.main_fragment, fragment, tag);
    }
    ft.commitAllowingStateLoss();
    act.getSupportFragmentManager().executePendingTransactions();
}
 
Example #22
Source File: AbstractTabsAdapter.java    From tup.dota2recipe with Apache License 2.0 5 votes vote down vote up
public AbstractTabsAdapter(ActionBarActivity activity, ViewPager pager) {
    super(activity.getSupportFragmentManager());
    mContext = activity;
    mActionBar = activity.getSupportActionBar();
    mViewPager = pager;
    mViewPager.setAdapter(this);
    mViewPager.setOnPageChangeListener(this);
}
 
Example #23
Source File: FadingActionBarHelper.java    From FadingActionBar with Apache License 2.0 5 votes vote down vote up
private ActionBar getActionBar(Activity activity) {
    if (activity instanceof ActionBarActivity) {
        return ((ActionBarActivity) activity).getSupportActionBar();
    }
    ActionBar actionBar = getActionBarWithReflection(activity, "getSupportActionBar");
    if (actionBar == null) {
        throw new RuntimeException("Activity should derive from ActionBarActivity "
            + "or implement a method called getSupportActionBar");
    }
    return actionBar;
}
 
Example #24
Source File: ClassTable.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 展示网络加载异常结果
 * @param ctx
 * @param requestCode
 */
@Override
@UiThread
void showErrorResult(ActionBarActivity ctx, int requestCode){
    swipe_refresh.setRefreshing(false);
    if(requestCode == 404){
        AppMsg.makeText(ctx, R.string.tips_classtable_null, AppMsg.STYLE_ALERT).show();
    }else{
        app.showError(requestCode,ctx);
    }
}
 
Example #25
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, String color, String unit, String prop, int seekBarMax, int seekBarProgress, int seekBarProgress2, ActionBarActivity fa, ActionMode.Callback callback) {
    this.title = title;
    this.desc = desc;
    this.color = color;
    this.unit = unit;
    this.seekBarMax = seekBarMax;
    this.seekBarProgress = seekBarProgress;
    this.seekBarProgress2 = seekBarProgress2;
    this.fa = fa;
    this.prop = prop;
    this.callback = callback;
}
 
Example #26
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, String color, String unit, String prop, int seekBarMin, int seekBarMax, int seekBarProgress, int seekBarProgress2, ActionBarActivity fa, ActionMode.Callback callback) {
    this.title = title;
    this.desc = desc;
    this.color = color;
    this.unit = unit;
    this.seekbarMin = seekBarMin;
    this.seekBarMax = seekBarMax;
    this.seekBarProgress = seekBarProgress;
    this.seekBarProgress2 = seekBarProgress2;
    this.fa = fa;
    this.prop = prop;
    this.callback = callback;
}
 
Example #27
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, ArrayList<String> spinnerEntries, ActionBarActivity fa, AdapterView.OnItemSelectedListener onItemSelectedListener) {
    this.title = title;
    this.desc = desc;
    this.spinnerEntries = spinnerEntries;
    this.fa = fa;
    this.onItemSelectedListener = onItemSelectedListener;
}
 
Example #28
Source File: MaterialMenuIconCompat.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
protected void setActionBarSettings(Activity activity) {
    ActionBar actionBar = ((ActionBarActivity) activity).getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setIcon(getDrawable());
}
 
Example #29
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, String prop, ActionBarActivity fa, CompoundButton.OnCheckedChangeListener onCheckedChangeListener) {
    this.title = title;
    this.desc = desc;
    this.fa = fa;
    this.prop = prop;
    this.onCheckedChangeListener = onCheckedChangeListener;
}
 
Example #30
Source File: Card.java    From Pimp_my_Z1 with GNU General Public License v2.0 5 votes vote down vote up
public Card(String title, String desc, String url, String filePath, String buttonText1, ActionBarActivity fa) {
    this.title = title;
    this.desc = desc;
    this.fa = fa;
    this.url = url;
    this.filePath = filePath;
    this.buttonText1 = buttonText1;
}