mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-06-30 21:04:16 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
|
@ -0,0 +1,452 @@
|
|||
package com.adins.mss.odr;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.adins.mss.base.ChangePasswordFragment;
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.about.activity.AboutActivity;
|
||||
import com.adins.mss.base.mainmenu.MainMenuActivity;
|
||||
import com.adins.mss.base.mainmenu.MainMenuHelper;
|
||||
import com.adins.mss.base.tasklog.TaskLogImpl;
|
||||
import com.adins.mss.base.timeline.MenuAdapter;
|
||||
import com.adins.mss.base.timeline.MenuModel;
|
||||
import com.adins.mss.base.todolist.ToDoList;
|
||||
import com.adins.mss.base.todolist.form.StatusTabFragment;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.odr.assignment.OrderAssignmentTask;
|
||||
import com.adins.mss.odr.news.NewsHeaderTask;
|
||||
import com.adins.mss.odr.simulasi.CreditSimulationActivity;
|
||||
import com.services.MainServices;
|
||||
import com.services.NotificationThread;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MOMainMenuActivity extends MainMenuActivity {
|
||||
|
||||
public static MenuModel mnTimeline;
|
||||
public static MenuModel mnNewOdr;
|
||||
public static MenuModel mnCheckOdr;
|
||||
public static MenuModel mnCreditSimulation;
|
||||
public static MenuModel mnOdrAssignment;
|
||||
public static MenuModel mnOdrReAssignment;
|
||||
public static MenuModel mnUpdateOdr;
|
||||
public static MenuModel mnAbsentI;
|
||||
public static MenuModel mnAbsentO;
|
||||
public static MenuModel mnNews;
|
||||
public static MenuModel mnExit;
|
||||
public static MenuModel mnAbout;
|
||||
public static MenuModel mnSynchronize;
|
||||
public static MenuModel mnStgProfile;
|
||||
public static MenuModel mnChangePassword;
|
||||
public static int flag_edit = 0;
|
||||
public static boolean inAbsent = false;
|
||||
public Intent RunNotificationNewsService;
|
||||
Fragment fragment;
|
||||
ChangePasswordFragment fragmentChgPwd;
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private ListView mDrawerListLeft;
|
||||
|
||||
@Override
|
||||
protected ArrayList<MenuModel> getModels() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
ArrayList<MenuModel> models = new ArrayList<MenuModel>();
|
||||
MenuModel titleGroup1 = new MenuModel(getString(R.string.title_mn_main_menu));
|
||||
titleGroup1.isGroupHeader();
|
||||
MenuModel titleGroup2 = new MenuModel(getString(R.string.title_mn_other));
|
||||
titleGroup2.isGroupHeader();
|
||||
|
||||
mnTimeline = new MenuModel(R.drawable.ic_home, getString(R.string.title_mn_home), null);
|
||||
models.add(titleGroup1);
|
||||
models.add(mnTimeline);
|
||||
List<String> mainMenuTitle = getMainMenuTitle();
|
||||
List<Integer> mainMenuIcon = getMainMenuIcon();
|
||||
for (int i = 0; i < mainMenuTitle.size(); i++) {
|
||||
if (mainMenuTitle.get(i).equalsIgnoreCase(getString(R.string.title_mn_tasklist))) {
|
||||
mnTaskList = new MenuModel(mainMenuIcon.get(i), mainMenuTitle.get(i), "0");
|
||||
models.add(mnTaskList);
|
||||
} else if (getMainMenuTitle().get(i).equalsIgnoreCase(getString(R.string.title_mn_log))) {
|
||||
mnLog = new MenuModel(mainMenuIcon.get(i), mainMenuTitle.get(i), "0");
|
||||
models.add(mnLog);
|
||||
} else {
|
||||
models.add(new MenuModel(mainMenuIcon.get(i), mainMenuTitle.get(i), null));
|
||||
}
|
||||
}
|
||||
|
||||
models.add(titleGroup2);
|
||||
List<String> otherMenuTitle = getOtherMenuTitle();
|
||||
List<Integer> otherMenuIcon = getOtherMenuIcon();
|
||||
// mnChangePassword = new MenuModel(R.drawable.ic_changepassword,getString(R.string.title_mn_changepassword), null);
|
||||
// models.add(mnChangePassword);
|
||||
for (int i = 0; i < otherMenuTitle.size(); i++) {
|
||||
models.add(new MenuModel(otherMenuIcon.get(i), otherMenuTitle.get(i), null));
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < models.size(); i++) {
|
||||
this.allMenu.add(models.get(i).getTitle());
|
||||
}
|
||||
|
||||
this.models = models;
|
||||
|
||||
return models;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTitleGroup() {
|
||||
// TODO Auto-generated method stub
|
||||
return "Order";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// TODO Auto-generated method stub
|
||||
MainMenuActivity.setMss(this.getClass());
|
||||
super.onCreate(savedInstanceState);
|
||||
AboutActivity.setChangeLog(ChangeLog.getChangeLog(getApplicationContext()), 1);
|
||||
mDrawerLayout = findViewById(R.id.drawer_layout);
|
||||
mDrawerListLeft = findViewById(R.id.left_drawer);
|
||||
menuAdapter = new MenuAdapter(this, getModels(), R.drawable.activated_background_indicator);
|
||||
mDrawerListLeft.setAdapter(menuAdapter);
|
||||
|
||||
mDrawerListLeft.setOnItemClickListener(this);
|
||||
|
||||
//setcounter
|
||||
try {
|
||||
long newsCounter = News.getCounterNews(this);
|
||||
long logCounter = TaskLogImpl.getCounterLog(this);
|
||||
long taskListCounter = ToDoList.getCounterTaskList(this);
|
||||
|
||||
// MOMainMenuActivity.mnNews.setCounter(String.valueOf(newsCounter));
|
||||
mnLog.setCounter(String.valueOf(logCounter));
|
||||
mnTaskList.setCounter(String.valueOf(taskListCounter));
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
if (savedInstanceState == null) {
|
||||
goTimeline(1);
|
||||
Global.positionStack.push(1);
|
||||
}
|
||||
|
||||
/*System.out.println("Before start RunNotificationNewsService");
|
||||
RunNotificationNewsService = new Intent(this, NotificationNewsService.class);
|
||||
startService(RunNotificationNewsService);
|
||||
System.out.println("Start RunNotificationNewsService");*/
|
||||
try {
|
||||
actionFromNotif(getIntent());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
protected void actionFromNotif(Intent intent) {
|
||||
try {
|
||||
String action = intent.getAction();
|
||||
if (action != null) {
|
||||
if (action.equals(NotificationThread.TASKLIST_NOTIFICATION_KEY)) {
|
||||
gotoTaskList(0);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
actionFromNotif(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Global.syncIntent = new Intent(getApplicationContext(), MOSynchronizeActivity.class);
|
||||
if (MainMenuActivity.getMss() == null) {
|
||||
MainMenuActivity.setMss(this.getClass());
|
||||
// NotificationService.mss = mss;
|
||||
MainServices.mainClass = mss;
|
||||
}
|
||||
MainMenuActivity.setMainMenuClass(MOMainMenuActivity.class);
|
||||
try {
|
||||
final long logCounter = TaskLogImpl.getCounterLog(this);
|
||||
final long taskListCounter = ToDoList.getCounterTaskList(this);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mnLog.setCounter(String.valueOf(logCounter));
|
||||
mnTaskList.setCounter(String.valueOf(taskListCounter));
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
getActionBar().removeAllTabs();
|
||||
getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, final int position,
|
||||
long id) {
|
||||
// TODO Auto-generated method stub
|
||||
super.onItemClick(parent, view, position, id);
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (getString(R.string.title_mn_changepassword).equalsIgnoreCase(allMenu.get(position))) {
|
||||
gotoChangePassword();
|
||||
}
|
||||
}
|
||||
}, 250);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getIntentSynchronize() {
|
||||
// TODO Auto-generated method stub
|
||||
return new Intent(this, MOSynchronizeActivity.class);
|
||||
}
|
||||
|
||||
//bong 10 apr 15 - menjaga saat change password tidak dapat lihat menu
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||
if (fragmentChgPwd != null) {
|
||||
if (fragmentChgPwd.isVisible()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
//bong 7 apr 15 disabled onBackpressed on fragment
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// TODO Auto-generated method stub
|
||||
if (fragmentChgPwd != null) {
|
||||
if (fragmentChgPwd.isVisible()) {
|
||||
if (GlobalData.getSharedGlobalData().getUser().getChg_pwd().equals("1")) {
|
||||
ChangePasswordFragment.onBackPressed();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
private void gotoChangePassword() {
|
||||
fragment = new ChangePasswordFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean(ChangePasswordFragment.AS_ACTIVITY, false);
|
||||
fragment.setArguments(args);
|
||||
if (GlobalData.getSharedGlobalData().getUser().getChg_pwd().equals("1") ||
|
||||
GlobalData.getSharedGlobalData().getUser().getPwd_exp().equals("1")) {
|
||||
fragmentChgPwd = (ChangePasswordFragment) fragment;
|
||||
fragmentChgPwd.setArguments(args);
|
||||
}
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Fragment getChgPassFragment() {
|
||||
// TODO Auto-generated method stub
|
||||
return fragmentChgPwd;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void goTimeline(int position) {
|
||||
// TimelineModel.status_fragment=new StatusSectionFragment();
|
||||
super.goTimeline(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoNewTask(int position) {
|
||||
// GetSchemeTask task = new GetSchemeTask(this, new MONewTaskActivity(), true);
|
||||
// task.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoCheckOrder(int position) {
|
||||
fragment = new CheckOrderActivity();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoCreditSimulation(int position) {
|
||||
fragment = new CreditSimulationActivity();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoCancelOrder(int position) {
|
||||
fragment = new OrderFilterActivity();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(Global.BUND_KEY_TASK_TYPE, Global.TASK_CANCEL_ORDER);
|
||||
fragment.setArguments(args);
|
||||
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoTaskList(int position) {
|
||||
fragment = new StatusTabFragment();
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoPromo(int position) {
|
||||
NewsHeaderTask task = new NewsHeaderTask(this, getString(R.string.progressWait),
|
||||
getString(R.string.msgNoList), R.id.content_frame);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoNews(int position) {
|
||||
NewsHeaderTask task = new NewsHeaderTask(this, getString(R.string.progressWait),
|
||||
getString(R.string.msgNoList), R.id.content_frame);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoAbout() {
|
||||
AboutActivity.setChangeLog(ChangeLog.getChangeLog(getApplicationContext()), 1);
|
||||
super.gotoAbout();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyPerformance(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyVerification(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyApproval(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoOrderAssignment(int position) {
|
||||
OrderAssignmentTask task = new OrderAssignmentTask(this, getString(R.string.progressWait),
|
||||
getString(R.string.msgNoList), R.id.content_frame);
|
||||
task.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoOrderReassignment(int position) {
|
||||
fragment = new OrderFilterActivity();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(Global.BUND_KEY_TASK_TYPE, Global.TASK_ORDER_REASSIGNMENT);
|
||||
fragment.setArguments(args);
|
||||
|
||||
FragmentTransaction transaction = MainMenuActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate, R.anim.activity_close_scale, R.anim.activity_open_scale, R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyAssignment(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyReassignment(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoReportSummary(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoDepositReport(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoPaymentHistory(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoInstallmentSchedule(int position) {
|
||||
showNotAvailableMenu(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoClosingTask(int position) {
|
||||
|
||||
}
|
||||
|
||||
public void showNotAvailableMenu(int position) {
|
||||
MainMenuHelper.showNotAvailableMenuDialog(MOMainMenuActivity.this, allMenu.get(position));
|
||||
Global.positionStack.pop();
|
||||
mDrawerListLeft.setItemChecked(Global.positionStack.lastElement(), true);
|
||||
setTitle(models.get(Global.positionStack.lastElement()).getTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyVerificationByBranch(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoSurveyApprovalByBranch(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,535 @@
|
|||
/*
|
||||
* Copyright 2013, Edmodo, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License.
|
||||
* You may obtain a copy of the License in the LICENSE file, or at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
|
||||
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package com.edmodo.cropper.cropwindow.edge;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import com.edmodo.cropper.util.AspectRatioUtil;
|
||||
|
||||
/**
|
||||
* Enum representing an edge in the crop window.
|
||||
*/
|
||||
public enum Edge {
|
||||
|
||||
LEFT,
|
||||
TOP,
|
||||
RIGHT,
|
||||
BOTTOM;
|
||||
|
||||
// Private Constants ///////////////////////////////////////////////////////
|
||||
|
||||
// Minimum distance in pixels that one edge can get to its opposing edge.
|
||||
// This is an arbitrary value that simply prevents the crop window from
|
||||
// becoming too small.
|
||||
public static final int MIN_CROP_LENGTH_PX = 40;
|
||||
|
||||
// Member Variables ////////////////////////////////////////////////////////
|
||||
|
||||
private float mCoordinate;
|
||||
|
||||
// Public Methods //////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Gets the current width of the crop window.
|
||||
*/
|
||||
public static float getWidth() {
|
||||
return Edge.RIGHT.getCoordinate() - Edge.LEFT.getCoordinate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current height of the crop window.
|
||||
*/
|
||||
public static float getHeight() {
|
||||
return Edge.BOTTOM.getCoordinate() - Edge.TOP.getCoordinate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the resulting x-position of the left edge of the crop window given
|
||||
* the handle's position and the image's bounding box and snap radius.
|
||||
*
|
||||
* @param x the x-position that the left edge is dragged to
|
||||
* @param imageRect the bounding box of the image that is being cropped
|
||||
* @param imageSnapRadius the snap distance to the image edge (in pixels)
|
||||
* @return the actual x-position of the left edge
|
||||
*/
|
||||
private static float adjustLeft(float x, Rect imageRect, float imageSnapRadius, float aspectRatio) {
|
||||
|
||||
float resultX = x;
|
||||
|
||||
if (x - imageRect.left < imageSnapRadius)
|
||||
resultX = imageRect.left;
|
||||
|
||||
else {
|
||||
// Select the minimum of the three possible values to use
|
||||
float resultXHoriz = Float.POSITIVE_INFINITY;
|
||||
float resultXVert = Float.POSITIVE_INFINITY;
|
||||
|
||||
// Checks if the window is too small horizontally
|
||||
if (x >= Edge.RIGHT.getCoordinate() - MIN_CROP_LENGTH_PX)
|
||||
resultXHoriz = Edge.RIGHT.getCoordinate() - MIN_CROP_LENGTH_PX;
|
||||
|
||||
// Checks if the window is too small vertically
|
||||
if (((Edge.RIGHT.getCoordinate() - x) / aspectRatio) <= MIN_CROP_LENGTH_PX)
|
||||
resultXVert = Edge.RIGHT.getCoordinate() - (MIN_CROP_LENGTH_PX * aspectRatio);
|
||||
|
||||
resultX = Math.min(resultX, Math.min(resultXHoriz, resultXVert));
|
||||
}
|
||||
return resultX;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the resulting x-position of the right edge of the crop window given
|
||||
* the handle's position and the image's bounding box and snap radius.
|
||||
*
|
||||
* @param x the x-position that the right edge is dragged to
|
||||
* @param imageRect the bounding box of the image that is being cropped
|
||||
* @param imageSnapRadius the snap distance to the image edge (in pixels)
|
||||
* @return the actual x-position of the right edge
|
||||
*/
|
||||
private static float adjustRight(float x, Rect imageRect, float imageSnapRadius, float aspectRatio) {
|
||||
|
||||
float resultX = x;
|
||||
|
||||
// If close to the edge
|
||||
if (imageRect.right - x < imageSnapRadius)
|
||||
resultX = imageRect.right;
|
||||
|
||||
else {
|
||||
// Select the maximum of the three possible values to use
|
||||
float resultXHoriz = Float.NEGATIVE_INFINITY;
|
||||
float resultXVert = Float.NEGATIVE_INFINITY;
|
||||
|
||||
// Checks if the window is too small horizontally
|
||||
if (x <= Edge.LEFT.getCoordinate() + MIN_CROP_LENGTH_PX)
|
||||
resultXHoriz = Edge.LEFT.getCoordinate() + MIN_CROP_LENGTH_PX;
|
||||
|
||||
// Checks if the window is too small vertically
|
||||
if (((x - Edge.LEFT.getCoordinate()) / aspectRatio) <= MIN_CROP_LENGTH_PX) {
|
||||
resultXVert = Edge.LEFT.getCoordinate() + (MIN_CROP_LENGTH_PX * aspectRatio);
|
||||
}
|
||||
|
||||
resultX = Math.max(resultX, Math.max(resultXHoriz, resultXVert));
|
||||
|
||||
}
|
||||
|
||||
return resultX;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the resulting y-position of the top edge of the crop window given the
|
||||
* handle's position and the image's bounding box and snap radius.
|
||||
*
|
||||
* @param y the x-position that the top edge is dragged to
|
||||
* @param imageRect the bounding box of the image that is being cropped
|
||||
* @param imageSnapRadius the snap distance to the image edge (in pixels)
|
||||
* @return the actual y-position of the top edge
|
||||
*/
|
||||
private static float adjustTop(float y, Rect imageRect, float imageSnapRadius, float aspectRatio) {
|
||||
|
||||
float resultY = y;
|
||||
|
||||
if (y - imageRect.top < imageSnapRadius)
|
||||
resultY = imageRect.top;
|
||||
|
||||
else {
|
||||
// Select the minimum of the three possible values to use
|
||||
float resultYVert = Float.POSITIVE_INFINITY;
|
||||
float resultYHoriz = Float.POSITIVE_INFINITY;
|
||||
|
||||
// Checks if the window is too small vertically
|
||||
if (y >= Edge.BOTTOM.getCoordinate() - MIN_CROP_LENGTH_PX)
|
||||
resultYHoriz = Edge.BOTTOM.getCoordinate() - MIN_CROP_LENGTH_PX;
|
||||
|
||||
// Checks if the window is too small horizontally
|
||||
if (((Edge.BOTTOM.getCoordinate() - y) * aspectRatio) <= MIN_CROP_LENGTH_PX)
|
||||
resultYVert = Edge.BOTTOM.getCoordinate() - (MIN_CROP_LENGTH_PX / aspectRatio);
|
||||
|
||||
resultY = Math.min(resultY, Math.min(resultYHoriz, resultYVert));
|
||||
|
||||
}
|
||||
|
||||
return resultY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the resulting y-position of the bottom edge of the crop window given
|
||||
* the handle's position and the image's bounding box and snap radius.
|
||||
*
|
||||
* @param y the x-position that the bottom edge is dragged to
|
||||
* @param imageRect the bounding box of the image that is being cropped
|
||||
* @param imageSnapRadius the snap distance to the image edge (in pixels)
|
||||
* @return the actual y-position of the bottom edge
|
||||
*/
|
||||
private static float adjustBottom(float y, Rect imageRect, float imageSnapRadius, float aspectRatio) {
|
||||
|
||||
float resultY = y;
|
||||
|
||||
if (imageRect.bottom - y < imageSnapRadius)
|
||||
resultY = imageRect.bottom;
|
||||
else {
|
||||
// Select the maximum of the three possible values to use
|
||||
float resultYVert = Float.NEGATIVE_INFINITY;
|
||||
float resultYHoriz = Float.NEGATIVE_INFINITY;
|
||||
|
||||
// Checks if the window is too small vertically
|
||||
if (y <= Edge.TOP.getCoordinate() + MIN_CROP_LENGTH_PX)
|
||||
resultYVert = Edge.TOP.getCoordinate() + MIN_CROP_LENGTH_PX;
|
||||
|
||||
// Checks if the window is too small horizontally
|
||||
if (((y - Edge.TOP.getCoordinate()) * aspectRatio) <= MIN_CROP_LENGTH_PX)
|
||||
resultYHoriz = Edge.TOP.getCoordinate() + (MIN_CROP_LENGTH_PX / aspectRatio);
|
||||
|
||||
resultY = Math.max(resultY, Math.max(resultYHoriz, resultYVert));
|
||||
}
|
||||
|
||||
return resultY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given number of pixels to the current coordinate position of this
|
||||
* Edge.
|
||||
*
|
||||
* @param distance the number of pixels to add
|
||||
*/
|
||||
public void offset(float distance) {
|
||||
mCoordinate += distance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the coordinate of the Edge
|
||||
*
|
||||
* @return the Edge coordinate (x-coordinate for LEFT and RIGHT Edges and
|
||||
* the y-coordinate for TOP and BOTTOM edges)
|
||||
*/
|
||||
public float getCoordinate() {
|
||||
return mCoordinate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the coordinate of the Edge. The coordinate will represent the
|
||||
* x-coordinate for LEFT and RIGHT Edges and the y-coordinate for TOP and
|
||||
* BOTTOM edges.
|
||||
*
|
||||
* @param coordinate the position of the edge
|
||||
*/
|
||||
public void setCoordinate(float coordinate) {
|
||||
mCoordinate = coordinate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Edge to the given x-y coordinate but also adjusting for snapping
|
||||
* to the image bounds and parent view border constraints.
|
||||
*
|
||||
* @param x the x-coordinate
|
||||
* @param y the y-coordinate
|
||||
* @param imageRect the bounding rectangle of the image
|
||||
* @param imageSnapRadius the radius (in pixels) at which the edge should
|
||||
* snap to the image
|
||||
*/
|
||||
public void adjustCoordinate(float x, float y, Rect imageRect, float imageSnapRadius, float aspectRatio) {
|
||||
|
||||
switch (this) {
|
||||
case LEFT:
|
||||
mCoordinate = adjustLeft(x, imageRect, imageSnapRadius, aspectRatio);
|
||||
break;
|
||||
case TOP:
|
||||
mCoordinate = adjustTop(y, imageRect, imageSnapRadius, aspectRatio);
|
||||
break;
|
||||
case RIGHT:
|
||||
mCoordinate = adjustRight(x, imageRect, imageSnapRadius, aspectRatio);
|
||||
break;
|
||||
case BOTTOM:
|
||||
mCoordinate = adjustBottom(y, imageRect, imageSnapRadius, aspectRatio);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts this Edge position such that the resulting window will have the
|
||||
* given aspect ratio.
|
||||
*
|
||||
* @param aspectRatio the aspect ratio to achieve
|
||||
*/
|
||||
public void adjustCoordinate(float aspectRatio) {
|
||||
|
||||
final float left = Edge.LEFT.getCoordinate();
|
||||
final float top = Edge.TOP.getCoordinate();
|
||||
final float right = Edge.RIGHT.getCoordinate();
|
||||
final float bottom = Edge.BOTTOM.getCoordinate();
|
||||
|
||||
switch (this) {
|
||||
case LEFT:
|
||||
mCoordinate = AspectRatioUtil.calculateLeft(top, right, bottom, aspectRatio);
|
||||
break;
|
||||
case TOP:
|
||||
mCoordinate = AspectRatioUtil.calculateTop(left, right, bottom, aspectRatio);
|
||||
break;
|
||||
case RIGHT:
|
||||
mCoordinate = AspectRatioUtil.calculateRight(left, top, bottom, aspectRatio);
|
||||
break;
|
||||
case BOTTOM:
|
||||
mCoordinate = AspectRatioUtil.calculateBottom(left, top, right, aspectRatio);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not you can re-scale the image based on whether any edge would be out of bounds.
|
||||
* Checks all the edges for a possibility of jumping out of bounds.
|
||||
*
|
||||
* @param Edge the Edge that is about to be expanded
|
||||
* @param imageRect the rectangle of the picture
|
||||
* @param aspectratio the desired aspectRatio of the picture.
|
||||
* @return whether or not the new image would be out of bounds.
|
||||
*/
|
||||
public boolean isNewRectangleOutOfBounds(Edge edge, Rect imageRect, float aspectRatio) {
|
||||
|
||||
float offset = edge.snapOffset(imageRect);
|
||||
|
||||
switch (this) {
|
||||
case LEFT:
|
||||
if (edge.equals(Edge.TOP)) {
|
||||
float top = imageRect.top;
|
||||
float bottom = Edge.BOTTOM.getCoordinate() - offset;
|
||||
float right = Edge.RIGHT.getCoordinate();
|
||||
float left = AspectRatioUtil.calculateLeft(top, right, bottom, aspectRatio);
|
||||
|
||||
return isOutOfBounds(top, left, bottom, right, imageRect);
|
||||
|
||||
} else if (edge.equals(Edge.BOTTOM)) {
|
||||
float bottom = imageRect.bottom;
|
||||
float top = Edge.TOP.getCoordinate() - offset;
|
||||
float right = Edge.RIGHT.getCoordinate();
|
||||
float left = AspectRatioUtil.calculateLeft(top, right, bottom, aspectRatio);
|
||||
|
||||
return isOutOfBounds(top, left, bottom, right, imageRect);
|
||||
}
|
||||
break;
|
||||
|
||||
case TOP:
|
||||
if (edge.equals(Edge.LEFT)) {
|
||||
float left = imageRect.left;
|
||||
float right = Edge.RIGHT.getCoordinate() - offset;
|
||||
float bottom = Edge.BOTTOM.getCoordinate();
|
||||
float top = AspectRatioUtil.calculateTop(left, right, bottom, aspectRatio);
|
||||
|
||||
return isOutOfBounds(top, left, bottom, right, imageRect);
|
||||
|
||||
} else if (edge.equals(Edge.RIGHT)) {
|
||||
float right = imageRect.right;
|
||||
float left = Edge.LEFT.getCoordinate() - offset;
|
||||
float bottom = Edge.BOTTOM.getCoordinate();
|
||||
float top = AspectRatioUtil.calculateTop(left, right, bottom, aspectRatio);
|
||||
|
||||
return isOutOfBounds(top, left, bottom, right, imageRect);
|
||||
}
|
||||
break;
|
||||
|
||||
case RIGHT:
|
||||
if (edge.equals(Edge.TOP)) {
|
||||
float top = imageRect.top;
|
||||
float bottom = Edge.BOTTOM.getCoordinate() - offset;
|
||||
float left = Edge.LEFT.getCoordinate();
|
||||
float right = AspectRatioUtil.calculateRight(left, top, bottom, aspectRatio);
|
||||
|
||||
return isOutOfBounds(top, left, bottom, right, imageRect);
|
||||
|
||||
} else if (edge.equals(Edge.BOTTOM)) {
|
||||
float bottom = imageRect.bottom;
|
||||
float top = Edge.TOP.getCoordinate() - offset;
|
||||
float left = Edge.LEFT.getCoordinate();
|
||||
float right = AspectRatioUtil.calculateRight(left, top, bottom, aspectRatio);
|
||||
|
||||
return isOutOfBounds(top, left, bottom, right, imageRect);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case BOTTOM:
|
||||
if (edge.equals(Edge.LEFT)) {
|
||||
float left = imageRect.left;
|
||||
float right = Edge.RIGHT.getCoordinate() - offset;
|
||||
float top = Edge.TOP.getCoordinate();
|
||||
float bottom = AspectRatioUtil.calculateBottom(left, top, right, aspectRatio);
|
||||
|
||||
return isOutOfBounds(top, left, bottom, right, imageRect);
|
||||
|
||||
} else if (edge.equals(Edge.RIGHT)) {
|
||||
float right = imageRect.right;
|
||||
float left = Edge.LEFT.getCoordinate() - offset;
|
||||
float top = Edge.TOP.getCoordinate();
|
||||
float bottom = AspectRatioUtil.calculateBottom(left, top, right, aspectRatio);
|
||||
|
||||
return isOutOfBounds(top, left, bottom, right, imageRect);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the new rectangle would be out of bounds.
|
||||
*
|
||||
* @param top
|
||||
* @param left
|
||||
* @param bottom
|
||||
* @param right
|
||||
* @param imageRect the Image to be compared with.
|
||||
* @return whether it would be out of bounds
|
||||
*/
|
||||
private boolean isOutOfBounds(float top, float left, float bottom, float right, Rect imageRect) {
|
||||
return (top < imageRect.top || left < imageRect.left || bottom > imageRect.bottom || right > imageRect.right);
|
||||
}
|
||||
|
||||
/**
|
||||
* Snap this Edge to the given image boundaries.
|
||||
*
|
||||
* @param imageRect the bounding rectangle of the image to snap to
|
||||
* @return the amount (in pixels) that this coordinate was changed (i.e. the
|
||||
* new coordinate minus the old coordinate value)
|
||||
*/
|
||||
public float snapToRect(Rect imageRect) {
|
||||
|
||||
final float oldCoordinate = mCoordinate;
|
||||
|
||||
switch (this) {
|
||||
case LEFT:
|
||||
mCoordinate = imageRect.left;
|
||||
break;
|
||||
case TOP:
|
||||
mCoordinate = imageRect.top;
|
||||
break;
|
||||
case RIGHT:
|
||||
mCoordinate = imageRect.right;
|
||||
break;
|
||||
case BOTTOM:
|
||||
mCoordinate = imageRect.bottom;
|
||||
break;
|
||||
}
|
||||
|
||||
final float offset = mCoordinate - oldCoordinate;
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
// Private Methods /////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Returns the potential snap offset of snaptoRect, without changing the coordinate.
|
||||
*
|
||||
* @param imageRect the bounding rectangle of the image to snap to
|
||||
* @return the amount (in pixels) that this coordinate was changed (i.e. the
|
||||
* new coordinate minus the old coordinate value)
|
||||
*/
|
||||
public float snapOffset(Rect imageRect) {
|
||||
|
||||
final float oldCoordinate = mCoordinate;
|
||||
float newCoordinate = oldCoordinate;
|
||||
|
||||
switch (this) {
|
||||
case LEFT:
|
||||
newCoordinate = imageRect.left;
|
||||
break;
|
||||
case TOP:
|
||||
newCoordinate = imageRect.top;
|
||||
break;
|
||||
case RIGHT:
|
||||
newCoordinate = imageRect.right;
|
||||
break;
|
||||
case BOTTOM:
|
||||
newCoordinate = imageRect.bottom;
|
||||
break;
|
||||
}
|
||||
|
||||
final float offset = newCoordinate - oldCoordinate;
|
||||
return offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Snap this Edge to the given View boundaries.
|
||||
*
|
||||
* @param view the View to snap to
|
||||
*/
|
||||
public void snapToView(View view) {
|
||||
|
||||
switch (this) {
|
||||
case LEFT:
|
||||
mCoordinate = 0;
|
||||
break;
|
||||
case TOP:
|
||||
mCoordinate = 0;
|
||||
break;
|
||||
case RIGHT:
|
||||
mCoordinate = view.getWidth();
|
||||
break;
|
||||
case BOTTOM:
|
||||
mCoordinate = view.getHeight();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this Edge is outside the inner margins of the given bounding
|
||||
* rectangle. The margins come inside the actual frame by SNAPRADIUS amount;
|
||||
* therefore, determines if the point is outside the inner "margin" frame.
|
||||
*/
|
||||
public boolean isOutsideMargin(Rect rect, float margin) {
|
||||
|
||||
boolean result = false;
|
||||
|
||||
switch (this) {
|
||||
case LEFT:
|
||||
result = mCoordinate - rect.left < margin;
|
||||
break;
|
||||
case TOP:
|
||||
result = mCoordinate - rect.top < margin;
|
||||
break;
|
||||
case RIGHT:
|
||||
result = rect.right - mCoordinate < margin;
|
||||
break;
|
||||
case BOTTOM:
|
||||
result = rect.bottom - mCoordinate < margin;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this Edge is outside the image frame of the given bounding
|
||||
* rectangle.
|
||||
*/
|
||||
public boolean isOutsideFrame(Rect rect) {
|
||||
|
||||
double margin = 0;
|
||||
boolean result = false;
|
||||
|
||||
switch (this) {
|
||||
case LEFT:
|
||||
result = mCoordinate - rect.left < margin;
|
||||
break;
|
||||
case TOP:
|
||||
result = mCoordinate - rect.top < margin;
|
||||
break;
|
||||
case RIGHT:
|
||||
result = rect.right - mCoordinate < margin;
|
||||
break;
|
||||
case BOTTOM:
|
||||
result = rect.bottom - mCoordinate < margin;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.adins.mss.foundation.print.rv;
|
||||
|
||||
/**
|
||||
* Created by angga.permadi on 4/20/2016.
|
||||
*/
|
||||
public interface ApiCodes {
|
||||
int RV_NUMBER = 1;
|
||||
int RV_NUMBER_AUTO_SEND = 2;
|
||||
|
||||
}
|
|
@ -0,0 +1,297 @@
|
|||
package org.acra.collector;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.SparseArray;
|
||||
import android.view.Display;
|
||||
import android.view.Surface;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import static org.acra.ACRA.LOG_TAG;
|
||||
|
||||
final class DisplayManagerCollector {
|
||||
|
||||
final static SparseArray<String> mFlagsNames = new SparseArray<String>();
|
||||
final static SparseArray<String> mDensities = new SparseArray<String>();
|
||||
|
||||
public static String collectDisplays(Context ctx) {
|
||||
Display[] displays = null;
|
||||
final StringBuilder result = new StringBuilder();
|
||||
|
||||
if (Compatibility.getAPILevel() < 17) {
|
||||
// Before Android 4.2, there was a single display available from the
|
||||
// window manager
|
||||
final WindowManager windowManager = (WindowManager) ctx
|
||||
.getSystemService(android.content.Context.WINDOW_SERVICE);
|
||||
displays = new Display[1];
|
||||
displays[0] = windowManager.getDefaultDisplay();
|
||||
} else {
|
||||
// Since Android 4.2, we can fetch multiple displays with the
|
||||
// DisplayManager.
|
||||
try {
|
||||
Object displayManager = ctx.getSystemService((String) (ctx.getClass().getField("DISPLAY_SERVICE")
|
||||
.get(null)));
|
||||
Method getDisplays = displayManager.getClass().getMethod("getDisplays");
|
||||
displays = (Display[]) getDisplays.invoke(displayManager);
|
||||
} catch (IllegalArgumentException e) {
|
||||
ACRA.log.w(LOG_TAG, "Error while collecting DisplayManager data: ", e);
|
||||
} catch (SecurityException e) {
|
||||
ACRA.log.w(LOG_TAG, "Error while collecting DisplayManager data: ", e);
|
||||
} catch (IllegalAccessException e) {
|
||||
ACRA.log.w(LOG_TAG, "Error while collecting DisplayManager data: ", e);
|
||||
} catch (NoSuchFieldException e) {
|
||||
ACRA.log.w(LOG_TAG, "Error while collecting DisplayManager data: ", e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
ACRA.log.w(LOG_TAG, "Error while collecting DisplayManager data: ", e);
|
||||
} catch (InvocationTargetException e) {
|
||||
ACRA.log.w(LOG_TAG, "Error while collecting DisplayManager data: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
for (Display display : displays) {
|
||||
result.append(collectDisplayData(display));
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static Object collectDisplayData(Display display) {
|
||||
final DisplayMetrics metrics = new DisplayMetrics();
|
||||
display.getMetrics(metrics);
|
||||
|
||||
final StringBuilder result = new StringBuilder();
|
||||
|
||||
result.append(collectCurrentSizeRange(display));
|
||||
result.append(collectFlags(display));
|
||||
result.append(display.getDisplayId()).append(".height=").append(display.getHeight()).append('\n');
|
||||
result.append(collectMetrics(display, "getMetrics"));
|
||||
result.append(collectName(display));
|
||||
result.append(display.getDisplayId()).append(".orientation=").append(display.getOrientation()).append('\n');
|
||||
result.append(display.getDisplayId()).append(".pixelFormat=").append(display.getPixelFormat()).append('\n');
|
||||
result.append(collectMetrics(display, "getRealMetrics"));
|
||||
result.append(collectSize(display, "getRealSize"));
|
||||
result.append(collectRectSize(display));
|
||||
result.append(display.getDisplayId()).append(".refreshRate=").append(display.getRefreshRate()).append('\n');
|
||||
result.append(collectRotation(display));
|
||||
result.append(collectSize(display, "getSize"));
|
||||
result.append(display.getDisplayId()).append(".width=").append(display.getWidth()).append('\n');
|
||||
result.append(collectIsValid(display));
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static Object collectIsValid(Display display) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
try {
|
||||
Method isValid = display.getClass().getMethod("isValid");
|
||||
Boolean value = (Boolean) isValid.invoke(display);
|
||||
result.append(display.getDisplayId()).append(".isValid=").append(value).append('\n');
|
||||
} catch (SecurityException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static Object collectRotation(Display display) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
try {
|
||||
Method getRotation = display.getClass().getMethod("getRotation");
|
||||
int rotation = (Integer) getRotation.invoke(display);
|
||||
result.append(display.getDisplayId()).append(".rotation=");
|
||||
switch (rotation) {
|
||||
case Surface.ROTATION_0:
|
||||
result.append("ROTATION_0");
|
||||
break;
|
||||
case Surface.ROTATION_90:
|
||||
result.append("ROTATION_90");
|
||||
break;
|
||||
case Surface.ROTATION_180:
|
||||
result.append("ROTATION_180");
|
||||
break;
|
||||
case Surface.ROTATION_270:
|
||||
result.append("ROTATION_270");
|
||||
break;
|
||||
default:
|
||||
result.append(rotation);
|
||||
break;
|
||||
}
|
||||
result.append('\n');
|
||||
} catch (SecurityException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static Object collectRectSize(Display display) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
try {
|
||||
Method getRectSize = display.getClass().getMethod("getRectSize", Rect.class);
|
||||
Rect size = new Rect();
|
||||
getRectSize.invoke(display, size);
|
||||
result.append(display.getDisplayId()).append(".rectSize=[").append(size.top).append(',').append(size.left)
|
||||
.append(',').append(size.width()).append(',').append(size.height()).append(']').append('\n');
|
||||
} catch (SecurityException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static Object collectSize(Display display, String methodName) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
try {
|
||||
Method getRealSize = display.getClass().getMethod(methodName, Point.class);
|
||||
Point size = new Point();
|
||||
getRealSize.invoke(display, size);
|
||||
result.append(display.getDisplayId()).append('.').append(methodName).append("=[").append(size.x)
|
||||
.append(',').append(size.y).append(']').append('\n');
|
||||
} catch (SecurityException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static String collectCurrentSizeRange(Display display) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
try {
|
||||
Method getCurrentSizeRange = display.getClass().getMethod("getCurrentSizeRange", Point.class, Point.class);
|
||||
Point smallest = new Point(), largest = new Point();
|
||||
getCurrentSizeRange.invoke(display, smallest, largest);
|
||||
result.append(display.getDisplayId()).append(".currentSizeRange.smallest=[").append(smallest.x).append(',')
|
||||
.append(smallest.y).append(']').append('\n');
|
||||
result.append(display.getDisplayId()).append(".currentSizeRange.largest=[").append(largest.x).append(',')
|
||||
.append(largest.y).append(']').append('\n');
|
||||
} catch (SecurityException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static String collectFlags(Display display) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
try {
|
||||
Method getFlags = display.getClass().getMethod("getFlags");
|
||||
int flags = (Integer) getFlags.invoke(display);
|
||||
|
||||
for (Field field : display.getClass().getFields()) {
|
||||
if (field.getName().startsWith("FLAG_")) {
|
||||
mFlagsNames.put(field.getInt(null), field.getName());
|
||||
}
|
||||
}
|
||||
|
||||
result.append(display.getDisplayId()).append(".flags=").append(activeFlags(mFlagsNames, flags))
|
||||
.append('\n');
|
||||
} catch (SecurityException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static String collectName(Display display) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
try {
|
||||
Method getName = display.getClass().getMethod("getName");
|
||||
String name = (String) getName.invoke(display);
|
||||
|
||||
result.append(display.getDisplayId()).append(".name=").append(name).append('\n');
|
||||
} catch (SecurityException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private static Object collectMetrics(Display display, String methodName) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
try {
|
||||
Method getMetrics = display.getClass().getMethod(methodName);
|
||||
DisplayMetrics metrics = (DisplayMetrics) getMetrics.invoke(display);
|
||||
|
||||
for (Field field : DisplayMetrics.class.getFields()) {
|
||||
if (field.getType().equals(Integer.class) && field.getName().startsWith("DENSITY_")
|
||||
&& !field.getName().equals("DENSITY_DEFAULT")) {
|
||||
mDensities.put(field.getInt(null), field.getName());
|
||||
}
|
||||
}
|
||||
|
||||
result.append(display.getDisplayId()).append('.').append(methodName).append(".density=")
|
||||
.append(metrics.density).append('\n');
|
||||
result.append(display.getDisplayId()).append('.').append(methodName).append(".densityDpi=")
|
||||
.append(metrics.getClass().getField("densityDpi")).append('\n');
|
||||
result.append(display.getDisplayId()).append('.').append(methodName).append("scaledDensity=x")
|
||||
.append(metrics.scaledDensity).append('\n');
|
||||
result.append(display.getDisplayId()).append('.').append(methodName).append(".widthPixels=")
|
||||
.append(metrics.widthPixels).append('\n');
|
||||
result.append(display.getDisplayId()).append('.').append(methodName).append(".heightPixels=")
|
||||
.append(metrics.heightPixels).append('\n');
|
||||
result.append(display.getDisplayId()).append('.').append(methodName).append(".xdpi=").append(metrics.xdpi)
|
||||
.append('\n');
|
||||
result.append(display.getDisplayId()).append('.').append(methodName).append(".ydpi=").append(metrics.ydpi)
|
||||
.append('\n');
|
||||
|
||||
} catch (SecurityException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
} catch (NoSuchFieldException e) {
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Some fields contain multiple value types which can be isolated by
|
||||
* applying a bitmask. That method returns the concatenation of active
|
||||
* values.
|
||||
*
|
||||
* @param valueNames The array containing the different values and names for this
|
||||
* field. Must contain mask values too.
|
||||
* @param bitfield The bitfield to inspect.
|
||||
* @return The names of the different values contained in the bitfield,
|
||||
* separated by '+'.
|
||||
*/
|
||||
private static String activeFlags(SparseArray<String> valueNames, int bitfield) {
|
||||
final StringBuilder result = new StringBuilder();
|
||||
|
||||
// Look for masks, apply it an retrieve the masked value
|
||||
for (int i = 0; i < valueNames.size(); i++) {
|
||||
final int maskValue = valueNames.keyAt(i);
|
||||
final int value = bitfield & maskValue;
|
||||
if (value > 0) {
|
||||
if (result.length() > 0) {
|
||||
result.append('+');
|
||||
}
|
||||
result.append(valueNames.get(value));
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/itemBase"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/agreementNumber_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:weightSum="1" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/itemLabel2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@+id/textView1"
|
||||
android:layout_weight="0.2"
|
||||
android:text="@string/label_agreement_no"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_weight="0.1"
|
||||
android:text="@string/divider_colon"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/itemValueAgreement"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@+id/textView1"
|
||||
android:layout_weight="0.7" />
|
||||
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:weightSum="1" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/itemLabel3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@+id/textView3"
|
||||
android:layout_weight="0.2"
|
||||
android:text="@string/label_deposit_amount"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_weight="0.1"
|
||||
android:text="@string/divider_colon"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/itemValue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@+id/textView3"
|
||||
android:layout_weight="0.7"
|
||||
android:gravity="right" />
|
||||
|
||||
</RelativeLayout>
|
||||
<!-- <LinearLayout -->
|
||||
<!-- android:layout_width="fill_parent" -->
|
||||
<!-- android:layout_height="wrap_content" -->
|
||||
<!-- android:orientation="horizontal" -->
|
||||
<!-- android:weightSum="1" > -->
|
||||
|
||||
<!-- <TextView -->
|
||||
<!-- android:id="@+id/itemLabel" -->
|
||||
<!-- android:layout_width="wrap_content" -->
|
||||
<!-- android:layout_weight="0.2" -->
|
||||
<!-- android:text="Deposit Amount" -->
|
||||
<!-- android:layout_height="wrap_content" /> -->
|
||||
|
||||
<!-- <TextView -->
|
||||
<!-- android:layout_width="wrap_content" -->
|
||||
<!-- android:layout_height="wrap_content" -->
|
||||
<!-- android:layout_weight="0.1" -->
|
||||
<!-- android:text=": " /> -->
|
||||
|
||||
<!-- <TextView -->
|
||||
<!-- android:id="@+id/itemValue" -->
|
||||
<!-- android:layout_weight="0.7" -->
|
||||
<!-- android:layout_width="wrap_content" -->
|
||||
<!-- android:layout_height="wrap_content" -->
|
||||
<!-- android:gravity="right" /> -->
|
||||
<!-- </LinearLayout> -->
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:fillAfter="true" >
|
||||
|
||||
<alpha
|
||||
android:duration="1000"
|
||||
android:fromAlpha="1.0"
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:toAlpha="0.0" />
|
||||
|
||||
</set>
|
|
@ -0,0 +1,155 @@
|
|||
package com.adins.mss.foundation.camerainapp.helper;
|
||||
|
||||
import android.media.ExifInterface;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by angga.permadi on 7/27/2016.
|
||||
*/
|
||||
public class ExifUtil {
|
||||
private static final String TAG = "CameraExif";
|
||||
|
||||
// Returns the degrees in clockwise. Values are 0, 90, 180, or 270.
|
||||
public static int getOrientation(byte[] jpeg) {
|
||||
if (jpeg == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int offset = 0;
|
||||
int length = 0;
|
||||
|
||||
// ISO/IEC 10918-1:1993(E)
|
||||
while (offset + 3 < jpeg.length && (jpeg[offset++] & 0xFF) == 0xFF) {
|
||||
int marker = jpeg[offset] & 0xFF;
|
||||
|
||||
// Check if the marker is a padding.
|
||||
if (marker == 0xFF) {
|
||||
continue;
|
||||
}
|
||||
offset++;
|
||||
|
||||
// Check if the marker is SOI or TEM.
|
||||
if (marker == 0xD8 || marker == 0x01) {
|
||||
continue;
|
||||
}
|
||||
// Check if the marker is EOI or SOS.
|
||||
if (marker == 0xD9 || marker == 0xDA) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Get the length and check if it is reasonable.
|
||||
length = pack(jpeg, offset, 2, false);
|
||||
if (length < 2 || offset + length > jpeg.length) {
|
||||
Logger.e(TAG, "Invalid length");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Break if the marker is EXIF in APP1.
|
||||
if (marker == 0xE1 && length >= 8 &&
|
||||
pack(jpeg, offset + 2, 4, false) == 0x45786966 &&
|
||||
pack(jpeg, offset + 6, 2, false) == 0) {
|
||||
offset += 8;
|
||||
length -= 8;
|
||||
break;
|
||||
}
|
||||
|
||||
// Skip other markers.
|
||||
offset += length;
|
||||
length = 0;
|
||||
}
|
||||
|
||||
// JEITA CP-3451 Exif Version 2.2
|
||||
if (length > 8) {
|
||||
// Identify the byte order.
|
||||
int tag = pack(jpeg, offset, 4, false);
|
||||
if (tag != 0x49492A00 && tag != 0x4D4D002A) {
|
||||
Logger.e(TAG, "Invalid byte order");
|
||||
return 0;
|
||||
}
|
||||
boolean littleEndian = (tag == 0x49492A00);
|
||||
|
||||
// Get the offset and check if it is reasonable.
|
||||
int count = pack(jpeg, offset + 4, 4, littleEndian) + 2;
|
||||
if (count < 10 || count > length) {
|
||||
Logger.e(TAG, "Invalid offset");
|
||||
return 0;
|
||||
}
|
||||
offset += count;
|
||||
length -= count;
|
||||
|
||||
// Get the count and go through all the elements.
|
||||
count = pack(jpeg, offset - 2, 2, littleEndian);
|
||||
while (count-- > 0 && length >= 12) {
|
||||
// Get the tag and check if it is orientation.
|
||||
tag = pack(jpeg, offset, 2, littleEndian);
|
||||
if (tag == 0x0112) {
|
||||
// We do not really care about type and count, do we?
|
||||
int orientation = pack(jpeg, offset + 8, 2, littleEndian);
|
||||
switch (orientation) {
|
||||
case 1:
|
||||
return 0;
|
||||
case 3:
|
||||
return 180;
|
||||
case 6:
|
||||
return 90;
|
||||
case 8:
|
||||
return 270;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Log.i(TAG, "Unsupported orientation");
|
||||
return 0;
|
||||
}
|
||||
offset += 12;
|
||||
length -= 12;
|
||||
}
|
||||
}
|
||||
|
||||
Log.i(TAG, "Orientation not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static int pack(byte[] bytes, int offset, int length,
|
||||
boolean littleEndian) {
|
||||
int step = 1;
|
||||
if (littleEndian) {
|
||||
offset += length - 1;
|
||||
step = -1;
|
||||
}
|
||||
|
||||
int value = 0;
|
||||
while (length-- > 0) {
|
||||
value = (value << 8) | (bytes[offset] & 0xFF);
|
||||
offset += step;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static void setRotationToFileExif(File file, int rotation) {
|
||||
try {
|
||||
ExifInterface exif = new ExifInterface(file.getAbsolutePath());
|
||||
switch (rotation) {
|
||||
case 0:
|
||||
exif.setAttribute(ExifInterface.TAG_ORIENTATION, "" + ExifInterface.ORIENTATION_UNDEFINED);
|
||||
break;
|
||||
case 90:
|
||||
exif.setAttribute(ExifInterface.TAG_ORIENTATION, "" + ExifInterface.ORIENTATION_ROTATE_90);
|
||||
break;
|
||||
case 180:
|
||||
exif.setAttribute(ExifInterface.TAG_ORIENTATION, "" + ExifInterface.ORIENTATION_ROTATE_180);
|
||||
break;
|
||||
case 270:
|
||||
exif.setAttribute(ExifInterface.TAG_ORIENTATION, "" + ExifInterface.ORIENTATION_ROTATE_270);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
exif.saveAttributes();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
|
@ -0,0 +1,140 @@
|
|||
package com.adins.mss.odr.news;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.MobileContentH;
|
||||
import com.adins.mss.foundation.UserHelp.UserHelp;
|
||||
import com.adins.mss.foundation.dialog.DialogManager;
|
||||
import com.adins.mss.foundation.dialog.NiftyDialogBuilder;
|
||||
import com.adins.mss.odr.R;
|
||||
import com.adins.mss.odr.tool.Constants;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.adins.mss.constant.Global.SHOW_USERHELP_DELAY_DEFAULT;
|
||||
|
||||
public class NewsActivity extends Fragment implements OnItemClickListener{
|
||||
private NewsListAdapter adapter;
|
||||
List<MobileContentH> objects;
|
||||
ListView listView;
|
||||
boolean isError;
|
||||
String errorMessage;
|
||||
private FirebaseAnalytics screenName;
|
||||
@Override
|
||||
public void onAttach(Context activity) {
|
||||
|
||||
super.onAttach(activity);
|
||||
setHasOptionsMenu(true);
|
||||
getActivity().setTitle(getString(R.string.title_mn_promo));
|
||||
News news= new News(getActivity());
|
||||
Bundle bundle = getArguments();
|
||||
isError=bundle.getBoolean(Constants.BUND_KEY_NEWS_ERROR);
|
||||
errorMessage=bundle.getString(Constants.BUND_KEY_NEWS_ERROR_MESSAGE);
|
||||
objects = news.getlistNewsParent();
|
||||
adapter = new NewsListAdapter(getActivity(), objects);
|
||||
ACRA.getErrorReporter().putCustomData("LAST_CLASS_ACCESSED", getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
Utility.freeMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.news_listparent_layout, container, false);
|
||||
listView = (ListView)view.findViewById(android.R.id.list);
|
||||
screenName = FirebaseAnalytics.getInstance(getActivity());
|
||||
// View notFoundView = inflater.inflate(R.layout.news_without_content_layout, null);
|
||||
if(objects.size()==0) {
|
||||
// listView.addHeaderView(notFoundView);
|
||||
view.findViewById(R.id.newTaskLayout).setBackgroundResource(R.drawable.bg_notfound);
|
||||
view.findViewById(R.id.txv_data_not_found).setVisibility(View.VISIBLE);
|
||||
} else{
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
UserHelp.showAllUserHelpWithListView(NewsActivity.this.getActivity(),NewsActivity.this.getClass().getSimpleName(),listView,0);
|
||||
}
|
||||
}, SHOW_USERHELP_DELAY_DEFAULT);
|
||||
}
|
||||
listView.setAdapter(adapter);
|
||||
listView.setOnItemClickListener(this);
|
||||
NiftyDialogBuilder dialogBuilder;
|
||||
if(isError){
|
||||
isError=false;
|
||||
if(GlobalData.isRequireRelogin()){
|
||||
DialogManager.showForceExitAlert(getActivity(),getString(R.string.msgLogout));
|
||||
}
|
||||
else if (errorMessage.contains(getString(R.string.no_address_associated))) {
|
||||
dialogBuilder = NiftyDialogBuilder.getInstance(getActivity());
|
||||
dialogBuilder.withTitle(getString(R.string.error_capital))
|
||||
.withMessage(getString(R.string.use_offline_mode)).show();
|
||||
}else{
|
||||
dialogBuilder = NiftyDialogBuilder.getInstance(getActivity());
|
||||
dialogBuilder.withTitle(getString(R.string.error_capital)).withMessage(errorMessage).show();
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
try {
|
||||
Intent intent = new Intent(getContext(), NewsChildActivity.class);
|
||||
intent.putExtra("uuid_parent", objects.get(position).getUuid_mobile_content_h());
|
||||
listView.setEnabled(false);
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if(item.getItemId() == R.id.mnGuide){
|
||||
if(!Global.BACKPRESS_RESTRICTION) {
|
||||
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
UserHelp.showAllUserHelpWithListView(NewsActivity.this.getActivity(), NewsActivity.this.getClass().getSimpleName(), listView, 0);
|
||||
}
|
||||
}, SHOW_USERHELP_DELAY_DEFAULT);
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
getActivity().setTitle(getString(R.string.title_mn_promo));
|
||||
listView.setEnabled(true);
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(getActivity(), getString(R.string.screen_name_promo), null);
|
||||
// getActivity().getActionBar().removeAllTabs();
|
||||
// getActivity().getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.adins.mss.base.loyalti.barchart;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ListView;
|
||||
|
||||
public class NonScrollListView extends ListView {
|
||||
public NonScrollListView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public NonScrollListView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public NonScrollListView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
|
||||
MeasureSpec.AT_MOST);
|
||||
super.onMeasure(widthMeasureSpec, expandSpec);
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue