Search in sources :

Example 26 with FilterShowActivity

use of com.android.gallery3d.filtershow.FilterShowActivity in project android_packages_apps_Gallery2 by LineageOS.

the class MainPanel method loadWaterMarkPanel.

public void loadWaterMarkPanel() {
    if (mCurrentSelected == WATERMARK) {
        return;
    }
    boolean fromRight = isRightAnimation(WATERMARK);
    selection(mCurrentSelected, false);
    CategoryPanel categoryPanel = new CategoryPanel();
    categoryPanel.setAdapter(WATERMARK);
    setCategoryFragment(categoryPanel, fromRight);
    mCurrentSelected = WATERMARK;
    selection(mCurrentSelected, true);
    final FilterShowActivity activity = (FilterShowActivity) getActivity();
    // String url = "http://api.map.baidu.com/location/ip?ak=PR0TaSQODfSbVr7hkcNF4NkAYEixoxSy&coor=bd09ll";
    String url = "";
    new AsyncTask<String, Void, String>() {

        @Override
        protected String doInBackground(String... strings) {
            HttpURLConnection connection = null;
            String location = "";
            try {
                URL url = new URL(strings[0]);
                connection = (HttpURLConnection) url.openConnection();
                connection.setRequestMethod("GET");
                connection.setRequestProperty("Charset", "UTF-8");
                connection.connect();
                if (connection.getResponseCode() == 200) {
                    String result = WaterMarkView.convertStream2String(connection.getInputStream());
                    JSONObject resultJson = new JSONObject(result);
                    location = resultJson.getJSONObject("content").getString("address");
                    if (!TextUtils.isEmpty(location)) {
                        getWeather(activity, location);
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                if (connection != null) {
                    connection.disconnect();
                }
            }
            return location;
        }

        @Override
        protected void onPostExecute(String s) {
            activity.setLocation(s);
        }
    }.execute(url);
}
Also used : HttpURLConnection(java.net.HttpURLConnection) JSONObject(org.json.JSONObject) FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity) URL(java.net.URL)

Example 27 with FilterShowActivity

use of com.android.gallery3d.filtershow.FilterShowActivity in project android_packages_apps_Gallery2 by LineageOS.

the class MainPanel method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mMainView = (LinearLayout) inflater.inflate(R.layout.filtershow_main_panel, null, false);
    getBottomPanelView(inflater);
    initBottomPanel();
    FilterShowActivity activity = (FilterShowActivity) getActivity();
    showPanel(activity.getCurrentPanel());
    return mMainView;
}
Also used : FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity)

Example 28 with FilterShowActivity

use of com.android.gallery3d.filtershow.FilterShowActivity in project android_packages_apps_Gallery2 by LineageOS.

the class MainPanel method loadCategoryVersionsPanel.

public void loadCategoryVersionsPanel() {
    if (mCurrentSelected == VERSIONS) {
        return;
    }
    FilterShowActivity activity = (FilterShowActivity) getActivity();
    activity.updateVersions();
    boolean fromRight = isRightAnimation(VERSIONS);
    selection(mCurrentSelected, false);
    CategoryPanel categoryPanel = new CategoryPanel();
    categoryPanel.setAdapter(VERSIONS);
    setCategoryFragment(categoryPanel, fromRight);
    mCurrentSelected = VERSIONS;
    selection(mCurrentSelected, true);
}
Also used : FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity)

Example 29 with FilterShowActivity

use of com.android.gallery3d.filtershow.FilterShowActivity in project android_packages_apps_Gallery2 by LineageOS.

the class CategoryPanelLevelTwo method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    LinearLayout main = (LinearLayout) inflater.inflate(R.layout.filtershow_category_panel_two, container, false);
    FiltersManager filtersManager = FiltersManager.getManager();
    mFiltersRepresentations = filtersManager.getWaterMarks();
    mBottomPanel = main.findViewById(R.id.bottom_panel);
    mExitButton = (ImageButton) main.findViewById(R.id.cancel);
    mApplyButton = (ImageButton) main.findViewById(R.id.done);
    final FilterShowActivity activity = (FilterShowActivity) getActivity();
    mApplyButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // Todo xukd add watermark to bufferimage
            activity.disableTouchEvent();
            activity.backToMain();
            activity.setActionBar();
        }
    });
    mExitButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            activity.cancelCurrentFilter();
            activity.backToMain();
            activity.setActionBar();
        }
    });
    mEditName = (TextView) main.findViewById(R.id.editor_name);
    int adapterId = mCurrentAdapter % FilterWatermarkRepresentation.LOCATION;
    if (adapterId >= 0 && adapterId < mFiltersRepresentations.size()) {
        mEditName.setText(mFiltersRepresentations.get(adapterId).getTextId());
    } else {
        mEditName.setText(DEFAULT_NAME);
    }
    View panelView = main.findViewById(R.id.listItems);
    if (panelView instanceof CategoryTrack) {
        CategoryTrack panel = (CategoryTrack) panelView;
        if (mAdapter != null) {
            mAdapter.setOrientation(CategoryView.HORIZONTAL);
            panel.setAdapter(mAdapter);
            mAdapter.setContainer(panel);
        }
    }
    mAddButton = (IconView) main.findViewById(R.id.addButton);
    if (mAddButton != null) {
        mAddButton.setOnClickListener(this);
        updateAddButtonVisibility();
    }
    return main;
}
Also used : FiltersManager(com.android.gallery3d.filtershow.filters.FiltersManager) FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity) TextView(android.widget.TextView) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 30 with FilterShowActivity

use of com.android.gallery3d.filtershow.FilterShowActivity in project android_packages_apps_Gallery2 by LineageOS.

the class TrueScannerPanel method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mEditorName.setText(R.string.truescanner);
    mBottomPanel.setVisibility(View.VISIBLE);
    final FilterShowActivity activity = (FilterShowActivity) getActivity();
    if (mTrueScannerEditor == null) {
        mTrueScannerEditor = (TrueScannerEditor) activity.getEditor(TrueScannerEditor.ID);
    }
    if (mTrueScannerEditor != null) {
        mTrueScannerEditor.initCords();
    }
    mExitButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            activity.cancelCurrentFilter();
            activity.backToMain();
            activity.setActionBar();
        }
    });
    mApplyButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (mTrueScannerEditor != null) {
                mTrueScannerEditor.finalApplyCalled();
            }
            activity.backToMain();
            activity.setActionBar();
        }
    });
}
Also used : FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity) View(android.view.View)

Aggregations

FilterShowActivity (com.android.gallery3d.filtershow.FilterShowActivity)48 View (android.view.View)11 Button (android.widget.Button)6 FragmentTransaction (android.support.v4.app.FragmentTransaction)5 TextView (android.widget.TextView)5 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)5 MenuItem (android.view.MenuItem)4 PopupMenu (android.widget.PopupMenu)4 DialogInterface (android.content.DialogInterface)3 LayoutInflater (android.view.LayoutInflater)3 ViewGroup (android.view.ViewGroup)3 Point (android.graphics.Point)2 Fragment (android.support.v4.app.Fragment)2 FragmentManager (android.support.v4.app.FragmentManager)2 OnClickListener (android.view.View.OnClickListener)2 ImageButton (android.widget.ImageButton)2 MasterImage (com.android.gallery3d.filtershow.imageshow.MasterImage)2 StatePanel (com.android.gallery3d.filtershow.state.StatePanel)2 DoNotShowAgainDialog (com.android.gallery3d.filtershow.ui.DoNotShowAgainDialog)2 AlertDialog (android.app.AlertDialog)1