Search in sources :

Example 1 with FDroidApp

use of org.fdroid.fdroid.FDroidApp in project fdroidclient by f-droid.

the class ManageReposActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    ((FDroidApp) getApplication()).applyTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.repo_list_activity);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final ListView repoList = (ListView) findViewById(R.id.list);
    repoAdapter = RepoAdapter.create(this, null, CursorAdapterCompat.FLAG_AUTO_REQUERY);
    repoAdapter.setEnabledListener(this);
    repoList.setAdapter(repoAdapter);
    repoList.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Repo repo = new Repo((Cursor) repoList.getItemAtPosition(position));
            editRepo(repo);
        }
    });
}
Also used : ListView(android.widget.ListView) Repo(org.fdroid.fdroid.data.Repo) FDroidApp(org.fdroid.fdroid.FDroidApp) AdapterView(android.widget.AdapterView) Cursor(android.database.Cursor) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint)

Example 2 with FDroidApp

use of org.fdroid.fdroid.FDroidApp in project fdroidclient by f-droid.

the class RepoDetailsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    ((FDroidApp) getApplication()).applyTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.repodetails);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    repoView = findViewById(R.id.repoView);
    repoId = getIntent().getLongExtra(ARG_REPO_ID, 0);
    final String[] projection = { RepoTable.Cols.NAME, RepoTable.Cols.ADDRESS, RepoTable.Cols.FINGERPRINT, RepoTable.Cols.MIRRORS, RepoTable.Cols.USER_MIRRORS };
    repo = RepoProvider.Helper.findById(this, repoId, projection);
    TextView inputUrl = (TextView) findViewById(R.id.input_repo_url);
    inputUrl.setText(repo.address);
    if (repo.address.startsWith("content://")) {
        // no need to show a QR Code, it is not shareable
        return;
    }
    Uri uri = Uri.parse(repo.address);
    uri = uri.buildUpon().appendQueryParameter("fingerprint", repo.fingerprint).build();
    String qrUriString = uri.toString();
    new QrGenAsyncTask(this, R.id.qr_code).execute(qrUriString);
}
Also used : FDroidApp(org.fdroid.fdroid.FDroidApp) TextView(android.widget.TextView) Uri(android.net.Uri) QrGenAsyncTask(org.fdroid.fdroid.QrGenAsyncTask) Toolbar(android.support.v7.widget.Toolbar)

Example 3 with FDroidApp

use of org.fdroid.fdroid.FDroidApp in project fdroidclient by f-droid.

the class ScreenShotsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    FDroidApp fdroidApp = (FDroidApp) getApplication();
    fdroidApp.applyTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_screenshots);
    String packageName = getIntent().getStringExtra(EXTRA_PACKAGE_NAME);
    int startPosition = getIntent().getIntExtra(EXTRA_START_POSITION, 0);
    App app = AppProvider.Helper.findHighestPriorityMetadata(getContentResolver(), packageName);
    String[] screenshots = app.getAllScreenshots(this);
    ViewPager viewPager = (ViewPager) findViewById(R.id.screenshot_view_pager);
    ScreenShotPagerAdapter adapter = new ScreenShotPagerAdapter(getSupportFragmentManager(), screenshots);
    viewPager.setAdapter(adapter);
    viewPager.setCurrentItem(startPosition);
    if (Build.VERSION.SDK_INT >= 11) {
        // display some nice animation while swiping
        viewPager.setPageTransformer(true, new DepthPageTransformer());
    }
}
Also used : FDroidApp(org.fdroid.fdroid.FDroidApp) App(org.fdroid.fdroid.data.App) FDroidApp(org.fdroid.fdroid.FDroidApp) ViewPager(android.support.v4.view.ViewPager)

Example 4 with FDroidApp

use of org.fdroid.fdroid.FDroidApp in project fdroidclient by f-droid.

the class AppListActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    ((FDroidApp) getApplication()).applyTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_app_list);
    searchInput = (EditText) findViewById(R.id.search);
    searchInput.addTextChangedListener(new CategoryTextWatcher(this, searchInput, this));
    searchInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
                // Hide the keyboard (http://stackoverflow.com/a/1109108 (when pressing search)
                InputMethodManager inputManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
                inputManager.hideSoftInputFromWindow(searchInput.getWindowToken(), 0);
                // Change focus from the search input to the app list.
                appView.requestFocus();
                return true;
            }
            return false;
        }
    });
    sortImage = (ImageView) findViewById(R.id.sort);
    if (FDroidApp.isAppThemeLight()) {
        sortImage.setImageResource(R.drawable.ic_last_updated_black);
    } else {
        sortImage.setImageResource(R.drawable.ic_last_updated_white);
    }
    sortImage.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (sortClauseSelected.equalsIgnoreCase(SortClause.LAST_UPDATED)) {
                sortClauseSelected = SortClause.NAME;
                if (FDroidApp.isAppThemeLight()) {
                    sortImage.setImageResource(R.drawable.ic_az_black);
                } else {
                    sortImage.setImageResource(R.drawable.ic_az_white);
                }
            } else {
                sortClauseSelected = SortClause.LAST_UPDATED;
                if (FDroidApp.isAppThemeLight()) {
                    sortImage.setImageResource(R.drawable.ic_last_updated_black);
                } else {
                    sortImage.setImageResource(R.drawable.ic_last_updated_white);
                }
            }
            getSupportLoaderManager().restartLoader(0, null, AppListActivity.this);
            appView.scrollToPosition(0);
        }
    });
    emptyState = (TextView) findViewById(R.id.empty_state);
    View backButton = findViewById(R.id.back);
    backButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    View clearButton = findViewById(R.id.clear);
    clearButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            searchInput.setText("");
        }
    });
    appAdapter = new AppListAdapter(this);
    appView = (RecyclerView) findViewById(R.id.app_list);
    appView.setHasFixedSize(true);
    appView.setLayoutManager(new LinearLayoutManager(this));
    appView.setAdapter(appAdapter);
    appView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        private final ImageLoader imageLoader = ImageLoader.getInstance();

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            switch(newState) {
                case RecyclerView.SCROLL_STATE_DRAGGING:
                    imageLoader.pause();
                    break;
                case RecyclerView.SCROLL_STATE_IDLE:
                    imageLoader.resume();
                    break;
            }
            super.onScrollStateChanged(recyclerView, newState);
        }
    });
    parseIntentForSearchQuery();
}
Also used : FDroidApp(org.fdroid.fdroid.FDroidApp) InputMethodManager(android.view.inputmethod.InputMethodManager) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) KeyEvent(android.view.KeyEvent) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) ImageLoader(com.nostra13.universalimageloader.core.ImageLoader)

Example 5 with FDroidApp

use of org.fdroid.fdroid.FDroidApp in project fdroidclient by f-droid.

the class MainActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    ((FDroidApp) getApplication()).applyTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    adapter = new MainViewAdapter(this);
    pager = (RecyclerView) findViewById(R.id.main_view_pager);
    pager.setHasFixedSize(true);
    pager.setLayoutManager(new NonScrollingHorizontalLayoutManager(this));
    pager.setAdapter(adapter);
    // reverting back to the "Latest" screen again, in completely non-deterministic ways.
    if (Build.VERSION.SDK_INT <= 15) {
        pager.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
    }
    updatesBadge = new BadgeItem().hide(false);
    bottomNavigation = (BottomNavigationBar) findViewById(R.id.bottom_navigation);
    bottomNavigation.setTabSelectedListener(this).setBarBackgroundColor(getBottomNavigationBackgroundColorResId()).setInActiveColor(R.color.bottom_nav_items).setActiveColor(android.R.color.white).setMode(BottomNavigationBar.MODE_FIXED).addItem(new BottomNavigationItem(R.drawable.ic_latest, R.string.main_menu__latest_apps)).addItem(new BottomNavigationItem(R.drawable.ic_categories, R.string.main_menu__categories)).addItem(new BottomNavigationItem(R.drawable.ic_nearby, R.string.main_menu__swap_nearby)).addItem(new BottomNavigationItem(R.drawable.ic_updates, R.string.updates).setBadgeItem(updatesBadge)).addItem(new BottomNavigationItem(R.drawable.ic_settings, R.string.menu_settings)).initialise();
    IntentFilter updateableAppsFilter = new IntentFilter(AppUpdateStatusManager.BROADCAST_APPSTATUS_LIST_CHANGED);
    updateableAppsFilter.addAction(AppUpdateStatusManager.BROADCAST_APPSTATUS_CHANGED);
    updateableAppsFilter.addAction(AppUpdateStatusManager.BROADCAST_APPSTATUS_REMOVED);
    LocalBroadcastManager.getInstance(this).registerReceiver(onUpdateableAppsChanged, updateableAppsFilter);
    if (savedInstanceState != null) {
        selectedMenuId = savedInstanceState.getInt(STATE_SELECTED_MENU_ID, R.id.whats_new);
    }
    setSelectedMenuInNav();
    initialRepoUpdateIfRequired();
    Intent intent = getIntent();
    handleSearchOrAppViewIntent(intent);
}
Also used : IntentFilter(android.content.IntentFilter) FDroidApp(org.fdroid.fdroid.FDroidApp) Intent(android.content.Intent) BadgeItem(com.ashokvarma.bottomnavigation.BadgeItem) BottomNavigationItem(com.ashokvarma.bottomnavigation.BottomNavigationItem)

Aggregations

FDroidApp (org.fdroid.fdroid.FDroidApp)9 Toolbar (android.support.v7.widget.Toolbar)3 TextView (android.widget.TextView)3 Intent (android.content.Intent)2 Uri (android.net.Uri)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 View (android.view.View)2 SuppressLint (android.annotation.SuppressLint)1 PendingIntent (android.app.PendingIntent)1 IntentFilter (android.content.IntentFilter)1 Cursor (android.database.Cursor)1 ViewPager (android.support.v4.view.ViewPager)1 ActionBar (android.support.v7.app.ActionBar)1 RecyclerView (android.support.v7.widget.RecyclerView)1 KeyEvent (android.view.KeyEvent)1 InputMethodManager (android.view.inputmethod.InputMethodManager)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 BadgeItem (com.ashokvarma.bottomnavigation.BadgeItem)1