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);
}
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;
}
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);
}
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;
}
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();
}
});
}
Aggregations