blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
6409f8c546fb8ca1a2649687cc05847a303da0d7
938c6311877277e7580fa4fd53b8c3d222c6e10a
/app/src/main/java/Page1/Page1_1_1_SecondAdapter.java
c02d3a62175214b2da008524c71f41a3c86008ea
[]
no_license
hansol98/Spot_200510_hs
58ef57416ed697261564d483d1b45f41e33592f0
39b1b8dfb125d826f4289de53727ae02348d93d7
refs/heads/master
2022-07-23T17:04:18.320977
2020-05-12T09:45:06
2020-05-12T09:45:06
263,293,507
0
0
null
null
null
null
UTF-8
Java
false
false
2,035
java
package Page1; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.example.hansol.spot_200510_hs.R; import java.util.List; public class Page1_1_1_SecondAdapter extends RecyclerView.Adapter<Page1_1_1_SecondAdapter.ViewHolder> { Context context; private String[] stay = new String[5]; // 하트의 클릭 여부 private List<Page1_1_1.Recycler_item> items; //리사이클러뷰 안에 들어갈 값 저장 public Page1_1_1_SecondAdapter(List<Page1_1_1.Recycler_item> items) { this.items = items; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { context = parent.getContext(); View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.page1_1_1_second_item, parent, false); return new ViewHolder(v); } @Override public void onBindViewHolder(ViewHolder holder, int position) { final Page1_1_1.Recycler_item item=items.get(position); holder.title.setText(items.get(position).title); //이미지뷰에 url 이미지 넣기. Glide.with(context).load(item.getImage()).centerCrop().into(holder.imageView); } @Override public int getItemCount() { return items.size(); } public class ViewHolder extends RecyclerView.ViewHolder { ImageView imageView; TextView type; TextView title; Button heart; public ViewHolder(View itemView) { super(itemView); imageView = itemView.findViewById(R.id.no_image); type = itemView.findViewById(R.id.page1_1_1_cardview_type); title = itemView.findViewById(R.id.page1_1_1_cardview_title); heart = itemView.findViewById(R.id.page1_1_1_cardview_heart); } } }
cfe0c50ae2fbac7ad91d9eb86f269b66f7e8d369
6f0c80be2d58525c34b0b9ed6098277ae07bd08d
/SEL Project 1/src/test/GraphManagerTest.java
5ea48c674a100c38501d48071a84643a47dd0062
[]
no_license
oscarcorreag/Unimelb
def9ccf9be5e3d61ad70c59a02f0f74c4ec2b18a
ac99b7cc83278f16f1fff9237f42431d909a5e27
refs/heads/master
2021-01-19T10:11:13.142106
2013-09-07T03:47:02
2013-09-07T03:47:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,871
java
package test; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import managers.GraphManager; import org.junit.Test; import dto.Edge; public class GraphManagerTest { // @Test /* * public void testReadFromFile() { AdjList g = new AdjList(); * g.readTrainData(); assertNotNull(g); } */ @Test public void testCalcCN() { String dataset = "final"; GraphManager g = new GraphManager(); // HashSet<Integer> vertices_set = g.readTestVertices("test_" + dataset + ".txt"); ArrayList<Edge> edgestest = g.getEdgesFromFile("test_" + dataset + ".txt","\t"); ArrayList<Edge> edgestrain = g.getEdgesFromFile("out_train.txt",","); edgestest.addAll(edgestrain); // HashSet vertices_set = edges System.out.println(edgestest.size()); g.readTrainGraphFromFile(edgestest, "train_" + dataset + "_mod.txt"); // ArrayList<Edge> edges = g.getTestEdges("test_" + dataset + "_from_678_1200.txt"); // g.writeFiles("out_train.txt", "out_test.txt", edges0); g.createFileWithMeasures("out_train.txt"); g.createFileWithMeasures("out_test.txt"); // HashMap<Integer, Double> initProbs = new HashMap<Integer, Double> (); ////int src = 2685339; //int src = 355230; //int dest = 2748795; // initProbs.put(src, 1.0); // // HashMap<Integer, Double> pr_Probs = new HashMap<Integer, Double> (); // pr_Probs.put(dest, 0.0); // pr_Probs.put(src, 1.0); // long t0 = System.currentTimeMillis(); // Map<Integer, Double> pr_Probs_1 = g._graph.calcPageRank(src, initProbs, pr_Probs); // System.out.println("new : " + pr_Probs_1.get(dest)) ; //long t1 = System.currentTimeMillis(); //System.out.println(t1- t0); // pr_Probs_1 = g._graph.calcPageRankOld(src, initProbs); // System.out.println(System.currentTimeMillis()- t1 ); // System.out.println("old : " + pr_Probs_1.get(dest)) ; } }
be7b80428d3f11cf6acb17d970066995ded21adc
67fd17e818e511cbe76f934e91d43d6161a6c850
/app/src/main/java/com/example/dmitriy/bdconnectqrex/qrActivity.java
20bdd98bb4ca4337d7015810214ed19bb9eb7979
[]
no_license
funafunfa/bdconnectqrex
eb1a66014b48bcf711ee890622dbf5b6fd8f3c6b
b2c864e18a9f87dff4347c1d9b031b64b6544ce7
refs/heads/master
2021-01-11T05:37:18.560191
2016-10-22T20:58:39
2016-10-22T20:58:39
71,498,052
0
0
null
null
null
null
UTF-8
Java
false
false
3,086
java
package com.example.dmitriy.bdconnectqrex; import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import com.google.zxing.Result; import org.apache.http.NameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import me.dm7.barcodescanner.zxing.ZXingScannerView; import static com.example.dmitriy.bdconnectqrex.AllProductsActivity.APP_PREFERENCES_STRING; import static com.example.dmitriy.bdconnectqrex.AllProductsActivity.TAG_NAME; import static com.example.dmitriy.bdconnectqrex.AllProductsActivity.TAG_PID; import static com.example.dmitriy.bdconnectqrex.AllProductsActivity.TAG_PRODUCTS; import static com.example.dmitriy.bdconnectqrex.AllProductsActivity.TAG_SUCCESS; import static com.example.dmitriy.bdconnectqrex.AllProductsActivity.TAG_SWEET_DESCRIPTION; import static com.example.dmitriy.bdconnectqrex.AllProductsActivity.TAG_SWEET_ID; import static com.example.dmitriy.bdconnectqrex.AllProductsActivity.jParser; import static com.example.dmitriy.bdconnectqrex.AllProductsActivity.json; import static com.example.dmitriy.bdconnectqrex.AllProductsActivity.preference; import static com.example.dmitriy.bdconnectqrex.AllProductsActivity.productsList; import static com.example.dmitriy.bdconnectqrex.ProductCreater.productCreaters; public class qrActivity extends AppCompatActivity implements ZXingScannerView.ResultHandler{ private ZXingScannerView zXingScannerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); zXingScannerView = new ZXingScannerView(this); setContentView(zXingScannerView); zXingScannerView.setResultHandler(this); zXingScannerView.startCamera(); } public void onClick(View view) { zXingScannerView = new ZXingScannerView(this); setContentView(zXingScannerView); zXingScannerView.setResultHandler(this); zXingScannerView.startCamera(); } @Override protected void onPause() { super.onPause(); zXingScannerView.stopCamera(); } @Override public void handleResult(Result result) { for (int i = 0; i <= productCreaters.size()-1;i++){ Intent intent = new Intent(qrActivity.this, OneProductActivity.class); //intent.putExtra("code", productCreaters.get(i).getQr_id()); Log.d("Path", "1"); if(productCreaters.get(i).getQr_id().equals(result.toString())){ //Intent intent = new Intent(qrActivity.this, OneProductActivity.class); intent.putExtra("code", productCreaters.get(i).getQr_id()); //intent.putExtra("net", "local"); Log.d("Path", "2a"); finish(); startActivity(intent); } } } }
3361d7674aff45183ff4d0989fc229befb0834b8
06cf1e482cc18041d50ca6cc007491808580d9dc
/app/src/androidTest/java/example/android/com/gitproject/ExampleInstrumentedTest.java
cd7c61f29e777c56b63a8747632fb090b25ddfc3
[]
no_license
AjayMouniTMS/GitProject
e63c95b7f7850ae800f109b0f6ac59ae0b0517b3
34b55028439beba29a5b7e6fa98091b47681f40a
refs/heads/master
2020-04-12T19:11:13.883255
2018-12-21T10:44:15
2018-12-21T10:44:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
746
java
package example.android.com.gitproject; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("example.android.com.gitproject_1", appContext.getPackageName()); } }
f0b32a13e2bf7f76b6640f8ae5913cce4f647ceb
781e2692049e87a4256320c76e82a19be257a05d
/all_data/cs61bl/lab14/cs61bl-by/AmoebaFamilyTest.java
13520840b26f2a7a2df5a01ac6e156fc7036fc93
[]
no_license
itsolutionscorp/AutoStyle-Clustering
54bde86fe6dbad35b568b38cfcb14c5ffaab51b0
be0e2f635a7558f56c61bc0b36c6146b01d1e6e6
refs/heads/master
2020-12-11T07:27:19.291038
2016-03-16T03:18:00
2016-03-16T03:18:42
59,454,921
4
0
null
2016-05-23T05:40:56
2016-05-23T05:40:56
null
UTF-8
Java
false
false
695
java
import junit.framework.TestCase; public class AmoebaFamilyTest extends TestCase { public void testheight(){ AmoebaFamily family = new AmoebaFamily("Amos McCoy"); family.addChild("Amos McCoy", "mom/dad"); family.addChild("Amos McCoy", "auntie"); family.addChild("mom/dad", "me"); family.addChild("mom/dad", "Fred"); family.addChild("mom/dad", "Wilma"); family.addChild("me", "Mike"); family.addChild("me", "Homer"); family.addChild("me", "Marge"); family.addChild("Mike", "Bart"); family.addChild("Mike", "Lisa"); family.addChild("Marge", "Bill"); family.addChild("Marge", "Hilary"); //System.out.println(family.height()); assertTrue(family.height() == 5); } }
708df0f651476fbfc53505be3595d5b9dcd2cf81
65ca7b5a1ba85da22a09808fa934f205fa389c83
/src/main/java/com/intuit/cg/Application.java
f0cb55852e02389a00c911bd2008274bbdbf6428
[]
no_license
AKAProfessor/card_games
067c767190852d93afbbadf5a9442fa9e4f2170b
eab72c5613dfa0c35a19b55494953f66c5e148fc
refs/heads/master
2020-05-04T21:17:57.935438
2019-03-29T17:54:21
2019-04-10T19:42:43
179,471,310
2
0
null
null
null
null
UTF-8
Java
false
false
1,451
java
package com.intuit.cg; import com.intuit.cg.cli.GameCLI; import com.intuit.cg.cli.GameConfigurationCLI; import com.intuit.cg.dao.Dao; import com.intuit.cg.dao.PlayerDao; import com.intuit.cg.dao.validator.PlayerLineValidator; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; import java.util.List; public class Application { public static void main(String[] args) { if (args.length == 0) { System.out.println("Usage: java -jar card_games.jar [save-file]"); return; } if (args.length != 1) { System.err.println("Invalid parameters: " + Arrays.toString(args)); return; } if (!Files.exists(Paths.get(args[0]))) { System.err.println("Specified file not found: " + args[0]); return; } new Application().run(args[0]); } public void run(String saveFileLocation) { // TODO: DAO should be used through a service Dao<Player> playerDao = new PlayerDao(saveFileLocation, new PlayerLineValidator()); List<Player> playerList = playerDao.getAll(); GameConfigurationCLI gameConfigurationCLI = new GameConfigurationCLI(playerList); Game game = gameConfigurationCLI.run(); if (game != null) { GameCLI gameCLI = new GameCLI(game); gameCLI.run(); playerDao.saveAll(game.playerList()); } } }
6184f5c2fa41224f51d5f43c1ec4a016ac2eb6a0
285c8df7cd39031d6f8f090576e8c437c6d83d7d
/tnt4j-streams-admin-registry/src/main/java/com/jkoolcloud/tnt4j/streams/registry/zoo/jmx/JmxConnRegistry.java
a71be57df88670ea2485b40516b739f82a447e02
[ "Apache-2.0" ]
permissive
Nastel/tnt4j-streams-admin
8578b0a29ff250dbd96a0ee1fd371c7910e61ee0
e90b1867c3180c7837f58ac1b88c9f0f8b2645a8
refs/heads/master
2023-06-22T11:44:07.697851
2023-06-15T05:02:47
2023-06-15T05:02:47
196,005,540
0
1
Apache-2.0
2023-06-15T05:02:48
2019-07-09T12:37:05
Java
UTF-8
Java
false
false
1,388
java
/* * Copyright 2014-2020 JKOOL, LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License 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.jkoolcloud.tnt4j.streams.registry.zoo.jmx; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import javax.inject.Singleton; @Singleton public class JmxConnRegistry { private Map<String, JmxConnRemote> streamAgentNameToJmxConn = new ConcurrentHashMap<>(); private JmxStreamAgentsDiscovery jmxStreamAgentsDiscovery = new JmxStreamAgentsDiscovery(); public void add(String key, JmxConnRemote jmxConnRemote) { streamAgentNameToJmxConn.put(key, jmxConnRemote); } public JmxConnRemote get(String key) { return streamAgentNameToJmxConn.get(key); } public JmxConnRegistry() { } public void remove(String name) { streamAgentNameToJmxConn.remove(name); } public void searchForOfflineAgents() { } public void searchForLiveAgents() { } }
929bd84ac47c91bcec77d5dc01034cd6ca366c72
8c5f9c0aca263045b1fde8a7267df8c34fa2e018
/src/com/itheima/customer/domain/PageBean.java
a0faa8ff162a334534307f2ceb6bc0f26a79a29a
[]
no_license
FelixCJF/customer
c0c6dc8f84739827cf04d07ee631381760db9ec9
b43effaa54eb52e4256333d31876ba97b020e867
refs/heads/master
2021-01-12T08:24:20.956067
2016-12-15T14:26:38
2016-12-15T14:26:38
76,566,572
0
0
null
null
null
null
UTF-8
Java
false
false
964
java
package com.itheima.customer.domain; import java.util.List; public class PageBean<T> { public static final int PAGESIZE = 8; private int currPage;// 当前页数. private int pageSize;// 每页显示记录数. private int totalCount;// 总记录数. private int totalPage;// 总页数. private List<T> list;// 每页显示数据集合. public int getCurrPage() { return currPage; } public void setCurrPage(int currPage) { this.currPage = currPage; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getTotalCount() { return totalCount; } public void setTotalCount(int totalCount) { this.totalCount = totalCount; } public int getTotalPage() { return totalPage; } public void setTotalPage(int totalPage) { this.totalPage = totalPage; } public List<T> getList() { return list; } public void setList(List<T> list) { this.list = list; } }
0afa05a2500d4c77dec11ed3cd41259c0f54187b
1db831322ada4862eaf53077acbbadb52dca94b6
/commons-utils/src/main/java/io/onedev/commons/utils/DependencyAware.java
5c93ef509aa5e273d575b8fa537cdb301a4d43bf
[ "MIT" ]
permissive
theonedev/commons
511bbada0c4d5d40b6bd2d9a60ac04f1bfc6039c
2247856c60f363496cd7e229537d5ed3a7fa4eac
refs/heads/main
2023-08-31T09:15:45.385466
2023-08-28T01:58:33
2023-08-28T01:58:33
175,148,890
2
12
MIT
2023-06-14T22:34:09
2019-03-12T06:27:32
Java
UTF-8
Java
false
false
440
java
package io.onedev.commons.utils; import java.util.Set; public interface DependencyAware<K> { /** * Get key of the dependent object. * @return */ K getId(); /** * Get set of keys of other dependency objects this dependency object directly depends on. * @return * Should not be null. In case of no dependencies, please return an empty collection * instead of a null value. */ Set<K> getDependencies(); }
6e89481601227d98372834e688ed56e8677044ab
1ec0790d4c43c61fa0f0d6169ac46b0c2bc26832
/src/com/liange/chapter5/Pattern2.java
0899cccc5c3304142c9287682407ae766e03ba4e
[]
no_license
Rameswar-git/Core-Java
dce0527918c2ba68dca65bb767dccad4a72a1949
61c6ee50146aa49cd69ff6186b5375f7e2b01088
refs/heads/master
2023-04-27T04:43:17.601448
2022-12-14T20:37:52
2022-12-14T20:37:52
128,160,995
1
0
null
2023-04-17T19:41:56
2018-04-05T04:58:09
Java
UTF-8
Java
false
false
294
java
package com.liange.chapter5; public class Pattern2 { public static void main(String[] args) { int row=6; for (int i = 6; i>0; i--) { // int coun=i; for(int j=i;j>0;j--){ System.out.print(j+" "); // coun--; } System.out.println(); } } }
[ "Administrator@Admin" ]
Administrator@Admin
dff4108977d73aaf866b7a811e4b5817c2a4404d
fb3617a151ebec22120a12c43a8c1cfcb2961875
/src/main/java/com/fywl/ILook/win/ext/User32Extra.java
2be250a41bb2da0f0aaf3dc78351db40eecb4397
[]
no_license
wangwei19910928/ilook
6f771828bef6f3071037e663c1b233e4160b9fc8
2f05f11cf6765765248233cfb8e329cb48d8082b
refs/heads/master
2021-01-22T23:49:10.972570
2015-10-30T06:40:07
2015-10-30T06:40:07
45,233,981
0
1
null
null
null
null
UTF-8
Java
false
false
604
java
package com.fywl.ILook.win.ext; import com.sun.jna.Native; import com.sun.jna.platform.win32.User32; import com.sun.jna.win32.W32APIOptions; public interface User32Extra extends User32 { User32Extra INSTANCE = (User32Extra) Native.loadLibrary("user32", User32Extra.class, W32APIOptions.DEFAULT_OPTIONS); public boolean PrintWindow(HWND hwnd, HDC hdcBlt, int nFlags); public HWND GetDesktopWindow(); public HDC GetWindowDC(HWND hWnd); public boolean GetClientRect(HWND hWnd, RECT rect); public int GetWindowTextA(HWND hWnd, byte[] lpString, int nMaxCount); }
e307053f968cd6baa4cf0d16ffa98e6d560107d6
3c9fd716bb9f0a2aa0952b1765a20068b5c3b499
/src/main/java/com/hacker/dao/ShippingMapper.java
c31fad134ed883bf8be7eabbf2301fed4870088b
[]
no_license
UncleCatMySelf/SSM_To_Mall
fd57116316060a0d1c9e1f5056f5b41580687e34
c11be8ef383ada88ab8448cce4848883ef906b76
refs/heads/master
2020-03-26T14:23:59.359856
2018-08-16T12:36:31
2018-08-16T12:36:31
144,985,755
2
0
null
null
null
null
UTF-8
Java
false
false
739
java
package com.hacker.dao; import com.hacker.pojo.Shipping; import org.apache.ibatis.annotations.Param; import java.util.List; public interface ShippingMapper { int deleteByPrimaryKey(Integer id); int insert(Shipping record); int insertSelective(Shipping record); Shipping selectByPrimaryKey(Integer id); int updateByPrimaryKeySelective(Shipping record); int updateByPrimaryKey(Shipping record); int deleteByShippingIdUserId(@Param("userId")Integer userId,@Param("shippingId")Integer shippingId); int updateByShipping(Shipping record); Shipping selectByShippingIdUserId(@Param("userId")Integer userId,@Param("shippingId")Integer shippingId); List<Shipping> selectByUserId(Integer userId); }
b6601079bebea8286dca62af56a3a679ae52a3be
1cb4a0017b2c5a7a5edae9c8f759e78c5687f428
/app/src/main/java/com/wxzd/gfzdj/views/activities/H5Activity.java
5d4a74eddef5b0f0b88b0483bd0e3da7639aff7d
[]
no_license
tadpole145/StudyAndroid
737870ba2b873af2f74d02bfd2cad85ef213264b
ad06014b6a1861d4a43d39b45979ac24ca6e5ca0
refs/heads/master
2022-04-02T03:50:45.358821
2020-01-16T09:05:08
2020-01-16T09:05:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
619
java
package com.wxzd.gfzdj.views.activities; import android.os.Bundle; import android.view.View; import androidx.annotation.Nullable; import com.example.gfzdj.R; import com.wxzd.gfzdj.global.base.BaseActivity; public class H5Activity extends BaseActivity { @Override public void initData(@Nullable Bundle bundle) { } @Override public int bindLayoutID() { return R.layout.activity_h5; } @Override public void initView(Bundle savedInstanceState ) { } @Override public void initListener() { } @Override public void onWidgetClick(View view) { } }
ce2934ca9c6f65eb7ddc633686ca0ebca857b35c
bade91480dbc1b6b96502ece9ec1da7d7d3777f1
/src/main/java/com/dianping/vc/reporter/model/context/ModelContext.java
4506cfae39a4254df103ee1e930d11011ea8bdef
[]
no_license
chaishipeng/reporter
6f13898c9c9c4139cb17c103c7f01d98ea3c69d2
24d92012519c9f4d59fe952a8e14e1673fe01189
refs/heads/master
2021-01-25T05:09:58.095827
2017-06-13T11:55:02
2017-06-13T11:55:02
93,515,414
1
1
null
null
null
null
UTF-8
Java
false
false
1,498
java
package com.dianping.vc.reporter.model.context; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeanWrapperImpl; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by chaishipeng on 2017/6/6. */ public class ModelContext { private HSSFWorkbook book; private Map data; private Object currentData; private Map metaData = new HashMap(); public HSSFWorkbook getBook() { return book; } public void setBook(HSSFWorkbook book) { this.book = book; } public Object getData(String key){ if (currentData instanceof Map){ return ((Map)currentData).get(key); } if (currentData instanceof List) { throw new RuntimeException("ParentData is List !!!"); } BeanWrapper beanWrapper = new BeanWrapperImpl(currentData); return beanWrapper.getPropertyValue(key); } public Map getData() { return data; } public void setData(Map data) { this.data = data; this.currentData = data; } public Object getCurrentData() { return currentData; } public void setCurrentData(Object currentData) { this.currentData = currentData; } public Object getMeta(String key){ return metaData.get(key); } public void setMeta(String key, Object obj){ metaData.put(key, obj); } }
[ "Chaishi92" ]
Chaishi92
c5c9b7d96d652e6b2eac1c4ce4738d63c74f2fcb
76481baf7b21daffa193128de9669c5117f9ee67
/Angry Birds AI/src/ab/server/proxy/message/ProxyClickMessage.java
84377e6d62d0f33970be774f787e5a9cc2d28cfd
[ "MIT" ]
permissive
nikonkate/DQBirds
6de0ff28ec528ada302e630155b0c8d5887c294d
63cae6caeb1174f4ef26ecc22f8a95f30031fff6
refs/heads/master
2022-10-24T03:45:21.476561
2019-12-12T03:03:47
2019-12-12T03:03:47
156,966,409
2
3
MIT
2022-10-04T23:54:41
2018-11-10T09:27:33
Java
UTF-8
Java
false
false
1,184
java
/***************************************************************************** ** ANGRYBIRDS AI AGENT FRAMEWORK ** Copyright (c) 2014,XiaoYu (Gary) Ge, Stephen Gould,Jochen Renz ** Sahan Abeyasinghe, Jim Keys, Andrew Wang, Peng Zhang ** All rights reserved. **This work is licensed under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. **To view a copy of this license, visit http://www.gnu.org/licenses/ *****************************************************************************/ package ab.server.proxy.message; import org.json.simple.JSONObject; import ab.server.ProxyMessage; public class ProxyClickMessage implements ProxyMessage<Object> { private int x, y; public ProxyClickMessage(int x, int y) { this.x = x; this.y = y; } @Override public String getMessageName() { return "click"; } @SuppressWarnings("unchecked") @Override public JSONObject getJSON() { JSONObject o = new JSONObject(); o.put("x", x); o.put("y", y); return o; } @Override public Object gotResponse(JSONObject data) { return new Object(); } }
f909b6a5ecf7eac6b5bf1ae31c20cba4171c51a6
88926782a2b4ab94f06cfff4bf949532c280c493
/src/main/java/com/qiusheng/www/Thread/ThreadTest2.java
46a993d056d12a8b8bf6a06f575dc1ed832bcfd0
[]
no_license
AtticusMA/test
c9c175b86619e705589f5c207190d7503a2307f1
d2443c74e75592b2d91671194e1c72e9539a1e1d
refs/heads/master
2020-04-25T19:35:15.180991
2019-03-01T05:43:15
2019-03-01T05:43:15
173,025,443
0
0
null
null
null
null
UTF-8
Java
false
false
826
java
package com.qiusheng.www.Thread; public class ThreadTest2 { static ThreadTest2 threadTest2 = new ThreadTest2(); public static void main(String args[]){ Thread thread1 = new Thread(new Runnable(){ //synchronized是同步执行方法,其他程序方法无法进入此方法 @Override public synchronized void run(){ for(int i=0;i<4;i++){ try { Thread.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Thread1 still alive, " + i); } } }); new Thread(thread1).start(); new Thread(thread1).start(); } }
329e2b61d7c629112c837c42d661694551661e58
603486ef98a9d86cb311430a6cdf41f585ccea9b
/src/main/java/com/example/dbtradeapp/repos/TradeBookRepo.java
97c26d10a22c0dd7616e45835a695165b01011a2
[]
no_license
hackedemon/db-trade-app
de4f4f2d96bf42b7ca17172c3d98d08eaadbd1c2
4c677054f9b953a15ce465a856c0178a42c90c90
refs/heads/main
2023-04-11T05:59:47.407579
2021-05-03T08:33:42
2021-05-03T08:33:42
363,580,086
0
0
null
null
null
null
UTF-8
Java
false
false
762
java
package com.example.dbtradeapp.repos; import java.time.LocalDate; import java.util.List; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.example.dbtradeapp.entities.TradeBook; import com.example.dbtradeapp.entities.composite.TradeBookId; @Repository public interface TradeBookRepo extends JpaRepository<TradeBook, TradeBookId> { /** * Fetches all entities filtered by tradeId. * @param tradeId * @return */ Optional<List<TradeBook>> findByTradeId(String tradeId); /** * Fetches all entities less than maturity date. * @param maturityDate * @return */ Optional<List<TradeBook>> findByMaturityDateLessThan(LocalDate maturityDate); }
f7d94240f42e094570b37efad54dc4868cc1914f
1afc2011ef182458bf921472da188a6eafb1d3b7
/Silabo/src/java/dda/silabo/observaciones/iu/ObservacionesIU.java
7d664080cc900b0327a81f51e658896f7819d04f
[]
no_license
rramosaveros/Silabo
2bd5c617908e19e9247f8269c4069094e6fd7424
9337ef262b6757fc84e8c8bc76ecaa0f777c828c
refs/heads/master
2023-04-17T20:08:28.664747
2021-04-30T16:23:19
2021-04-30T16:23:19
310,903,113
0
0
null
null
null
null
UTF-8
Java
false
false
3,506
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package dda.silabo.observaciones.iu; import dda.silabo.observaciones.comunes.FechaObservacion; import dda.silabo.observaciones.comunes.Observacion; import dda.silabo.observaciones.comunes.Observaciones; /** * * @author Jorge Zaruma */ public class ObservacionesIU extends Observaciones { public void actualizarClase(Observaciones observaciones) { this.setFechas(observaciones.getFechas()); this.setObservacion(observaciones.getObservacion()); } public String toHTML(String clase, String rol, String Title, Integer idTipo) { String result = "", estadoObservacion = "disabled"; if (rol.equals("Dir") || rol.equals("Cor")) { estadoObservacion = ""; } if((this.getObservacion().getDescsec() == null) && (rol.equals("Doc"))){ result += "<br/>"; }else{ // if(this.getObservacion().getDescsec() != null){ result += "<br/>" + " <div class='form-group row'>" + "<label for='txtObservaciones' class='col-xs-2 col-form-label'>Observaciones:</label>" + "<div class='col-xs-10'>" + "<textarea class='form-control bg-warning' onkeypress='return soloLetras(event);' onkeyup='verificarCambiosInput(this);' id='txtObservaciones' rows='5' " + estadoObservacion + ">"; if (this.getObservacion().getDescsec() != null) { result += this.getObservacion().getObservacion(); } result += "</textarea>" + "</div>" + "</div>"; } if (this.getObservacion().getId_observacion() != null) { result += "<input type='hidden' id='idObservacion' value='" + this.getObservacion().getId_observacion() + "' >"; } result+= "<input type='hidden' id='idTipo' value='" + idTipo + "'>" + "<div class='form-group row'>" + " <div class='col-xs-9'>" + " </div>" + " <div class='col-xs-3'>" + " <button type='button' id='btnGuardar' class='btn btn-primary float-xs-right' onclick='" + clase + "(this);' data-toggle='tooltip' data-placement='top' title='" + Title + "'>" + " Guardar | <i class='fa fa-save'></i>" + " </button>" + " </div>" + "</div>"; if (!this.getFechas().isEmpty()) { result += "<div class='form-group row'>" + "<label for='txtObservaciones' class='col-xs-2 col-form-label'>Hist&oacute;rico:</label>" + " <div class='col-xs-10'>" + "<dl>"; for (FechaObservacion fechaObservacion : this.getFechas()) { result += "<dt>" + fechaObservacion.getFecha() + "</dt>"; for (Observacion observacion : fechaObservacion.getObservaciones()) { String Observacion = observacion.getObservacion(); // Observacion = Observacion.replaceAll("%20", " ").replaceAll("%0A", "<br>"); result += " <dd class='ml-1'>" + Observacion + "</dd>"; } } result += "</dl>" + "</div>" + "</div>"; } return result; } }
2c664d5dd1e8f7e6798fccd926a318a7cf95ddfa
aece4995cc3233b80f7c33b989d8c128155cd2fc
/src/com/lqy/source/java/util/Objects.java
5a2d620c87a088e6e91199dbf12866ca12909ca1
[]
no_license
liuqiyang7/jdksource
a0db5f1242a1bf49d83f4bf586b4628268b45577
2133872ba9861519b81e3a7f7955d6b884a8ed5e
refs/heads/master
2023-04-09T15:16:39.443391
2021-04-21T09:44:56
2021-04-21T09:44:56
358,816,549
1
0
null
null
null
null
UTF-8
Java
false
false
10,247
java
/* * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package java.util; import java.util.function.Supplier; /** * This class consists of {@code static} utility methods for operating * on objects. These utilities include {@code null}-safe or {@code * null}-tolerant methods for computing the hash code of an object, * returning a string for an object, and comparing two objects. * * @since 1.7 */ public final class Objects { private Objects() { throw new AssertionError("No java.util.Objects instances for you!"); } /** * Returns {@code true} if the arguments are equal to each other * and {@code false} otherwise. * Consequently, if both arguments are {@code null}, {@code true} * is returned and if exactly one argument is {@code null}, {@code * false} is returned. Otherwise, equality is determined by using * the {@link Object#equals equals} method of the first * argument. * * @param a an object * @param b an object to be compared with {@code a} for equality * @return {@code true} if the arguments are equal to each other * and {@code false} otherwise * @see Object#equals(Object) */ public static boolean equals(Object a, Object b) { return (a == b) || (a != null && a.equals(b)); } /** * Returns {@code true} if the arguments are deeply equal to each other * and {@code false} otherwise. * * Two {@code null} values are deeply equal. If both arguments are * arrays, the algorithm in {@link Arrays#deepEquals(Object[], * Object[]) Arrays.deepEquals} is used to determine equality. * Otherwise, equality is determined by using the {@link * Object#equals equals} method of the first argument. * * @param a an object * @param b an object to be compared with {@code a} for deep equality * @return {@code true} if the arguments are deeply equal to each other * and {@code false} otherwise * @see Arrays#deepEquals(Object[], Object[]) * @see Objects#equals(Object, Object) */ public static boolean deepEquals(Object a, Object b) { if (a == b) return true; else if (a == null || b == null) return false; else return Arrays.deepEquals0(a, b); } /** * Returns the hash code of a non-{@code null} argument and 0 for * a {@code null} argument. * * @param o an object * @return the hash code of a non-{@code null} argument and 0 for * a {@code null} argument * @see Object#hashCode */ public static int hashCode(Object o) { return o != null ? o.hashCode() : 0; } /** * Generates a hash code for a sequence of input values. The hash * code is generated as if all the input values were placed into an * array, and that array were hashed by calling {@link * Arrays#hashCode(Object[])}. * * <p>This method is useful for implementing {@link * Object#hashCode()} on objects containing multiple fields. For * example, if an object that has three fields, {@code x}, {@code * y}, and {@code z}, one could write: * * <blockquote><pre> * &#064;Override public int hashCode() { * return Objects.hash(x, y, z); * } * </pre></blockquote> * * <b>Warning: When a single object reference is supplied, the returned * value does not equal the hash code of that object reference.</b> This * value can be computed by calling {@link #hashCode(Object)}. * * @param values the values to be hashed * @return a hash value of the sequence of input values * @see Arrays#hashCode(Object[]) * @see List#hashCode */ public static int hash(Object... values) { return Arrays.hashCode(values); } /** * Returns the result of calling {@code toString} for a non-{@code * null} argument and {@code "null"} for a {@code null} argument. * * @param o an object * @return the result of calling {@code toString} for a non-{@code * null} argument and {@code "null"} for a {@code null} argument * @see Object#toString * @see String#valueOf(Object) */ public static String toString(Object o) { return String.valueOf(o); } /** * Returns the result of calling {@code toString} on the first * argument if the first argument is not {@code null} and returns * the second argument otherwise. * * @param o an object * @param nullDefault string to return if the first argument is * {@code null} * @return the result of calling {@code toString} on the first * argument if it is not {@code null} and the second argument * otherwise. * @see Objects#toString(Object) */ public static String toString(Object o, String nullDefault) { return (o != null) ? o.toString() : nullDefault; } /** * Returns 0 if the arguments are identical and {@code * c.compare(a, b)} otherwise. * Consequently, if both arguments are {@code null} 0 * is returned. * * <p>Note that if one of the arguments is {@code null}, a {@code * NullPointerException} may or may not be thrown depending on * what ordering policy, if any, the {@link Comparator Comparator} * chooses to have for {@code null} values. * * @param <T> the type of the objects being compared * @param a an object * @param b an object to be compared with {@code a} * @param c the {@code Comparator} to compare the first two arguments * @return 0 if the arguments are identical and {@code * c.compare(a, b)} otherwise. * @see Comparable * @see Comparator */ public static <T> int compare(T a, T b, Comparator<? super T> c) { return (a == b) ? 0 : c.compare(a, b); } /** * Checks that the specified object reference is not {@code null}. This * method is designed primarily for doing parameter validation in methods * and constructors, as demonstrated below: * <blockquote><pre> * public Foo(Bar bar) { * this.bar = Objects.requireNonNull(bar); * } * </pre></blockquote> * * @param obj the object reference to check for nullity * @param <T> the type of the reference * @return {@code obj} if not {@code null} * @throws NullPointerException if {@code obj} is {@code null} */ //传过来的对象为空报空指针 public static <T> T requireNonNull(T obj) { if (obj == null) throw new NullPointerException(); return obj; } /** * Checks that the specified object reference is not {@code null} and * throws a customized {@link NullPointerException} if it is. This method * is designed primarily for doing parameter validation in methods and * constructors with multiple parameters, as demonstrated below: * <blockquote><pre> * public Foo(Bar bar, Baz baz) { * this.bar = Objects.requireNonNull(bar, "bar must not be null"); * this.baz = Objects.requireNonNull(baz, "baz must not be null"); * } * </pre></blockquote> * * @param obj the object reference to check for nullity * @param message detail message to be used in the event that a {@code * NullPointerException} is thrown * @param <T> the type of the reference * @return {@code obj} if not {@code null} * @throws NullPointerException if {@code obj} is {@code null} */ public static <T> T requireNonNull(T obj, String message) { if (obj == null) throw new NullPointerException(message); return obj; } /** * Returns {@code true} if the provided reference is {@code null} otherwise * returns {@code false}. * * @apiNote This method exists to be used as a * {@link java.util.function.Predicate}, {@code filter(Objects::isNull)} * * @param obj a reference to be checked against {@code null} * @return {@code true} if the provided reference is {@code null} otherwise * {@code false} * * @see java.util.function.Predicate * @since 1.8 */ public static boolean isNull(Object obj) { return obj == null; } /** * Returns {@code true} if the provided reference is non-{@code null} * otherwise returns {@code false}. * * @apiNote This method exists to be used as a * {@link java.util.function.Predicate}, {@code filter(Objects::nonNull)} * * @param obj a reference to be checked against {@code null} * @return {@code true} if the provided reference is non-{@code null} * otherwise {@code false} * * @see java.util.function.Predicate * @since 1.8 */ public static boolean nonNull(Object obj) { return obj != null; } /** * Checks that the specified object reference is not {@code null} and * throws a customized {@link NullPointerException} if it is. * * <p>Unlike the method {@link #requireNonNull(Object, String)}, * this method allows creation of the message to be deferred until * after the null check is made. While this may confer a * performance advantage in the non-null case, when deciding to * call this method care should be taken that the costs of * creating the message supplier are less than the cost of just * creating the string message directly. * * @param obj the object reference to check for nullity * @param messageSupplier supplier of the detail message to be * used in the event that a {@code NullPointerException} is thrown * @param <T> the type of the reference * @return {@code obj} if not {@code null} * @throws NullPointerException if {@code obj} is {@code null} * @since 1.8 */ public static <T> T requireNonNull(T obj, Supplier<String> messageSupplier) { if (obj == null) throw new NullPointerException(messageSupplier.get()); return obj; } }
fbe32935537b40f14c25f35f95d44cb8c7919ee6
a25d8005827976c8550b4e3174f73a6aad50709c
/payoff-client/app/src/main/java/com/example/phonepe/MainActivity.java
ab94cbe9969bc4bb96285aeb9127c523b7738101
[]
no_license
AVJefferson/hackfest2021-debeggers-phonepe
4e3ab31c056728784c4db4a3e56a68cf27d68c8d
e21314d34cb399fdbca7164ffda00ddf44ddcd4c
refs/heads/master
2023-04-20T15:05:11.652978
2021-05-02T06:19:16
2021-05-02T06:19:16
363,576,902
1
3
null
null
null
null
UTF-8
Java
false
false
962
java
package com.example.phonepe; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pay); // getSupportActionBar().hide(); findViewById(R.id.button3).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this,PayActivity.class)); } }); findViewById(R.id.button2).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this,KycActivity.class)); } }); } }
f55695056f09776a3b198f75c36b01544c8d4524
44b336d63990497588e5d0150a339d81c4380810
/src/main/java/org/jenkinsci/plugins/bbprb/BitbucketBuildTrigger.java
d05b96b89bbba6baae053e5b12edc40b01aa9d1a
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
ip1981/bbprb
e493e1101746bb1ecbb4edfce203c69124123940
279c4e5ad1952478221ab7be883d750fbfe38c9c
refs/heads/master
2022-04-12T16:24:00.430474
2020-03-27T17:17:45
2020-03-27T17:17:51
112,850,273
8
6
null
2018-01-18T11:31:06
2017-12-02T14:51:58
Java
UTF-8
Java
false
false
11,904
java
package org.jenkinsci.plugins.bbprb; import antlr.ANTLRException; import com.cloudbees.plugins.credentials.common.StandardListBoxModel; import com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials; import com.cloudbees.plugins.credentials.common.UsernamePasswordCredentials; import com.cloudbees.plugins.credentials.CredentialsMatchers; import com.cloudbees.plugins.credentials.CredentialsProvider; import com.cloudbees.plugins.credentials.domains.URIRequirementBuilder; import hudson.Extension; import hudson.model.AbstractProject; import hudson.model.Cause; import hudson.model.Executor; import hudson.model.Item; import hudson.model.ParameterDefinition; import hudson.model.ParametersAction; import hudson.model.ParametersDefinitionProperty; import hudson.model.ParameterValue; import hudson.model.queue.QueueTaskFuture; import hudson.model.Queue; import hudson.model.Result; import hudson.model.Run; import hudson.model.StringParameterValue; import hudson.security.ACL; import hudson.triggers.Trigger; import hudson.triggers.TriggerDescriptor; import hudson.util.ListBoxModel; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import java.util.Map; import javax.annotation.Nonnull; import javax.annotation.Nullable; import jenkins.model.Jenkins; import net.sf.json.JSONObject; import org.acegisecurity.context.SecurityContext; import org.acegisecurity.context.SecurityContextHolder; import org.apache.commons.lang.StringUtils; import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.StaplerRequest; import static com.cloudbees.plugins.credentials.CredentialsMatchers.instanceOf; import org.jenkinsci.plugins.bbprb.bitbucket.ApiClient; import org.jenkinsci.plugins.bbprb.bitbucket.BuildState; public class BitbucketBuildTrigger extends Trigger<AbstractProject<?, ?>> { private final String ciKey; private final String ciName; private final String credentialsId; private final String destinationRepository; private final boolean cancelOutdatedJobs; // XXX: This is for Jelly. // https://wiki.jenkins.io/display/JENKINS/Basic+guide+to+Jelly+usage+in+Jenkins public String getCiKey() { return this.ciKey; } public String getCiName() { return this.ciName; } public String getCredentialsId() { return this.credentialsId; } public String getDestinationRepository() { return this.destinationRepository; } public boolean getCancelOutdatedJobs() { return this.cancelOutdatedJobs; } private transient ApiClient apiClient; private static final transient ArrayList<String> bbprbSafeParameters = new ArrayList<String>() { { add("bbprbDestinationBranch"); add("bbprbDestinationCommitHash"); add("bbprbDestinationRepository"); add("bbprbPullRequestAuthor"); add("bbprbPullRequestId"); add("bbprbPullRequestTitle"); add("bbprbSourceBranch"); add("bbprbSourceCommitHash"); add("bbprbSourceRepository"); } }; public static final BitbucketBuildTriggerDescriptor descriptor = new BitbucketBuildTriggerDescriptor(); @DataBoundConstructor public BitbucketBuildTrigger(String credentialsId, String destinationRepository, String ciKey, String ciName, boolean cancelOutdatedJobs) throws ANTLRException { super(); this.apiClient = null; this.cancelOutdatedJobs = cancelOutdatedJobs; this.ciKey = ciKey; this.ciName = ciName; this.credentialsId = credentialsId; this.destinationRepository = destinationRepository; } @Override public void start(AbstractProject<?, ?> project, boolean newInstance) { logger.log(Level.FINE, "Started for `{0}`", project.getFullName()); super.start(project, newInstance); if (credentialsId != null && !credentialsId.isEmpty()) { logger.log(Level.FINE, "Looking up credentials `{0}`", this.credentialsId); List<UsernamePasswordCredentials> all = CredentialsProvider.lookupCredentials( UsernamePasswordCredentials.class, (Item)null, ACL.SYSTEM, URIRequirementBuilder.fromUri("https://bitbucket.org").build()); UsernamePasswordCredentials creds = CredentialsMatchers.firstOrNull( all, CredentialsMatchers.withId(this.credentialsId)); if (creds != null) { logger.log(Level.INFO, "Creating Bitbucket API client"); this.apiClient = new ApiClient(creds.getUsername(), creds.getPassword().getPlainText(), this.ciKey, this.ciName); } else { logger.log(Level.SEVERE, "Credentials `{0}` not found", this.credentialsId); } } else { logger.log(Level.WARNING, "Missing Bitbucket API credentials"); } } public void setPRState(BitbucketCause cause, BuildState state, String path) { if (this.apiClient != null) { logger.log(Level.INFO, "Setting status of PR #{0} to {1} for {2}", new Object[] {cause.getPullRequestId(), state, cause.getDestinationRepository()}); this.apiClient.setBuildStatus( cause.getSourceRepository(), cause.getSourceCommitHash(), state, getInstance().getRootUrl() + path, null, this.job.getFullName()); } else { logger.log(Level.INFO, "Will not set Bitbucket PR build status (not configured)"); } } private void startJob(BitbucketCause cause) { List<ParameterValue> bbprb = new ArrayList<>(); bbprb.add(new StringParameterValue("bbprbDestinationBranch", cause.getDestinationBranch())); bbprb.add(new StringParameterValue("bbprbDestinationCommitHash", cause.getDestinationCommitHash())); bbprb.add(new StringParameterValue("bbprbDestinationRepository", cause.getDestinationRepository())); bbprb.add(new StringParameterValue("bbprbPullRequestAuthor", cause.getPullRequestAuthor())); bbprb.add(new StringParameterValue("bbprbPullRequestId", cause.getPullRequestId())); bbprb.add(new StringParameterValue("bbprbPullRequestTitle", cause.getPullRequestTitle())); bbprb.add( new StringParameterValue("bbprbSourceBranch", cause.getSourceBranch())); bbprb.add(new StringParameterValue("bbprbSourceCommitHash", cause.getSourceCommitHash())); bbprb.add(new StringParameterValue("bbprbSourceRepository", cause.getSourceRepository())); setPRState(cause, BuildState.INPROGRESS, this.job.getUrl()); this.job.scheduleBuild2(0, cause, new ParametersAction(bbprb, bbprbSafeParameters)); } private Jenkins getInstance() { final Jenkins instance = Jenkins.getInstance(); if (instance == null) { throw new IllegalStateException("Jenkins instance is NULL!"); } return instance; } private boolean hasCauseFromTheSamePullRequest(@Nullable List<Cause> causes, @Nullable BitbucketCause pullRequestCause) { if (causes != null && pullRequestCause != null) { for (Cause cause : causes) { if (cause instanceof BitbucketCause) { BitbucketCause sc = (BitbucketCause)cause; if (StringUtils.equals(sc.getPullRequestId(), pullRequestCause.getPullRequestId()) && StringUtils.equals(sc.getSourceRepository(), pullRequestCause.getSourceRepository())) { return true; } } } } return false; } private void cancelPR(BitbucketCause cause) { SecurityContext orig = ACL.impersonate(ACL.SYSTEM); logger.log(Level.FINE, "Looking for queued jobs that match PR #{0}", cause.getPullRequestId()); Queue queue = getInstance().getQueue(); for (Queue.Item item : queue.getItems()) { if (hasCauseFromTheSamePullRequest(item.getCauses(), cause)) { logger.fine("Canceling item in queue: " + item); queue.cancel(item); } } logger.log(Level.FINE, "Looking for running jobs that match PR #{0}", cause.getPullRequestId()); for (Object o : job.getBuilds()) { if (o instanceof Run) { Run build = (Run)o; if (build.isBuilding() && hasCauseFromTheSamePullRequest(build.getCauses(), cause)) { logger.fine("Aborting '" + build + "' since the PR is outdated"); try { build.setDescription("Aborted build since the PR is outdated"); } catch (IOException e) { logger.warning("Could not set build description: " + e.getMessage()); } final Executor executor = build.getExecutor(); if (executor == null) { throw new IllegalStateException("Executor can't be NULL"); } executor.interrupt(Result.ABORTED); } } } SecurityContextHolder.setContext(orig); } public void handlePR(String event, JSONObject pr) { JSONObject src = pr.getJSONObject("source"); JSONObject dst = pr.getJSONObject("destination"); String dstRepository = dst.getJSONObject("repository").getString("full_name"); if (!dstRepository.equals(this.destinationRepository)) { logger.log(Level.FINE, "Job `{0}`: repository `{1}` does not match `{2}`. Skipping.", new Object[] {this.job.getFullName(), dstRepository, this.destinationRepository}); return; } BitbucketCause cause = new BitbucketCause( src.getJSONObject("branch").getString("name"), dst.getJSONObject("branch").getString("name"), src.getJSONObject("repository").getString("full_name"), pr.getString("id"), // FIXME: it is integer dstRepository, pr.getString("title"), src.getJSONObject("commit").getString("hash"), dst.getJSONObject("commit").getString("hash"), pr.getJSONObject("author").getString("display_name")); switch (event) { case "pullrequest:created": startJob(cause); break; case "pullrequest:updated": if (this.cancelOutdatedJobs) { cancelPR(cause); } startJob(cause); break; default: logger.log(Level.WARNING, "Unhandled event: `{0}`", new Object[] {event}); } } @Extension @Symbol("bbprb") public static final class BitbucketBuildTriggerDescriptor extends TriggerDescriptor { public BitbucketBuildTriggerDescriptor() { load(); } @Override public boolean isApplicable(Item item) { return item instanceof AbstractProject; } @Override public String getDisplayName() { return "Bitbucket Pull Requests Builder"; } @Override public boolean configure(StaplerRequest req, JSONObject json) throws FormException { save(); return super.configure(req, json); } public ListBoxModel doFillCredentialsIdItems() { return new StandardListBoxModel().withEmptySelection().withMatching( instanceOf(UsernamePasswordCredentials.class), CredentialsProvider.lookupCredentials( StandardUsernamePasswordCredentials.class)); } } private static final Logger logger = Logger.getLogger(BitbucketBuildTrigger.class.getName()); }
d7a569315feec93dc69400493b04125753f1a1cc
f374eb9c89a0243c55e7e8cabcf9289a9d0c47b9
/src/Bank/BankGUI.java
cde9bb0da1b1e646673a3952d2dd9fab4a343ed5
[]
no_license
hcastillomartinez/AuctionHouse
ccc1c1d7cfa45c08fea94245833aba83ca482bf9
21235e2475e7408663e700567f5e535330879afd
refs/heads/master
2021-07-10T03:06:16.215622
2020-07-15T13:08:41
2020-07-15T13:08:41
170,723,558
0
1
null
null
null
null
UTF-8
Java
false
false
5,734
java
package Bank; import javafx.application.Application; import javafx.application.Platform; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.concurrent.Task; import javafx.scene.Scene; import javafx.scene.control.ListView; import javafx.scene.control.TitledPane; import javafx.scene.layout.Pane; import javafx.stage.Screen; import javafx.stage.Stage; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.SECONDS; /** * The GUI for Bank. * @author Daniel Miller */ public class BankGUI extends Application { Pane mainPane; static Bank bank; //reference to the static bank // final variables private final double WIDTH = Screen.getPrimary().getBounds().getWidth() * 0.75; private final double HEIGHT = Screen.getPrimary().getBounds().getHeight() * 0.75; //observable lists for agent and auction house bank accounts private ObservableList<Account> agentAccountList = FXCollections.observableArrayList(); private ObservableList<Account> auctionHouseAccountList = FXCollections.observableArrayList(); //list views for displaying agent and auction house bank accounts private ListView<Account> agentAccountsListView; private ListView<Account> auctionHouseAccountsListView; //titled panes to display accounts private TitledPane agentsPane; private TitledPane housesPane; /** * Constructor for BankGUI */ public BankGUI() { mainPane = new Pane(); initializeObservableLists(); initializeListViews(); initializeTitledPanes(); mainPane.getChildren().addAll(agentsPane, housesPane); } /** * Updates the observable lists to contain the most recent account information */ private void refreshAccountInformation(){ agentAccountList.setAll(getAgentAccounts()); auctionHouseAccountList.setAll(getHouseAccounts()); } /** * @return a list of all auction house bank accounts */ private ArrayList<Account> getHouseAccounts(){ ArrayList<Account> accounts = new ArrayList<>(); for(Account account : bank.getAccountsAsList()){ if(!account.isAgent()){ accounts.add(account); } } return accounts; } /** * @return a list of all agent bank accounts */ private ArrayList<Account> getAgentAccounts(){ ArrayList<Account> accounts = new ArrayList<>(); for(Account account : bank.getAccountsAsList()){ if(account.isAgent()){ accounts.add(account); } } return accounts; } /** * Initializes the two titled panes used in the GUI. */ private void initializeTitledPanes(){ agentsPane = new TitledPane("Agent Accounts",agentAccountsListView); agentsPane.setPrefSize(WIDTH / 2,HEIGHT); agentsPane.setLayoutX(0); agentsPane.setLayoutY(0); housesPane = new TitledPane("Auction House Accounts",auctionHouseAccountsListView); housesPane.setPrefSize(WIDTH / 2,HEIGHT); housesPane.setLayoutX(WIDTH / 2); housesPane.setLayoutY(0); } /** * Initializes the two list views used by the GUI. */ private void initializeListViews(){ agentAccountsListView = new ListView<>(agentAccountList); agentAccountsListView.setEditable(true); agentAccountsListView.setLayoutX(0); agentAccountsListView.setLayoutY(0); auctionHouseAccountsListView = new ListView<>(auctionHouseAccountList); auctionHouseAccountsListView.setEditable(true); agentAccountsListView.setLayoutX(0); agentAccountsListView.setLayoutY(0); } /** * Initializes the two observable lists used by the GUI */ private void initializeObservableLists(){ agentAccountList = FXCollections.observableArrayList(); auctionHouseAccountList = FXCollections.observableArrayList(); } /** * Launches the application. * @param args IP Address and Port Number */ public static void launch(String...args) { String address; int portNumber; if(args.length >= 1){ address = args[0]; portNumber = Integer.parseInt(args[1]); } else{ return; } bank = new Bank(address, portNumber); Thread bankThread = new Thread(bank); bankThread.start(); BankGUI.launch(BankGUI.class); } /** * Function to start running the application. */ @Override public void start(Stage primaryStage) throws Exception { BankGUI gui = new BankGUI(); //bank.gui = gui; Scene scene = new Scene(gui.mainPane); primaryStage.setTitle("Bank"); primaryStage.setScene(scene); primaryStage.setResizable(false); primaryStage.show(); Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { Platform.runLater(new Runnable() { @Override public void run() { gui.refreshAccountInformation(); } }); } }, 0, 1000); } /** * Stops the program. */ @Override public void stop(){ System.exit(1); } }
211e610848fb1f92376b4add6d57c22fe96ac1f5
952d82feee93531235cf3419d7266cc5b62da8f4
/app/src/main/java/ziz/org/ecommerce/ui/home/HomeViewModel.java
a634f18d44c4a4bd3bbe9e111e2fa112853a9635
[]
no_license
kemokaba/projet
595ef4f69817cc3c483e75bfff145e7c2bd1359d
40bf0142f090d0e63ddbb88dda4d926cd4afbbee
refs/heads/master
2023-02-10T04:37:11.925341
2021-01-04T22:46:32
2021-01-04T22:46:32
326,744,657
0
0
null
null
null
null
UTF-8
Java
false
false
440
java
package ziz.org.ecommerce.ui.home; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; public class HomeViewModel extends ViewModel { private MutableLiveData<String> mText; public HomeViewModel() { mText = new MutableLiveData<>(); mText.setValue("This is home fragment"); } public LiveData<String> getText() { return mText; } }
79b7eee882e054a26ae98f92947a8180fd245af0
92326aa879b75edc6205b9d449e1a2e4e66d5b16
/src/main/java/sparkproject/sessionAnalysis/SessionAggrStatAccumulator.java
a66313a84fffc57b9aab12e5e6f7186cbf7e60b3
[]
no_license
cauchy8389/SparkTest
053b008a0d1386ddf48e54360de0fe439bfa689d
47058b44499828acbaf7667b4e2a9259654d1734
refs/heads/master
2022-07-07T09:19:20.562335
2021-04-29T02:31:46
2021-04-29T02:31:46
161,974,273
1
0
null
2022-06-17T02:02:29
2018-12-16T06:26:56
Scala
UTF-8
Java
false
false
4,694
java
package sparkproject.sessionAnalysis; import org.apache.commons.lang3.StringUtils; import org.apache.spark.util.AccumulatorV2; import sparkproject.Constants; import sparkproject.MockData; import sparkproject.ParamUtils; /** * session聚合统计Accumulator * * 大家可以看到 * 其实使用自己定义的一些数据格式,比如String,甚至说,我们可以自己定义model,自己定义的类(必须可序列化) * 然后呢,可以基于这种特殊的数据格式,可以实现自己复杂的分布式的计算逻辑 * 各个task,分布式在运行,可以根据你的需求,task给Accumulator传入不同的值 * 根据不同的值,去做复杂的逻辑 * * Spark Core里面很实用的高端技术 * * @author Administrator * */ public class SessionAggrStatAccumulator extends AccumulatorV2<String,String> { private static final long serialVersionUID = 6311074555136039130L; private String str = SessionAggrStatAccumulator.zero; final static String zero = Constants.SESSION_COUNT + "=0|" + Constants.TIME_PERIOD_1s_3s + "=0|" + Constants.TIME_PERIOD_4s_6s + "=0|" + Constants.TIME_PERIOD_7s_9s + "=0|" + Constants.TIME_PERIOD_10s_30s + "=0|" + Constants.TIME_PERIOD_30s_60s + "=0|" + Constants.TIME_PERIOD_1m_3m + "=0|" + Constants.TIME_PERIOD_3m_10m + "=0|" + Constants.TIME_PERIOD_10m_30m + "=0|" + Constants.TIME_PERIOD_30m + "=0|" + Constants.STEP_PERIOD_1_3 + "=0|" + Constants.STEP_PERIOD_4_6 + "=0|" + Constants.STEP_PERIOD_7_9 + "=0|" + Constants.STEP_PERIOD_10_30 + "=0|" + Constants.STEP_PERIOD_30_60 + "=0|" + Constants.STEP_PERIOD_60 + "=0"; /** * zero方法,其实主要用于数据的初始化 * 那么,我们这里,就返回一个值,就是初始化中,所有范围区间的数量,都是0 * 各个范围区间的统计数量的拼接,还是采用一如既往的key=value|key=value的连接串的格式 */ @Override public boolean isZero() { return StringUtils.equals(str,SessionAggrStatAccumulator.zero); } @Override public AccumulatorV2<String, String> copy() { SessionAggrStatAccumulator newAccumulator = new SessionAggrStatAccumulator(); newAccumulator.str = this.str; return newAccumulator; } @Override public void reset() { str = SessionAggrStatAccumulator.zero; } @Override public void add(String v) { // 校验:v1为空的话,直接返回v2 if(StringUtils.isEmpty(v)) { return; } // 使用StringUtils工具类,从v1中,提取v2对应的值,并累加1 String oldValue = ParamUtils.getFieldFromConcatString(str, "\\|", v); if(oldValue != null) { // 将范围区间原有的值,累加1 int newValue = Integer.valueOf(oldValue) + 1; // 使用StringUtils工具类,将v1中,v2对应的值,设置成新的累加后的值 str = ParamUtils.setFieldIntoConcatString(str, "\\|", v, String.valueOf(newValue)); } } @Override public void merge(AccumulatorV2<String, String> other) { //SessionAggrStatAccumulator o =(SessionAggrStatAccumulator)other; //str += o.str; addOtherValue(other, Constants.SESSION_COUNT); addOtherValue(other, Constants.TIME_PERIOD_1s_3s); addOtherValue(other, Constants.TIME_PERIOD_4s_6s); addOtherValue(other, Constants.TIME_PERIOD_7s_9s); addOtherValue(other, Constants.TIME_PERIOD_10s_30s); addOtherValue(other, Constants.TIME_PERIOD_30s_60s); addOtherValue(other, Constants.TIME_PERIOD_1m_3m); addOtherValue(other, Constants.TIME_PERIOD_3m_10m); addOtherValue(other, Constants.TIME_PERIOD_10m_30m); addOtherValue(other, Constants.TIME_PERIOD_30m); addOtherValue(other, Constants.STEP_PERIOD_1_3 ); addOtherValue(other, Constants.STEP_PERIOD_4_6); addOtherValue(other, Constants.STEP_PERIOD_7_9); addOtherValue(other, Constants.STEP_PERIOD_10_30 ); addOtherValue(other, Constants.STEP_PERIOD_30_60); addOtherValue(other, Constants.STEP_PERIOD_60); } private void addOtherValue(AccumulatorV2<String, String> other, String vv){ //String retValue = StringUtils.EMPTY; String otherValue = ParamUtils.getFieldFromConcatString(other.value(), "\\|", vv); String thisValue = ParamUtils.getFieldFromConcatString(str, "\\|", vv); if(otherValue != null) { if (thisValue == null) { str = ParamUtils.setFieldIntoConcatString(str, "\\|", vv, String.valueOf(otherValue)); } else { int newValue = Integer.valueOf(otherValue) + Integer.valueOf(thisValue); // 使用StringUtils工具类,将v1中,v2对应的值,设置成新的累加后的值 str = ParamUtils.setFieldIntoConcatString(str, "\\|", vv, String.valueOf(newValue)); } } } @Override public String value() { return str; } }
58403ec37957d53307e1a8da47946583727c9ddc
d3656d4b524753f361382d213586203c23f92554
/src/DynamicProgramming/problems/GoldMiner.java
e9657bb99efad3f6314b2eef192070abf1ad8d7c
[]
no_license
wanderergit/Data_Structures_and_Algorithms
36904fef73c366f18328b60c96422471af7056d2
6cee04276db8a6f4188e6bc37aba6598e11fa57d
refs/heads/master
2023-06-26T11:10:05.700584
2021-07-23T06:58:27
2021-07-23T06:58:27
334,597,590
0
0
null
null
null
null
UTF-8
Java
false
false
1,164
java
package DynamicProgramming.problems; public class GoldMiner { public static void main(String[] args) { int[][] M = {{1, 3, 1, 5}, {2, 2, 4, 1}, {5, 0, 2, 3}, {0, 6, 1, 2}}; System.out.println(maxGold(4, 4, M)); } static int maxGold(int m, int n, int M[][]) { for (int j = n - 2; j >= 0; j--) { for (int i = 0; i < m; i++) { M[i][j] += getMaxNeighbors(i, j, m, M); } } int max = 0; for (int i = 0; i < m; i++) { max = Math.max(max, M[i][0]); } return max; } // this method simply returns the maximum out of all valid neighbors of that particular cell static int getMaxNeighbors(int i, int j, int m, int[][] mat){ int max = 0; if(i != 0) { if(max < mat[i-1][j+1]){ max = mat[i-1][j+1]; } } if(max < mat[i][j+1]){ max = mat[i][j+1]; } if(i != m-1){ if(max < mat[i+1][j+1]){ max = mat[i+1][j+1]; } } return max; } }
68fe3dfc5f6d5105da909ba3708d393417f9a498
b320fec53c930244c18101333ac6cae8300601c4
/backend/manager/modules/welcome/src/main/java/org/ovirt/engine/core/OAuthCallbackServlet.java
0cf23b2ad73957a4093b7d34b7fe5bee3188c83b
[ "Apache-2.0" ]
permissive
kanalun/ovirt-engine
b979ee05801881e7bea37d7655c6c972e9ea9acd
5086d44e3c1397812192cfc4381f77cc76cfc022
refs/heads/master
2021-01-18T02:44:39.981423
2016-03-31T12:36:58
2016-04-05T10:49:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,444
java
package org.ovirt.engine.core; import java.io.IOException; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.aaa.SSOOAuthServiceUtils; import org.ovirt.engine.core.utils.EngineLocalConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class OAuthCallbackServlet extends HttpServlet { private static final Logger log = LoggerFactory.getLogger(OAuthCallbackServlet.class); private static final long serialVersionUID = 5943389529927921616L; private static String moduleScope = "ovirt-app-admin ovirt-app-portal"; @Override protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { log.debug("Entered OAuthCallbackServlet"); String authCode = request.getParameter(WelcomeUtils.CODE); String state = request.getParameter(WelcomeUtils.STATE); String stateInSession = (String) request.getSession(true).getAttribute(WelcomeUtils.STATE); String engineUri = EngineLocalConfig.getInstance().getProperty(WelcomeUtils.ENGINE_URI) + "/"; String redirectUri = engineUri + "oauth2-callback"; String token = ""; if (StringUtils.isNotEmpty(stateInSession) && stateInSession.equals(state)) { if (StringUtils.isNotEmpty(authCode)) { String tokenForAuthCode = getTokenForAuthCode(request, authCode, moduleScope, redirectUri); if (StringUtils.isNotEmpty(tokenForAuthCode)) { token = tokenForAuthCode; } else { authCode = null; } } } request.getSession(true).setAttribute(WelcomeUtils.AUTH_CODE, authCode == null ? "" : authCode); if (StringUtils.isEmpty((String) request.getSession(true).getAttribute(WelcomeUtils.TOKEN))) { request.getSession(true).setAttribute(WelcomeUtils.TOKEN, token); } if (StringUtils.isNotEmpty(request.getParameter(WelcomeUtils.ERROR_CODE)) && !WelcomeUtils.ERR_OVIRT_CODE_NOT_AUTHENTICATED.equals(request.getParameter(WelcomeUtils.ERROR_CODE))) { request.getSession(true).setAttribute(WelcomeUtils.ERROR, request.getParameter(WelcomeUtils.ERROR)); request.getSession(true).setAttribute(WelcomeUtils.ERROR_CODE, request.getParameter(WelcomeUtils.ERROR_CODE)); } log.debug("Redirecting to {}", engineUri); response.sendRedirect(engineUri); log.debug("Exited OAuthCallbackServlet"); } private String getTokenForAuthCode(HttpServletRequest request, String authCode, String scope, String redirectUri) { String token = null; Map<String, Object> tokenMap = SSOOAuthServiceUtils.getToken(WelcomeUtils.AUTHORIZATION_CODE, authCode, scope, redirectUri); if (tokenMap.containsKey(WelcomeUtils.ERROR)) { request.getSession(true).setAttribute(WelcomeUtils.ERROR, tokenMap.get(WelcomeUtils.ERROR)); request.getSession(true).setAttribute(WelcomeUtils.ERROR_CODE, tokenMap.get(WelcomeUtils.ERROR_CODE)); } else { token = (String) tokenMap.get(WelcomeUtils.JSON_ACCESS_TOKEN); } return token; } }
a3cd18697aa7ff411cdd6544664a3d77f9243a95
7405bd964813f1d2d836e5a7a543f5daffb4f1ca
/app/src/androidTest/java/de/lgblaumeiser/anpfiff/ApplicationTest.java
697df13a7603df6b488a4dd101256be8f39b1ce6
[ "BSD-2-Clause" ]
permissive
lgblaumeiser/Anpfiff
b14c94c13b05a3fd93f1565e811c0d34c41e820a
1be6689d9fe5d20b5dc477dd22cb69e8512bc088
refs/heads/master
2020-05-26T19:58:57.190337
2015-08-20T17:53:29
2015-08-20T17:53:29
28,721,500
0
0
null
null
null
null
UTF-8
Java
false
false
354
java
package de.lgblaumeiser.anpfiff; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
3d1a0ed2f3b5a8b2c6defe59df78ddf303739fd3
011175f0cd5d80dbe4dda46b02f96cde6f82bbbc
/src/test/java/de/fernuni/pi3/interactionmanager/rules/sensingeventmanager/TooManyParticipantsRuleTest.java
165397f9d179c0ce0f2928ce11df9903fdb4fc18
[]
no_license
ascheerer/interaction-manager
7760c498b364353026be7288a3dc1de5d2259f89
0177326eb1516dc6e1709ab5cd376b50c6b55b66
refs/heads/master
2016-09-05T20:15:38.572220
2013-06-20T17:11:16
2013-06-20T17:11:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,394
java
package de.fernuni.pi3.interactionmanager.rules.sensingeventmanager; import java.util.HashMap; import org.junit.Before; import de.fernuni.pi3.interactionmanager.Event; import de.fernuni.pi3.interactionmanager.InstanceVars; import de.fernuni.pi3.interactionmanager.rules.AbstractRuleTest; import de.fernuni.pi3.interactionmanager.rules.Rule; import de.fernuni.pi3.interactionmanager.rules.sensingeventmanager.TooManyParticipantsRule; public class TooManyParticipantsRuleTest extends AbstractRuleTest { private static final String inEventJson = "{\"name\":\"participant\",\"appType\":\"SensingEventManager\",\"appInstanceId\":\"50924677bbcdaaa713000001\",\"properties\":{\"feedbackType\":\"question\",\"feedbackAnswer\":\"nein\",\"feedbackAnswerRating\":1.0,\"participantName\":\"user1\"},\"customVars\":{\"id\":1.36437731446243E14,\"eventId\":1.0,\"eventType\":\"feedbackAssistant\",\"senderTime\":\"pulse\",\"_dateCreated\":\"2013-03-27T10:41:54\",\"_timeCreated\":\"10:41:54\"}}"; @Override @Before public void setUpTestData() { // given Event givenEvent = Event.fromJson(inEventJson); InstanceVars givenInstanceVars = new InstanceVars(); givenInstanceVars.put("PARTICIPANT_COUNT", SensingEventManagerConsts.MAX_PARTICIPANT_COUNT + 1); givenInstanceVars.put("MEETING_TYPE", "Planning"); // expected Event expectedEvent = createTestEvent(); expectedEvent.setAppType(givenEvent.getAppType()); expectedEvent.setAppInstanceId(givenEvent.getAppInstanceId()); expectedEvent.setName("recommendation"); expectedEvent.setProperty("eventId", 40); expectedEvent .setProperty("headline", "Die maximale Anzahl der Teilnehmer wurde überschritten."); expectedEvent .setProperty( "text", "Wollen Sie mit dem Meeting fortfahren oder es beenden?"); HashMap<String, String> options = new HashMap<String, String>(); options.put("Abbrechen", "Meetingstar.util.global.sensingEngine.MagicButtonFunctions.quit"); options.put("Fortfahren", "Meetingstar.util.global.sensingEngine.MagicButtonFunctions.continue"); expectedEvent.setProperty("options", options); InstanceVars expectedInstanceVars = new InstanceVars(); expectedInstanceVars.putAll(givenInstanceVars); addTestData(givenEvent, givenInstanceVars, expectedEvent, expectedInstanceVars); } @Override protected Rule getRule() { return new TooManyParticipantsRule(); } }
68497d10edde9cb0552a06ded1a0a7239370fb4e
508d45cc158632dc1b4ad823e71ccdf303c6d2b4
/src/com/wip/automation/excercise4/PastDateUsingDateAPI.java
5eba42f65b53b32e71926dc80ba1b36ab90e45b1
[]
no_license
aanpudur/wipautomation
d88fabbca6705f478fdff08d6134e41ac271420d
aa8bb9e646ebd25a38b3b9ce49c50fce79c6c657
refs/heads/master
2021-01-22T05:15:48.252097
2017-03-19T06:39:40
2017-03-19T06:39:40
81,634,555
0
0
null
null
null
null
UTF-8
Java
false
false
885
java
package com.wip.automation.excercise4; //Create a two past date using java date api import java.util.Calendar; import java.util.Date; public class PastDateUsingDateAPI { public static void main(String[] args) { // Generate a date for Jan. 25, 2013, 10:11:15 AM Calendar cal = Calendar.getInstance(); // YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE, and SECOND. cal.set(2013, Calendar.JANUARY, 25, 10, 11, 15); Date date1 = cal.getTime(); System.out.println("The past date1 using java date api ===> " + date1); // Generate a date for October. 5, 1966, 12:55:15 AM // YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE, and SECOND. cal.set(1966, Calendar.OCTOBER, 5, 12, 55, 5); Date date2 = cal.getTime(); System.out.println("The past date2 using java date api ===> " + date2); } }
de6d5f8c1956185f9a2fd285e7a474a41eab43fe
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/11/11_d599d0f8193daafc71f86e0f6a773e30f8a33ada/GDHDMovieActivity/11_d599d0f8193daafc71f86e0f6a773e30f8a33ada_GDHDMovieActivity_s.java
718324ee47f53e2312903af5dd60a3bf42524c6c
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
19,225
java
package com.dbstar.app; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import com.dbstar.R; import com.dbstar.app.alert.GDAlertDialog; import com.dbstar.app.media.GDPlayerUtil; import com.dbstar.model.ContentData; import com.dbstar.model.EventData; import com.dbstar.model.GDCommon; import com.dbstar.model.ProductItem; import com.dbstar.service.GDDataProviderService; import com.dbstar.model.Movie; import com.dbstar.model.GDDVBDataContract.Content; import com.dbstar.widget.GDAdapterView; import com.dbstar.widget.GDGridView; import com.dbstar.widget.GDAdapterView.OnItemSelectedListener; import com.dbstar.widget.GDScrollBar; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Bitmap; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; public class GDHDMovieActivity extends GDBaseActivity { private static final String TAG = "GDHDMovieActivity"; private static final int COLUMN_ITEMS = 6; private static final int PAGE_ITEMS = 12; private static final int PageSize = PAGE_ITEMS; int mPageNumber = 0; int mPageCount = 0; int mTotalCount = 0; String mColumnId; List<Movie[]> mPageDatas; GDGridView mSmallThumbnailView; MovieAdapter mAdapter; int mSeletedItemIndex = 0; GDScrollBar mScrollBar = null; View mSelectedView = null; boolean mReachPageEnd = false; TextView mPageNumberView; ImageView mViewMask = null; boolean mEnterPlayer = false; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.hdmovie_view); Intent intent = getIntent(); mColumnId = intent.getStringExtra(Content.COLUMN_ID); mMenuPath = intent.getStringExtra(INTENT_KEY_MENUPATH); Log.d(TAG, "column id = " + mColumnId); Log.d(TAG, "menu path = " + mMenuPath); mPageDatas = new LinkedList<Movie[]>(); initializeView(); } protected void initializeView() { super.initializeView(); mPageNumberView = (TextView) findViewById(R.id.pageNumberView); mScrollBar = (GDScrollBar) findViewById(R.id.scrollbar); mSmallThumbnailView = (GDGridView) findViewById(R.id.gridview); mViewMask = (ImageView) findViewById(R.id.view_mask); mSmallThumbnailView .setOnItemSelectedListener(mThumbnailSelectedListener); mAdapter = new MovieAdapter(this); mSmallThumbnailView.setAdapter(mAdapter); mSmallThumbnailView.setOnKeyListener(mThumbnailOnKeyListener); mSmallThumbnailView.requestFocus(); mPageNumberView.setText(formPageText(0, 0)); } public void onStart() { super.onStart(); if (mAdapter.getCount() > 0) { mSmallThumbnailView.setSelection(mSeletedItemIndex); } showMenuPath(mMenuPath.split(MENU_STRING_DELIMITER)); mViewMask.setVisibility(View.GONE); mEnterPlayer = false; } public void onResume () { super.onResume(); mViewMask.setVisibility(View.GONE); mEnterPlayer = false; } public void onDestroy() { super.onDestroy(); for (int i = 0; mPageDatas != null && i < mPageDatas.size(); i++) { Movie[] movies = mPageDatas.get(i); for (int j = 0; j < movies.length; j++) { if (movies[j].Thumbnail != null) { movies[j].Thumbnail.recycle(); } } } } public void onServiceStart() { super.onServiceStart(); mService.getPublications(this, mColumnId); } private void loadPrevPage() { if (mPageNumber > 0) { Log.d(TAG, "loadPrevPage"); mPageNumber--; mPageNumberView.setText(formPageText(mPageNumber + 1, mPageCount)); Movie[] movies = mPageDatas.get(mPageNumber); mAdapter.setDataSet(movies); mSmallThumbnailView.setSelection(movies.length - 1); mAdapter.notifyDataSetChanged(); mScrollBar.setPosition(mPageNumber); } } private void loadNextPage() { Log.d(TAG, "loadNextPage"); if ((mPageNumber + 1) < mPageDatas.size()) { mPageNumber++; mPageNumberView.setText(formPageText(mPageNumber + 1, mPageCount)); Movie[] movies = mPageDatas.get(mPageNumber); mAdapter.setDataSet(movies); mSmallThumbnailView.setSelection(0); mAdapter.notifyDataSetChanged(); mScrollBar.setPosition(mPageNumber); } } private Movie getSelectedMovie() { int currentItem = mSmallThumbnailView.getSelectedItemPosition(); Movie[] movies = mPageDatas.get(mPageNumber); return movies[currentItem]; } private void playMovie() { Log.d(TAG, "playMovie"); Movie movie = getSelectedMovie(); String file = mService.getMediaFile(movie.Content); String drmFile = mService.getDRMFile(movie.Content); Log.d(TAG, " file = " + file); if (file == null || file.isEmpty()) { alertFileNotExist(); mViewMask.setVisibility(View.GONE); mEnterPlayer = false; return; } if (drmFile != null && !drmFile.isEmpty() && !isSmartcardReady()) { alertSmartcardInfo(); mViewMask.setVisibility(View.GONE); mEnterPlayer = false; return; } GDPlayerUtil.playVideo(this, null, movie.Content, file, drmFile, false); } public void updateData(int type, Object key, Object data) { if (type == GDDataProviderService.REQUESTTYPE_GETPUBLICATION) { ContentData[] contents = (ContentData[]) data; Log.d(TAG, "update "); if (contents != null && contents.length > 0) { Log.d(TAG, "update " + contents.length); mTotalCount = contents.length; mPageCount = mTotalCount / PageSize; int index = 0; for (int i = 0; i < mPageCount; i++) { Movie[] movies = new Movie[PageSize]; for (int j = 0; j < PageSize; j++, index++) { movies[j] = new Movie(); movies[j].Content = contents[index]; } mPageDatas.add(i, movies); } int remain = mTotalCount % PageSize; if (remain > 0) { mPageCount += 1; Movie[] movies = new Movie[remain]; for (int i = 0; i < remain; i++, index++) { movies[i] = new Movie(); movies[i].Content = contents[index]; } mPageDatas.add(movies); } mPageNumber = 0; // update views updateViews(mPageDatas.get(mPageNumber)); Log.d(TAG, "update mPageCount " + mPageCount); mRequestPageIndex = 0; requestPageData(mRequestPageIndex); } } else if (type == GDDataProviderService.REQUESTTYPE_GETPUBLICATIONDRMINFO) { String drmInfo = (String) data; String publicationId = (String) key; updateDrmInfo(publicationId, drmInfo); } } int mRequestPageIndex = -1; int mRequestCount = 0; void requestPageData(int pageNumber) { Movie[] movies = mPageDatas.get(pageNumber); mRequestCount = movies.length; for (int j = 0; j < movies.length; j++) { mService.getDetailsData(this, pageNumber, j, movies[j].Content); } } public void updateData(int type, int param1, int param2, Object data) { if (type == GDDataProviderService.REQUESTTYPE_GETDETAILSDATA) { int pageNumber = param1; int index = param2; Log.d(TAG, "updateData page number = " + pageNumber + " index = " + index); mService.getImage(this, pageNumber, index, (ContentData) data); mRequestCount--; if (mRequestCount == 0) { mRequestPageIndex++; if (mRequestPageIndex < mPageCount) { requestPageData(mRequestPageIndex); } } } else if (type == GDDataProviderService.REQUESTTYPE_GETIMAGE) { int pageNumber = param1; int index = param2; Log.d(TAG, "updateData page number = " + pageNumber + " index = " + index); Movie[] movies = mPageDatas.get(pageNumber); movies[index].Thumbnail = (Bitmap) data; if (pageNumber == mPageNumber) mAdapter.notifyDataSetChanged(); } } @Override public void notifyEvent(int type, Object event) { super.notifyEvent(type, event); if (type == EventData.EVENT_DELETE) { EventData.DeleteEvent deleteEvent = (EventData.DeleteEvent) event; String publicationId = deleteEvent.PublicationId; Movie[] movies = mPageDatas.get(mPageNumber); int i = 0; boolean found = false; for (i = 0; i < movies.length; i++) { ContentData content = movies[i].Content; if (content.Id.equals(publicationId)) { found = true; break; } } if (found) { movePageItems(mPageNumber, i); } mPageCount = mPageDatas.size(); if (mPageCount > 0) { // delete last page if (mPageNumber == mPageCount) { mPageNumber = mPageCount - 1; } movies = mPageDatas.get(mPageNumber); } else { movies = null; } updateViews(movies); } else if (type == EventData.EVENT_UPDATE_PROPERTY) { EventData.UpdatePropertyEvent updateEvent = (EventData.UpdatePropertyEvent) event; String publicationId = updateEvent.PublicationId; if (mPageDatas.size() == 0) { return; } Movie[] movies = mPageDatas.get(mPageNumber); int i = 0; boolean found = false; for (i = 0; i < movies.length; i++) { ContentData content = movies[i].Content; if (content.Id.equals(publicationId)) { found = true; break; } } if (found) { ContentData content = movies[i].Content; updatePropery(content, updateEvent.PropertyName, updateEvent.PropertyValue); } } } private void updatePropery(ContentData content, String propery, Object value) { if (propery.equals(GDCommon.KeyBookmark)) { content.BookMark = (Integer) value; } } private void movePageItems(int pageNumber, int start) { Movie[] movies = mPageDatas.get(pageNumber); Log.d(TAG, " == movePageItems == page=" + pageNumber + " delete = " + start + " size=" + movies.length); if (start == movies.length - 1 && start == 0) { // the deleted item is the last one // there is only one item in this page mPageDatas.remove(pageNumber); return; } for (int i = start; i < movies.length - 1; i++) { movies[i] = movies[i + 1]; movies[i + 1] = null; } if (pageNumber < mPageCount - 1) { Movie[] nextMovies = mPageDatas.get(pageNumber + 1); movies[movies.length - 1] = nextMovies[0]; movePageItems(pageNumber + 1, 0); } else { // this is the last page, remove the last null item Movie[] newMovies = new Movie[movies.length - 1]; for (int i = 0; i < newMovies.length; i++) { newMovies[i] = movies[i]; } Log.d(TAG, " == page size = " + mPageDatas.size() + " " + newMovies.length); mPageDatas.set(pageNumber, newMovies); } } private void updateViews(Movie[] movies) { mPageNumberView.setText(formPageText(mPageNumber + 1, mPageCount)); mScrollBar.setRange(mPageCount); mScrollBar.setPosition(mPageNumber); mAdapter.setDataSet(movies); if (movies != null && movies.length > 0) { mSmallThumbnailView.setSelection(0); } mAdapter.notifyDataSetChanged(); } private class MovieAdapter extends BaseAdapter { private Movie[] mDataSet = null; public class ViewHolder { // TextView titleView; ImageView thumbnailView; } public MovieAdapter(Context context) { } public void setDataSet(Movie[] dataSet) { mDataSet = dataSet; } @Override public int getCount() { int count = 0; if (mDataSet != null) { count = mDataSet.length; } return count; } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = new ViewHolder(); if (mSmallThumbnailView.getSelectedItemPosition() == position) { if (mSelectedView == null) { LayoutInflater inflater = getLayoutInflater(); mSelectedView = inflater.inflate( R.layout.small_thumbnail_item_focused, parent, false); // holder.titleView = (TextView) mSelectedView // .findViewById(R.id.item_text); holder.thumbnailView = (ImageView) mSelectedView .findViewById(R.id.thumbnail); mSelectedView.setTag(holder); } if (convertView != mSelectedView) { convertView = mSelectedView; } } else { if (convertView == mSelectedView) { convertView = null; } } if (null == convertView) { LayoutInflater inflater = getLayoutInflater(); convertView = inflater.inflate( R.layout.small_thumbnail_item_normal, parent, false); // holder.titleView = (TextView) convertView // .findViewById(R.id.item_text); holder.thumbnailView = (ImageView) convertView .findViewById(R.id.thumbnail); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Bitmap thumbnail = mDataSet[position].Thumbnail; holder.thumbnailView.setImageBitmap(thumbnail); // holder.titleView.setText(mDataSet[position].Content.Name); return convertView; } } OnItemSelectedListener mThumbnailSelectedListener = new OnItemSelectedListener() { @Override public void onItemSelected(GDAdapterView<?> parent, View view, int position, long id) { Log.d(TAG, "mSmallThumbnailView selected = " + position); mSeletedItemIndex = position; } @Override public void onNothingSelected(GDAdapterView<?> parent) { } }; View.OnKeyListener mThumbnailOnKeyListener = new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { Log.d(TAG, "onKey " + keyCode); boolean ret = false; int action = event.getAction(); if (action == KeyEvent.ACTION_DOWN) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_LEFT: { int currentItem = mSmallThumbnailView .getSelectedItemPosition(); if (currentItem == PAGE_ITEMS / 2) { mSmallThumbnailView.setSelection(currentItem - 1); ret = true; } else if (currentItem == 0) { // mSmallThumbnailView // .setSelection(mAdapter.getCount() - 1); if (mPageNumber > 0) { loadPrevPage(); } else { mSmallThumbnailView .setSelection(mSmallThumbnailView .getCount() - 1); } ret = true; } else { } break; } case KeyEvent.KEYCODE_DPAD_RIGHT: { int currentItem = mSmallThumbnailView .getSelectedItemPosition(); if (currentItem == (PAGE_ITEMS / 2 - 1)) { if (currentItem < (mAdapter.getCount() - 1)) { mSmallThumbnailView.setSelection(currentItem + 1); ret = true; } } else if (currentItem == (mAdapter.getCount() - 1)) { if (currentItem == (PageSize - 1)) { loadNextPage(); } else { mSmallThumbnailView.setSelection(0); } ret = true; } else { } break; } case KeyEvent.KEYCODE_DPAD_UP: { int currentItem = mSmallThumbnailView .getSelectedItemPosition(); if (currentItem < COLUMN_ITEMS) { loadPrevPage(); ret = true; } break; } case KeyEvent.KEYCODE_DPAD_DOWN: { int currentItem = mSmallThumbnailView .getSelectedItemPosition(); if (currentItem >= (PAGE_ITEMS - COLUMN_ITEMS)) { loadNextPage(); ret = true; } break; } case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: { if (!mEnterPlayer) { mEnterPlayer = true; // mViewMask.setVisibility(View.VISIBLE); mHandler.postDelayed(new Runnable() { public void run() { playMovie(); } }, 400); } ret = true; break; } // display drm info case KeyEvent.KEYCODE_MENU: { displayDrmInfo(); break; } default: break; } } return ret; } }; public Dialog onCreateDialog(int id) { Dialog dialog = null; dialog = super.onCreateDialog(id); switch (id) { case DLG_ID_DRMINFO: { mDrmInfoDialog = new GDDrmInfoDialog(this); mDrmInfoDialog.setOnShowListener(mDrmDlgOnShowListener); dialog = mDrmInfoDialog; break; } } return dialog; } DialogInterface.OnShowListener mDrmDlgOnShowListener = new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { if (mDrmInfo != null) { mDrmInfoDialog.setData(mDrmInfo); } } }; // DRM info GDDrmInfoDialog mDrmInfoDialog = null; ProductItem[] mDrmInfo = null; void displayDrmInfo() { Log.d(TAG, "displayDrmInfo"); Movie movie = getSelectedMovie(); String drmFile = mService.getDRMFile(movie.Content); if (drmFile != null && !drmFile.isEmpty()) { mDrmInfo = null; mService.getPublicationDrmInfo(this, movie.Content.Id); if (mDrmInfoDialog == null) { showDialog(DLG_ID_DRMINFO); } else { mDrmInfoDialog.show(); } } } void updateDrmInfo(String publicationId, String drmInfoData) { Movie movie = getSelectedMovie(); if (!publicationId.equals(movie.Content.Id)) { Log.d(TAG, "the drminfo is not for publication " + publicationId); return; } mDrmInfo = null; String[] items = drmInfoData.split("\n"); if (items.length == 0) { Log.d(TAG, " no product info !"); } else { ArrayList<ProductItem> products = new ArrayList<ProductItem>(); for (int i = 0; i < items.length; i++) { String[] item = items[i].split("\t"); if (item.length == 0) { continue; } ProductItem product = new ProductItem(); if (item.length > 0) product.ContentID = item[0]; if (item.length > 1) product.OperatorID = item[1]; if (item.length > 2) product.ProductID = item[2]; if (item.length > 3) product.StartTime = item[3]; if (item.length > 4) product.EndTime = item[4]; products.add(product); } if (products.size() > 0) { mDrmInfo = products.toArray(new ProductItem[products.size()]); } } if (mDrmInfoDialog != null) { mDrmInfoDialog.setData(mDrmInfo); } } }
f85938ef92a9af29c90dd09b03f18dd1046589c6
c713ab2fa5f771757ac264942fb799a206812382
/src/main/java/cn/ncut/java/designpattern/commandpattern/command/ControlTest.java
c8a70514981593e16be0165a1b2f02401390ceed
[]
no_license
xrw560/Base-Java
933f4999b40b635fc2bc06d09c3fdc74809ea8c7
e6b3e4d29396c1fa0f87b1a99243237e4b438698
refs/heads/master
2021-08-23T07:25:22.875313
2017-12-04T03:51:56
2017-12-04T03:51:56
107,069,601
0
0
null
null
null
null
UTF-8
Java
false
false
2,183
java
package cn.ncut.java.designpattern.commandpattern.command; import cn.ncut.java.designpattern.commandpattern.device.Light; import cn.ncut.java.designpattern.commandpattern.device.Stereo; /** * 命令模式:将请求、命令、动作等封装成对象,这样可以让项目使用这些对象来参数化其他对象。 * 使得命令的请求者和执行者解耦。 */ public class ControlTest { public static void main(String[] args) { CommandModeControl control = new CommandModeControl(); MarcoCommand onmarco, offmarco; Light bedroomlight = new Light("BedRoom"); Light kitchlight = new Light("Kitch"); Stereo stereo = new Stereo(); LightOnCommand bedroomlighton = new LightOnCommand(bedroomlight); LightOffCommand bedroomlightoff = new LightOffCommand(bedroomlight); LightOnCommand kitchlighton = new LightOnCommand(kitchlight); LightOffCommand kitchlightoff = new LightOffCommand(kitchlight); Command[] oncommands = {bedroomlighton, kitchlighton}; Command[] offcommands = {bedroomlightoff, kitchlightoff}; onmarco = new MarcoCommand(oncommands); offmarco = new MarcoCommand(offcommands); StereoOnCommand stereoOn = new StereoOnCommand(stereo); StereoOffCommand stereoOff = new StereoOffCommand(stereo); StereoAddVolCommand stereoaddvol = new StereoAddVolCommand(stereo); StereoSubVolCommand stereosubvol = new StereoSubVolCommand(stereo); control.setCommand(0, bedroomlighton, bedroomlightoff); control.setCommand(1, kitchlighton, kitchlightoff); control.setCommand(2, stereoOn, stereoOff); control.setCommand(3, stereoaddvol, stereosubvol); control.setCommand(4, onmarco, offmarco); control.onButton(0); control.undoButton(); //control.offButton(0); control.onButton(1); control.offButton(1); control.onButton(2); control.onButton(3); control.offButton(3); control.undoButton(); control.offButton(2); control.undoButton(); control.onButton(4); control.offButton(4); } }
90e9ebf37660a418090c29568b654ab931492e5e
ca0e9689023cc9998c7f24b9e0532261fd976e0e
/src/com/tencent/mm/plugin/sight/encode/ui/aa.java
b74290d76c3f4d8fd15a7aff26758a7e03cd8ff4
[]
no_license
honeyflyfish/com.tencent.mm
c7e992f51070f6ac5e9c05e9a2babd7b712cf713
ce6e605ff98164359a7073ab9a62a3f3101b8c34
refs/heads/master
2020-03-28T15:42:52.284117
2016-07-19T16:33:30
2016-07-19T16:33:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
700
java
package com.tencent.mm.plugin.sight.encode.ui; import com.tencent.mm.a.c; import com.tencent.mm.a.e; import com.tencent.mm.d.a.hs; import com.tencent.mm.d.a.hs.a; import com.tencent.mm.sdk.c.a; final class aa implements Runnable { aa(MainSightContainerView paramMainSightContainerView) {} public final void run() { hs localhs = new hs(); aET.type = 1; aET.aEW = MainSightContainerView.b(flE).getRecordPath(); aET.aEX = e.aE(MainSightContainerView.b(flE).getRecordPath()); aET.aEV = c.az(aET.aEW); a.hXQ.g(localhs); } } /* Location: * Qualified Name: com.tencent.mm.plugin.sight.encode.ui.aa * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
b3c37d599f8d62012a5908794ed96315149ab884
039e739f2f933be40bb55432e48125a34001fa18
/src/com/rozlicz2/application/server/service/ObjectifyDao.java
806c4d67469b64ab09bfb9b61567e204b745728f
[]
no_license
jacek-marchwicki/Rozlicz2Application
c8a679f8909e5f51d26b926969ad9b3de6cdaecd
b58b33a55c4203a95b8a7cf4288c324b38745879
refs/heads/master
2020-04-14T13:27:36.219427
2011-10-31T17:08:39
2011-10-31T17:08:39
2,247,480
0
0
null
null
null
null
UTF-8
Java
false
false
5,661
java
package com.rozlicz2.application.server.service; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.persistence.Embedded; import javax.persistence.Transient; import javax.servlet.http.HttpServletRequest; import com.google.appengine.api.datastore.PreparedQuery.TooManyResultsException; import com.google.web.bindery.requestfactory.server.RequestFactoryServlet; import com.googlecode.objectify.Key; import com.googlecode.objectify.NotFoundException; import com.googlecode.objectify.ObjectifyService; import com.googlecode.objectify.Query; import com.googlecode.objectify.util.DAOBase; import com.rozlicz2.application.server.Rozlicz2UserService; import com.rozlicz2.application.shared.entity.AppUser; /** * Generic DAO for use with Objectify * * @author turbomanage * * @param <T> */ public class ObjectifyDao<T> extends DAOBase { static final int BAD_MODIFIERS = Modifier.FINAL | Modifier.STATIC | Modifier.TRANSIENT; private static Rozlicz2UserService userService = new Rozlicz2UserService(); protected Class<T> clazz; @SuppressWarnings("unchecked") public ObjectifyDao() { Type genericSuperclass = getClass().getGenericSuperclass(); // Allow this class to be safely instantiated with or without a // parameterized type if (genericSuperclass instanceof ParameterizedType) clazz = (Class<T>) ((ParameterizedType) genericSuperclass) .getActualTypeArguments()[0]; } protected Query<T> buildQueryByExample(T exampleObj) { Query<T> q = ofy().query(clazz); // Add all non-null properties to query filter for (Field field : clazz.getDeclaredFields()) { // Ignore transient, embedded, array, and collection properties if (field.isAnnotationPresent(Transient.class) || (field.isAnnotationPresent(Embedded.class)) || (field.getType().isArray()) || (field.getType().isArray()) || (Collection.class.isAssignableFrom(field.getType())) || ((field.getModifiers() & BAD_MODIFIERS) != 0)) continue; field.setAccessible(true); Object value; try { value = field.get(exampleObj); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } if (value != null) { q.filter(field.getName(), value); } } return q; } public void delete(T entity) { ofy().delete(entity); } public void deleteAll(Iterable<T> entities) { ofy().delete(entities); } public void deleteKey(Key<T> entityKey) { ofy().delete(entityKey); } public void deleteKeys(Iterable<Key<T>> keys) { ofy().delete(keys); } public T find(String id) { if (id == null) return null; T elem = ofy().find(clazz, id); return elem; } public Map<Key<T>, T> get(Iterable<Key<T>> keys) { return ofy().get(keys); } public T get(Key<T> key) throws NotFoundException { return ofy().get(key); } public T get(Long id) throws NotFoundException { return ofy().get(this.clazz, id); } public T getByExample(T exampleObj) throws TooManyResultsException { Query<T> q = buildQueryByExample(exampleObj); Iterator<T> fetch = q.limit(2).list().iterator(); if (!fetch.hasNext()) { return null; } T obj = fetch.next(); if (fetch.hasNext()) { throw new TooManyResultsException(); } return obj; } /** * Convenience method to get all objects matching a single property * * @param propName * @param propValue * @return T matching Object * @throws TooManyResultsException */ public T getByProperty(String propName, Object propValue) throws TooManyResultsException { Query<T> q = ofy().query(clazz); q.filter(propName, propValue); Iterator<T> fetch = q.limit(2).list().iterator(); if (!fetch.hasNext()) { return null; } T obj = fetch.next(); if (fetch.hasNext()) { throw new TooManyResultsException(); } return obj; } protected AppUser getCurrentUser() { HttpServletRequest request = RequestFactoryServlet .getThreadLocalRequest(); return userService.getCurrentUserInfo(request); } public Key<T> getKey(Long id) { return new Key<T>(this.clazz, id); } public Key<T> key(T obj) { return ObjectifyService.factory().getKey(obj); } public List<T> listAll() { Query<T> q = ofy().query(clazz); return q.list(); } /* * Application-specific methods to retrieve items owned by a specific user */ public List<T> listAllForUser() { AppUser currentUserInfo = getCurrentUser(); if (currentUserInfo == null) return null; Key<AppUser> userKey = new Key<AppUser>(AppUser.class, currentUserInfo.getId()); return listByProperty("owner", userKey); } public List<T> listByExample(T exampleObj) { Query<T> queryByExample = buildQueryByExample(exampleObj); return queryByExample.list(); } public List<T> listByProperty(String propName, Object propValue) { Query<T> q = ofy().query(clazz); q.filter(propName, propValue); return q.list(); } public List<Key<T>> listChildKeys(Object parent) { return ofy().query(clazz).ancestor(parent).listKeys(); } public List<T> listChildren(Object parent) { return ofy().query(clazz).ancestor(parent).list(); } public List<Key<T>> listKeysByProperty(String propName, Object propValue) { Query<T> q = ofy().query(clazz); q.filter(propName, propValue); return q.listKeys(); } public Key<T> put(T entity) { return ofy().put(entity); } public Map<Key<T>, T> putAll(Iterable<T> entities) { return ofy().put(entities); } }
50bcae78d64333e8bdd478ac1aa5c16a855d1842
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/aosp-mirror--platform_frameworks_base/27c24fb8b85c36298de053699b1967a808c6d308/after/PackageManager.java
b907c55587128086a078510a54c771aaef6ecd13
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
209,252
java
/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License 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 android.content.pm; import android.Manifest; import android.annotation.CheckResult; import android.annotation.DrawableRes; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.StringRes; import android.annotation.SystemApi; import android.annotation.XmlRes; import android.app.PackageDeleteObserver; import android.app.PackageInstallObserver; import android.app.admin.DevicePolicyManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentSender; import android.content.pm.PackageParser.PackageParserException; import android.content.res.Resources; import android.content.res.XmlResourceParser; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.RemoteException; import android.os.UserHandle; import android.os.storage.VolumeInfo; import android.util.AndroidException; import com.android.internal.util.ArrayUtils; import java.io.File; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.List; /** * Class for retrieving various kinds of information related to the application * packages that are currently installed on the device. * * You can find this class through {@link Context#getPackageManager}. */ public abstract class PackageManager { /** * This exception is thrown when a given package, application, or component * name cannot be found. */ public static class NameNotFoundException extends AndroidException { public NameNotFoundException() { } public NameNotFoundException(String name) { super(name); } } /** * Listener for changes in permissions granted to a UID. * * @hide */ @SystemApi public interface OnPermissionsChangedListener { /** * Called when the permissions for a UID change. * @param uid The UID with a change. */ public void onPermissionsChanged(int uid); } /** * {@link PackageInfo} flag: return information about * activities in the package in {@link PackageInfo#activities}. */ public static final int GET_ACTIVITIES = 0x00000001; /** * {@link PackageInfo} flag: return information about * intent receivers in the package in * {@link PackageInfo#receivers}. */ public static final int GET_RECEIVERS = 0x00000002; /** * {@link PackageInfo} flag: return information about * services in the package in {@link PackageInfo#services}. */ public static final int GET_SERVICES = 0x00000004; /** * {@link PackageInfo} flag: return information about * content providers in the package in * {@link PackageInfo#providers}. */ public static final int GET_PROVIDERS = 0x00000008; /** * {@link PackageInfo} flag: return information about * instrumentation in the package in * {@link PackageInfo#instrumentation}. */ public static final int GET_INSTRUMENTATION = 0x00000010; /** * {@link PackageInfo} flag: return information about the * intent filters supported by the activity. */ public static final int GET_INTENT_FILTERS = 0x00000020; /** * {@link PackageInfo} flag: return information about the * signatures included in the package. */ public static final int GET_SIGNATURES = 0x00000040; /** * {@link ResolveInfo} flag: return the IntentFilter that * was matched for a particular ResolveInfo in * {@link ResolveInfo#filter}. */ public static final int GET_RESOLVED_FILTER = 0x00000040; /** * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData} * data {@link android.os.Bundle}s that are associated with a component. * This applies for any API returning a ComponentInfo subclass. */ public static final int GET_META_DATA = 0x00000080; /** * {@link PackageInfo} flag: return the * {@link PackageInfo#gids group ids} that are associated with an * application. * This applies for any API returning a PackageInfo class, either * directly or nested inside of another. */ public static final int GET_GIDS = 0x00000100; /** * {@link PackageInfo} flag: include disabled components in the returned info. */ public static final int GET_DISABLED_COMPONENTS = 0x00000200; /** * {@link ApplicationInfo} flag: return the * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries} * that are associated with an application. * This applies for any API returning an ApplicationInfo class, either * directly or nested inside of another. */ public static final int GET_SHARED_LIBRARY_FILES = 0x00000400; /** * {@link ProviderInfo} flag: return the * {@link ProviderInfo#uriPermissionPatterns URI permission patterns} * that are associated with a content provider. * This applies for any API returning a ProviderInfo class, either * directly or nested inside of another. */ public static final int GET_URI_PERMISSION_PATTERNS = 0x00000800; /** * {@link PackageInfo} flag: return information about * permissions in the package in * {@link PackageInfo#permissions}. */ public static final int GET_PERMISSIONS = 0x00001000; /** * Flag parameter to retrieve some information about all applications (even * uninstalled ones) which have data directories. This state could have * resulted if applications have been deleted with flag * {@code DONT_DELETE_DATA} with a possibility of being replaced or * reinstalled in future. * <p> * Note: this flag may cause less information about currently installed * applications to be returned. */ public static final int GET_UNINSTALLED_PACKAGES = 0x00002000; /** * {@link PackageInfo} flag: return information about * hardware preferences in * {@link PackageInfo#configPreferences PackageInfo.configPreferences}, * and requested features in {@link PackageInfo#reqFeatures} and * {@link PackageInfo#featureGroups}. */ public static final int GET_CONFIGURATIONS = 0x00004000; /** * {@link PackageInfo} flag: include disabled components which are in * that state only because of {@link #COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED} * in the returned info. Note that if you set this flag, applications * that are in this disabled state will be reported as enabled. */ public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 0x00008000; /** * Resolution and querying flag: if set, only filters that support the * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for * matching. This is a synonym for including the CATEGORY_DEFAULT in your * supplied Intent. */ public static final int MATCH_DEFAULT_ONLY = 0x00010000; /** * Querying flag: if set and if the platform is doing any filtering of the results, then * the filtering will not happen. This is a synonym for saying that all results should * be returned. */ public static final int MATCH_ALL = 0x00020000; /** * Flag for {@link addCrossProfileIntentFilter}: if this flag is set: * when resolving an intent that matches the {@link CrossProfileIntentFilter}, the current * profile will be skipped. * Only activities in the target user can respond to the intent. * @hide */ public static final int SKIP_CURRENT_PROFILE = 0x00000002; /** @hide */ @IntDef({PERMISSION_GRANTED, PERMISSION_DENIED}) @Retention(RetentionPolicy.SOURCE) public @interface PermissionResult {} /** * Permission check result: this is returned by {@link #checkPermission} * if the permission has been granted to the given package. */ public static final int PERMISSION_GRANTED = 0; /** * Permission check result: this is returned by {@link #checkPermission} * if the permission has not been granted to the given package. */ public static final int PERMISSION_DENIED = -1; /** * Signature check result: this is returned by {@link #checkSignatures} * if all signatures on the two packages match. */ public static final int SIGNATURE_MATCH = 0; /** * Signature check result: this is returned by {@link #checkSignatures} * if neither of the two packages is signed. */ public static final int SIGNATURE_NEITHER_SIGNED = 1; /** * Signature check result: this is returned by {@link #checkSignatures} * if the first package is not signed but the second is. */ public static final int SIGNATURE_FIRST_NOT_SIGNED = -1; /** * Signature check result: this is returned by {@link #checkSignatures} * if the second package is not signed but the first is. */ public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; /** * Signature check result: this is returned by {@link #checkSignatures} * if not all signatures on both packages match. */ public static final int SIGNATURE_NO_MATCH = -3; /** * Signature check result: this is returned by {@link #checkSignatures} * if either of the packages are not valid. */ public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; /** * Flag for {@link #setApplicationEnabledSetting(String, int, int)} * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This * component or application is in its default enabled state (as specified * in its manifest). */ public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; /** * Flag for {@link #setApplicationEnabledSetting(String, int, int)} * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This * component or application has been explictily enabled, regardless of * what it has specified in its manifest. */ public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; /** * Flag for {@link #setApplicationEnabledSetting(String, int, int)} * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This * component or application has been explicitly disabled, regardless of * what it has specified in its manifest. */ public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; /** * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The * user has explicitly disabled the application, regardless of what it has * specified in its manifest. Because this is due to the user's request, * they may re-enable it if desired through the appropriate system UI. This * option currently <strong>cannot</strong> be used with * {@link #setComponentEnabledSetting(ComponentName, int, int)}. */ public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3; /** * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: This * application should be considered, until the point where the user actually * wants to use it. This means that it will not normally show up to the user * (such as in the launcher), but various parts of the user interface can * use {@link #GET_DISABLED_UNTIL_USED_COMPONENTS} to still see it and allow * the user to select it (as for example an IME, device admin, etc). Such code, * once the user has selected the app, should at that point also make it enabled. * This option currently <strong>can not</strong> be used with * {@link #setComponentEnabledSetting(ComponentName, int, int)}. */ public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4; /** * Flag parameter for {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} to * indicate that this package should be installed as forward locked, i.e. only the app itself * should have access to its code and non-resource assets. * @hide */ public static final int INSTALL_FORWARD_LOCK = 0x00000001; /** * Flag parameter for {@link #installPackage} to indicate that you want to replace an already * installed package, if one exists. * @hide */ public static final int INSTALL_REPLACE_EXISTING = 0x00000002; /** * Flag parameter for {@link #installPackage} to indicate that you want to * allow test packages (those that have set android:testOnly in their * manifest) to be installed. * @hide */ public static final int INSTALL_ALLOW_TEST = 0x00000004; /** * Flag parameter for {@link #installPackage} to indicate that this package * must be installed to an ASEC on a {@link VolumeInfo#TYPE_PUBLIC}. * * @hide */ public static final int INSTALL_EXTERNAL = 0x00000008; /** * Flag parameter for {@link #installPackage} to indicate that this package * must be installed to internal storage. * * @hide */ public static final int INSTALL_INTERNAL = 0x00000010; /** * Flag parameter for {@link #installPackage} to indicate that this install * was initiated via ADB. * * @hide */ public static final int INSTALL_FROM_ADB = 0x00000020; /** * Flag parameter for {@link #installPackage} to indicate that this install * should immediately be visible to all users. * * @hide */ public static final int INSTALL_ALL_USERS = 0x00000040; /** * Flag parameter for {@link #installPackage} to indicate that it is okay * to install an update to an app where the newly installed app has a lower * version code than the currently installed app. * * @hide */ public static final int INSTALL_ALLOW_DOWNGRADE = 0x00000080; /** * Flag parameter for {@link #installPackage} to indicate that all runtime * permissions should be granted to the package. If {@link #INSTALL_ALL_USERS} * is set the runtime permissions will be granted to all users, otherwise * only to the owner. * * @hide */ public static final int INSTALL_GRANT_RUNTIME_PERMISSIONS = 0x00000100; /** {@hide} */ public static final int INSTALL_FORCE_VOLUME_UUID = 0x00000200; /** * Flag parameter for {@link #installPackage} to indicate that we always want to force * the prompt for permission approval. This overrides any special behaviour for internal * components. * * @hide */ public static final int INSTALL_FORCE_PERMISSION_PROMPT = 0x00000400; /** * Flag parameter for {@link #installPackage} to indicate that this package is * to be installed quickly. * * @hide */ public static final int INSTALL_QUICK = 0x00000800; /** * Flag parameter for * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate * that you don't want to kill the app containing the component. Be careful when you set this * since changing component states can make the containing application's behavior unpredictable. */ public static final int DONT_KILL_APP = 0x00000001; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success. * @hide */ @SystemApi public static final int INSTALL_SUCCEEDED = 1; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package is * already installed. * @hide */ @SystemApi public static final int INSTALL_FAILED_ALREADY_EXISTS = -1; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package archive * file is invalid. * @hide */ @SystemApi public static final int INSTALL_FAILED_INVALID_APK = -2; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the URI passed in * is invalid. * @hide */ @SystemApi public static final int INSTALL_FAILED_INVALID_URI = -3; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package manager * service found that the device didn't have enough storage space to install the app. * @hide */ @SystemApi public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if a * package is already installed with the same name. * @hide */ @SystemApi public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the requested shared user does not exist. * @hide */ @SystemApi public static final int INSTALL_FAILED_NO_SHARED_USER = -6; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * a previously installed package of the same name has a different signature * than the new package (and the old package's data was not removed). * @hide */ @SystemApi public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package is requested a shared user which is already installed on the * device and does not have matching signature. * @hide */ @SystemApi public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package uses a shared library that is not available. * @hide */ @SystemApi public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package uses a shared library that is not available. * @hide */ @SystemApi public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package failed while optimizing and validating its dex files, * either because there was not enough storage or the validation failed. * @hide */ @SystemApi public static final int INSTALL_FAILED_DEXOPT = -11; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package failed because the current SDK version is older than * that required by the package. * @hide */ @SystemApi public static final int INSTALL_FAILED_OLDER_SDK = -12; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package failed because it contains a content provider with the * same authority as a provider already installed in the system. * @hide */ @SystemApi public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package failed because the current SDK version is newer than * that required by the package. * @hide */ @SystemApi public static final int INSTALL_FAILED_NEWER_SDK = -14; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package failed because it has specified that it is a test-only * package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST} * flag. * @hide */ @SystemApi public static final int INSTALL_FAILED_TEST_ONLY = -15; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the package being installed contains native code, but none that is * compatible with the device's CPU_ABI. * @hide */ @SystemApi public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package uses a feature that is not available. * @hide */ @SystemApi public static final int INSTALL_FAILED_MISSING_FEATURE = -17; // ------ Errors related to sdcard /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * a secure container mount point couldn't be accessed on external media. * @hide */ @SystemApi public static final int INSTALL_FAILED_CONTAINER_ERROR = -18; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package couldn't be installed in the specified install * location. * @hide */ @SystemApi public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package couldn't be installed in the specified install * location because the media is not available. * @hide */ @SystemApi public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package couldn't be installed because the verification timed out. * @hide */ @SystemApi public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package couldn't be installed because the verification did not succeed. * @hide */ @SystemApi public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the package changed from what the calling program expected. * @hide */ @SystemApi public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package is assigned a different UID than it previously held. * @hide */ public static final int INSTALL_FAILED_UID_CHANGED = -24; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the new package has an older version code than the currently installed package. * @hide */ public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25; /** * Installation return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if * the old package has target SDK high enough to support runtime permission and * the new package has target SDK low enough to not support runtime permissions. * @hide */ @SystemApi public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26; /** * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the parser was given a path that is not a file, or does not end with the expected * '.apk' extension. * @hide */ @SystemApi public static final int INSTALL_PARSE_FAILED_NOT_APK = -100; /** * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the parser was unable to retrieve the AndroidManifest.xml file. * @hide */ @SystemApi public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101; /** * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the parser encountered an unexpected exception. * @hide */ @SystemApi public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102; /** * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the parser did not find any certificates in the .apk. * @hide */ @SystemApi public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103; /** * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the parser found inconsistent certificates on the files in the .apk. * @hide */ @SystemApi public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104; /** * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the parser encountered a CertificateEncodingException in one of the * files in the .apk. * @hide */ @SystemApi public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105; /** * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the parser encountered a bad or missing package name in the manifest. * @hide */ @SystemApi public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106; /** * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the parser encountered a bad shared user id name in the manifest. * @hide */ @SystemApi public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107; /** * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the parser encountered some structural problem in the manifest. * @hide */ @SystemApi public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108; /** * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the parser did not find any actionable tags (instrumentation or application) * in the manifest. * @hide */ @SystemApi public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109; /** * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the system failed to install the package because of system issues. * @hide */ @SystemApi public static final int INSTALL_FAILED_INTERNAL_ERROR = -110; /** * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the system failed to install the package because the user is restricted from installing * apps. * @hide */ public static final int INSTALL_FAILED_USER_RESTRICTED = -111; /** * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the system failed to install the package because it is attempting to define a * permission that is already defined by some existing package. * * <p>The package name of the app which has already defined the permission is passed to * a {@link PackageInstallObserver}, if any, as the {@link #EXTRA_EXISTING_PACKAGE} * string extra; and the name of the permission being redefined is passed in the * {@link #EXTRA_EXISTING_PERMISSION} string extra. * @hide */ public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112; /** * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} * if the system failed to install the package because its packaged native code did not * match any of the ABIs supported by the system. * * @hide */ public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113; /** * Internal return code for NativeLibraryHelper methods to indicate that the package * being processed did not contain any native code. This is placed here only so that * it can belong to the same value space as the other install failure codes. * * @hide */ public static final int NO_NATIVE_LIBRARIES = -114; /** {@hide} */ public static final int INSTALL_FAILED_ABORTED = -115; /** * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the * package's data directory. * * @hide */ public static final int DELETE_KEEP_DATA = 0x00000001; /** * Flag parameter for {@link #deletePackage} to indicate that you want the * package deleted for all users. * * @hide */ public static final int DELETE_ALL_USERS = 0x00000002; /** * Flag parameter for {@link #deletePackage} to indicate that, if you are calling * uninstall on a system that has been updated, then don't do the normal process * of uninstalling the update and rolling back to the older system version (which * needs to happen for all users); instead, just mark the app as uninstalled for * the current user. * * @hide */ public static final int DELETE_SYSTEM_APP = 0x00000004; /** * Return code for when package deletion succeeds. This is passed to the * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system * succeeded in deleting the package. * * @hide */ public static final int DELETE_SUCCEEDED = 1; /** * Deletion failed return code: this is passed to the * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system * failed to delete the package for an unspecified reason. * * @hide */ public static final int DELETE_FAILED_INTERNAL_ERROR = -1; /** * Deletion failed return code: this is passed to the * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system * failed to delete the package because it is the active DevicePolicy * manager. * * @hide */ public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2; /** * Deletion failed return code: this is passed to the * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system * failed to delete the package since the user is restricted. * * @hide */ public static final int DELETE_FAILED_USER_RESTRICTED = -3; /** * Deletion failed return code: this is passed to the * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system * failed to delete the package because a profile * or device owner has marked the package as uninstallable. * * @hide */ public static final int DELETE_FAILED_OWNER_BLOCKED = -4; /** {@hide} */ public static final int DELETE_FAILED_ABORTED = -5; /** * Return code that is passed to the {@link IPackageMoveObserver} by * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} when the * package has been successfully moved by the system. * * @hide */ public static final int MOVE_SUCCEEDED = -100; /** * Error code that is passed to the {@link IPackageMoveObserver} by * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} * when the package hasn't been successfully moved by the system * because of insufficient memory on specified media. * @hide */ public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1; /** * Error code that is passed to the {@link IPackageMoveObserver} by * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} * if the specified package doesn't exist. * @hide */ public static final int MOVE_FAILED_DOESNT_EXIST = -2; /** * Error code that is passed to the {@link IPackageMoveObserver} by * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} * if the specified package cannot be moved since its a system package. * @hide */ public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3; /** * Error code that is passed to the {@link IPackageMoveObserver} by * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} * if the specified package cannot be moved since its forward locked. * @hide */ public static final int MOVE_FAILED_FORWARD_LOCKED = -4; /** * Error code that is passed to the {@link IPackageMoveObserver} by * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} * if the specified package cannot be moved to the specified location. * @hide */ public static final int MOVE_FAILED_INVALID_LOCATION = -5; /** * Error code that is passed to the {@link IPackageMoveObserver} by * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} * if the specified package cannot be moved to the specified location. * @hide */ public static final int MOVE_FAILED_INTERNAL_ERROR = -6; /** * Error code that is passed to the {@link IPackageMoveObserver} by * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} if the * specified package already has an operation pending in the * {@link PackageHandler} queue. * * @hide */ public static final int MOVE_FAILED_OPERATION_PENDING = -7; /** * Flag parameter for {@link #movePackage} to indicate that * the package should be moved to internal storage if its * been installed on external media. * @hide */ @Deprecated public static final int MOVE_INTERNAL = 0x00000001; /** * Flag parameter for {@link #movePackage} to indicate that * the package should be moved to external media. * @hide */ @Deprecated public static final int MOVE_EXTERNAL_MEDIA = 0x00000002; /** {@hide} */ public static final String EXTRA_MOVE_ID = "android.content.pm.extra.MOVE_ID"; /** * Usable by the required verifier as the {@code verificationCode} argument * for {@link PackageManager#verifyPendingInstall} to indicate that it will * allow the installation to proceed without any of the optional verifiers * needing to vote. * * @hide */ public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2; /** * Used as the {@code verificationCode} argument for * {@link PackageManager#verifyPendingInstall} to indicate that the calling * package verifier allows the installation to proceed. */ public static final int VERIFICATION_ALLOW = 1; /** * Used as the {@code verificationCode} argument for * {@link PackageManager#verifyPendingInstall} to indicate the calling * package verifier does not vote to allow the installation to proceed. */ public static final int VERIFICATION_REJECT = -1; /** * Used as the {@code verificationCode} argument for * {@link PackageManager#verifyIntentFilter} to indicate that the calling * IntentFilter Verifier confirms that the IntentFilter is verified. * * @hide */ public static final int INTENT_FILTER_VERIFICATION_SUCCESS = 1; /** * Used as the {@code verificationCode} argument for * {@link PackageManager#verifyIntentFilter} to indicate that the calling * IntentFilter Verifier confirms that the IntentFilter is NOT verified. * * @hide */ public static final int INTENT_FILTER_VERIFICATION_FAILURE = -1; /** * Internal status code to indicate that an IntentFilter verification result is not specified. * * @hide */ public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED = 0; /** * Used as the {@code status} argument for {@link PackageManager#updateIntentVerificationStatus} * to indicate that the User will always be prompted the Intent Disambiguation Dialog if there * are two or more Intent resolved for the IntentFilter's domain(s). * * @hide */ public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK = 1; /** * Used as the {@code status} argument for {@link PackageManager#updateIntentVerificationStatus} * to indicate that the User will never be prompted the Intent Disambiguation Dialog if there * are two or more resolution of the Intent. The default App for the domain(s) specified in the * IntentFilter will also ALWAYS be used. * * @hide */ public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS = 2; /** * Used as the {@code status} argument for {@link PackageManager#updateIntentVerificationStatus} * to indicate that the User may be prompted the Intent Disambiguation Dialog if there * are two or more Intent resolved. The default App for the domain(s) specified in the * IntentFilter will also NEVER be presented to the User. * * @hide */ public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3; /** * Used as the {@code status} argument for {@link PackageManager#updateIntentVerificationStatus} * to indicate that this app should always be considered as an ambiguous candidate for * handling the matching Intent even if there are other candidate apps in the "always" * state. Put another way: if there are any 'always ask' apps in a set of more than * one candidate app, then a disambiguation is *always* presented even if there is * another candidate app with the 'always' state. * * @hide */ public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4; /** * Can be used as the {@code millisecondsToDelay} argument for * {@link PackageManager#extendVerificationTimeout}. This is the * maximum time {@code PackageManager} waits for the verification * agent to return (in milliseconds). */ public static final long MAXIMUM_VERIFICATION_TIMEOUT = 60*60*1000; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or * lag in sound input or output. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device includes at least one form of audio * output, such as speakers, audio jack or streaming over bluetooth */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output"; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: * The device has professional audio level of functionality, performance, and acoustics. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device is capable of communicating with * other devices via Bluetooth. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device is capable of communicating with * other devices via Bluetooth Low Energy radio. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device has a camera facing away * from the screen. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CAMERA = "android.hardware.camera"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device's camera supports auto-focus. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device has at least one camera pointing in * some direction, or can support an external camera being connected to it. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device can support having an external camera connected to it. * The external camera may not always be connected or available to applications to use. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device's camera supports flash. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device has a front facing camera. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front"; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one * of the cameras on the device supports the * {@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL full hardware} * capability level. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full"; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one * of the cameras on the device supports the * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR manual sensor} * capability level. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR = "android.hardware.camera.capability.manual_sensor"; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one * of the cameras on the device supports the * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING manual post-processing} * capability level. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING = "android.hardware.camera.capability.manual_post_processing"; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: At least one * of the cameras on the device supports the * {@link android.hardware.camera2.CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW RAW} * capability level. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CAMERA_CAPABILITY_RAW = "android.hardware.camera.capability.raw"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device is capable of communicating with * consumer IR devices. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports one or more methods of * reporting current location. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_LOCATION = "android.hardware.location"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device has a Global Positioning System * receiver and can report precise location. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device can report location with coarse * accuracy using a network-based geolocation system. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device can record audio via a * microphone. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_MICROPHONE = "android.hardware.microphone"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device can communicate using Near-Field * Communications (NFC). */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_NFC = "android.hardware.nfc"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports host- * based NFC card emulation. * * TODO remove when depending apps have moved to new constant. * @hide * @deprecated */ @Deprecated @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports host- * based NFC card emulation. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports the OpenGL ES * <a href="http://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt"> * Android Extension Pack</a>. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device includes an accelerometer. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device includes a barometer (air * pressure sensor.) */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device includes a magnetometer (compass). */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device includes a gyroscope. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device includes a light sensor. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device includes a proximity sensor. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device includes a hardware step counter. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device includes a hardware step detector. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device includes a heart rate monitor. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocargiogram. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SENSOR_HEART_RATE_ECG = "android.hardware.sensor.heartrate.ecg"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device includes a relative humidity sensor. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY = "android.hardware.sensor.relative_humidity"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device includes an ambient temperature sensor. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE = "android.hardware.sensor.ambient_temperature"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports high fidelity sensor processing * capabilities. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_HIFI_SENSORS = "android.hardware.sensor.hifi_sensors"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device has a telephony radio with data * communication support. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_TELEPHONY = "android.hardware.telephony"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device has a CDMA telephony stack. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device has a GSM telephony stack. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports connecting to USB devices * as the USB host. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_USB_HOST = "android.hardware.usb.host"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports connecting to USB accessories. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The SIP API is enabled on the device. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SIP = "android.software.sip"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports SIP-based VOIP. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SIP_VOIP = "android.software.sip.voip"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The Connection Service API is enabled on the device. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device's display has a touch screen. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device's touch screen supports * multitouch sufficient for basic two-finger gesture detection. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device's touch screen is capable of * tracking two or more fingers fully independently. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device's touch screen is capable of * tracking a full hand of fingers fully independently -- that is, 5 or * more simultaneous independent pointers. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device does not have a touch screen, but * does support touch emulation for basic events. For instance, the * device might use a mouse or remote control to drive a cursor, and * emulate basic touch pointer events like down, up, drag, etc. All * devices that support android.hardware.touchscreen or a sub-feature are * presumed to also support faketouch. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device does not have a touch screen, but * does support touch emulation for basic events that supports distinct * tracking of two or more fingers. This is an extension of * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note * that unlike a distinct multitouch screen as defined by * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input * devices will not actually provide full two-finger gestures since the * input is being transformed to cursor movement on the screen. That is, * single finger gestures will move a cursor; two-finger swipes will * result in single-finger touch events; other two-finger gestures will * result in the corresponding two-finger touch event. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device does not have a touch screen, but * does support touch emulation for basic events that supports tracking * a hand of fingers (5 or more fingers) fully independently. * This is an extension of * {@link #FEATURE_FAKETOUCH} for input devices with this capability. Note * that unlike a multitouch screen as defined by * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger * gestures can be detected due to the limitations described for * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device has biometric hardware to detect a fingerprint. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports portrait orientation * screens. For backwards compatibility, you can assume that if neither * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports * both portrait and landscape. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports landscape orientation * screens. For backwards compatibility, you can assume that if neither * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports * both portrait and landscape. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports live wallpapers. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports app widgets. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets"; /** * @hide * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports * {@link android.service.voice.VoiceInteractionService} and * {@link android.app.VoiceInteractor}. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports a home screen that is replaceable * by third party applications. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_HOME_SCREEN = "android.software.home_screen"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports adding new input methods implemented * with the {@link android.inputmethodservice.InputMethodService} API. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_INPUT_METHODS = "android.software.input_methods"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports device policy enforcement via device admins. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports leanback UI. This is * typically used in a living room television experience, but is a software * feature unlike {@link #FEATURE_TELEVISION}. Devices running with this * feature will use resources associated with the "television" UI mode. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_LEANBACK = "android.software.leanback"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports only leanback UI. Only * applications designed for this experience should be run, though this is * not enforced by the system. * @hide */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports live TV and can display * contents from TV inputs implemented with the * {@link android.media.tv.TvInputService} API. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_LIVE_TV = "android.software.live_tv"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_WIFI = "android.hardware.wifi"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: This is a device dedicated to showing UI * on a vehicle headunit. A headunit here is defined to be inside a * vehicle that may or may not be moving. A headunit uses either a * primary display in the center console and/or additional displays in * the instrument cluster or elsewhere in the vehicle. Headunit display(s) * have limited size and resolution. The user will likely be focused on * driving so limiting driver distraction is a primary concern. User input * can be a variety of hard buttons, touch, rotary controllers and even mouse- * like interfaces. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: This is a device dedicated to showing UI * on a television. Television here is defined to be a typical living * room television experience: displayed on a big screen, where the user * is sitting far away from it, and the dominant form of input will be * something like a DPAD, not through touch or mouse. * @deprecated use {@link #FEATURE_LEANBACK} instead. */ @Deprecated @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_TELEVISION = "android.hardware.type.television"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: This is a device dedicated to showing UI * on a watch. A watch here is defined to be a device worn on the body, perhaps on * the wrist. The user is very close when interacting with the device. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_WATCH = "android.hardware.type.watch"; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: * The device supports printing. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_PRINTING = "android.software.print"; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: * The device can perform backup and restore operations on installed applications. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_BACKUP = "android.software.backup"; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: * The device supports creating secondary users and managed profiles via * {@link DevicePolicyManager}. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_MANAGED_USERS = "android.software.managed_users"; /** * @hide * TODO: Remove after dependencies updated b/17392243 */ public static final String FEATURE_MANAGED_PROFILES = "android.software.managed_users"; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: * The device supports verified boot. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot"; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: * The device supports secure removal of users. When a user is deleted the data associated * with that user is securely deleted and no longer available. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_SECURELY_REMOVES_USERS = "android.software.securely_removes_users"; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: * The device has a full implementation of the android.webkit.* APIs. Devices * lacking this feature will not have a functioning WebView implementation. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_WEBVIEW = "android.software.webview"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: This device supports ethernet. * @hide */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_ETHERNET = "android.hardware.ethernet"; /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: This device supports HDMI-CEC. * @hide */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec"; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: * The device has all of the inputs necessary to be considered a compatible game controller, or * includes a compatible game controller in the box. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_GAMEPAD = "android.hardware.gamepad"; /** * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: * The device has a full implementation of the android.media.midi.* APIs. */ @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_MIDI = "android.software.midi"; /** * Action to external storage service to clean out removed apps. * @hide */ public static final String ACTION_CLEAN_EXTERNAL_STORAGE = "android.content.pm.CLEAN_EXTERNAL_STORAGE"; /** * Extra field name for the URI to a verification file. Passed to a package * verifier. * * @hide */ public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI"; /** * Extra field name for the ID of a package pending verification. Passed to * a package verifier and is used to call back to * {@link PackageManager#verifyPendingInstall(int, int)} */ public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID"; /** * Extra field name for the package identifier which is trying to install * the package. * * @hide */ public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE"; /** * Extra field name for the requested install flags for a package pending * verification. Passed to a package verifier. * * @hide */ public static final String EXTRA_VERIFICATION_INSTALL_FLAGS = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS"; /** * Extra field name for the uid of who is requesting to install * the package. * * @hide */ public static final String EXTRA_VERIFICATION_INSTALLER_UID = "android.content.pm.extra.VERIFICATION_INSTALLER_UID"; /** * Extra field name for the package name of a package pending verification. * * @hide */ public static final String EXTRA_VERIFICATION_PACKAGE_NAME = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME"; /** * Extra field name for the result of a verification, either * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}. * Passed to package verifiers after a package is verified. */ public static final String EXTRA_VERIFICATION_RESULT = "android.content.pm.extra.VERIFICATION_RESULT"; /** * Extra field name for the version code of a package pending verification. * * @hide */ public static final String EXTRA_VERIFICATION_VERSION_CODE = "android.content.pm.extra.VERIFICATION_VERSION_CODE"; /** * Extra field name for the ID of a intent filter pending verification. Passed to * an intent filter verifier and is used to call back to * {@link PackageManager#verifyIntentFilter(int, int)} * * @hide */ public static final String EXTRA_INTENT_FILTER_VERIFICATION_ID = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_ID"; /** * Extra field name for the scheme used for an intent filter pending verification. Passed to * an intent filter verifier and is used to construct the URI to verify against. * * Usually this is "https" * * @hide */ public static final String EXTRA_INTENT_FILTER_VERIFICATION_URI_SCHEME = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_URI_SCHEME"; /** * Extra field name for the host names to be used for an intent filter pending verification. * Passed to an intent filter verifier and is used to construct the URI to verify the * intent filter. * * This is a space delimited list of hosts. * * @hide */ public static final String EXTRA_INTENT_FILTER_VERIFICATION_HOSTS = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_HOSTS"; /** * Extra field name for the package name to be used for an intent filter pending verification. * Passed to an intent filter verifier and is used to check the verification responses coming * from the hosts. Each host response will need to include the package name of APK containing * the intent filter. * * @hide */ public static final String EXTRA_INTENT_FILTER_VERIFICATION_PACKAGE_NAME = "android.content.pm.extra.INTENT_FILTER_VERIFICATION_PACKAGE_NAME"; /** * The action used to request that the user approve a permission request * from the application. * * @hide */ @SystemApi public static final String ACTION_REQUEST_PERMISSIONS = "android.content.pm.action.REQUEST_PERMISSIONS"; /** * The names of the requested permissions. * <p> * <strong>Type:</strong> String[] * </p> * * @hide */ @SystemApi public static final String EXTRA_REQUEST_PERMISSIONS_NAMES = "android.content.pm.extra.REQUEST_PERMISSIONS_NAMES"; /** * The results from the permissions request. * <p> * <strong>Type:</strong> int[] of #PermissionResult * </p> * * @hide */ @SystemApi public static final String EXTRA_REQUEST_PERMISSIONS_RESULTS = "android.content.pm.extra.REQUEST_PERMISSIONS_RESULTS"; /** * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the package which provides * the existing definition for the permission. * @hide */ public static final String EXTRA_FAILURE_EXISTING_PACKAGE = "android.content.pm.extra.FAILURE_EXISTING_PACKAGE"; /** * String extra for {@link PackageInstallObserver} in the 'extras' Bundle in case of * {@link #INSTALL_FAILED_DUPLICATE_PERMISSION}. This extra names the permission that is * being redundantly defined by the package being installed. * @hide */ public static final String EXTRA_FAILURE_EXISTING_PERMISSION = "android.content.pm.extra.FAILURE_EXISTING_PERMISSION"; /** * Permission flag: The permission is set in its current state * by the user and apps can still request it at runtime. * * @hide */ public static final int FLAG_PERMISSION_USER_SET = 1 << 0; /** * Permission flag: The permission is set in its current state * by the user and it is fixed, i.e. apps can no longer request * this permission. * * @hide */ public static final int FLAG_PERMISSION_USER_FIXED = 1 << 1; /** * Permission flag: The permission is set in its current state * by device policy and neither apps nor the user can change * its state. * * @hide */ public static final int FLAG_PERMISSION_POLICY_FIXED = 1 << 2; /** * Permission flag: The permission is set in a granted state but * access to resources it guards is restricted by other means to * enable revoking a permission on legacy apps that do not support * runtime permissions. If this permission is upgraded to runtime * because the app was updated to support runtime permissions, the * the permission will be revoked in the upgrade process. * * @hide */ public static final int FLAG_PERMISSION_REVOKE_ON_UPGRADE = 1 << 3; /** * Permission flag: The permission is set in its current state * because the app is a component that is a part of the system. * * @hide */ public static final int FLAG_PERMISSION_SYSTEM_FIXED = 1 << 4; /** * Permission flag: The permission is granted by default because it * enables app functionality that is expected to work out-of-the-box * for providing a smooth user experience. For example, the phone app * is expected to have the phone permission. * * @hide */ public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 1 << 5; /** * Mask for all permission flags. * * @hide */ @SystemApi public static final int MASK_PERMISSION_FLAGS = 0xFF; /** * Retrieve overall information about an application package that is * installed on the system. * <p> * Throws {@link NameNotFoundException} if a package with the given name can * not be found on the system. * * @param packageName The full name (i.e. com.google.apps.contacts) of the * desired package. * @param flags Additional option flags. Use any combination of * {@link #GET_ACTIVITIES}, {@link #GET_GIDS}, * {@link #GET_CONFIGURATIONS}, {@link #GET_INSTRUMENTATION}, * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS}, * {@link #GET_RECEIVERS}, {@link #GET_SERVICES}, * {@link #GET_SIGNATURES}, {@link #GET_UNINSTALLED_PACKAGES} to * modify the data returned. * @return A PackageInfo object containing information about the * package. If flag GET_UNINSTALLED_PACKAGES is set and if the * package is not found in the list of installed applications, the * package information is retrieved from the list of uninstalled * applications (which includes installed applications as well as * applications with data directory i.e. applications which had been * deleted with {@code DONT_DELETE_DATA} flag set). * @see #GET_ACTIVITIES * @see #GET_GIDS * @see #GET_CONFIGURATIONS * @see #GET_INSTRUMENTATION * @see #GET_PERMISSIONS * @see #GET_PROVIDERS * @see #GET_RECEIVERS * @see #GET_SERVICES * @see #GET_SIGNATURES * @see #GET_UNINSTALLED_PACKAGES */ public abstract PackageInfo getPackageInfo(String packageName, int flags) throws NameNotFoundException; /** * @hide * Retrieve overall information about an application package that is * installed on the system. * <p> * Throws {@link NameNotFoundException} if a package with the given name can * not be found on the system. * * @param packageName The full name (i.e. com.google.apps.contacts) of the * desired package. * @param flags Additional option flags. Use any combination of * {@link #GET_ACTIVITIES}, {@link #GET_GIDS}, * {@link #GET_CONFIGURATIONS}, {@link #GET_INSTRUMENTATION}, * {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS}, * {@link #GET_RECEIVERS}, {@link #GET_SERVICES}, * {@link #GET_SIGNATURES}, {@link #GET_UNINSTALLED_PACKAGES} to * modify the data returned. * @param userId The user id. * @return A PackageInfo object containing information about the * package. If flag GET_UNINSTALLED_PACKAGES is set and if the * package is not found in the list of installed applications, the * package information is retrieved from the list of uninstalled * applications (which includes installed applications as well as * applications with data directory i.e. applications which had been * deleted with {@code DONT_DELETE_DATA} flag set). * @see #GET_ACTIVITIES * @see #GET_GIDS * @see #GET_CONFIGURATIONS * @see #GET_INSTRUMENTATION * @see #GET_PERMISSIONS * @see #GET_PROVIDERS * @see #GET_RECEIVERS * @see #GET_SERVICES * @see #GET_SIGNATURES * @see #GET_UNINSTALLED_PACKAGES */ @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS) public abstract PackageInfo getPackageInfoAsUser(String packageName, int flags, int userId) throws NameNotFoundException; /** * Map from the current package names in use on the device to whatever * the current canonical name of that package is. * @param names Array of current names to be mapped. * @return Returns an array of the same size as the original, containing * the canonical name for each package. */ public abstract String[] currentToCanonicalPackageNames(String[] names); /** * Map from a packages canonical name to the current name in use on the device. * @param names Array of new names to be mapped. * @return Returns an array of the same size as the original, containing * the current name for each package. */ public abstract String[] canonicalToCurrentPackageNames(String[] names); /** * Returns a "good" intent to launch a front-door activity in a package. * This is used, for example, to implement an "open" button when browsing * through packages. The current implementation looks first for a main * activity in the category {@link Intent#CATEGORY_INFO}, and next for a * main activity in the category {@link Intent#CATEGORY_LAUNCHER}. Returns * <code>null</code> if neither are found. * * @param packageName The name of the package to inspect. * * @return A fully-qualified {@link Intent} that can be used to launch the * main activity in the package. Returns <code>null</code> if the package * does not contain such an activity, or if <em>packageName</em> is not * recognized. */ public abstract Intent getLaunchIntentForPackage(String packageName); /** * Return a "good" intent to launch a front-door Leanback activity in a * package, for use for example to implement an "open" button when browsing * through packages. The current implementation will look for a main * activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or * return null if no main leanback activities are found. * <p> * Throws {@link NameNotFoundException} if a package with the given name * cannot be found on the system. * * @param packageName The name of the package to inspect. * @return Returns either a fully-qualified Intent that can be used to launch * the main Leanback activity in the package, or null if the package * does not contain such an activity. */ public abstract Intent getLeanbackLaunchIntentForPackage(String packageName); /** * Return an array of all of the secondary group-ids that have been assigned * to a package. * <p> * Throws {@link NameNotFoundException} if a package with the given name * cannot be found on the system. * * @param packageName The full name (i.e. com.google.apps.contacts) of the * desired package. * @return Returns an int array of the assigned gids, or null if there are * none. */ public abstract int[] getPackageGids(String packageName) throws NameNotFoundException; /** * @hide Return the uid associated with the given package name for the * given user. * * <p>Throws {@link NameNotFoundException} if a package with the given * name can not be found on the system. * * @param packageName The full name (i.e. com.google.apps.contacts) of the * desired package. * @param userHandle The user handle identifier to look up the package under. * * @return Returns an integer uid who owns the given package name. */ public abstract int getPackageUid(String packageName, int userHandle) throws NameNotFoundException; /** * Retrieve all of the information we know about a particular permission. * * <p>Throws {@link NameNotFoundException} if a permission with the given * name cannot be found on the system. * * @param name The fully qualified name (i.e. com.google.permission.LOGIN) * of the permission you are interested in. * @param flags Additional option flags. Use {@link #GET_META_DATA} to * retrieve any meta-data associated with the permission. * * @return Returns a {@link PermissionInfo} containing information about the * permission. */ public abstract PermissionInfo getPermissionInfo(String name, int flags) throws NameNotFoundException; /** * Query for all of the permissions associated with a particular group. * * <p>Throws {@link NameNotFoundException} if the given group does not * exist. * * @param group The fully qualified name (i.e. com.google.permission.LOGIN) * of the permission group you are interested in. Use null to * find all of the permissions not associated with a group. * @param flags Additional option flags. Use {@link #GET_META_DATA} to * retrieve any meta-data associated with the permissions. * * @return Returns a list of {@link PermissionInfo} containing information * about all of the permissions in the given group. */ public abstract List<PermissionInfo> queryPermissionsByGroup(String group, int flags) throws NameNotFoundException; /** * Retrieve all of the information we know about a particular group of * permissions. * * <p>Throws {@link NameNotFoundException} if a permission group with the given * name cannot be found on the system. * * @param name The fully qualified name (i.e. com.google.permission_group.APPS) * of the permission you are interested in. * @param flags Additional option flags. Use {@link #GET_META_DATA} to * retrieve any meta-data associated with the permission group. * * @return Returns a {@link PermissionGroupInfo} containing information * about the permission. */ public abstract PermissionGroupInfo getPermissionGroupInfo(String name, int flags) throws NameNotFoundException; /** * Retrieve all of the known permission groups in the system. * * @param flags Additional option flags. Use {@link #GET_META_DATA} to * retrieve any meta-data associated with the permission group. * * @return Returns a list of {@link PermissionGroupInfo} containing * information about all of the known permission groups. */ public abstract List<PermissionGroupInfo> getAllPermissionGroups(int flags); /** * Retrieve all of the information we know about a particular * package/application. * * <p>Throws {@link NameNotFoundException} if an application with the given * package name cannot be found on the system. * * @param packageName The full name (i.e. com.google.apps.contacts) of an * application. * @param flags Additional option flags. Use any combination of * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. * * @return {@link ApplicationInfo} Returns ApplicationInfo object containing * information about the package. * If flag GET_UNINSTALLED_PACKAGES is set and if the package is not * found in the list of installed applications, * the application information is retrieved from the * list of uninstalled applications(which includes * installed applications as well as applications * with data directory ie applications which had been * deleted with {@code DONT_DELETE_DATA} flag set). * * @see #GET_META_DATA * @see #GET_SHARED_LIBRARY_FILES * @see #GET_UNINSTALLED_PACKAGES */ public abstract ApplicationInfo getApplicationInfo(String packageName, int flags) throws NameNotFoundException; /** * Retrieve all of the information we know about a particular activity * class. * * <p>Throws {@link NameNotFoundException} if an activity with the given * class name cannot be found on the system. * * @param component The full component name (i.e. * com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity * class. * @param flags Additional option flags. Use any combination of * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, * to modify the data (in ApplicationInfo) returned. * * @return {@link ActivityInfo} containing information about the activity. * * @see #GET_INTENT_FILTERS * @see #GET_META_DATA * @see #GET_SHARED_LIBRARY_FILES */ public abstract ActivityInfo getActivityInfo(ComponentName component, int flags) throws NameNotFoundException; /** * Retrieve all of the information we know about a particular receiver * class. * * <p>Throws {@link NameNotFoundException} if a receiver with the given * class name cannot be found on the system. * * @param component The full component name (i.e. * com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver * class. * @param flags Additional option flags. Use any combination of * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, * to modify the data returned. * * @return {@link ActivityInfo} containing information about the receiver. * * @see #GET_INTENT_FILTERS * @see #GET_META_DATA * @see #GET_SHARED_LIBRARY_FILES */ public abstract ActivityInfo getReceiverInfo(ComponentName component, int flags) throws NameNotFoundException; /** * Retrieve all of the information we know about a particular service * class. * * <p>Throws {@link NameNotFoundException} if a service with the given * class name cannot be found on the system. * * @param component The full component name (i.e. * com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service * class. * @param flags Additional option flags. Use any combination of * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, * to modify the data returned. * * @return ServiceInfo containing information about the service. * * @see #GET_META_DATA * @see #GET_SHARED_LIBRARY_FILES */ public abstract ServiceInfo getServiceInfo(ComponentName component, int flags) throws NameNotFoundException; /** * Retrieve all of the information we know about a particular content * provider class. * * <p>Throws {@link NameNotFoundException} if a provider with the given * class name cannot be found on the system. * * @param component The full component name (i.e. * com.google.providers.media/com.google.providers.media.MediaProvider) of a * ContentProvider class. * @param flags Additional option flags. Use any combination of * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, * to modify the data returned. * * @return ProviderInfo containing information about the service. * * @see #GET_META_DATA * @see #GET_SHARED_LIBRARY_FILES */ public abstract ProviderInfo getProviderInfo(ComponentName component, int flags) throws NameNotFoundException; /** * Return a List of all packages that are installed * on the device. * * @param flags Additional option flags. Use any combination of * {@link #GET_ACTIVITIES}, * {@link #GET_GIDS}, * {@link #GET_CONFIGURATIONS}, * {@link #GET_INSTRUMENTATION}, * {@link #GET_PERMISSIONS}, * {@link #GET_PROVIDERS}, * {@link #GET_RECEIVERS}, * {@link #GET_SERVICES}, * {@link #GET_SIGNATURES}, * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. * * @return A List of PackageInfo objects, one for each package that is * installed on the device. In the unlikely case of there being no * installed packages, an empty list is returned. * If flag GET_UNINSTALLED_PACKAGES is set, a list of all * applications including those deleted with {@code DONT_DELETE_DATA} * (partially installed apps with data directory) will be returned. * * @see #GET_ACTIVITIES * @see #GET_GIDS * @see #GET_CONFIGURATIONS * @see #GET_INSTRUMENTATION * @see #GET_PERMISSIONS * @see #GET_PROVIDERS * @see #GET_RECEIVERS * @see #GET_SERVICES * @see #GET_SIGNATURES * @see #GET_UNINSTALLED_PACKAGES */ public abstract List<PackageInfo> getInstalledPackages(int flags); /** * Return a List of all installed packages that are currently * holding any of the given permissions. * * @param flags Additional option flags. Use any combination of * {@link #GET_ACTIVITIES}, * {@link #GET_GIDS}, * {@link #GET_CONFIGURATIONS}, * {@link #GET_INSTRUMENTATION}, * {@link #GET_PERMISSIONS}, * {@link #GET_PROVIDERS}, * {@link #GET_RECEIVERS}, * {@link #GET_SERVICES}, * {@link #GET_SIGNATURES}, * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. * * @return Returns a List of PackageInfo objects, one for each installed * application that is holding any of the permissions that were provided. * * @see #GET_ACTIVITIES * @see #GET_GIDS * @see #GET_CONFIGURATIONS * @see #GET_INSTRUMENTATION * @see #GET_PERMISSIONS * @see #GET_PROVIDERS * @see #GET_RECEIVERS * @see #GET_SERVICES * @see #GET_SIGNATURES * @see #GET_UNINSTALLED_PACKAGES */ public abstract List<PackageInfo> getPackagesHoldingPermissions( String[] permissions, int flags); /** * Return a List of all packages that are installed on the device, for a specific user. * Requesting a list of installed packages for another user * will require the permission INTERACT_ACROSS_USERS_FULL. * @param flags Additional option flags. Use any combination of * {@link #GET_ACTIVITIES}, * {@link #GET_GIDS}, * {@link #GET_CONFIGURATIONS}, * {@link #GET_INSTRUMENTATION}, * {@link #GET_PERMISSIONS}, * {@link #GET_PROVIDERS}, * {@link #GET_RECEIVERS}, * {@link #GET_SERVICES}, * {@link #GET_SIGNATURES}, * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. * @param userId The user for whom the installed packages are to be listed * * @return A List of PackageInfo objects, one for each package that is * installed on the device. In the unlikely case of there being no * installed packages, an empty list is returned. * If flag GET_UNINSTALLED_PACKAGES is set, a list of all * applications including those deleted with {@code DONT_DELETE_DATA} * (partially installed apps with data directory) will be returned. * * @see #GET_ACTIVITIES * @see #GET_GIDS * @see #GET_CONFIGURATIONS * @see #GET_INSTRUMENTATION * @see #GET_PERMISSIONS * @see #GET_PROVIDERS * @see #GET_RECEIVERS * @see #GET_SERVICES * @see #GET_SIGNATURES * @see #GET_UNINSTALLED_PACKAGES * * @hide */ public abstract List<PackageInfo> getInstalledPackages(int flags, int userId); /** * Check whether a particular package has been granted a particular * permission. * * @param permName The name of the permission you are checking for. * @param pkgName The name of the package you are checking against. * * @return If the package has the permission, PERMISSION_GRANTED is * returned. If it does not have the permission, PERMISSION_DENIED * is returned. * * @see #PERMISSION_GRANTED * @see #PERMISSION_DENIED */ @CheckResult public abstract int checkPermission(String permName, String pkgName); /** * Checks whether a particular permissions has been revoked for a * package by policy. Typically the device owner or the profile owner * may apply such a policy. The user cannot grant policy revoked * permissions, hence the only way for an app to get such a permission * is by a policy change. * * @param permName The name of the permission you are checking for. * @param pkgName The name of the package you are checking against. * * @return Whether the permission is restricted by policy. */ @CheckResult public abstract boolean isPermissionRevokedByPolicy(@NonNull String permName, @NonNull String pkgName); /** * Gets the package name of the component controlling runtime permissions. * * @return The package name. * * @hide */ public abstract String getPermissionControllerPackageName(); /** * Add a new dynamic permission to the system. For this to work, your * package must have defined a permission tree through the * {@link android.R.styleable#AndroidManifestPermissionTree * &lt;permission-tree&gt;} tag in its manifest. A package can only add * permissions to trees that were defined by either its own package or * another with the same user id; a permission is in a tree if it * matches the name of the permission tree + ".": for example, * "com.foo.bar" is a member of the permission tree "com.foo". * * <p>It is good to make your permission tree name descriptive, because you * are taking possession of that entire set of permission names. Thus, it * must be under a domain you control, with a suffix that will not match * any normal permissions that may be declared in any applications that * are part of that domain. * * <p>New permissions must be added before * any .apks are installed that use those permissions. Permissions you * add through this method are remembered across reboots of the device. * If the given permission already exists, the info you supply here * will be used to update it. * * @param info Description of the permission to be added. * * @return Returns true if a new permission was created, false if an * existing one was updated. * * @throws SecurityException if you are not allowed to add the * given permission name. * * @see #removePermission(String) */ public abstract boolean addPermission(PermissionInfo info); /** * Like {@link #addPermission(PermissionInfo)} but asynchronously * persists the package manager state after returning from the call, * allowing it to return quicker and batch a series of adds at the * expense of no guarantee the added permission will be retained if * the device is rebooted before it is written. */ public abstract boolean addPermissionAsync(PermissionInfo info); /** * Removes a permission that was previously added with * {@link #addPermission(PermissionInfo)}. The same ownership rules apply * -- you are only allowed to remove permissions that you are allowed * to add. * * @param name The name of the permission to remove. * * @throws SecurityException if you are not allowed to remove the * given permission name. * * @see #addPermission(PermissionInfo) */ public abstract void removePermission(String name); /** * Permission flags set when granting or revoking a permission. * * @hide */ @SystemApi @IntDef({FLAG_PERMISSION_USER_SET, FLAG_PERMISSION_USER_FIXED, FLAG_PERMISSION_POLICY_FIXED, FLAG_PERMISSION_REVOKE_ON_UPGRADE, FLAG_PERMISSION_SYSTEM_FIXED, FLAG_PERMISSION_GRANTED_BY_DEFAULT}) @Retention(RetentionPolicy.SOURCE) public @interface PermissionFlags {} /** * Grant a runtime permission to an application which the application does not * already have. The permission must have been requested by the application. * If the application is not allowed to hold the permission, a {@link * java.lang.SecurityException} is thrown. * <p> * <strong>Note: </strong>Using this API requires holding * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is * not the current user android.permission.INTERACT_ACROSS_USERS_FULL. * </p> * * @param packageName The package to which to grant the permission. * @param permissionName The permission name to grant. * @param user The user for which to grant the permission. * * @see #revokeRuntimePermission(String, String, android.os.UserHandle) * @see android.content.pm.PackageManager.PermissionFlags * * @hide */ @SystemApi public abstract void grantRuntimePermission(@NonNull String packageName, @NonNull String permissionName, @NonNull UserHandle user); /** * Revoke a runtime permission that was previously granted by {@link * #grantRuntimePermission(String, String, android.os.UserHandle)}. The * permission must have been requested by and granted to the application. * If the application is not allowed to hold the permission, a {@link * java.lang.SecurityException} is thrown. * <p> * <strong>Note: </strong>Using this API requires holding * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is * not the current user android.permission.INTERACT_ACROSS_USERS_FULL. * </p> * * @param packageName The package from which to revoke the permission. * @param permissionName The permission name to revoke. * @param user The user for which to revoke the permission. * * @see #grantRuntimePermission(String, String, android.os.UserHandle) * @see android.content.pm.PackageManager.PermissionFlags * * @hide */ @SystemApi public abstract void revokeRuntimePermission(@NonNull String packageName, @NonNull String permissionName, @NonNull UserHandle user); /** * Gets the state flags associated with a permission. * * @param permissionName The permission for which to get the flags. * @param packageName The package name for which to get the flags. * @param user The user for which to get permission flags. * @return The permission flags. * * @hide */ @SystemApi public abstract @PermissionFlags int getPermissionFlags(String permissionName, String packageName, @NonNull UserHandle user); /** * Updates the flags associated with a permission by replacing the flags in * the specified mask with the provided flag values. * * @param permissionName The permission for which to update the flags. * @param packageName The package name for which to update the flags. * @param flagMask The flags which to replace. * @param flagValues The flags with which to replace. * @param user The user for which to update the permission flags. * * @hide */ @SystemApi public abstract void updatePermissionFlags(String permissionName, String packageName, @PermissionFlags int flagMask, int flagValues, @NonNull UserHandle user); /** * Gets whether you should show UI with rationale for requesting a permission. * You should do this only if you do not have the permission and the context in * which the permission is requested does not clearly communicate to the user * what would be the benefit from grating this permission. * * @param permission A permission your app wants to request. * @return Whether you can show permission rationale UI. * * @hide */ public abstract boolean shouldShowRequestPermissionRationale(String permission); /** * Returns an {@link android.content.Intent} suitable for passing to * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)} * which prompts the user to grant permissions to this application. * * @throws NullPointerException if {@code permissions} is {@code null} or empty. * * @hide */ public Intent buildRequestPermissionsIntent(@NonNull String[] permissions) { if (ArrayUtils.isEmpty(permissions)) { throw new NullPointerException("permission cannot be null or empty"); } Intent intent = new Intent(ACTION_REQUEST_PERMISSIONS); intent.putExtra(EXTRA_REQUEST_PERMISSIONS_NAMES, permissions); intent.setPackage(getPermissionControllerPackageName()); return intent; } /** * Compare the signatures of two packages to determine if the same * signature appears in both of them. If they do contain the same * signature, then they are allowed special privileges when working * with each other: they can share the same user-id, run instrumentation * against each other, etc. * * @param pkg1 First package name whose signature will be compared. * @param pkg2 Second package name whose signature will be compared. * * @return Returns an integer indicating whether all signatures on the * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if * all signatures match or < 0 if there is not a match ({@link * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). * * @see #checkSignatures(int, int) * @see #SIGNATURE_MATCH * @see #SIGNATURE_NO_MATCH * @see #SIGNATURE_UNKNOWN_PACKAGE */ @CheckResult public abstract int checkSignatures(String pkg1, String pkg2); /** * Like {@link #checkSignatures(String, String)}, but takes UIDs of * the two packages to be checked. This can be useful, for example, * when doing the check in an IPC, where the UID is the only identity * available. It is functionally identical to determining the package * associated with the UIDs and checking their signatures. * * @param uid1 First UID whose signature will be compared. * @param uid2 Second UID whose signature will be compared. * * @return Returns an integer indicating whether all signatures on the * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if * all signatures match or < 0 if there is not a match ({@link * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}). * * @see #checkSignatures(String, String) * @see #SIGNATURE_MATCH * @see #SIGNATURE_NO_MATCH * @see #SIGNATURE_UNKNOWN_PACKAGE */ @CheckResult public abstract int checkSignatures(int uid1, int uid2); /** * Retrieve the names of all packages that are associated with a particular * user id. In most cases, this will be a single package name, the package * that has been assigned that user id. Where there are multiple packages * sharing the same user id through the "sharedUserId" mechanism, all * packages with that id will be returned. * * @param uid The user id for which you would like to retrieve the * associated packages. * * @return Returns an array of one or more packages assigned to the user * id, or null if there are no known packages with the given id. */ public abstract String[] getPackagesForUid(int uid); /** * Retrieve the official name associated with a user id. This name is * guaranteed to never change, though it is possible for the underlying * user id to be changed. That is, if you are storing information about * user ids in persistent storage, you should use the string returned * by this function instead of the raw user-id. * * @param uid The user id for which you would like to retrieve a name. * @return Returns a unique name for the given user id, or null if the * user id is not currently assigned. */ public abstract String getNameForUid(int uid); /** * Return the user id associated with a shared user name. Multiple * applications can specify a shared user name in their manifest and thus * end up using a common uid. This might be used for new applications * that use an existing shared user name and need to know the uid of the * shared user. * * @param sharedUserName The shared user name whose uid is to be retrieved. * @return Returns the uid associated with the shared user, or NameNotFoundException * if the shared user name is not being used by any installed packages * @hide */ public abstract int getUidForSharedUser(String sharedUserName) throws NameNotFoundException; /** * Return a List of all application packages that are installed on the * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all * applications including those deleted with {@code DONT_DELETE_DATA} (partially * installed apps with data directory) will be returned. * * @param flags Additional option flags. Use any combination of * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. * * @return Returns a List of ApplicationInfo objects, one for each application that * is installed on the device. In the unlikely case of there being * no installed applications, an empty list is returned. * If flag GET_UNINSTALLED_PACKAGES is set, a list of all * applications including those deleted with {@code DONT_DELETE_DATA} * (partially installed apps with data directory) will be returned. * * @see #GET_META_DATA * @see #GET_SHARED_LIBRARY_FILES * @see #GET_UNINSTALLED_PACKAGES */ public abstract List<ApplicationInfo> getInstalledApplications(int flags); /** * Get a list of shared libraries that are available on the * system. * * @return An array of shared library names that are * available on the system, or null if none are installed. * */ public abstract String[] getSystemSharedLibraryNames(); /** * Get a list of features that are available on the * system. * * @return An array of FeatureInfo classes describing the features * that are available on the system, or null if there are none(!!). */ public abstract FeatureInfo[] getSystemAvailableFeatures(); /** * Check whether the given feature name is one of the available * features as returned by {@link #getSystemAvailableFeatures()}. * * @return Returns true if the devices supports the feature, else * false. */ public abstract boolean hasSystemFeature(String name); /** * Determine the best action to perform for a given Intent. This is how * {@link Intent#resolveActivity} finds an activity if a class has not * been explicitly specified. * * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY} * only flag. You need to do so to resolve the activity in the same way * that {@link android.content.Context#startActivity(Intent)} and * {@link android.content.Intent#resolveActivity(PackageManager) * Intent.resolveActivity(PackageManager)} do.</p> * * @param intent An intent containing all of the desired specification * (action, data, type, category, and/or component). * @param flags Additional option flags. The most important is * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. * * @return Returns a ResolveInfo containing the final activity intent that * was determined to be the best action. Returns null if no * matching activity was found. If multiple matching activities are * found and there is no default set, returns a ResolveInfo * containing something else, such as the activity resolver. * * @see #MATCH_DEFAULT_ONLY * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER */ public abstract ResolveInfo resolveActivity(Intent intent, int flags); /** * Determine the best action to perform for a given Intent for a given user. This * is how {@link Intent#resolveActivity} finds an activity if a class has not * been explicitly specified. * * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY} * only flag. You need to do so to resolve the activity in the same way * that {@link android.content.Context#startActivity(Intent)} and * {@link android.content.Intent#resolveActivity(PackageManager) * Intent.resolveActivity(PackageManager)} do.</p> * * @param intent An intent containing all of the desired specification * (action, data, type, category, and/or component). * @param flags Additional option flags. The most important is * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. * @param userId The user id. * * @return Returns a ResolveInfo containing the final activity intent that * was determined to be the best action. Returns null if no * matching activity was found. If multiple matching activities are * found and there is no default set, returns a ResolveInfo * containing something else, such as the activity resolver. * * @see #MATCH_DEFAULT_ONLY * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER * * @hide */ public abstract ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId); /** * Retrieve all activities that can be performed for the given intent. * * @param intent The desired intent as per resolveActivity(). * @param flags Additional option flags. The most important is * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. * * You can also set {@link #MATCH_ALL} for preventing the filtering of the results. * * @return A List&lt;ResolveInfo&gt; containing one entry for each matching * Activity. These are ordered from best to worst match -- that * is, the first item in the list is what is returned by * {@link #resolveActivity}. If there are no matching activities, an empty * list is returned. * * @see #MATCH_DEFAULT_ONLY * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER */ public abstract List<ResolveInfo> queryIntentActivities(Intent intent, int flags); /** * Retrieve all activities that can be performed for the given intent, for a specific user. * * @param intent The desired intent as per resolveActivity(). * @param flags Additional option flags. The most important is * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. * * You can also set {@link #MATCH_ALL} for preventing the filtering of the results. * * @return A List&lt;ResolveInfo&gt; containing one entry for each matching * Activity. These are ordered from best to worst match -- that * is, the first item in the list is what is returned by * {@link #resolveActivity}. If there are no matching activities, an empty * list is returned. * * @see #MATCH_DEFAULT_ONLY * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER * @hide */ public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, int flags, int userId); /** * Retrieve a set of activities that should be presented to the user as * similar options. This is like {@link #queryIntentActivities}, except it * also allows you to supply a list of more explicit Intents that you would * like to resolve to particular options, and takes care of returning the * final ResolveInfo list in a reasonable order, with no duplicates, based * on those inputs. * * @param caller The class name of the activity that is making the * request. This activity will never appear in the output * list. Can be null. * @param specifics An array of Intents that should be resolved to the * first specific results. Can be null. * @param intent The desired intent as per resolveActivity(). * @param flags Additional option flags. The most important is * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}. * * @return A List&lt;ResolveInfo&gt; containing one entry for each matching * Activity. These are ordered first by all of the intents resolved * in <var>specifics</var> and then any additional activities that * can handle <var>intent</var> but did not get included by one of * the <var>specifics</var> intents. If there are no matching * activities, an empty list is returned. * * @see #MATCH_DEFAULT_ONLY * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER */ public abstract List<ResolveInfo> queryIntentActivityOptions( ComponentName caller, Intent[] specifics, Intent intent, int flags); /** * Retrieve all receivers that can handle a broadcast of the given intent. * * @param intent The desired intent as per resolveActivity(). * @param flags Additional option flags. * * @return A List&lt;ResolveInfo&gt; containing one entry for each matching * Receiver. These are ordered from first to last in priority. If * there are no matching receivers, an empty list is returned. * * @see #MATCH_DEFAULT_ONLY * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER */ public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags); /** * Retrieve all receivers that can handle a broadcast of the given intent, for a specific * user. * * @param intent The desired intent as per resolveActivity(). * @param flags Additional option flags. * @param userId The userId of the user being queried. * * @return A List&lt;ResolveInfo&gt; containing one entry for each matching * Receiver. These are ordered from first to last in priority. If * there are no matching receivers, an empty list or {@code null} is returned. * * @see #MATCH_DEFAULT_ONLY * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER * @hide */ public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags, int userId); /** * Determine the best service to handle for a given Intent. * * @param intent An intent containing all of the desired specification * (action, data, type, category, and/or component). * @param flags Additional option flags. * * @return Returns a ResolveInfo containing the final service intent that * was determined to be the best action. Returns null if no * matching service was found. * * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER */ public abstract ResolveInfo resolveService(Intent intent, int flags); /** * Retrieve all services that can match the given intent. * * @param intent The desired intent as per resolveService(). * @param flags Additional option flags. * * @return A List&lt;ResolveInfo&gt; containing one entry for each matching * ServiceInfo. These are ordered from best to worst match -- that * is, the first item in the list is what is returned by * resolveService(). If there are no matching services, an empty * list or {@code null} is returned. * * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER */ public abstract List<ResolveInfo> queryIntentServices(Intent intent, int flags); /** * Retrieve all services that can match the given intent for a given user. * * @param intent The desired intent as per resolveService(). * @param flags Additional option flags. * @param userId The user id. * * @return A List&lt;ResolveInfo&gt; containing one entry for each matching * ServiceInfo. These are ordered from best to worst match -- that * is, the first item in the list is what is returned by * resolveService(). If there are no matching services, an empty * list or {@code null} is returned. * * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER * * @hide */ public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent, int flags, int userId); /** {@hide} */ public abstract List<ResolveInfo> queryIntentContentProvidersAsUser( Intent intent, int flags, int userId); /** * Retrieve all providers that can match the given intent. * * @param intent An intent containing all of the desired specification * (action, data, type, category, and/or component). * @param flags Additional option flags. * @return A List&lt;ResolveInfo&gt; containing one entry for each matching * ProviderInfo. These are ordered from best to worst match. If * there are no matching providers, an empty list or {@code null} is returned. * @see #GET_INTENT_FILTERS * @see #GET_RESOLVED_FILTER */ public abstract List<ResolveInfo> queryIntentContentProviders(Intent intent, int flags); /** * Find a single content provider by its base path name. * * @param name The name of the provider to find. * @param flags Additional option flags. Currently should always be 0. * * @return ContentProviderInfo Information about the provider, if found, * else null. */ public abstract ProviderInfo resolveContentProvider(String name, int flags); /** * Find a single content provider by its base path name. * * @param name The name of the provider to find. * @param flags Additional option flags. Currently should always be 0. * @param userId The user id. * * @return ContentProviderInfo Information about the provider, if found, * else null. * @hide */ public abstract ProviderInfo resolveContentProviderAsUser(String name, int flags, int userId); /** * Retrieve content provider information. * * <p><em>Note: unlike most other methods, an empty result set is indicated * by a null return instead of an empty list.</em> * * @param processName If non-null, limits the returned providers to only * those that are hosted by the given process. If null, * all content providers are returned. * @param uid If <var>processName</var> is non-null, this is the required * uid owning the requested content providers. * @param flags Additional option flags. Currently should always be 0. * * @return A List&lt;ContentProviderInfo&gt; containing one entry for each * content provider either patching <var>processName</var> or, if * <var>processName</var> is null, all known content providers. * <em>If there are no matching providers, null is returned.</em> */ public abstract List<ProviderInfo> queryContentProviders( String processName, int uid, int flags); /** * Retrieve all of the information we know about a particular * instrumentation class. * * <p>Throws {@link NameNotFoundException} if instrumentation with the * given class name cannot be found on the system. * * @param className The full name (i.e. * com.google.apps.contacts.InstrumentList) of an * Instrumentation class. * @param flags Additional option flags. Currently should always be 0. * * @return InstrumentationInfo containing information about the * instrumentation. */ public abstract InstrumentationInfo getInstrumentationInfo( ComponentName className, int flags) throws NameNotFoundException; /** * Retrieve information about available instrumentation code. May be used * to retrieve either all instrumentation code, or only the code targeting * a particular package. * * @param targetPackage If null, all instrumentation is returned; only the * instrumentation targeting this package name is * returned. * @param flags Additional option flags. Currently should always be 0. * * @return A List&lt;InstrumentationInfo&gt; containing one entry for each * matching available Instrumentation. Returns an empty list if * there is no instrumentation available for the given package. */ public abstract List<InstrumentationInfo> queryInstrumentation( String targetPackage, int flags); /** * Retrieve an image from a package. This is a low-level API used by * the various package manager info structures (such as * {@link ComponentInfo} to implement retrieval of their associated * icon. * * @param packageName The name of the package that this icon is coming from. * Cannot be null. * @param resid The resource identifier of the desired image. Cannot be 0. * @param appInfo Overall information about <var>packageName</var>. This * may be null, in which case the application information will be retrieved * for you if needed; if you already have this information around, it can * be much more efficient to supply it here. * * @return Returns a Drawable holding the requested image. Returns null if * an image could not be found for any reason. */ public abstract Drawable getDrawable(String packageName, @DrawableRes int resid, ApplicationInfo appInfo); /** * Retrieve the icon associated with an activity. Given the full name of * an activity, retrieves the information about it and calls * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon. * If the activity cannot be found, NameNotFoundException is thrown. * * @param activityName Name of the activity whose icon is to be retrieved. * * @return Returns the image of the icon, or the default activity icon if * it could not be found. Does not return null. * @throws NameNotFoundException Thrown if the resources for the given * activity could not be loaded. * * @see #getActivityIcon(Intent) */ public abstract Drawable getActivityIcon(ComponentName activityName) throws NameNotFoundException; /** * Retrieve the icon associated with an Intent. If intent.getClassName() is * set, this simply returns the result of * getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's * component and returns the icon associated with the resolved component. * If intent.getClassName() cannot be found or the Intent cannot be resolved * to a component, NameNotFoundException is thrown. * * @param intent The intent for which you would like to retrieve an icon. * * @return Returns the image of the icon, or the default activity icon if * it could not be found. Does not return null. * @throws NameNotFoundException Thrown if the resources for application * matching the given intent could not be loaded. * * @see #getActivityIcon(ComponentName) */ public abstract Drawable getActivityIcon(Intent intent) throws NameNotFoundException; /** * Retrieve the banner associated with an activity. Given the full name of * an activity, retrieves the information about it and calls * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its * banner. If the activity cannot be found, NameNotFoundException is thrown. * * @param activityName Name of the activity whose banner is to be retrieved. * @return Returns the image of the banner, or null if the activity has no * banner specified. * @throws NameNotFoundException Thrown if the resources for the given * activity could not be loaded. * @see #getActivityBanner(Intent) */ public abstract Drawable getActivityBanner(ComponentName activityName) throws NameNotFoundException; /** * Retrieve the banner associated with an Intent. If intent.getClassName() * is set, this simply returns the result of * getActivityBanner(intent.getClassName()). Otherwise it resolves the * intent's component and returns the banner associated with the resolved * component. If intent.getClassName() cannot be found or the Intent cannot * be resolved to a component, NameNotFoundException is thrown. * * @param intent The intent for which you would like to retrieve a banner. * @return Returns the image of the banner, or null if the activity has no * banner specified. * @throws NameNotFoundException Thrown if the resources for application * matching the given intent could not be loaded. * @see #getActivityBanner(ComponentName) */ public abstract Drawable getActivityBanner(Intent intent) throws NameNotFoundException; /** * Return the generic icon for an activity that is used when no specific * icon is defined. * * @return Drawable Image of the icon. */ public abstract Drawable getDefaultActivityIcon(); /** * Retrieve the icon associated with an application. If it has not defined * an icon, the default app icon is returned. Does not return null. * * @param info Information about application being queried. * * @return Returns the image of the icon, or the default application icon * if it could not be found. * * @see #getApplicationIcon(String) */ public abstract Drawable getApplicationIcon(ApplicationInfo info); /** * Retrieve the icon associated with an application. Given the name of the * application's package, retrieves the information about it and calls * getApplicationIcon() to return its icon. If the application cannot be * found, NameNotFoundException is thrown. * * @param packageName Name of the package whose application icon is to be * retrieved. * * @return Returns the image of the icon, or the default application icon * if it could not be found. Does not return null. * @throws NameNotFoundException Thrown if the resources for the given * application could not be loaded. * * @see #getApplicationIcon(ApplicationInfo) */ public abstract Drawable getApplicationIcon(String packageName) throws NameNotFoundException; /** * Retrieve the banner associated with an application. * * @param info Information about application being queried. * @return Returns the image of the banner or null if the application has no * banner specified. * @see #getApplicationBanner(String) */ public abstract Drawable getApplicationBanner(ApplicationInfo info); /** * Retrieve the banner associated with an application. Given the name of the * application's package, retrieves the information about it and calls * getApplicationIcon() to return its banner. If the application cannot be * found, NameNotFoundException is thrown. * * @param packageName Name of the package whose application banner is to be * retrieved. * @return Returns the image of the banner or null if the application has no * banner specified. * @throws NameNotFoundException Thrown if the resources for the given * application could not be loaded. * @see #getApplicationBanner(ApplicationInfo) */ public abstract Drawable getApplicationBanner(String packageName) throws NameNotFoundException; /** * Retrieve the logo associated with an activity. Given the full name of an * activity, retrieves the information about it and calls * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its * logo. If the activity cannot be found, NameNotFoundException is thrown. * * @param activityName Name of the activity whose logo is to be retrieved. * @return Returns the image of the logo or null if the activity has no logo * specified. * @throws NameNotFoundException Thrown if the resources for the given * activity could not be loaded. * @see #getActivityLogo(Intent) */ public abstract Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException; /** * Retrieve the logo associated with an Intent. If intent.getClassName() is * set, this simply returns the result of * getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's * component and returns the logo associated with the resolved component. * If intent.getClassName() cannot be found or the Intent cannot be resolved * to a component, NameNotFoundException is thrown. * * @param intent The intent for which you would like to retrieve a logo. * * @return Returns the image of the logo, or null if the activity has no * logo specified. * * @throws NameNotFoundException Thrown if the resources for application * matching the given intent could not be loaded. * * @see #getActivityLogo(ComponentName) */ public abstract Drawable getActivityLogo(Intent intent) throws NameNotFoundException; /** * Retrieve the logo associated with an application. If it has not specified * a logo, this method returns null. * * @param info Information about application being queried. * * @return Returns the image of the logo, or null if no logo is specified * by the application. * * @see #getApplicationLogo(String) */ public abstract Drawable getApplicationLogo(ApplicationInfo info); /** * Retrieve the logo associated with an application. Given the name of the * application's package, retrieves the information about it and calls * getApplicationLogo() to return its logo. If the application cannot be * found, NameNotFoundException is thrown. * * @param packageName Name of the package whose application logo is to be * retrieved. * * @return Returns the image of the logo, or null if no application logo * has been specified. * * @throws NameNotFoundException Thrown if the resources for the given * application could not be loaded. * * @see #getApplicationLogo(ApplicationInfo) */ public abstract Drawable getApplicationLogo(String packageName) throws NameNotFoundException; /** * If the target user is a managed profile of the calling user or if the * target user is the caller and is itself a managed profile, then this * returns a badged copy of the given icon to be able to distinguish it from * the original icon. For badging an arbitrary drawable use * {@link #getUserBadgedDrawableForDensity( * android.graphics.drawable.Drawable, UserHandle, android.graphics.Rect, int)}. * <p> * If the original drawable is a BitmapDrawable and the backing bitmap is * mutable as per {@link android.graphics.Bitmap#isMutable()}, the badging * is performed in place and the original drawable is returned. * </p> * * @param icon The icon to badge. * @param user The target user. * @return A drawable that combines the original icon and a badge as * determined by the system. */ public abstract Drawable getUserBadgedIcon(Drawable icon, UserHandle user); /** * If the target user is a managed profile of the calling user or the caller * is itself a managed profile, then this returns a badged copy of the given * drawable allowing the user to distinguish it from the original drawable. * The caller can specify the location in the bounds of the drawable to be * badged where the badge should be applied as well as the density of the * badge to be used. * <p> * If the original drawable is a BitmapDrawable and the backing bitmap is * mutable as per {@link android.graphics.Bitmap#isMutable()}, the bading * is performed in place and the original drawable is returned. * </p> * * @param drawable The drawable to badge. * @param user The target user. * @param badgeLocation Where in the bounds of the badged drawable to place * the badge. If not provided, the badge is applied on top of the entire * drawable being badged. * @param badgeDensity The optional desired density for the badge as per * {@link android.util.DisplayMetrics#densityDpi}. If not provided, * the density of the display is used. * @return A drawable that combines the original drawable and a badge as * determined by the system. */ public abstract Drawable getUserBadgedDrawableForDensity(Drawable drawable, UserHandle user, Rect badgeLocation, int badgeDensity); /** * If the target user is a managed profile of the calling user or the caller * is itself a managed profile, then this returns a drawable to use as a small * icon to include in a view to distinguish it from the original icon. * * @param user The target user. * @param density The optional desired density for the badge as per * {@link android.util.DisplayMetrics#densityDpi}. If not provided * the density of the current display is used. * @return the drawable or null if no drawable is required. * @hide */ public abstract Drawable getUserBadgeForDensity(UserHandle user, int density); /** * If the target user is a managed profile of the calling user or the caller * is itself a managed profile, then this returns a copy of the label with * badging for accessibility services like talkback. E.g. passing in "Email" * and it might return "Work Email" for Email in the work profile. * * @param label The label to change. * @param user The target user. * @return A label that combines the original label and a badge as * determined by the system. */ public abstract CharSequence getUserBadgedLabel(CharSequence label, UserHandle user); /** * Retrieve text from a package. This is a low-level API used by * the various package manager info structures (such as * {@link ComponentInfo} to implement retrieval of their associated * labels and other text. * * @param packageName The name of the package that this text is coming from. * Cannot be null. * @param resid The resource identifier of the desired text. Cannot be 0. * @param appInfo Overall information about <var>packageName</var>. This * may be null, in which case the application information will be retrieved * for you if needed; if you already have this information around, it can * be much more efficient to supply it here. * * @return Returns a CharSequence holding the requested text. Returns null * if the text could not be found for any reason. */ public abstract CharSequence getText(String packageName, @StringRes int resid, ApplicationInfo appInfo); /** * Retrieve an XML file from a package. This is a low-level API used to * retrieve XML meta data. * * @param packageName The name of the package that this xml is coming from. * Cannot be null. * @param resid The resource identifier of the desired xml. Cannot be 0. * @param appInfo Overall information about <var>packageName</var>. This * may be null, in which case the application information will be retrieved * for you if needed; if you already have this information around, it can * be much more efficient to supply it here. * * @return Returns an XmlPullParser allowing you to parse out the XML * data. Returns null if the xml resource could not be found for any * reason. */ public abstract XmlResourceParser getXml(String packageName, @XmlRes int resid, ApplicationInfo appInfo); /** * Return the label to use for this application. * * @return Returns the label associated with this application, or null if * it could not be found for any reason. * @param info The application to get the label of. */ public abstract CharSequence getApplicationLabel(ApplicationInfo info); /** * Retrieve the resources associated with an activity. Given the full * name of an activity, retrieves the information about it and calls * getResources() to return its application's resources. If the activity * cannot be found, NameNotFoundException is thrown. * * @param activityName Name of the activity whose resources are to be * retrieved. * * @return Returns the application's Resources. * @throws NameNotFoundException Thrown if the resources for the given * application could not be loaded. * * @see #getResourcesForApplication(ApplicationInfo) */ public abstract Resources getResourcesForActivity(ComponentName activityName) throws NameNotFoundException; /** * Retrieve the resources for an application. Throws NameNotFoundException * if the package is no longer installed. * * @param app Information about the desired application. * * @return Returns the application's Resources. * @throws NameNotFoundException Thrown if the resources for the given * application could not be loaded (most likely because it was uninstalled). */ public abstract Resources getResourcesForApplication(ApplicationInfo app) throws NameNotFoundException; /** * Retrieve the resources associated with an application. Given the full * package name of an application, retrieves the information about it and * calls getResources() to return its application's resources. If the * appPackageName cannot be found, NameNotFoundException is thrown. * * @param appPackageName Package name of the application whose resources * are to be retrieved. * * @return Returns the application's Resources. * @throws NameNotFoundException Thrown if the resources for the given * application could not be loaded. * * @see #getResourcesForApplication(ApplicationInfo) */ public abstract Resources getResourcesForApplication(String appPackageName) throws NameNotFoundException; /** @hide */ public abstract Resources getResourcesForApplicationAsUser(String appPackageName, int userId) throws NameNotFoundException; /** * Retrieve overall information about an application package defined * in a package archive file * * @param archiveFilePath The path to the archive file * @param flags Additional option flags. Use any combination of * {@link #GET_ACTIVITIES}, * {@link #GET_GIDS}, * {@link #GET_CONFIGURATIONS}, * {@link #GET_INSTRUMENTATION}, * {@link #GET_PERMISSIONS}, * {@link #GET_PROVIDERS}, * {@link #GET_RECEIVERS}, * {@link #GET_SERVICES}, * {@link #GET_SIGNATURES}, to modify the data returned. * * @return Returns the information about the package. Returns * null if the package could not be successfully parsed. * * @see #GET_ACTIVITIES * @see #GET_GIDS * @see #GET_CONFIGURATIONS * @see #GET_INSTRUMENTATION * @see #GET_PERMISSIONS * @see #GET_PROVIDERS * @see #GET_RECEIVERS * @see #GET_SERVICES * @see #GET_SIGNATURES * */ public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) { final PackageParser parser = new PackageParser(); final File apkFile = new File(archiveFilePath); try { PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0); if ((flags & GET_SIGNATURES) != 0) { parser.collectCertificates(pkg, 0); parser.collectManifestDigest(pkg); } PackageUserState state = new PackageUserState(); return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0, null, state); } catch (PackageParserException e) { return null; } } /** * @hide Install a package. Since this may take a little while, the result * will be posted back to the given observer. An installation will * fail if the calling context lacks the * {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if * the package named in the package file's manifest is already * installed, or if there's no space available on the device. * @param packageURI The location of the package file to install. This can * be a 'file:' or a 'content:' URI. * @param observer An observer callback to get notified when the package * installation is complete. * {@link IPackageInstallObserver#packageInstalled(String, int)} * will be called when that happens. This parameter must not be * null. * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, * {@link #INSTALL_REPLACE_EXISTING}, * {@link #INSTALL_ALLOW_TEST}. * @param installerPackageName Optional package name of the application that * is performing the installation. This identifies which market * the package came from. * @deprecated Use {@link #installPackage(Uri, PackageInstallObserver, int, * String)} instead. This method will continue to be supported * but the older observer interface will not get additional * failure details. */ // @SystemApi public abstract void installPackage( Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName); /** * Similar to * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but * with an extra verification file provided. * * @param packageURI The location of the package file to install. This can * be a 'file:' or a 'content:' URI. * @param observer An observer callback to get notified when the package * installation is complete. * {@link IPackageInstallObserver#packageInstalled(String, int)} * will be called when that happens. This parameter must not be * null. * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, * {@link #INSTALL_REPLACE_EXISTING}, * {@link #INSTALL_ALLOW_TEST}. * @param installerPackageName Optional package name of the application that * is performing the installation. This identifies which market * the package came from. * @param verificationURI The location of the supplementary verification * file. This can be a 'file:' or a 'content:' URI. May be * {@code null}. * @param manifestDigest an object that holds the digest of the package * which can be used to verify ownership. May be {@code null}. * @param encryptionParams if the package to be installed is encrypted, * these parameters describing the encryption and authentication * used. May be {@code null}. * @hide * @deprecated Use {@link #installPackageWithVerification(Uri, * PackageInstallObserver, int, String, Uri, ManifestDigest, * ContainerEncryptionParams)} instead. This method will * continue to be supported but the older observer interface * will not get additional failure details. */ // @SystemApi public abstract void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName, Uri verificationURI, ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams); /** * Similar to * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but * with an extra verification information provided. * * @param packageURI The location of the package file to install. This can * be a 'file:' or a 'content:' URI. * @param observer An observer callback to get notified when the package * installation is complete. * {@link IPackageInstallObserver#packageInstalled(String, int)} * will be called when that happens. This parameter must not be * null. * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, * {@link #INSTALL_REPLACE_EXISTING}, * {@link #INSTALL_ALLOW_TEST}. * @param installerPackageName Optional package name of the application that * is performing the installation. This identifies which market * the package came from. * @param verificationParams an object that holds signal information to * assist verification. May be {@code null}. * @param encryptionParams if the package to be installed is encrypted, * these parameters describing the encryption and authentication * used. May be {@code null}. * @hide * @deprecated Use {@link #installPackageWithVerificationAndEncryption(Uri, * PackageInstallObserver, int, String, VerificationParams, * ContainerEncryptionParams)} instead. This method will * continue to be supported but the older observer interface * will not get additional failure details. */ @Deprecated public abstract void installPackageWithVerificationAndEncryption(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName, VerificationParams verificationParams, ContainerEncryptionParams encryptionParams); // Package-install variants that take the new, expanded form of observer interface. // Note that these *also* take the original observer type and will redundantly // report the same information to that observer if supplied; but it is not required. /** * @hide * * Install a package. Since this may take a little while, the result will * be posted back to the given observer. An installation will fail if the calling context * lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the * package named in the package file's manifest is already installed, or if there's no space * available on the device. * * @param packageURI The location of the package file to install. This can be a 'file:' or a * 'content:' URI. * @param observer An observer callback to get notified when the package installation is * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be * called when that happens. This parameter must not be null. * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. * @param installerPackageName Optional package name of the application that is performing the * installation. This identifies which market the package came from. */ public abstract void installPackage( Uri packageURI, PackageInstallObserver observer, int flags, String installerPackageName); /** * @hide * Install a package. Since this may take a little while, the result will be * posted back to the given observer. An installation will fail if the package named * in the package file's manifest is already installed, or if there's no space * available on the device. * @param packageURI The location of the package file to install. This can be a 'file:' or a * 'content:' URI. * @param observer An observer callback to get notified when the package installation is * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be * called when that happens. This parameter must not be null. * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. * @param installerPackageName Optional package name of the application that is performing the * installation. This identifies which market the package came from. * @param userId The user id. */ @RequiresPermission(anyOf = { Manifest.permission.INSTALL_PACKAGES, Manifest.permission.INTERACT_ACROSS_USERS_FULL}) public abstract void installPackageAsUser( Uri packageURI, PackageInstallObserver observer, int flags, String installerPackageName, int userId); /** * Similar to * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but * with an extra verification file provided. * * @param packageURI The location of the package file to install. This can * be a 'file:' or a 'content:' URI. * @param observer An observer callback to get notified when the package installation is * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be * called when that happens. This parameter must not be null. * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. * @param installerPackageName Optional package name of the application that * is performing the installation. This identifies which market * the package came from. * @param verificationURI The location of the supplementary verification * file. This can be a 'file:' or a 'content:' URI. May be * {@code null}. * @param manifestDigest an object that holds the digest of the package * which can be used to verify ownership. May be {@code null}. * @param encryptionParams if the package to be installed is encrypted, * these parameters describing the encryption and authentication * used. May be {@code null}. * @hide */ public abstract void installPackageWithVerification(Uri packageURI, PackageInstallObserver observer, int flags, String installerPackageName, Uri verificationURI, ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams); /** * Similar to * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but * with an extra verification information provided. * * @param packageURI The location of the package file to install. This can * be a 'file:' or a 'content:' URI. * @param observer An observer callback to get notified when the package installation is * complete. {@link PackageInstallObserver#packageInstalled(String, Bundle, int)} will be * called when that happens. This parameter must not be null. * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK}, * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}. * @param installerPackageName Optional package name of the application that * is performing the installation. This identifies which market * the package came from. * @param verificationParams an object that holds signal information to * assist verification. May be {@code null}. * @param encryptionParams if the package to be installed is encrypted, * these parameters describing the encryption and authentication * used. May be {@code null}. * * @hide */ public abstract void installPackageWithVerificationAndEncryption(Uri packageURI, PackageInstallObserver observer, int flags, String installerPackageName, VerificationParams verificationParams, ContainerEncryptionParams encryptionParams); /** * If there is already an application with the given package name installed * on the system for other users, also install it for the calling user. * @hide */ // @SystemApi public abstract int installExistingPackage(String packageName) throws NameNotFoundException; /** * If there is already an application with the given package name installed * on the system for other users, also install it for the specified user. * @hide */ @RequiresPermission(anyOf = { Manifest.permission.INSTALL_PACKAGES, Manifest.permission.INTERACT_ACROSS_USERS_FULL}) public abstract int installExistingPackageAsUser(String packageName, int userId) throws NameNotFoundException; /** * Allows a package listening to the * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification * broadcast} to respond to the package manager. The response must include * the {@code verificationCode} which is one of * {@link PackageManager#VERIFICATION_ALLOW} or * {@link PackageManager#VERIFICATION_REJECT}. * * @param id pending package identifier as passed via the * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW} * or {@link PackageManager#VERIFICATION_REJECT}. * @throws SecurityException if the caller does not have the * PACKAGE_VERIFICATION_AGENT permission. */ public abstract void verifyPendingInstall(int id, int verificationCode); /** * Allows a package listening to the * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification * broadcast} to extend the default timeout for a response and declare what * action to perform after the timeout occurs. The response must include * the {@code verificationCodeAtTimeout} which is one of * {@link PackageManager#VERIFICATION_ALLOW} or * {@link PackageManager#VERIFICATION_REJECT}. * * This method may only be called once per package id. Additional calls * will have no effect. * * @param id pending package identifier as passed via the * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. * @param verificationCodeAtTimeout either * {@link PackageManager#VERIFICATION_ALLOW} or * {@link PackageManager#VERIFICATION_REJECT}. If * {@code verificationCodeAtTimeout} is neither * {@link PackageManager#VERIFICATION_ALLOW} or * {@link PackageManager#VERIFICATION_REJECT}, then * {@code verificationCodeAtTimeout} will default to * {@link PackageManager#VERIFICATION_REJECT}. * @param millisecondsToDelay the amount of time requested for the timeout. * Must be positive and less than * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. If * {@code millisecondsToDelay} is out of bounds, * {@code millisecondsToDelay} will be set to the closest in * bounds value; namely, 0 or * {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}. * @throws SecurityException if the caller does not have the * PACKAGE_VERIFICATION_AGENT permission. */ public abstract void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay); /** * Allows a package listening to the * {@link Intent#ACTION_INTENT_FILTER_NEEDS_VERIFICATION intent filter verification * broadcast} to respond to the package manager. The response must include * the {@code verificationCode} which is one of * {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} or * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}. * * @param verificationId pending package identifier as passed via the * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra. * @param verificationCode either {@link PackageManager#INTENT_FILTER_VERIFICATION_SUCCESS} * or {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}. * @param outFailedDomains a list of failed domains if the verificationCode is * {@link PackageManager#INTENT_FILTER_VERIFICATION_FAILURE}, otherwise null; * @throws SecurityException if the caller does not have the * INTENT_FILTER_VERIFICATION_AGENT permission. * * @hide */ @SystemApi public abstract void verifyIntentFilter(int verificationId, int verificationCode, List<String> outFailedDomains); /** * Get the status of a Domain Verification Result for an IntentFilter. This is * related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and * {@link android.content.IntentFilter#getAutoVerify()} * * This is used by the ResolverActivity to change the status depending on what the User select * in the Disambiguation Dialog and also used by the Settings App for changing the default App * for a domain. * * @param packageName The package name of the Activity associated with the IntentFilter. * @param userId The user id. * * @return The status to set to. This can be * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} or * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED} * * @hide */ public abstract int getIntentVerificationStatus(String packageName, int userId); /** * Allow to change the status of a Intent Verification status for all IntentFilter of an App. * This is related to the {@link android.content.IntentFilter#setAutoVerify(boolean)} and * {@link android.content.IntentFilter#getAutoVerify()} * * This is used by the ResolverActivity to change the status depending on what the User select * in the Disambiguation Dialog and also used by the Settings App for changing the default App * for a domain. * * @param packageName The package name of the Activity associated with the IntentFilter. * @param status The status to set to. This can be * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK} or * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS} or * {@link #INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER} * @param userId The user id. * * @return true if the status has been set. False otherwise. * * @hide */ public abstract boolean updateIntentVerificationStatus(String packageName, int status, int userId); /** * Get the list of IntentFilterVerificationInfo for a specific package and User. * * @param packageName the package name. When this parameter is set to a non null value, * the results will be filtered by the package name provided. * Otherwise, there will be no filtering and it will return a list * corresponding for all packages * * @return a list of IntentFilterVerificationInfo for a specific package. * * @hide */ public abstract List<IntentFilterVerificationInfo> getIntentFilterVerifications( String packageName); /** * Get the list of IntentFilter for a specific package. * * @param packageName the package name. This parameter is set to a non null value, * the list will contain all the IntentFilter for that package. * Otherwise, the list will be empty. * * @return a list of IntentFilter for a specific package. * * @hide */ public abstract List<IntentFilter> getAllIntentFilters(String packageName); /** * Get the default Browser package name for a specific user. * * @param userId The user id. * * @return the package name of the default Browser for the specified user. If the user id passed * is -1 (all users) it will return a null value. * * @hide */ public abstract String getDefaultBrowserPackageName(int userId); /** * Set the default Browser package name for a specific user. * * @param packageName The package name of the default Browser. * @param userId The user id. * * @return true if the default Browser for the specified user has been set, * otherwise return false. If the user id passed is -1 (all users) this call will not * do anything and just return false. * * @hide */ public abstract boolean setDefaultBrowserPackageName(String packageName, int userId); /** * Change the installer associated with a given package. There are limitations * on how the installer package can be changed; in particular: * <ul> * <li> A SecurityException will be thrown if <var>installerPackageName</var> * is not signed with the same certificate as the calling application. * <li> A SecurityException will be thrown if <var>targetPackage</var> already * has an installer package, and that installer package is not signed with * the same certificate as the calling application. * </ul> * * @param targetPackage The installed package whose installer will be changed. * @param installerPackageName The package name of the new installer. May be * null to clear the association. */ public abstract void setInstallerPackageName(String targetPackage, String installerPackageName); /** * Attempts to delete a package. Since this may take a little while, the result will * be posted back to the given observer. A deletion will fail if the calling context * lacks the {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the * named package cannot be found, or if the named package is a "system package". * (TODO: include pointer to documentation on "system packages") * * @param packageName The name of the package to delete * @param observer An observer callback to get notified when the package deletion is * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be * called when that happens. observer may be null to indicate that no callback is desired. * @param flags Possible values: {@link #DELETE_KEEP_DATA}, * {@link #DELETE_ALL_USERS}. * * @hide */ // @SystemApi public abstract void deletePackage( String packageName, IPackageDeleteObserver observer, int flags); /** * Attempts to delete a package. Since this may take a little while, the result will * be posted back to the given observer. A deletion will fail if the named package cannot be * found, or if the named package is a "system package". * (TODO: include pointer to documentation on "system packages") * * @param packageName The name of the package to delete * @param observer An observer callback to get notified when the package deletion is * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be * called when that happens. observer may be null to indicate that no callback is desired. * @param flags Possible values: {@link #DELETE_KEEP_DATA}, {@link #DELETE_ALL_USERS}. * @param userId The user Id * * @hide */ @RequiresPermission(anyOf = { Manifest.permission.DELETE_PACKAGES, Manifest.permission.INTERACT_ACROSS_USERS_FULL}) public abstract void deletePackageAsUser( String packageName, IPackageDeleteObserver observer, int flags, int userId); /** * Retrieve the package name of the application that installed a package. This identifies * which market the package came from. * * @param packageName The name of the package to query */ public abstract String getInstallerPackageName(String packageName); /** * Attempts to clear the user data directory of an application. * Since this may take a little while, the result will * be posted back to the given observer. A deletion will fail if the * named package cannot be found, or if the named package is a "system package". * * @param packageName The name of the package * @param observer An observer callback to get notified when the operation is finished * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} * will be called when that happens. observer may be null to indicate that * no callback is desired. * * @hide */ public abstract void clearApplicationUserData(String packageName, IPackageDataObserver observer); /** * Attempts to delete the cache files associated with an application. * Since this may take a little while, the result will * be posted back to the given observer. A deletion will fail if the calling context * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the * named package cannot be found, or if the named package is a "system package". * * @param packageName The name of the package to delete * @param observer An observer callback to get notified when the cache file deletion * is complete. * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)} * will be called when that happens. observer may be null to indicate that * no callback is desired. * * @hide */ public abstract void deleteApplicationCacheFiles(String packageName, IPackageDataObserver observer); /** * Free storage by deleting LRU sorted list of cache files across * all applications. If the currently available free storage * on the device is greater than or equal to the requested * free storage, no cache files are cleared. If the currently * available storage on the device is less than the requested * free storage, some or all of the cache files across * all applications are deleted (based on last accessed time) * to increase the free storage space on the device to * the requested value. There is no guarantee that clearing all * the cache files from all applications will clear up * enough storage to achieve the desired value. * @param freeStorageSize The number of bytes of storage to be * freed by the system. Say if freeStorageSize is XX, * and the current free storage is YY, * if XX is less than YY, just return. if not free XX-YY number * of bytes if possible. * @param observer call back used to notify when * the operation is completed * * @hide */ // @SystemApi public void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) { freeStorageAndNotify(null, freeStorageSize, observer); } /** {@hide} */ public abstract void freeStorageAndNotify(String volumeUuid, long freeStorageSize, IPackageDataObserver observer); /** * Free storage by deleting LRU sorted list of cache files across * all applications. If the currently available free storage * on the device is greater than or equal to the requested * free storage, no cache files are cleared. If the currently * available storage on the device is less than the requested * free storage, some or all of the cache files across * all applications are deleted (based on last accessed time) * to increase the free storage space on the device to * the requested value. There is no guarantee that clearing all * the cache files from all applications will clear up * enough storage to achieve the desired value. * @param freeStorageSize The number of bytes of storage to be * freed by the system. Say if freeStorageSize is XX, * and the current free storage is YY, * if XX is less than YY, just return. if not free XX-YY number * of bytes if possible. * @param pi IntentSender call back used to * notify when the operation is completed.May be null * to indicate that no call back is desired. * * @hide */ public void freeStorage(long freeStorageSize, IntentSender pi) { freeStorage(null, freeStorageSize, pi); } /** {@hide} */ public abstract void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi); /** * Retrieve the size information for a package. * Since this may take a little while, the result will * be posted back to the given observer. The calling context * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission. * * @param packageName The name of the package whose size information is to be retrieved * @param userHandle The user whose size information should be retrieved. * @param observer An observer callback to get notified when the operation * is complete. * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)} * The observer's callback is invoked with a PackageStats object(containing the * code, data and cache sizes of the package) and a boolean value representing * the status of the operation. observer may be null to indicate that * no callback is desired. * * @hide */ public abstract void getPackageSizeInfo(String packageName, int userHandle, IPackageStatsObserver observer); /** * Like {@link #getPackageSizeInfo(String, int, IPackageStatsObserver)}, but * returns the size for the calling user. * * @hide */ public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) { getPackageSizeInfo(packageName, UserHandle.myUserId(), observer); } /** * @deprecated This function no longer does anything; it was an old * approach to managing preferred activities, which has been superseded * by (and conflicts with) the modern activity-based preferences. */ @Deprecated public abstract void addPackageToPreferred(String packageName); /** * @deprecated This function no longer does anything; it was an old * approach to managing preferred activities, which has been superseded * by (and conflicts with) the modern activity-based preferences. */ @Deprecated public abstract void removePackageFromPreferred(String packageName); /** * Retrieve the list of all currently configured preferred packages. The * first package on the list is the most preferred, the last is the * least preferred. * * @param flags Additional option flags. Use any combination of * {@link #GET_ACTIVITIES}, * {@link #GET_GIDS}, * {@link #GET_CONFIGURATIONS}, * {@link #GET_INSTRUMENTATION}, * {@link #GET_PERMISSIONS}, * {@link #GET_PROVIDERS}, * {@link #GET_RECEIVERS}, * {@link #GET_SERVICES}, * {@link #GET_SIGNATURES}, to modify the data returned. * * @return Returns a list of PackageInfo objects describing each * preferred application, in order of preference. * * @see #GET_ACTIVITIES * @see #GET_GIDS * @see #GET_CONFIGURATIONS * @see #GET_INSTRUMENTATION * @see #GET_PERMISSIONS * @see #GET_PROVIDERS * @see #GET_RECEIVERS * @see #GET_SERVICES * @see #GET_SIGNATURES */ public abstract List<PackageInfo> getPreferredPackages(int flags); /** * @deprecated This is a protected API that should not have been available * to third party applications. It is the platform's responsibility for * assigning preferred activities and this cannot be directly modified. * * Add a new preferred activity mapping to the system. This will be used * to automatically select the given activity component when * {@link Context#startActivity(Intent) Context.startActivity()} finds * multiple matching activities and also matches the given filter. * * @param filter The set of intents under which this activity will be * made preferred. * @param match The IntentFilter match category that this preference * applies to. * @param set The set of activities that the user was picking from when * this preference was made. * @param activity The component name of the activity that is to be * preferred. */ @Deprecated public abstract void addPreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity); /** * Same as {@link #addPreferredActivity(IntentFilter, int, ComponentName[], ComponentName)}, but with a specific userId to apply the preference to. * @hide */ public void addPreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity, int userId) { throw new RuntimeException("Not implemented. Must override in a subclass."); } /** * @deprecated This is a protected API that should not have been available * to third party applications. It is the platform's responsibility for * assigning preferred activities and this cannot be directly modified. * * Replaces an existing preferred activity mapping to the system, and if that were not present * adds a new preferred activity. This will be used * to automatically select the given activity component when * {@link Context#startActivity(Intent) Context.startActivity()} finds * multiple matching activities and also matches the given filter. * * @param filter The set of intents under which this activity will be * made preferred. * @param match The IntentFilter match category that this preference * applies to. * @param set The set of activities that the user was picking from when * this preference was made. * @param activity The component name of the activity that is to be * preferred. * @hide */ @Deprecated public abstract void replacePreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity); /** * @hide */ @Deprecated public void replacePreferredActivityAsUser(IntentFilter filter, int match, ComponentName[] set, ComponentName activity, int userId) { throw new RuntimeException("Not implemented. Must override in a subclass."); } /** * Remove all preferred activity mappings, previously added with * {@link #addPreferredActivity}, from the * system whose activities are implemented in the given package name. * An application can only clear its own package(s). * * @param packageName The name of the package whose preferred activity * mappings are to be removed. */ public abstract void clearPackagePreferredActivities(String packageName); /** * Retrieve all preferred activities, previously added with * {@link #addPreferredActivity}, that are * currently registered with the system. * * @param outFilters A required list in which to place the filters of all of the * preferred activities. * @param outActivities A required list in which to place the component names of * all of the preferred activities. * @param packageName An optional package in which you would like to limit * the list. If null, all activities will be returned; if non-null, only * those activities in the given package are returned. * * @return Returns the total number of registered preferred activities * (the number of distinct IntentFilter records, not the number of unique * activity components) that were found. */ public abstract int getPreferredActivities(@NonNull List<IntentFilter> outFilters, @NonNull List<ComponentName> outActivities, String packageName); /** * Ask for the set of available 'home' activities and the current explicit * default, if any. * @hide */ public abstract ComponentName getHomeActivities(List<ResolveInfo> outActivities); /** * Set the enabled setting for a package component (activity, receiver, service, provider). * This setting will override any enabled state which may have been set by the component in its * manifest. * * @param componentName The component to enable * @param newState The new enabled state for the component. The legal values for this state * are: * {@link #COMPONENT_ENABLED_STATE_ENABLED}, * {@link #COMPONENT_ENABLED_STATE_DISABLED} * and * {@link #COMPONENT_ENABLED_STATE_DEFAULT} * The last one removes the setting, thereby restoring the component's state to * whatever was set in it's manifest (or enabled, by default). * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0. */ public abstract void setComponentEnabledSetting(ComponentName componentName, int newState, int flags); /** * Return the enabled setting for a package component (activity, * receiver, service, provider). This returns the last value set by * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since * the value originally specified in the manifest has not been modified. * * @param componentName The component to retrieve. * @return Returns the current enabled state for the component. May * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED}, * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the * component's enabled state is based on the original information in * the manifest as found in {@link ComponentInfo}. */ public abstract int getComponentEnabledSetting(ComponentName componentName); /** * Set the enabled setting for an application * This setting will override any enabled state which may have been set by the application in * its manifest. It also overrides the enabled state set in the manifest for any of the * application's components. It does not override any enabled state set by * {@link #setComponentEnabledSetting} for any of the application's components. * * @param packageName The package name of the application to enable * @param newState The new enabled state for the component. The legal values for this state * are: * {@link #COMPONENT_ENABLED_STATE_ENABLED}, * {@link #COMPONENT_ENABLED_STATE_DISABLED} * and * {@link #COMPONENT_ENABLED_STATE_DEFAULT} * The last one removes the setting, thereby restoring the applications's state to * whatever was set in its manifest (or enabled, by default). * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0. */ public abstract void setApplicationEnabledSetting(String packageName, int newState, int flags); /** * Return the enabled setting for an application. This returns * the last value set by * {@link #setApplicationEnabledSetting(String, int, int)}; in most * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since * the value originally specified in the manifest has not been modified. * * @param packageName The package name of the application to retrieve. * @return Returns the current enabled state for the application. May * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED}, * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or * {@link #COMPONENT_ENABLED_STATE_DEFAULT}. The last one means the * application's enabled state is based on the original information in * the manifest as found in {@link ComponentInfo}. * @throws IllegalArgumentException if the named package does not exist. */ public abstract int getApplicationEnabledSetting(String packageName); /** * Puts the package in a hidden state, which is almost like an uninstalled state, * making the package unavailable, but it doesn't remove the data or the actual * package file. Application can be unhidden by either resetting the hidden state * or by installing it, such as with {@link #installExistingPackage(String)} * @hide */ public abstract boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, UserHandle userHandle); /** * Returns the hidden state of a package. * @see #setApplicationHiddenSettingAsUser(String, boolean, UserHandle) * @hide */ public abstract boolean getApplicationHiddenSettingAsUser(String packageName, UserHandle userHandle); /** * Return whether the device has been booted into safe mode. */ public abstract boolean isSafeMode(); /** * Adds a listener for permission changes for installed packages. * * @param listener The listener to add. * * @hide */ @SystemApi @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS) public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener); /** * Remvoes a listener for permission changes for installed packages. * * @param listener The listener to remove. * * @hide */ @SystemApi public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener); /** * Return the {@link KeySet} associated with the String alias for this * application. * * @param alias The alias for a given {@link KeySet} as defined in the * application's AndroidManifest.xml. * @hide */ public abstract KeySet getKeySetByAlias(String packageName, String alias); /** Return the signing {@link KeySet} for this application. * @hide */ public abstract KeySet getSigningKeySet(String packageName); /** * Return whether the package denoted by packageName has been signed by all * of the keys specified by the {@link KeySet} ks. This will return true if * the package has been signed by additional keys (a superset) as well. * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}. * @hide */ public abstract boolean isSignedBy(String packageName, KeySet ks); /** * Return whether the package denoted by packageName has been signed by all * of, and only, the keys specified by the {@link KeySet} ks. Compare to * {@link #isSignedBy(String packageName, KeySet ks)}. * @hide */ public abstract boolean isSignedByExactly(String packageName, KeySet ks); /** * Attempts to move package resources from internal to external media or vice versa. * Since this may take a little while, the result will * be posted back to the given observer. This call may fail if the calling context * lacks the {@link android.Manifest.permission#MOVE_PACKAGE} permission, if the * named package cannot be found, or if the named package is a "system package". * * @param packageName The name of the package to delete * @param observer An observer callback to get notified when the package move is * complete. {@link android.content.pm.IPackageMoveObserver#packageMoved(boolean)} will be * called when that happens. observer may be null to indicate that no callback is desired. * @param flags To indicate install location {@link #MOVE_INTERNAL} or * {@link #MOVE_EXTERNAL_MEDIA} * * @hide */ @Deprecated public void movePackage(String packageName, IPackageMoveObserver observer, int flags) { throw new UnsupportedOperationException(); } /** {@hide} */ public static boolean isMoveStatusFinished(int status) { return (status < 0 || status > 100); } /** {@hide} */ public static abstract class MoveCallback { public void onCreated(int moveId, Bundle extras) {} public abstract void onStatusChanged(int moveId, int status, long estMillis); } /** {@hide} */ public abstract int getMoveStatus(int moveId); /** {@hide} */ public abstract void registerMoveCallback(MoveCallback callback, Handler handler); /** {@hide} */ public abstract void unregisterMoveCallback(MoveCallback callback); /** {@hide} */ public abstract int movePackage(String packageName, VolumeInfo vol); /** {@hide} */ public abstract @Nullable VolumeInfo getPackageCurrentVolume(ApplicationInfo app); /** {@hide} */ public abstract @NonNull List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app); /** {@hide} */ public abstract int movePrimaryStorage(VolumeInfo vol); /** {@hide} */ public abstract @Nullable VolumeInfo getPrimaryStorageCurrentVolume(); /** {@hide} */ public abstract @NonNull List<VolumeInfo> getPrimaryStorageCandidateVolumes(); /** * Returns the device identity that verifiers can use to associate their scheme to a particular * device. This should not be used by anything other than a package verifier. * * @return identity that uniquely identifies current device * @hide */ public abstract VerifierDeviceIdentity getVerifierDeviceIdentity(); /** * Returns true if the device is upgrading, such as first boot after OTA. * * @hide */ public abstract boolean isUpgrade(); /** * Return interface that offers the ability to install, upgrade, and remove * applications on the device. */ public abstract @NonNull PackageInstaller getPackageInstaller(); /** * Adds a {@link CrossProfileIntentFilter}. After calling this method all intents sent from the * user with id sourceUserId can also be be resolved by activities in the user with id * targetUserId if they match the specified intent filter. * @param filter The {@link IntentFilter} the intent has to match * @param sourceUserId The source user id. * @param targetUserId The target user id. * @param flags The only possible value is {@link SKIP_CURRENT_PROFILE} * @hide */ public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId, int targetUserId, int flags); /** * Clearing {@link CrossProfileIntentFilter}s which have the specified user as their * source, and have been set by the app calling this method. * @param sourceUserId The source user id. * @hide */ public abstract void clearCrossProfileIntentFilters(int sourceUserId); /** * @hide */ public abstract Drawable loadItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo); /** * @hide */ public abstract Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo); /** {@hide} */ public abstract boolean isPackageAvailable(String packageName); /** {@hide} */ public static String installStatusToString(int status, String msg) { final String str = installStatusToString(status); if (msg != null) { return str + ": " + msg; } else { return str; } } /** {@hide} */ public static String installStatusToString(int status) { switch (status) { case INSTALL_SUCCEEDED: return "INSTALL_SUCCEEDED"; case INSTALL_FAILED_ALREADY_EXISTS: return "INSTALL_FAILED_ALREADY_EXISTS"; case INSTALL_FAILED_INVALID_APK: return "INSTALL_FAILED_INVALID_APK"; case INSTALL_FAILED_INVALID_URI: return "INSTALL_FAILED_INVALID_URI"; case INSTALL_FAILED_INSUFFICIENT_STORAGE: return "INSTALL_FAILED_INSUFFICIENT_STORAGE"; case INSTALL_FAILED_DUPLICATE_PACKAGE: return "INSTALL_FAILED_DUPLICATE_PACKAGE"; case INSTALL_FAILED_NO_SHARED_USER: return "INSTALL_FAILED_NO_SHARED_USER"; case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return "INSTALL_FAILED_UPDATE_INCOMPATIBLE"; case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return "INSTALL_FAILED_SHARED_USER_INCOMPATIBLE"; case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return "INSTALL_FAILED_MISSING_SHARED_LIBRARY"; case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return "INSTALL_FAILED_REPLACE_COULDNT_DELETE"; case INSTALL_FAILED_DEXOPT: return "INSTALL_FAILED_DEXOPT"; case INSTALL_FAILED_OLDER_SDK: return "INSTALL_FAILED_OLDER_SDK"; case INSTALL_FAILED_CONFLICTING_PROVIDER: return "INSTALL_FAILED_CONFLICTING_PROVIDER"; case INSTALL_FAILED_NEWER_SDK: return "INSTALL_FAILED_NEWER_SDK"; case INSTALL_FAILED_TEST_ONLY: return "INSTALL_FAILED_TEST_ONLY"; case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE"; case INSTALL_FAILED_MISSING_FEATURE: return "INSTALL_FAILED_MISSING_FEATURE"; case INSTALL_FAILED_CONTAINER_ERROR: return "INSTALL_FAILED_CONTAINER_ERROR"; case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return "INSTALL_FAILED_INVALID_INSTALL_LOCATION"; case INSTALL_FAILED_MEDIA_UNAVAILABLE: return "INSTALL_FAILED_MEDIA_UNAVAILABLE"; case INSTALL_FAILED_VERIFICATION_TIMEOUT: return "INSTALL_FAILED_VERIFICATION_TIMEOUT"; case INSTALL_FAILED_VERIFICATION_FAILURE: return "INSTALL_FAILED_VERIFICATION_FAILURE"; case INSTALL_FAILED_PACKAGE_CHANGED: return "INSTALL_FAILED_PACKAGE_CHANGED"; case INSTALL_FAILED_UID_CHANGED: return "INSTALL_FAILED_UID_CHANGED"; case INSTALL_FAILED_VERSION_DOWNGRADE: return "INSTALL_FAILED_VERSION_DOWNGRADE"; case INSTALL_PARSE_FAILED_NOT_APK: return "INSTALL_PARSE_FAILED_NOT_APK"; case INSTALL_PARSE_FAILED_BAD_MANIFEST: return "INSTALL_PARSE_FAILED_BAD_MANIFEST"; case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION"; case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return "INSTALL_PARSE_FAILED_NO_CERTIFICATES"; case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES"; case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING"; case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME"; case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID"; case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED"; case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return "INSTALL_PARSE_FAILED_MANIFEST_EMPTY"; case INSTALL_FAILED_INTERNAL_ERROR: return "INSTALL_FAILED_INTERNAL_ERROR"; case INSTALL_FAILED_USER_RESTRICTED: return "INSTALL_FAILED_USER_RESTRICTED"; case INSTALL_FAILED_DUPLICATE_PERMISSION: return "INSTALL_FAILED_DUPLICATE_PERMISSION"; case INSTALL_FAILED_NO_MATCHING_ABIS: return "INSTALL_FAILED_NO_MATCHING_ABIS"; case INSTALL_FAILED_ABORTED: return "INSTALL_FAILED_ABORTED"; default: return Integer.toString(status); } } /** {@hide} */ public static int installStatusToPublicStatus(int status) { switch (status) { case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS; case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE; case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE; case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE; case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE; case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED; case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED; case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE; case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED; default: return PackageInstaller.STATUS_FAILURE; } } /** {@hide} */ public static String deleteStatusToString(int status, String msg) { final String str = deleteStatusToString(status); if (msg != null) { return str + ": " + msg; } else { return str; } } /** {@hide} */ public static String deleteStatusToString(int status) { switch (status) { case DELETE_SUCCEEDED: return "DELETE_SUCCEEDED"; case DELETE_FAILED_INTERNAL_ERROR: return "DELETE_FAILED_INTERNAL_ERROR"; case DELETE_FAILED_DEVICE_POLICY_MANAGER: return "DELETE_FAILED_DEVICE_POLICY_MANAGER"; case DELETE_FAILED_USER_RESTRICTED: return "DELETE_FAILED_USER_RESTRICTED"; case DELETE_FAILED_OWNER_BLOCKED: return "DELETE_FAILED_OWNER_BLOCKED"; case DELETE_FAILED_ABORTED: return "DELETE_FAILED_ABORTED"; default: return Integer.toString(status); } } /** {@hide} */ public static int deleteStatusToPublicStatus(int status) { switch (status) { case DELETE_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS; case DELETE_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE; case DELETE_FAILED_DEVICE_POLICY_MANAGER: return PackageInstaller.STATUS_FAILURE_BLOCKED; case DELETE_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_BLOCKED; case DELETE_FAILED_OWNER_BLOCKED: return PackageInstaller.STATUS_FAILURE_BLOCKED; case DELETE_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED; default: return PackageInstaller.STATUS_FAILURE; } } /** {@hide} */ public static String permissionFlagToString(int flag) { switch (flag) { case FLAG_PERMISSION_GRANTED_BY_DEFAULT: return "GRANTED_BY_DEFAULT"; case FLAG_PERMISSION_POLICY_FIXED: return "POLICY_FIXED"; case FLAG_PERMISSION_SYSTEM_FIXED: return "SYSTEM_FIXED"; case FLAG_PERMISSION_USER_SET: return "USER_SET"; case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE"; case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED"; default: return Integer.toString(flag); } } /** {@hide} */ public static class LegacyPackageInstallObserver extends PackageInstallObserver { private final IPackageInstallObserver mLegacy; public LegacyPackageInstallObserver(IPackageInstallObserver legacy) { mLegacy = legacy; } @Override public void onPackageInstalled(String basePackageName, int returnCode, String msg, Bundle extras) { if (mLegacy == null) return; try { mLegacy.packageInstalled(basePackageName, returnCode); } catch (RemoteException ignored) { } } } /** {@hide} */ public static class LegacyPackageDeleteObserver extends PackageDeleteObserver { private final IPackageDeleteObserver mLegacy; public LegacyPackageDeleteObserver(IPackageDeleteObserver legacy) { mLegacy = legacy; } @Override public void onPackageDeleted(String basePackageName, int returnCode, String msg) { if (mLegacy == null) return; try { mLegacy.packageDeleted(basePackageName, returnCode); } catch (RemoteException ignored) { } } } }
0ac6cf9b6a00544f96f60d22c723e671d61c5fef
6670b30227d8deb546fb9b34fbdcceb67da69ba9
/src/test/java/ex/rr/tasklist/TaskListRepositoryTest.java
6ac1ce6d1169eed086ed1fbb3d7f3549935bf21a
[]
no_license
rromanowicz/task-list
4451958258093842dbb1cbc678333da873c1abcf
25ec0540f8bd3a9c9b73cc787ccfd41ed30a9b5d
refs/heads/master
2023-03-27T09:10:21.925010
2021-03-26T10:08:23
2021-03-26T10:08:23
348,346,897
0
0
null
2021-03-26T10:08:24
2021-03-16T12:53:58
Java
UTF-8
Java
false
false
3,942
java
package ex.rr.tasklist; import ex.rr.tasklist.database.entity.Task; import ex.rr.tasklist.database.entity.TaskList; import ex.rr.tasklist.database.entity.User; import ex.rr.tasklist.database.repository.TaskListRepository; import ex.rr.tasklist.database.repository.UserRepository; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; import java.util.ArrayList; import java.util.List; import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; @SuppressWarnings({"unused","OptionalGetWithoutIsPresent"}) @SpringBootTest @ExtendWith(SpringExtension.class) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) public class TaskListRepositoryTest { private static final Logger logger = LoggerFactory.getLogger(TaskListRepositoryTest.class); private static TaskList taskList; @Autowired private TaskListRepository repository; @Autowired private UserRepository userRepository; @Test @Order(1) public void injectedComponentsAreNotNull() { assertThat(repository).isNotNull(); assertThat(userRepository).isNotNull(); } @Test @Order(2) public void shouldCreateDbTaskList() { taskList = createTaskListRecord(); assertThat(taskList).isNotNull(); } @Test @Order(3) public void shouldReturnAllTaskLists() { List<TaskList> lists = repository.findAll(); assertThat(lists).isNotEmpty(); assertThat(lists).hasSizeGreaterThan(0); } @Test @Order(4) public void shouldReturn1TaskList() { Optional<TaskList> list = repository.findById(taskList.getId()); assertThat(list.orElse(null)).isNotNull(); } @Test @Order(5) public void listShouldHaveTasks() { Optional<TaskList> list = repository.findById(taskList.getId()); logger.debug(list::toString); List<Task> tasks = list.get().getTasks(); assertThat(tasks).hasSize(2); } @Test @Order(6) public void shouldReturnUserLists() { List<TaskList> userLists = repository.findAllByUser("user1"); assertThat(userLists).hasSizeGreaterThan(0); } @Test @Order(7) public void shouldReturnListsSharedWithUser() { List<TaskList> userLists = repository.findAllByUser("user2"); assertThat(userLists).hasSizeGreaterThan(0); } @Test @Order(8) public void shouldDeleteTaskList() { repository.deleteById(taskList.getId()); assertThat(repository.findById(taskList.getId())).isEmpty(); } private TaskList createTaskListRecord() { TaskList tl = createTaskList(); return repository.save(tl); } private TaskList createTaskList() { List<Task> tasks = new ArrayList<>(); Task t1 = Task.builder().taskName("test1").build().toBuilder().build(); Task t2 = Task.builder().taskName("test2").build().toBuilder().build(); tasks.add(t1); tasks.add(t2); User u1 = userRepository.findByUsername("user1").orElse(null); User u2 = userRepository.findByUsername("user2").orElse(null); List<User> sharedWith = new ArrayList<>(); sharedWith.add(u2); return TaskList.builder() .listName("list1") .listDescription("desc1") .tasks(tasks) .owner(u1) .sharedWith(sharedWith) .build() .toBuilder() .build(); } }
760ab38346f3faa1087fd74cb2cb72c283e65f54
d991dfbef8c02b207ba543ac0720cbd7bda94e57
/binding/ilsdiv1_0_bc/src/main/java/org/oclc/circill/toolkit/binding/ilsdiv1_0_bc/jaxb/dozer/CirculationStatusSchemeValuePairConverter.java
d3e71b8df48ac5e9e7fe99d6e04c156fcca08a12
[ "MIT" ]
permissive
OCLC-Developer-Network/circill-toolkit
fa66f6a800029b51960634dc674562c4588c63ae
f29d6f59a8b223dabf7b733f178be8fd4489ad58
refs/heads/master
2023-03-18T22:06:48.392938
2021-03-04T22:19:07
2021-03-04T22:19:07
307,710,469
2
0
null
null
null
null
UTF-8
Java
false
false
836
java
/* * Copyright (c) 2010 eXtensible Catalog Organization. * * This program is free software; you can redistribute it and/or modify it * under the terms of the MIT/X11 license. The text of the license can be * found at http://www.opensource.org/licenses/mit-license.php. */ package org.oclc.circill.toolkit.binding.ilsdiv1_0_bc.jaxb.dozer; import org.oclc.circill.toolkit.binding.ilsdiv1_0_bc.jaxb.elements.SchemeValuePair; import org.oclc.circill.toolkit.binding.jaxb.dozer.BaseSchemeValuePairConverter; import org.oclc.circill.toolkit.service.ncip.CirculationStatus; public class CirculationStatusSchemeValuePairConverter extends BaseSchemeValuePairConverter<SchemeValuePair, CirculationStatus> { public CirculationStatusSchemeValuePairConverter() { super(SchemeValuePair.class, CirculationStatus.class); } }
0d04d03107241ba93fab7fc3afed51ed9c518628
1401e2a52d68ea7dba97d5bdf0d0c67ea757c7c5
/app/src/main/java/Modules/Truck.java
2da0c7945b12eeb7bede4d444d5a362f501ee61f
[]
no_license
RahulJain7/Truck_App_Java
ff3f0da87907d971df4d9168ec630b580329e3b5
73f3d817d0286e208531ebea19af885c908fc09c
refs/heads/master
2020-12-03T02:24:43.794962
2017-07-01T01:38:21
2017-07-01T01:38:21
95,935,220
0
0
null
null
null
null
UTF-8
Java
false
false
301
java
package Modules; /** * Created by Vinesh on 27/06/17. */ public class Truck { public String Name; public String raw_source; public String raw_destination; public Truck(String Name){ this.Name = Name; } public String driver_name; public String driver_number; }
401c644c7393dc5a631f5104e844da97de5d11b2
3c03a1295c09bb22f6d56b07fc85fa5feaa04dac
/src/D17_BreadthFirstTraversal/BreadthFirst.java
ee90f24b0e6cec396fa6afde26d902b47c03dfa2
[]
no_license
MavenOfCode/data-structures-and-algorithms
b4fe8699b3985076c86f084bf9934b263011a3f5
0f55ed0900836ecaddd7179f6bfb062019bf3422
refs/heads/master
2020-03-22T16:50:04.731411
2018-09-04T02:27:44
2018-09-04T02:27:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,911
java
package D17_BreadthFirstTraversal; import D16_FizzBuzzTree.tree.TreeNode; import javax.xml.soap.Node; import java.sql.SQLOutput; import java.util.LinkedList; import java.util.Queue; //help for this code from lecture, Geeks for Geeks: //https://www.geeksforgeeks.org/level-order-tree-traversal/ ///TAs, Instructor and classmate, Ahmed Ossan public class BreadthFirst { //instantiate TreeNode from other Whiteboard // (after making it's properties public) //so have access to the left, right and data properties of a TreeNode //that is known to me (built in Nodes had too many different options //I don't yet understand. TreeNode root; //public part of recursive method pair public String breadthFirstTraversal(){ return breadthFirstTraversal(this.root); } //private part of recursive method pair private String breadthFirstTraversal(TreeNode node){ //immediatly address null node case if(node == null) { return null; } //instantiate helper queue that is empty to hold a node and it's children //temporarily to print out each node as visited Queue<TreeNode> helperQueue = new LinkedList<>(); //add the node argument passed in to the empty helper queue helperQueue.add(node); String result = "\n"; while(!helperQueue.isEmpty()) { //take the current node at the front of the queue for printing TreeNode temp = helperQueue.poll(); result += temp.data + "\n"; //add left child of temp node to queue for print out if (temp.left != null) { helperQueue.add(temp.left); } //add right child of temp node to queue for print out if (temp.right != null) { helperQueue.add(temp.right); } } return result; } }
35055099124742f5959ecbce021026b43c322be0
3c746e53a937817823f73bbbb0bcb364616593b7
/app/src/main/java/xzy/myrecoder/View/Fragment/ItemFragment.java
27a93392e15ea35a5d8012da6d2e3529dc000c85
[]
no_license
cy601/SoundRecorder
2b806ec2baf0ecd63e36a0abcb921f656326441f
01a0f3b5d54ff421ac62a7c0ec169b20d7bb32da
refs/heads/master
2020-04-10T00:40:37.120295
2018-12-06T15:18:30
2018-12-06T15:18:30
160,673,663
0
0
null
null
null
null
UTF-8
Java
false
false
668
java
package xzy.myrecoder.View.Fragment; import android.os.Bundle; import android.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import xzy.myrecoder.R; /** * A simple {@link Fragment} subclass. */ public class ItemFragment extends Fragment { public ItemFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_item, container, false); } }
fdb79cca9892a5acfea0045a081da0911b0eafd6
303f9d308151f4f1b1cbfdfcbfd4442aa79be8ed
/spring06_toyProject/src/main/java/com/kh/spring/common/interceptor/AuthInterceptor.java
d98b6e1690a34d637873e1c99f4c66271d9f5701
[]
no_license
soeunnnn/spring
b3ef8880a40b72fcef9f78a2db545bdeb027afcb
006c348418bd85ee7d95de00ca3c3b2080a68250
refs/heads/main
2023-09-01T18:27:18.014938
2021-10-27T11:47:23
2021-10-27T11:47:23
417,136,804
0
0
null
null
null
null
UTF-8
Java
false
false
3,568
java
package com.kh.spring.common.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.springframework.web.servlet.HandlerInterceptor; import com.kh.spring.common.code.ErrorCode; import com.kh.spring.common.code.MemberGrade; import com.kh.spring.common.exception.HandlableException; import com.kh.spring.member.model.dto.Member; public class AuthInterceptor implements HandlerInterceptor{ @Override public boolean preHandle(HttpServletRequest httpRequest, HttpServletResponse httpResponse, Object handler) { String[] uriArr = httpRequest.getRequestURI().split("/"); if(uriArr.length != 0) { switch (uriArr[1]) { case "member": memberAuthorize(httpRequest, httpResponse, uriArr); break; case "admin": adminAuthorize(httpRequest, httpResponse, uriArr); break; case "board": boardAuthorize(httpRequest, httpResponse, uriArr); break; default: break; } } //다음 인터셉터 또는 컨트롤러에게 요청을 전달 return true; } private void boardAuthorize(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String[] uriArr) { HttpSession session = httpRequest.getSession(); Member member = (Member) session.getAttribute("authentication"); switch (uriArr[2]) { case "board-form": if(member == null) { throw new HandlableException(ErrorCode.UNAUTHORIZED_PAGE_ERROR); } break; case "upload": if(member == null) { throw new HandlableException(ErrorCode.UNAUTHORIZED_PAGE_ERROR); } break; default: break; } } private void adminAuthorize(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String[] uriArr) { HttpSession session = httpRequest.getSession(); Member member = (Member) session.getAttribute("authentication"); //비회원과, 사용자 회원인지를 판단. if(member == null || MemberGrade.valueOf(member.getGrade()).ROLE.equals("user")) { throw new HandlableException(ErrorCode.UNAUTHORIZED_PAGE_ERROR); } //슈퍼관리자라면 모든 admin페이지에 접근할 수 있다. if(MemberGrade.valueOf(member.getGrade()).DESC.equals("super")) { return; } switch (uriArr[2]) { case "member": if(!MemberGrade.valueOf(member.getGrade()).DESC.equals("member")) { throw new HandlableException(ErrorCode.UNAUTHORIZED_PAGE_ERROR); } break; case "board": if(!MemberGrade.valueOf(member.getGrade()).DESC.equals("board")) { throw new HandlableException(ErrorCode.UNAUTHORIZED_PAGE_ERROR); } break; default: break; } } private void memberAuthorize(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String[] uriArr) { HttpSession session = httpRequest.getSession(); switch (uriArr[2]) { case "mypage": if(session.getAttribute("authentication") == null) { throw new HandlableException(ErrorCode.UNAUTHORIZED_PAGE_ERROR); } break; default: break; } } }
b9716b86fbc9429513ee12b0e779c2b6cd9892b3
2f47cb46a28ecd5cec082ed1118c859c7cdf65fa
/userservice-domain/src/main/java/com/dyz/userservice/domain/repository/UserRoleRepository.java
e2e5d011bc8b4daac49a1aa847f07da72c80a63b
[]
no_license
dyzlx/UserManageService
0cbf6f4612cb79019e07744972e0b464560976ec
4c1ccb293e2fe0bab6c22613b2cc3145850040cb
refs/heads/master
2021-07-04T10:04:38.414425
2020-11-13T07:32:36
2020-11-13T07:32:36
230,078,141
0
0
null
2021-04-26T19:49:23
2019-12-25T09:28:05
Java
UTF-8
Java
false
false
440
java
package com.dyz.userservice.domain.repository; import com.dyz.userservice.domain.entity.UserRole; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface UserRoleRepository extends JpaRepository<UserRole, Integer> { List<UserRole> queryUserRolesByUserId(Integer userId); void deleteUserRolesByUserId(Integer userId); }
692bee9c80cfb786c0841c89e19bbed3b80c3108
6464f3a7331d7c54619ab1adda230fe9d0c0bfed
/src/test/java/com/niks/unit/service/FileWriterServiceTest.java
3c0fd67ae74b888be39bb227ab80ed5a8e364809
[]
no_license
nikhilshinde57/executor-framework-usecase-study
5145bd2e61b4e2625f41c5ad3c28e3e373cadeac
bfc2ff92ae56340be0767c00649a7225f3dd68a3
refs/heads/master
2023-01-24T03:39:59.689624
2020-12-05T14:32:28
2020-12-05T14:32:28
312,804,039
0
1
null
null
null
null
UTF-8
Java
false
false
2,946
java
package com.niks.unit.service; import com.niks.services.Exception.S3FileUploadFailed; import com.niks.services.file.FileWriterService; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import com.niks.constants.ErrorConstants; import com.niks.model.SQSMessagePayload; import com.niks.services.s3.S3OperationsHelperService; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.runners.MockitoJUnitRunner; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @RunWith(MockitoJUnitRunner.class) public class FileWriterServiceTest { @InjectMocks FileWriterService fileWriterService; @Mock S3OperationsHelperService s3OperationsHelperService; @Before public void setup() { MockitoAnnotations.initMocks(this); } @Test public void testWriteFileShouldSucceed() throws IOException, S3FileUploadFailed { SQSMessagePayload sqsMessagePayload = getSQSMessagePayload(); String fileName = "test.dat", dataToWrite = "SampleData"; List list = new ArrayList<String>(); list.add(dataToWrite); String[] sortedArrayToWrite = new String[]{"SampleData"}; doNothing().when(s3OperationsHelperService) .multipartUploadToS3(sqsMessagePayload, fileName, list); fileWriterService.writeFile(sqsMessagePayload, fileName, sortedArrayToWrite); verify(s3OperationsHelperService, times(1)) .multipartUploadToS3(sqsMessagePayload, fileName, list); } @Test public void testWriteFileShouldThrowS3FileUploadFailedException() throws IOException, S3FileUploadFailed { SQSMessagePayload sqsMessagePayload = getSQSMessagePayload(); String fileName = "test.dat", dataToWrite = "SampleData"; List list = new ArrayList<String>(); list.add(dataToWrite); String[] sortedArrayToWrite = new String[]{"SampleData"}; doThrow(new S3FileUploadFailed(ErrorConstants.S3_FILE_UPLOAD_FAILED)).when(s3OperationsHelperService) .multipartUploadToS3(sqsMessagePayload, fileName, list); try { fileWriterService.writeFile(sqsMessagePayload, fileName, sortedArrayToWrite); } catch (Exception ex) { assertTrue(ex instanceof S3FileUploadFailed); } verify(s3OperationsHelperService, times(1)) .multipartUploadToS3(sqsMessagePayload, fileName, list); } private SQSMessagePayload getSQSMessagePayload() { SQSMessagePayload sqsMessagePayload = new SQSMessagePayload(); sqsMessagePayload.setBucketName("niks"); sqsMessagePayload.setFolderName("input"); sqsMessagePayload.setFolderPath("119D3831852F51/input/test.dat"); sqsMessagePayload.setTenantId("119D3831852F51"); return sqsMessagePayload; } }
66b763de1a21eecff32bb52e8c9b1fc4fa7bfa18
63128fcd1b9d8e02244309936a3fb2cb123df6c9
/src/control/ErrorContrl.java
cfbf79f1b5716b5da26f186017230f7bdbe6f0ac
[]
no_license
PrivateCollections/tiger
14fb42da967e23293b99e690b9fb6075931e27d1
80757bbc420f5c3fa33cbd81c4a0584b0a6a81c5
refs/heads/master
2021-06-12T18:24:30.837397
2017-04-26T14:25:05
2017-04-26T14:25:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
package control; import java.util.LinkedList; import ast.Ast.Type; public class ErrorContrl { LinkedList<Error> errorList; LinkedList<String> errorMsgList; public ErrorContrl(){ errorList = new LinkedList<Error>(); errorMsgList = new LinkedList<String>(); } public void addError(Type.T wanted,Type.T got){ Error e = new Error(wanted,got); errorList.add(e); } public void addErrorMsg(String msg){ errorMsgList.add(msg); } public LinkedList<Error> getErrors(){ return errorList; } public LinkedList<String> getErrorMsgs(){ return errorMsgList; } }
961b311560499468eca82bd881a18a6b3606d60e
d1a2ae1005e263b75920afb4e5b91ec3bea17310
/bank-core/src/main/java/com/midtrans/bank/core/model/Transaction.java
ccf3e0cfdff54cc60787abe6da5ff3f2cfb6b984
[]
no_license
mohbadar/bank-simulator
8015f6ed4dcc1e07f553783dc58d6e3f59325464
3357c430e2017a44c558775cd5bae6346332d787
refs/heads/master
2020-08-31T15:11:55.471423
2013-09-12T09:01:32
2013-09-12T09:01:32
218,719,286
2
0
null
2019-10-31T08:32:06
2019-10-31T08:32:05
null
UTF-8
Java
false
false
3,089
java
package com.midtrans.bank.core.model; import java.io.Serializable; import java.util.Date; /** * Created with IntelliJ IDEA. * User: shaddiqa * Date: 8/17/13 * Time: 8:35 PM * To change this template use File | Settings | File Templates. */ public class Transaction implements Serializable { private Long id; private Long amount; private Trace trace; private String cardNumber; private String cardExpire; private Date txnTime; private String referenceNumber; private String authorizationId; private String responseCode; private Long voidAmount; private boolean reversal; private Date createdAt; public Transaction() { this.amount = 0L; this.voidAmount = 0L; this.reversal = false; this.createdAt = new Date(); } public void modifyVoidAmount(VoidTxn voidTxn) { if(voidTxn.isReversal()) { this.voidAmount -= voidTxn.getAmount(); } else { this.voidAmount += voidTxn.getAmount(); } } public Long calcSettleAmount() { if(reversal) { return 0L; } return amount - voidAmount; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getAmount() { return amount; } public void setAmount(Long amount) { this.amount = amount; } public Trace getTrace() { return trace; } public void setTrace(Trace trace) { this.trace = trace; } public String getCardNumber() { return cardNumber; } public void setCardNumber(String cardNumber) { this.cardNumber = cardNumber; } public String getCardExpire() { return cardExpire; } public void setCardExpire(String cardExpire) { this.cardExpire = cardExpire; } public Date getTxnTime() { return txnTime; } public void setTxnTime(Date txnTime) { this.txnTime = txnTime; } public String getReferenceNumber() { return referenceNumber; } public void setReferenceNumber(String referenceNumber) { this.referenceNumber = referenceNumber; } public String getAuthorizationId() { return authorizationId; } public void setAuthorizationId(String authorizationId) { this.authorizationId = authorizationId; } public String getResponseCode() { return responseCode; } public void setResponseCode(String responseCode) { this.responseCode = responseCode; } public Long getVoidAmount() { return voidAmount; } public void setVoidAmount(Long voidAmount) { this.voidAmount = voidAmount; } public boolean isReversal() { return reversal; } public void setReversal(boolean reversal) { this.reversal = reversal; } public Date getCreatedAt() { return createdAt; } public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } }
d5b8415d94e0436fd30f0fc7057c7aa3df59f9ef
d06a4b4cfd724d284ae3396411b32e238356e5d0
/backend/src/main/java/co/inventorsoft/scripty/controller/ExceptionHandlingController.java
8e71b84fa29baea514429ac262eb4d60ddb8a33c
[]
no_license
symynjuk/scripty
d89142a48b7bf8dc62c5c6f7a66e8f031172696a
3f6c5f9bf67ec614583dbe6e9de4420db584c59a
refs/heads/master
2020-04-10T07:12:44.652545
2018-12-06T13:35:29
2018-12-06T13:35:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
691
java
package co.inventorsoft.scripty.controller; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import co.inventorsoft.scripty.exception.ApplicationException; import co.inventorsoft.scripty.model.dto.StringResponse; /** * global ExceptionHandler for ApplicationException */ @ControllerAdvice public class ExceptionHandlingController { @ExceptionHandler(ApplicationException.class) public ResponseEntity<StringResponse> exceptionHandler(ApplicationException ae) { return ResponseEntity.status(ae.getCode()).body(new StringResponse(ae.getMessage())); } }
fbad02dfa4e2bd0ff877f3fd2eada17e82ae7989
58ea1a193ac9cbc853de1075e3cf1dcc9ee73e7b
/app/src/main/java/com/example/studentagency/mvp/presenter/PublishActivityBasePresenter.java
2a1400eed323981a37eef6713e285c88f1a17638
[]
no_license
A-10ng/StudentAgency
99a63e5533acd8eab07c79384f4ac74c2954ce15
49241200dfbd8fdc5a37393994dd48c47a615e6a
refs/heads/master
2022-11-22T08:06:38.526648
2020-03-23T05:19:37
2020-03-23T05:19:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,884
java
package com.example.studentagency.mvp.presenter; import com.example.studentagency.bean.ResponseBean; import com.example.studentagency.mvp.model.Callback.PublishActivityPublishIndentCallBack; import com.example.studentagency.mvp.model.PublishActivityBaseModel; import com.example.studentagency.mvp.view.PublishActivityBaseView; import java.lang.ref.WeakReference; /** * author:LongSh1z * email:[email protected] * time:2020/01/15 * desc: */ public class PublishActivityBasePresenter extends IPresenter { public PublishActivityBasePresenter(PublishActivityBaseView view) { this.mIModel = new PublishActivityBaseModel(); this.mViewRef = new WeakReference<>(view); } public void publishIndent(int publishId, int type, float price, String description, String address, String publishTime, String planTime){ if (null != mIModel && null != mViewRef && null != mViewRef.get()){ ((PublishActivityBaseModel)mIModel).publishIndent( publishId, type, price, description, address, publishTime, planTime, new PublishActivityPublishIndentCallBack() { @Override public void publishIndentSuccess(ResponseBean responseBean) { if (mViewRef.get() != null){ ((PublishActivityBaseView)mViewRef.get()).publishIndentSuccess(responseBean); } } @Override public void publishIndentFail() { if (mViewRef.get() != null){ ((PublishActivityBaseView)mViewRef.get()).publishIndentFail(); } } }); } } }
c08daab0b43a3bd549f57d5dfcadac74f2a3cdeb
204c6c5e3df2e0a4aaa93a53158d7dbad9d870f7
/src/com/company/JuegoAdivinaPar.java
053ec94da39905daa1eb4cfea47aff5937b57087
[]
no_license
Taty1-hub/JuegosJava
5d6a957ebe5af61ffbb673ec80e76394550ceac0
14ef588d5a4730159d84a81e5ef7d70e6357ef50
refs/heads/master
2022-11-24T01:39:52.791637
2020-07-29T18:21:47
2020-07-29T18:21:47
283,519,918
0
0
null
null
null
null
UTF-8
Java
false
false
375
java
package com.company; public class JuegoAdivinaPar extends JuegoAdivinaNumero { public JuegoAdivinaPar(int vidas, int numero) { super(vidas, numero); } @Override public boolean ValidaNumero(int num) { if (num%2==0){ return true; }else { System.out.println("Error"); return false; } } }
20fb9e2b2e3f59e7f4e4c6bc121bc901497c0b69
b0f21787377c1f70e8f26776cb36c2db1bd728ee
/koudaijiajiao/app/src/main/java/com/koudaijiajiao/koudaijiajiao/activity/ForgetpasswordActivity.java
5d4d998bd127c990dad038d2bdeda3609163e3e1
[]
no_license
Ytsssss/koudaijiajiao
8f8c4a4ede50107fc743dca958f6e7ba9b897655
942e4e836307fff6e2d986ae1994c494bc901b48
refs/heads/master
2021-01-12T15:26:18.663559
2016-10-29T11:25:00
2016-10-29T11:25:00
71,783,071
1
0
null
2016-10-24T11:42:56
2016-10-24T11:42:56
null
UTF-8
Java
false
false
138
java
package com.koudaijiajiao.koudaijiajiao.activity; /** * Created by killandy on 2016/10/27. */ public class ForgetpasswordActivity { }
f385606c5c40ef314950bfa9129a39eedf7d3957
32b72e1dc8b6ee1be2e80bb70a03a021c83db550
/ast_results/wolpi_prim-ftpd/slf4j-android-1.6.1-RC1/src/org/slf4j/impl/StaticMDCBinder.java
285dce081a077c3d09b4c784888de3e935a439a6
[]
no_license
cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning
d90c41a17e88fcd99d543124eeb6e93f9133cb4a
0564143d92f8024ff5fa6b659c2baebf827582b1
refs/heads/master
2020-07-13T13:53:40.297493
2019-01-11T11:51:18
2019-01-11T11:51:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
514
java
// isComment package org.slf4j.impl; import org.slf4j.helpers.NOPMDCAdapter; import org.slf4j.spi.MDCAdapter; /** * isComment */ public class isClassOrIsInterface { /** * isComment */ public static final StaticMDCBinder isVariable = new StaticMDCBinder(); private isConstructor() { } /** * isComment */ public MDCAdapter isMethod() { return new NOPMDCAdapter(); } public String isMethod() { return NOPMDCAdapter.class.isMethod(); } }
c0239fd18016f617183a7f3f4ebdfef39730c18c
3001fcfe996fb82ad6cfb1843a71e54434975373
/utils/IdeaProject/archive/unsorted/2013.04/2013.04.21 - Gran-Prix of Taganrog/A.java
28cda22d6643e2c3a86626c09a94f850d5de32f1
[]
no_license
niyaznigmatullin/nncontests
751d8cde9c18feae165dd7d1b0ea2cf1f075d39c
59748ce96f521e832c5a511ba849a523e35ad469
refs/heads/master
2022-07-14T08:33:27.055971
2022-06-28T17:58:23
2022-06-28T17:58:23
36,932,376
7
1
null
null
null
null
UTF-8
Java
false
false
640
java
package coding; import ru.ifmo.niyaz.arrayutils.ArrayUtils; import ru.ifmo.niyaz.io.FastScanner; import ru.ifmo.niyaz.io.FastPrinter; public class A { public void solve(int testNumber, FastScanner in, FastPrinter out) { int n = in.nextInt(); int[] a = in.readIntArray(n); int inv = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (a[i] > a[j]) ++inv; } } int all = n * (n - 1) / 2; if ((inv & 1) != (all & 1)) { out.println("First"); } else { out.println("Second"); } } }
6d8c04a5464774bfa391eb54d0fd10668b07574a
0d8e2372f4fcaf5326b9fe62f7d2d2a4bcc4b6a6
/src/main/java/bm/parser/target/instructions/PDecrement.java
c143ecc1133b3423246193633dd093a22bcae69e
[ "MIT" ]
permissive
bm-lang/bm-compiler
0ecddd4f3fa3c127855804f91f8b9e99b8975aab
0586da4555f968835c899286a38f4658acde23b7
refs/heads/master
2020-09-16T03:37:22.227903
2019-11-26T01:14:03
2019-11-26T01:14:03
223,638,803
0
0
null
null
null
null
UTF-8
Java
false
false
367
java
package bm.parser.target.instructions; import bm.parser.target.expressions.PReference; public class PDecrement extends PInstruction { private PReference reference; // getters & setters public PReference getReference() { return reference; } public void setReference(PReference reference) { this.reference = reference; } }
24cd5fda34249354a838093b5fd8773edd8762bc
5354325ba887cfa3de6b4481ad12fcd4fa62c518
/app/src/main/java/in/citbit/autobuy1/MainActivity.java
fc9b6339d9fc61f01249ed954856d6859f74554c
[]
no_license
ishubhamx/autobuy
6d8316f8489c45004ee546b647770213735895b5
861fcc07034af13657eeb8c9fcab612a8ac99101
refs/heads/master
2022-11-19T10:56:00.160724
2020-06-23T17:27:36
2020-06-23T17:27:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,222
java
package in.citbit.autobuy1; import android.content.Intent; import android.os.Bundle; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import android.util.Log; import android.view.MenuItem; import android.view.View; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.navigation.NavController; import androidx.navigation.Navigation; import androidx.navigation.ui.AppBarConfiguration; import androidx.navigation.ui.NavigationUI; import com.google.android.material.navigation.NavigationView; import androidx.drawerlayout.widget.DrawerLayout; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import android.view.Menu; import android.widget.Toast; public class MainActivity extends AppCompatActivity { private AppBarConfiguration mAppBarConfiguration; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); DrawerLayout drawer = findViewById(R.id.drawer_layout); NavigationView navigationView = findViewById(R.id.nav_view); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) { Log.d("taggggg", menuItem.toString()); int id = menuItem.getItemId(); switch (id) { case R.id.menu_9_pro_max: MainActivity.this.startActivity("amazon", "https://amzn.to/3fBkYkb"); Toast.makeText(MainActivity.this, "menu_9_pro_max", Toast.LENGTH_SHORT).show(); break; case R.id.menu_redmi_8A: MainActivity.this.startActivity("amazon", "https://amzn.to/2UM3Z6F"); Toast.makeText(MainActivity.this, "menu_redmi_8A", Toast.LENGTH_SHORT).show(); break; case R.id.nav_menu_note_9_pro: MainActivity.this.startActivity("amazon", "https://amzn.to/3hss5gq"); Toast.makeText(MainActivity.this, "nav_menu_note_9_pro", Toast.LENGTH_SHORT).show(); break; case R.id.vivo_u10: MainActivity.this.startActivity("amazon", "https://amzn.to/37Wn3V5"); Toast.makeText(MainActivity.this, "nav_menu_note_9_pro", Toast.LENGTH_SHORT).show(); break; case R.id.vivou20: MainActivity.this.startActivity("amazon", "https://amzn.to/2AUeyxT"); Toast.makeText(MainActivity.this, "nav_menu_note_9_pro", Toast.LENGTH_SHORT).show(); break; case R.id.vivoy91i: MainActivity.this.startActivity("amazon", "https://amzn.to/3fTPnua"); Toast.makeText(MainActivity.this, "nav_menu_note_9_pro", Toast.LENGTH_SHORT).show(); break; case R.id.y2: MainActivity.this.startActivity("amazon", "https://amzn.to/3hV4Mfq"); Toast.makeText(MainActivity.this, "nav_menu_note_9_pro", Toast.LENGTH_SHORT).show(); break; case R.id.y1: MainActivity.this.startActivity("amazon", "https://www.amazon.in/Redmi-Grey-3GB-32GB-Storage/dp/B0756ZJ1FN?tag=citbit010d-21"); Toast.makeText(MainActivity.this, "nav_menu_note_9_pro", Toast.LENGTH_SHORT).show(); break; default: return true; } return true; } }); // navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { // @Override // public boolean onNavigationItemSelected(@NonNull MenuItem item) { // Log.d("taggggg", item.toString()); // int id = item.getItemId(); // switch (id) { // case R.id.menu_9_pro_max: // Toast.makeText(MainActivity.this, "", Toast.LENGTH_SHORT).show(); // break; // case R.id.menu_redmi_8A: // Toast.makeText(MainActivity.this, "Settings", Toast.LENGTH_SHORT).show(); // break; // case R.id.nav_menu_note_9_pro: // Toast.makeText(MainActivity.this, "My Cart", Toast.LENGTH_SHORT).show(); // break; // default: // return true; // } // // // return true; // // } // }); // // Passing each menu ID as a set of Ids because each // // menu should be considered as top level destinations... // mAppBarConfiguration = new AppBarConfiguration.Builder( // R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow, // R.id.nav_tools, R.id.nav_share) // .setDrawerLayout(drawer) // .build(); // // NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); // NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration); // NavigationUI.setupWithNavController(navigationView, navController); } public void startActivity(String sitename, String variantLink) { Intent intent = new Intent(this, WebViewActivity.class); intent.putExtra(getString(R.string.site_name), sitename); intent.putExtra(getString(R.string.variant_link), variantLink); startActivity(intent); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onSupportNavigateUp() { NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); return NavigationUI.navigateUp(navController, mAppBarConfiguration) || super.onSupportNavigateUp(); } }
cf61836fb60c3a1fc76701bfa71e18bd4a92636a
9804305e336db200d076c9bf6d1685cdad748bee
/src/sample/ConfirmBox.java
d9c5ec8d1305e19cd3b38b19d295e050e1058e22
[]
no_license
arunkumar198857/JavaFX_Practice
6e7c6723e859127a6bdd06ba77d2d23f7a4777eb
4b0c70322082f4e8f83851893ccb0aec18968bb9
refs/heads/master
2022-07-10T03:55:32.298596
2020-05-16T21:31:00
2020-05-16T21:31:00
264,528,966
0
0
null
null
null
null
UTF-8
Java
false
false
1,325
java
package sample; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.VBox; import javafx.stage.Modality; import javafx.stage.Stage; public class ConfirmBox{ static boolean answer; public static boolean display(String title, String message){ Stage window = new Stage(); window.initModality(Modality.APPLICATION_MODAL); window.setTitle(title); window.setMinWidth(250); window.setMinHeight(250); Label label1 = new Label(); label1.setText(message); Button yesButton = new Button("YES"); Button noButton = new Button(("NO")); yesButton.setOnAction(e->{ answer = true; window.close(); }); noButton.setOnAction(e->{ answer = false; window.close(); }); VBox layout = new VBox(20); layout.setPadding(new Insets(20,20,20,20)); layout.getChildren().addAll(label1,yesButton,noButton); layout.setAlignment(Pos.CENTER); Scene scene = new Scene(layout); window.setScene(scene); window.showAndWait(); return answer; } }
5dd60b1457bf3f5018fcbf641657b48a0941f847
26f3d24e070cee4839edfb1c6e86b809430b1cce
/reload/java/grpc/grpclb/src/generated/main/java/io/grpc/grpclb/ClientStats.java
c5b6f8d3f53a1b08165605921c26303f162dd122
[ "Apache-2.0", "MIT" ]
permissive
AleckDarcy/reload
df6e7a6b033ad9e487b93a5d6237bd4dc2628596
be7916cddd9636d3ffc969da5cc9d574a7cdc51e
refs/heads/master
2022-05-22T21:45:34.263378
2021-01-12T02:52:45
2021-01-12T02:52:45
242,857,693
4
0
MIT
2020-10-13T20:50:13
2020-02-24T22:28:36
Java
UTF-8
Java
false
true
45,249
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: load_balancer.proto package io.grpc.grpclb; /** * <pre> * Contains client level statistics that are useful to load balancing. Each * count except the timestamp should be reset to zero after reporting the stats. * </pre> * * Protobuf type {@code grpc.lb.v1.ClientStats} */ public final class ClientStats extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:grpc.lb.v1.ClientStats) ClientStatsOrBuilder { private static final long serialVersionUID = 0L; // Use ClientStats.newBuilder() to construct. private ClientStats(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private ClientStats() { numCallsStarted_ = 0L; numCallsFinished_ = 0L; numCallsFinishedWithClientFailedToSend_ = 0L; numCallsFinishedKnownReceived_ = 0L; callsFinishedWithDrop_ = java.util.Collections.emptyList(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ClientStats( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownFieldProto3( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { com.google.protobuf.Timestamp.Builder subBuilder = null; if (timestamp_ != null) { subBuilder = timestamp_.toBuilder(); } timestamp_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(timestamp_); timestamp_ = subBuilder.buildPartial(); } break; } case 16: { numCallsStarted_ = input.readInt64(); break; } case 24: { numCallsFinished_ = input.readInt64(); break; } case 48: { numCallsFinishedWithClientFailedToSend_ = input.readInt64(); break; } case 56: { numCallsFinishedKnownReceived_ = input.readInt64(); break; } case 66: { if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { callsFinishedWithDrop_ = new java.util.ArrayList<io.grpc.grpclb.ClientStatsPerToken>(); mutable_bitField0_ |= 0x00000020; } callsFinishedWithDrop_.add( input.readMessage(io.grpc.grpclb.ClientStatsPerToken.parser(), extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { callsFinishedWithDrop_ = java.util.Collections.unmodifiableList(callsFinishedWithDrop_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return io.grpc.grpclb.LoadBalancerProto.internal_static_grpc_lb_v1_ClientStats_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return io.grpc.grpclb.LoadBalancerProto.internal_static_grpc_lb_v1_ClientStats_fieldAccessorTable .ensureFieldAccessorsInitialized( io.grpc.grpclb.ClientStats.class, io.grpc.grpclb.ClientStats.Builder.class); } private int bitField0_; public static final int TIMESTAMP_FIELD_NUMBER = 1; private com.google.protobuf.Timestamp timestamp_; /** * <pre> * The timestamp of generating the report. * </pre> * * <code>.google.protobuf.Timestamp timestamp = 1;</code> */ public boolean hasTimestamp() { return timestamp_ != null; } /** * <pre> * The timestamp of generating the report. * </pre> * * <code>.google.protobuf.Timestamp timestamp = 1;</code> */ public com.google.protobuf.Timestamp getTimestamp() { return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; } /** * <pre> * The timestamp of generating the report. * </pre> * * <code>.google.protobuf.Timestamp timestamp = 1;</code> */ public com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder() { return getTimestamp(); } public static final int NUM_CALLS_STARTED_FIELD_NUMBER = 2; private long numCallsStarted_; /** * <pre> * The total number of RPCs that started. * </pre> * * <code>int64 num_calls_started = 2;</code> */ public long getNumCallsStarted() { return numCallsStarted_; } public static final int NUM_CALLS_FINISHED_FIELD_NUMBER = 3; private long numCallsFinished_; /** * <pre> * The total number of RPCs that finished. * </pre> * * <code>int64 num_calls_finished = 3;</code> */ public long getNumCallsFinished() { return numCallsFinished_; } public static final int NUM_CALLS_FINISHED_WITH_CLIENT_FAILED_TO_SEND_FIELD_NUMBER = 6; private long numCallsFinishedWithClientFailedToSend_; /** * <pre> * The total number of RPCs that failed to reach a server except dropped RPCs. * </pre> * * <code>int64 num_calls_finished_with_client_failed_to_send = 6;</code> */ public long getNumCallsFinishedWithClientFailedToSend() { return numCallsFinishedWithClientFailedToSend_; } public static final int NUM_CALLS_FINISHED_KNOWN_RECEIVED_FIELD_NUMBER = 7; private long numCallsFinishedKnownReceived_; /** * <pre> * The total number of RPCs that finished and are known to have been received * by a server. * </pre> * * <code>int64 num_calls_finished_known_received = 7;</code> */ public long getNumCallsFinishedKnownReceived() { return numCallsFinishedKnownReceived_; } public static final int CALLS_FINISHED_WITH_DROP_FIELD_NUMBER = 8; private java.util.List<io.grpc.grpclb.ClientStatsPerToken> callsFinishedWithDrop_; /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public java.util.List<io.grpc.grpclb.ClientStatsPerToken> getCallsFinishedWithDropList() { return callsFinishedWithDrop_; } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public java.util.List<? extends io.grpc.grpclb.ClientStatsPerTokenOrBuilder> getCallsFinishedWithDropOrBuilderList() { return callsFinishedWithDrop_; } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public int getCallsFinishedWithDropCount() { return callsFinishedWithDrop_.size(); } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public io.grpc.grpclb.ClientStatsPerToken getCallsFinishedWithDrop(int index) { return callsFinishedWithDrop_.get(index); } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public io.grpc.grpclb.ClientStatsPerTokenOrBuilder getCallsFinishedWithDropOrBuilder( int index) { return callsFinishedWithDrop_.get(index); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (timestamp_ != null) { output.writeMessage(1, getTimestamp()); } if (numCallsStarted_ != 0L) { output.writeInt64(2, numCallsStarted_); } if (numCallsFinished_ != 0L) { output.writeInt64(3, numCallsFinished_); } if (numCallsFinishedWithClientFailedToSend_ != 0L) { output.writeInt64(6, numCallsFinishedWithClientFailedToSend_); } if (numCallsFinishedKnownReceived_ != 0L) { output.writeInt64(7, numCallsFinishedKnownReceived_); } for (int i = 0; i < callsFinishedWithDrop_.size(); i++) { output.writeMessage(8, callsFinishedWithDrop_.get(i)); } unknownFields.writeTo(output); } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (timestamp_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, getTimestamp()); } if (numCallsStarted_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(2, numCallsStarted_); } if (numCallsFinished_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(3, numCallsFinished_); } if (numCallsFinishedWithClientFailedToSend_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(6, numCallsFinishedWithClientFailedToSend_); } if (numCallsFinishedKnownReceived_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(7, numCallsFinishedKnownReceived_); } for (int i = 0; i < callsFinishedWithDrop_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(8, callsFinishedWithDrop_.get(i)); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof io.grpc.grpclb.ClientStats)) { return super.equals(obj); } io.grpc.grpclb.ClientStats other = (io.grpc.grpclb.ClientStats) obj; boolean result = true; result = result && (hasTimestamp() == other.hasTimestamp()); if (hasTimestamp()) { result = result && getTimestamp() .equals(other.getTimestamp()); } result = result && (getNumCallsStarted() == other.getNumCallsStarted()); result = result && (getNumCallsFinished() == other.getNumCallsFinished()); result = result && (getNumCallsFinishedWithClientFailedToSend() == other.getNumCallsFinishedWithClientFailedToSend()); result = result && (getNumCallsFinishedKnownReceived() == other.getNumCallsFinishedKnownReceived()); result = result && getCallsFinishedWithDropList() .equals(other.getCallsFinishedWithDropList()); result = result && unknownFields.equals(other.unknownFields); return result; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasTimestamp()) { hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; hash = (53 * hash) + getTimestamp().hashCode(); } hash = (37 * hash) + NUM_CALLS_STARTED_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getNumCallsStarted()); hash = (37 * hash) + NUM_CALLS_FINISHED_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getNumCallsFinished()); hash = (37 * hash) + NUM_CALLS_FINISHED_WITH_CLIENT_FAILED_TO_SEND_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getNumCallsFinishedWithClientFailedToSend()); hash = (37 * hash) + NUM_CALLS_FINISHED_KNOWN_RECEIVED_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getNumCallsFinishedKnownReceived()); if (getCallsFinishedWithDropCount() > 0) { hash = (37 * hash) + CALLS_FINISHED_WITH_DROP_FIELD_NUMBER; hash = (53 * hash) + getCallsFinishedWithDropList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static io.grpc.grpclb.ClientStats parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static io.grpc.grpclb.ClientStats parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static io.grpc.grpclb.ClientStats parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static io.grpc.grpclb.ClientStats parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static io.grpc.grpclb.ClientStats parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static io.grpc.grpclb.ClientStats parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static io.grpc.grpclb.ClientStats parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static io.grpc.grpclb.ClientStats parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static io.grpc.grpclb.ClientStats parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static io.grpc.grpclb.ClientStats parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static io.grpc.grpclb.ClientStats parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static io.grpc.grpclb.ClientStats parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(io.grpc.grpclb.ClientStats prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * <pre> * Contains client level statistics that are useful to load balancing. Each * count except the timestamp should be reset to zero after reporting the stats. * </pre> * * Protobuf type {@code grpc.lb.v1.ClientStats} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:grpc.lb.v1.ClientStats) io.grpc.grpclb.ClientStatsOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return io.grpc.grpclb.LoadBalancerProto.internal_static_grpc_lb_v1_ClientStats_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return io.grpc.grpclb.LoadBalancerProto.internal_static_grpc_lb_v1_ClientStats_fieldAccessorTable .ensureFieldAccessorsInitialized( io.grpc.grpclb.ClientStats.class, io.grpc.grpclb.ClientStats.Builder.class); } // Construct using io.grpc.grpclb.ClientStats.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { getCallsFinishedWithDropFieldBuilder(); } } public Builder clear() { super.clear(); if (timestampBuilder_ == null) { timestamp_ = null; } else { timestamp_ = null; timestampBuilder_ = null; } numCallsStarted_ = 0L; numCallsFinished_ = 0L; numCallsFinishedWithClientFailedToSend_ = 0L; numCallsFinishedKnownReceived_ = 0L; if (callsFinishedWithDropBuilder_ == null) { callsFinishedWithDrop_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000020); } else { callsFinishedWithDropBuilder_.clear(); } return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return io.grpc.grpclb.LoadBalancerProto.internal_static_grpc_lb_v1_ClientStats_descriptor; } public io.grpc.grpclb.ClientStats getDefaultInstanceForType() { return io.grpc.grpclb.ClientStats.getDefaultInstance(); } public io.grpc.grpclb.ClientStats build() { io.grpc.grpclb.ClientStats result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public io.grpc.grpclb.ClientStats buildPartial() { io.grpc.grpclb.ClientStats result = new io.grpc.grpclb.ClientStats(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (timestampBuilder_ == null) { result.timestamp_ = timestamp_; } else { result.timestamp_ = timestampBuilder_.build(); } result.numCallsStarted_ = numCallsStarted_; result.numCallsFinished_ = numCallsFinished_; result.numCallsFinishedWithClientFailedToSend_ = numCallsFinishedWithClientFailedToSend_; result.numCallsFinishedKnownReceived_ = numCallsFinishedKnownReceived_; if (callsFinishedWithDropBuilder_ == null) { if (((bitField0_ & 0x00000020) == 0x00000020)) { callsFinishedWithDrop_ = java.util.Collections.unmodifiableList(callsFinishedWithDrop_); bitField0_ = (bitField0_ & ~0x00000020); } result.callsFinishedWithDrop_ = callsFinishedWithDrop_; } else { result.callsFinishedWithDrop_ = callsFinishedWithDropBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder clone() { return (Builder) super.clone(); } public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.setField(field, value); } public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return (Builder) super.clearField(field); } public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return (Builder) super.clearOneof(oneof); } public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return (Builder) super.setRepeatedField(field, index, value); } public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.addRepeatedField(field, value); } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof io.grpc.grpclb.ClientStats) { return mergeFrom((io.grpc.grpclb.ClientStats)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(io.grpc.grpclb.ClientStats other) { if (other == io.grpc.grpclb.ClientStats.getDefaultInstance()) return this; if (other.hasTimestamp()) { mergeTimestamp(other.getTimestamp()); } if (other.getNumCallsStarted() != 0L) { setNumCallsStarted(other.getNumCallsStarted()); } if (other.getNumCallsFinished() != 0L) { setNumCallsFinished(other.getNumCallsFinished()); } if (other.getNumCallsFinishedWithClientFailedToSend() != 0L) { setNumCallsFinishedWithClientFailedToSend(other.getNumCallsFinishedWithClientFailedToSend()); } if (other.getNumCallsFinishedKnownReceived() != 0L) { setNumCallsFinishedKnownReceived(other.getNumCallsFinishedKnownReceived()); } if (callsFinishedWithDropBuilder_ == null) { if (!other.callsFinishedWithDrop_.isEmpty()) { if (callsFinishedWithDrop_.isEmpty()) { callsFinishedWithDrop_ = other.callsFinishedWithDrop_; bitField0_ = (bitField0_ & ~0x00000020); } else { ensureCallsFinishedWithDropIsMutable(); callsFinishedWithDrop_.addAll(other.callsFinishedWithDrop_); } onChanged(); } } else { if (!other.callsFinishedWithDrop_.isEmpty()) { if (callsFinishedWithDropBuilder_.isEmpty()) { callsFinishedWithDropBuilder_.dispose(); callsFinishedWithDropBuilder_ = null; callsFinishedWithDrop_ = other.callsFinishedWithDrop_; bitField0_ = (bitField0_ & ~0x00000020); callsFinishedWithDropBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getCallsFinishedWithDropFieldBuilder() : null; } else { callsFinishedWithDropBuilder_.addAllMessages(other.callsFinishedWithDrop_); } } } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { io.grpc.grpclb.ClientStats parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (io.grpc.grpclb.ClientStats) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private com.google.protobuf.Timestamp timestamp_ = null; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> timestampBuilder_; /** * <pre> * The timestamp of generating the report. * </pre> * * <code>.google.protobuf.Timestamp timestamp = 1;</code> */ public boolean hasTimestamp() { return timestampBuilder_ != null || timestamp_ != null; } /** * <pre> * The timestamp of generating the report. * </pre> * * <code>.google.protobuf.Timestamp timestamp = 1;</code> */ public com.google.protobuf.Timestamp getTimestamp() { if (timestampBuilder_ == null) { return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; } else { return timestampBuilder_.getMessage(); } } /** * <pre> * The timestamp of generating the report. * </pre> * * <code>.google.protobuf.Timestamp timestamp = 1;</code> */ public Builder setTimestamp(com.google.protobuf.Timestamp value) { if (timestampBuilder_ == null) { if (value == null) { throw new NullPointerException(); } timestamp_ = value; onChanged(); } else { timestampBuilder_.setMessage(value); } return this; } /** * <pre> * The timestamp of generating the report. * </pre> * * <code>.google.protobuf.Timestamp timestamp = 1;</code> */ public Builder setTimestamp( com.google.protobuf.Timestamp.Builder builderForValue) { if (timestampBuilder_ == null) { timestamp_ = builderForValue.build(); onChanged(); } else { timestampBuilder_.setMessage(builderForValue.build()); } return this; } /** * <pre> * The timestamp of generating the report. * </pre> * * <code>.google.protobuf.Timestamp timestamp = 1;</code> */ public Builder mergeTimestamp(com.google.protobuf.Timestamp value) { if (timestampBuilder_ == null) { if (timestamp_ != null) { timestamp_ = com.google.protobuf.Timestamp.newBuilder(timestamp_).mergeFrom(value).buildPartial(); } else { timestamp_ = value; } onChanged(); } else { timestampBuilder_.mergeFrom(value); } return this; } /** * <pre> * The timestamp of generating the report. * </pre> * * <code>.google.protobuf.Timestamp timestamp = 1;</code> */ public Builder clearTimestamp() { if (timestampBuilder_ == null) { timestamp_ = null; onChanged(); } else { timestamp_ = null; timestampBuilder_ = null; } return this; } /** * <pre> * The timestamp of generating the report. * </pre> * * <code>.google.protobuf.Timestamp timestamp = 1;</code> */ public com.google.protobuf.Timestamp.Builder getTimestampBuilder() { onChanged(); return getTimestampFieldBuilder().getBuilder(); } /** * <pre> * The timestamp of generating the report. * </pre> * * <code>.google.protobuf.Timestamp timestamp = 1;</code> */ public com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder() { if (timestampBuilder_ != null) { return timestampBuilder_.getMessageOrBuilder(); } else { return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; } } /** * <pre> * The timestamp of generating the report. * </pre> * * <code>.google.protobuf.Timestamp timestamp = 1;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> getTimestampFieldBuilder() { if (timestampBuilder_ == null) { timestampBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( getTimestamp(), getParentForChildren(), isClean()); timestamp_ = null; } return timestampBuilder_; } private long numCallsStarted_ ; /** * <pre> * The total number of RPCs that started. * </pre> * * <code>int64 num_calls_started = 2;</code> */ public long getNumCallsStarted() { return numCallsStarted_; } /** * <pre> * The total number of RPCs that started. * </pre> * * <code>int64 num_calls_started = 2;</code> */ public Builder setNumCallsStarted(long value) { numCallsStarted_ = value; onChanged(); return this; } /** * <pre> * The total number of RPCs that started. * </pre> * * <code>int64 num_calls_started = 2;</code> */ public Builder clearNumCallsStarted() { numCallsStarted_ = 0L; onChanged(); return this; } private long numCallsFinished_ ; /** * <pre> * The total number of RPCs that finished. * </pre> * * <code>int64 num_calls_finished = 3;</code> */ public long getNumCallsFinished() { return numCallsFinished_; } /** * <pre> * The total number of RPCs that finished. * </pre> * * <code>int64 num_calls_finished = 3;</code> */ public Builder setNumCallsFinished(long value) { numCallsFinished_ = value; onChanged(); return this; } /** * <pre> * The total number of RPCs that finished. * </pre> * * <code>int64 num_calls_finished = 3;</code> */ public Builder clearNumCallsFinished() { numCallsFinished_ = 0L; onChanged(); return this; } private long numCallsFinishedWithClientFailedToSend_ ; /** * <pre> * The total number of RPCs that failed to reach a server except dropped RPCs. * </pre> * * <code>int64 num_calls_finished_with_client_failed_to_send = 6;</code> */ public long getNumCallsFinishedWithClientFailedToSend() { return numCallsFinishedWithClientFailedToSend_; } /** * <pre> * The total number of RPCs that failed to reach a server except dropped RPCs. * </pre> * * <code>int64 num_calls_finished_with_client_failed_to_send = 6;</code> */ public Builder setNumCallsFinishedWithClientFailedToSend(long value) { numCallsFinishedWithClientFailedToSend_ = value; onChanged(); return this; } /** * <pre> * The total number of RPCs that failed to reach a server except dropped RPCs. * </pre> * * <code>int64 num_calls_finished_with_client_failed_to_send = 6;</code> */ public Builder clearNumCallsFinishedWithClientFailedToSend() { numCallsFinishedWithClientFailedToSend_ = 0L; onChanged(); return this; } private long numCallsFinishedKnownReceived_ ; /** * <pre> * The total number of RPCs that finished and are known to have been received * by a server. * </pre> * * <code>int64 num_calls_finished_known_received = 7;</code> */ public long getNumCallsFinishedKnownReceived() { return numCallsFinishedKnownReceived_; } /** * <pre> * The total number of RPCs that finished and are known to have been received * by a server. * </pre> * * <code>int64 num_calls_finished_known_received = 7;</code> */ public Builder setNumCallsFinishedKnownReceived(long value) { numCallsFinishedKnownReceived_ = value; onChanged(); return this; } /** * <pre> * The total number of RPCs that finished and are known to have been received * by a server. * </pre> * * <code>int64 num_calls_finished_known_received = 7;</code> */ public Builder clearNumCallsFinishedKnownReceived() { numCallsFinishedKnownReceived_ = 0L; onChanged(); return this; } private java.util.List<io.grpc.grpclb.ClientStatsPerToken> callsFinishedWithDrop_ = java.util.Collections.emptyList(); private void ensureCallsFinishedWithDropIsMutable() { if (!((bitField0_ & 0x00000020) == 0x00000020)) { callsFinishedWithDrop_ = new java.util.ArrayList<io.grpc.grpclb.ClientStatsPerToken>(callsFinishedWithDrop_); bitField0_ |= 0x00000020; } } private com.google.protobuf.RepeatedFieldBuilderV3< io.grpc.grpclb.ClientStatsPerToken, io.grpc.grpclb.ClientStatsPerToken.Builder, io.grpc.grpclb.ClientStatsPerTokenOrBuilder> callsFinishedWithDropBuilder_; /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public java.util.List<io.grpc.grpclb.ClientStatsPerToken> getCallsFinishedWithDropList() { if (callsFinishedWithDropBuilder_ == null) { return java.util.Collections.unmodifiableList(callsFinishedWithDrop_); } else { return callsFinishedWithDropBuilder_.getMessageList(); } } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public int getCallsFinishedWithDropCount() { if (callsFinishedWithDropBuilder_ == null) { return callsFinishedWithDrop_.size(); } else { return callsFinishedWithDropBuilder_.getCount(); } } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public io.grpc.grpclb.ClientStatsPerToken getCallsFinishedWithDrop(int index) { if (callsFinishedWithDropBuilder_ == null) { return callsFinishedWithDrop_.get(index); } else { return callsFinishedWithDropBuilder_.getMessage(index); } } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public Builder setCallsFinishedWithDrop( int index, io.grpc.grpclb.ClientStatsPerToken value) { if (callsFinishedWithDropBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureCallsFinishedWithDropIsMutable(); callsFinishedWithDrop_.set(index, value); onChanged(); } else { callsFinishedWithDropBuilder_.setMessage(index, value); } return this; } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public Builder setCallsFinishedWithDrop( int index, io.grpc.grpclb.ClientStatsPerToken.Builder builderForValue) { if (callsFinishedWithDropBuilder_ == null) { ensureCallsFinishedWithDropIsMutable(); callsFinishedWithDrop_.set(index, builderForValue.build()); onChanged(); } else { callsFinishedWithDropBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public Builder addCallsFinishedWithDrop(io.grpc.grpclb.ClientStatsPerToken value) { if (callsFinishedWithDropBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureCallsFinishedWithDropIsMutable(); callsFinishedWithDrop_.add(value); onChanged(); } else { callsFinishedWithDropBuilder_.addMessage(value); } return this; } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public Builder addCallsFinishedWithDrop( int index, io.grpc.grpclb.ClientStatsPerToken value) { if (callsFinishedWithDropBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureCallsFinishedWithDropIsMutable(); callsFinishedWithDrop_.add(index, value); onChanged(); } else { callsFinishedWithDropBuilder_.addMessage(index, value); } return this; } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public Builder addCallsFinishedWithDrop( io.grpc.grpclb.ClientStatsPerToken.Builder builderForValue) { if (callsFinishedWithDropBuilder_ == null) { ensureCallsFinishedWithDropIsMutable(); callsFinishedWithDrop_.add(builderForValue.build()); onChanged(); } else { callsFinishedWithDropBuilder_.addMessage(builderForValue.build()); } return this; } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public Builder addCallsFinishedWithDrop( int index, io.grpc.grpclb.ClientStatsPerToken.Builder builderForValue) { if (callsFinishedWithDropBuilder_ == null) { ensureCallsFinishedWithDropIsMutable(); callsFinishedWithDrop_.add(index, builderForValue.build()); onChanged(); } else { callsFinishedWithDropBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public Builder addAllCallsFinishedWithDrop( java.lang.Iterable<? extends io.grpc.grpclb.ClientStatsPerToken> values) { if (callsFinishedWithDropBuilder_ == null) { ensureCallsFinishedWithDropIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, callsFinishedWithDrop_); onChanged(); } else { callsFinishedWithDropBuilder_.addAllMessages(values); } return this; } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public Builder clearCallsFinishedWithDrop() { if (callsFinishedWithDropBuilder_ == null) { callsFinishedWithDrop_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000020); onChanged(); } else { callsFinishedWithDropBuilder_.clear(); } return this; } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public Builder removeCallsFinishedWithDrop(int index) { if (callsFinishedWithDropBuilder_ == null) { ensureCallsFinishedWithDropIsMutable(); callsFinishedWithDrop_.remove(index); onChanged(); } else { callsFinishedWithDropBuilder_.remove(index); } return this; } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public io.grpc.grpclb.ClientStatsPerToken.Builder getCallsFinishedWithDropBuilder( int index) { return getCallsFinishedWithDropFieldBuilder().getBuilder(index); } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public io.grpc.grpclb.ClientStatsPerTokenOrBuilder getCallsFinishedWithDropOrBuilder( int index) { if (callsFinishedWithDropBuilder_ == null) { return callsFinishedWithDrop_.get(index); } else { return callsFinishedWithDropBuilder_.getMessageOrBuilder(index); } } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public java.util.List<? extends io.grpc.grpclb.ClientStatsPerTokenOrBuilder> getCallsFinishedWithDropOrBuilderList() { if (callsFinishedWithDropBuilder_ != null) { return callsFinishedWithDropBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(callsFinishedWithDrop_); } } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public io.grpc.grpclb.ClientStatsPerToken.Builder addCallsFinishedWithDropBuilder() { return getCallsFinishedWithDropFieldBuilder().addBuilder( io.grpc.grpclb.ClientStatsPerToken.getDefaultInstance()); } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public io.grpc.grpclb.ClientStatsPerToken.Builder addCallsFinishedWithDropBuilder( int index) { return getCallsFinishedWithDropFieldBuilder().addBuilder( index, io.grpc.grpclb.ClientStatsPerToken.getDefaultInstance()); } /** * <pre> * The list of dropped calls. * </pre> * * <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code> */ public java.util.List<io.grpc.grpclb.ClientStatsPerToken.Builder> getCallsFinishedWithDropBuilderList() { return getCallsFinishedWithDropFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< io.grpc.grpclb.ClientStatsPerToken, io.grpc.grpclb.ClientStatsPerToken.Builder, io.grpc.grpclb.ClientStatsPerTokenOrBuilder> getCallsFinishedWithDropFieldBuilder() { if (callsFinishedWithDropBuilder_ == null) { callsFinishedWithDropBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< io.grpc.grpclb.ClientStatsPerToken, io.grpc.grpclb.ClientStatsPerToken.Builder, io.grpc.grpclb.ClientStatsPerTokenOrBuilder>( callsFinishedWithDrop_, ((bitField0_ & 0x00000020) == 0x00000020), getParentForChildren(), isClean()); callsFinishedWithDrop_ = null; } return callsFinishedWithDropBuilder_; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFieldsProto3(unknownFields); } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:grpc.lb.v1.ClientStats) } // @@protoc_insertion_point(class_scope:grpc.lb.v1.ClientStats) private static final io.grpc.grpclb.ClientStats DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new io.grpc.grpclb.ClientStats(); } public static io.grpc.grpclb.ClientStats getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<ClientStats> PARSER = new com.google.protobuf.AbstractParser<ClientStats>() { public ClientStats parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ClientStats(input, extensionRegistry); } }; public static com.google.protobuf.Parser<ClientStats> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<ClientStats> getParserForType() { return PARSER; } public io.grpc.grpclb.ClientStats getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
c05ba256bb929df39b54bc81cdba0988094d4814
cab886ebd90d507aba04544fd5c40f5037220e0a
/app/src/main/java/com/ehi/aca/Global.java
718153d2220684f222bbff4ca54bb0f8ac3ddc09
[]
no_license
hardi1989/automotive-catalog
bd32e42bb741e68d0f2a8a029ee93c28632a0bdb
4e8256d66a2700ff78ee1703751eec30dc38f7aa
refs/heads/master
2020-09-27T06:32:06.596040
2019-12-10T04:35:53
2019-12-10T04:35:53
226,453,187
0
0
null
null
null
null
UTF-8
Java
false
false
669
java
package com.ehi.aca; import android.content.Context; import android.util.Log; import android.widget.Toast; /* * File Description * Author: Hardi */ public class Global { public static boolean showToast = true; public static boolean showLog = true; public static boolean isConnected=false; public static String baseUrl = "https://vpic.nhtsa.dot.gov/api/vehicles/"; public static void eLog(String tagName, String logInfo) { if (showLog) Log.i(tagName, logInfo); } public static void eToast(Context ctx, String msg) { if (showToast) Toast.makeText(ctx, msg, Toast.LENGTH_LONG).show(); } }
c58917651e98acf7afdb0788b18856df3e252d01
dcaff2751db87bc47992f1df31b9e444ea9673ee
/4.JavaCollections/src/com/javarush/task/task33/task3305/Motorbike.java
eaf928825776c1c131f021c210674431860e2cfd
[]
no_license
ygreksh/JavaRushTasks
629ec9f0216b139d9134e2f0a160690b1af21dd4
3b8c0fd46d0b6740321d748580715a31b02fce22
refs/heads/master
2021-01-22T12:49:09.857400
2017-11-22T10:59:24
2017-11-22T10:59:24
102,356,387
0
0
null
null
null
null
UTF-8
Java
false
false
634
java
package com.javarush.task.task33.task3305; import com.fasterxml.jackson.annotation.JsonAutoDetect; @JsonAutoDetect public class Motorbike extends Auto { private String owner; public Motorbike(String name) { this.name = name; } public String getName() { return name; } public String getOwner() { return owner; } public void setOwner(String owner) { this.owner = owner; } @Override public String toString() { return "Motorbike{" + "name='" + name + '\'' + ", owner='" + owner + '\'' + '}'; } }
d93ac2c77b972f0970b8b3bbba88f5ba5b4f5709
f61bf26fa8b4b12753ef76bda6dc5511ea189125
/core/pax-exam-servlet-bridge/src/main/java/org/ops4j/pax/exam/servlet/ContainerTestListener.java
66cdade6cdde45e7ff5be3ce80e993d4e917190f
[ "Apache-2.0" ]
permissive
ops4j/org.ops4j.pax.exam2
d8d38eecda3edf0cacf3f7ebd1746ffb17036f07
9717368a14429c6df0e22c994cb8f23dc99585ce
refs/heads/master
2023-07-04T14:01:30.331866
2021-11-21T20:43:43
2021-11-21T20:43:43
1,081,991
66
97
Apache-2.0
2023-08-21T19:44:17
2010-11-15T13:59:35
Java
UTF-8
Java
false
false
2,571
java
/* * Copyright 2016 Harald Wellmann. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License 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 org.ops4j.pax.exam.servlet; import java.io.IOException; import java.io.ObjectOutputStream; import org.junit.runner.Description; import org.junit.runner.notification.Failure; import org.junit.runner.notification.RunListener; import org.ops4j.pax.exam.TestDescription; import org.ops4j.pax.exam.TestEvent; import org.ops4j.pax.exam.TestEventType; import org.ops4j.pax.exam.WrappedTestContainerException; import org.ops4j.pax.exam.util.Exceptions; /** * @author hwellmann * */ public class ContainerTestListener extends RunListener { private ObjectOutputStream oos; public ContainerTestListener(ObjectOutputStream oos) { this.oos = oos; } private void writeEvent(TestEvent event) { try { oos.writeObject(event); } catch (IOException exc) { throw Exceptions.unchecked(exc); } } @Override public void testFailure(Failure failure) throws Exception { TestDescription description = convertDescription(failure.getDescription()); Throwable exc = WrappedTestContainerException.wrapIfNeeded(failure.getException()); writeEvent(new TestEvent(TestEventType.TEST_FAILED, description, exc)); } @Override public void testFinished(Description description) throws Exception { writeEvent(new TestEvent(TestEventType.TEST_FINISHED, convertDescription(description))); } @Override public void testStarted(Description description) throws Exception { writeEvent(new TestEvent(TestEventType.TEST_STARTED, convertDescription(description))); } @Override public void testIgnored(Description description) throws Exception { writeEvent(new TestEvent(TestEventType.TEST_IGNORED, convertDescription(description))); } public static TestDescription convertDescription(Description description) { return new TestDescription(description.getClassName(), description.getMethodName()); } }
1391d6162b6896d01fb98c3af4b1910ca5caaf5e
b4bd19457dae6ecb124e446455f11f0a67677c88
/src/main/java/org/logesco/dao/UtilisateursRepository.java
9df30f877b195756a72763de3b9ecd17617368a3
[]
no_license
ckiad/logesco1.0
a0a79201c01a42801b000de26f0908596c60bbb8
86c5e73284099d1ff92cea4d162891ad1d8d927d
refs/heads/master
2022-07-14T03:57:45.032254
2019-07-03T03:18:08
2019-07-03T03:18:08
163,557,512
0
0
null
2022-06-29T17:08:19
2018-12-30T03:06:11
Roff
UTF-8
Java
false
false
948
java
/** * */ package org.logesco.dao; import java.util.List; import org.logesco.entities.Utilisateurs; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; /** * @author cedrickiadjeu * */ public interface UtilisateursRepository extends JpaRepository<Utilisateurs, Long> { @Query("select u from Utilisateurs u where u.username=:x") public Utilisateurs getUtilisateursByUsername(@Param("x")String username); public Utilisateurs findByUsername(String username); @Query("select u from Utilisateurs u order by u.username") public List<Utilisateurs> findAllUtilisateurs(); @Query("SELECT u FROM Utilisateurs u ORDER BY u.username ASC") public Page<Utilisateurs> findAll(Pageable pageable); }
2bc9afe91bda6d23befa4bc2bab1ad0236ebaa78
88936152379cab188e5dc287a8dd03d58ba7d1bf
/tests/paper_ex3/JPEGWriter.java
3b615f24892f04eaa1d8220193e31fde3e126c50
[]
no_license
anthonycanino1/ent
00bce54124bdab423310c76dff50e10ecc916783
dc089a528429c2ac5d83e7027b89e8c8f8b22d71
refs/heads/master
2020-04-09T07:36:08.158871
2017-04-14T10:53:33
2017-04-14T10:53:33
32,361,392
2
3
null
null
null
null
UTF-8
Java
false
false
89
java
package paper_ex3; public class JPEGWriter@mode<X> { public void write(Image i) { } }
ccf5669bec5a488ffa832d2876ae6582af924776
a60082f6a5cd2f58d742167735ee0dad75e9a0ec
/src/main/java/ldh/common/testui/assist/template/beetl/function/JsonHelp.java
f081b0c2f3f7f34c444b37257dc7d95c8f7a17e2
[]
no_license
li-tuan-wei/javaFX-proj
8f80b55812883be02df8fc3bfb587b60527be7f9
d9186fdba42c5615f1bc674f6ef733940802bdfd
refs/heads/master
2022-07-07T10:57:14.961756
2019-08-21T14:02:42
2019-08-21T14:02:53
203,596,301
0
0
null
2022-06-21T01:43:08
2019-08-21T14:01:04
Java
UTF-8
Java
false
false
799
java
package ldh.common.testui.assist.template.beetl.function; import ldh.common.testui.util.JsonUtil; import ldh.common.testui.vo.JsonPathHelp; import java.lang.reflect.Type; /** * Created by ldh on 2018/12/25. */ public class JsonHelp { public Object toBean(String json, Class<?> clazzType) { return ldh.common.testui.util.JsonUtil.toObject(json, clazzType); } public Object toBean(String json, Type clazzType) { return ldh.common.testui.util.JsonUtil.toObject(json, clazzType); } public String toJson(String str) { return JsonUtil.parseJson(str); } public String jsonPathValue(String json, String jsonPath) { JsonPathHelp jsonPathHelp = new JsonPathHelp(json, jsonPath); return jsonPathHelp.jsonValue(String.class); } }
67ace851d8a9f046d0623b95108fbf5001301452
edae9856f6d8610622664d5535d8ced38ce8823a
/castle/ocastle/oGame.java
7cf91bc435bcfb5af26ad6229195ce79fea528fc
[]
no_license
blessed-19901108/-JAVA
039c30ba5d00ad30c9353b5aa3ba7787339ff8df
400f7a96a4dbf1643cb302b320ea90b7eb2cea69
refs/heads/main
2023-08-05T02:37:22.914640
2021-09-18T01:49:09
2021-09-18T01:49:09
358,589,413
0
0
null
2021-04-22T14:25:37
2021-04-16T12:18:18
Java
UTF-8
Java
false
false
4,125
java
package ocastle; import java.util.Scanner; public class oGame { private oRoom currentRoom; public oGame() { createRooms(); } private void createRooms() { oRoom outside, lobby, pub, study, bedroom; // 制造房间 outside = new oRoom("城堡外"); lobby = new oRoom("大堂"); pub = new oRoom("小酒吧"); study = new oRoom("书房"); bedroom = new oRoom("卧室"); // 初始化房间的出口 这一步传参数也就确定了currentRoom与currentRoom.northExit当作字符串输出的时候内容是不同的;这一步规定了哪些房间的哪个出口链接的是那个房间 outside.setExits(null, lobby, study, pub); lobby.setExits(null, null, null, outside); pub.setExits(null, outside, null, null); study.setExits(outside, bedroom, null, null); bedroom.setExits(null, null, null, study); currentRoom = outside; // 从城堡门外开始 } private void printWelcome() { System.out.println(); System.out.println("欢迎来到城堡!"); System.out.println("这是一个超级无聊的游戏。"); System.out.println("如果需要帮助,请输入 'help' 。"); System.out.println(); System.out.println("现在你在" + currentRoom); System.out.print("出口有:"); if(currentRoom.northExit != null) System.out.print("north "); if(currentRoom.eastExit != null) System.out.print("east "); if(currentRoom.southExit != null) System.out.print("south "); if(currentRoom.westExit != null) System.out.print("west "); System.out.println(); } // 以下为用户命令 private void printHelp() { System.out.print("迷路了吗?你可以做的命令有:go bye help");//go bye help隐形的硬编码,每增加一个命令都要改 System.out.println("如:\tgo east"); } private void goRoom(String direction) { oRoom nextRoom = null; if(direction.equals("north")) { nextRoom = currentRoom.northExit; } if(direction.equals("east")) { nextRoom = currentRoom.eastExit; } if(direction.equals("south")) { nextRoom = currentRoom.southExit; } if(direction.equals("west")) { nextRoom = currentRoom.westExit; } //经过以上一大串if,如果通过goroom还是没有走到一个房间就会执行nextRoom == null的语句;如果有一个房间,就会判断当前房间有什么出口 if (nextRoom == null) { System.out.println("那里没有门!"); } else { currentRoom = nextRoom; System.out.println("你在" + currentRoom); System.out.print("出口有: "); if(currentRoom.northExit != null) System.out.print("north "); if(currentRoom.eastExit != null) System.out.print("east "); if(currentRoom.southExit != null) System.out.print("south "); if(currentRoom.westExit != null) System.out.print("west "); System.out.println(); } } public static void main(String[] args) { Scanner in = new Scanner(System.in); oGame game = new oGame(); game.printWelcome(); //命令解析-->怎么做成框架?字符串对应个什么东西,HashMap可以做,但在这对应到底是函数;但HashMap的Key和Value都必须是对象;但类里面有函数 while ( true ) { String line = in.nextLine(); String[] words = line.split(" "); if ( words[0].equals("help") ) { game.printHelp(); } else if (words[0].equals("go") ) { game.goRoom(words[1]); } else if ( words[0].equals("bye") ) { break; } } System.out.println("感谢您的光临。再见!"); in.close(); } }
a964f60c4e9b930f387eda94aa7238a24dead70a
d0e7b985fa7cdc20c1f20302ae60e7a05a7229fc
/VendingSdk/src/main/java/com/cloudminds/vending/utils/ConfigureLog4j.java
94bd0b984d0c4e9f9e9395ce0ecaca41d4c59e9d
[]
no_license
whuan1024/Vending4UE4Test
f9a927b4bddfca464705838242017fde51cd4795
11f7304a345d76bc29b964793552549f5fc48144
refs/heads/master
2023-08-31T10:10:44.902858
2021-10-26T03:16:14
2021-10-26T03:16:14
357,148,651
0
0
null
null
null
null
UTF-8
Java
false
false
3,946
java
package com.cloudminds.vending.utils; import android.app.ActivityManager; import android.content.Context; import android.os.Environment; import android.text.TextUtils; import org.apache.log4j.Level; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.List; import java.util.Locale; import de.mindpipe.android.logging.log4j.LogConfigurator; public class ConfigureLog4j { private static final int MAX_FILE_SIZE = 1024 * 1024 * 50; private static final int MAX_FILE_NUMBER = 5; public static final String LOG_DIR_NAME = "/cloudminds/AppLog/"; private static final String DEFAULT_LOG_DIR = LOG_DIR_NAME.replaceAll("/", "//"); private static final String DEFAULT_LOG_FILE_NAME = "app.log"; private static String LOG_FILE_NAME = DEFAULT_LOG_FILE_NAME; private static final String TAG = "Log4jConfigure"; private static final DateFormat logDateFormat = new SimpleDateFormat("yyyy.MM.dd", Locale.US);//modify by wendy for MA-1091. private static Context curContext = null; private static void configure(String fileName) { LOG_FILE_NAME = fileName; final LogConfigurator logConfigurator = new LogConfigurator(); //日志文件路径地址:SD卡下 Constants.LOG_DIR_NAME String fileFullName = Environment.getExternalStorageDirectory() + DEFAULT_LOG_DIR + logDateFormat.format(Calendar.getInstance().getTime()) + "_" + fileName; //设置文件名 logConfigurator.setFileName(fileFullName); //设置root日志输出级别 默认为DEBUG logConfigurator.setRootLevel(Level.DEBUG); //设置日志输出级别 logConfigurator.setLevel("org.apache", Level.INFO); //设置输出到日志文件的文字格式 默认 %d %-5p [%c{2}]-[%L] %m%n logConfigurator.setFilePattern("%d %-5p [%c{2}] %m%n"); //设置输出到控制台的文字格式 默认%m%n logConfigurator.setLogCatPattern("%m%n"); //设置总文件大小 logConfigurator.setMaxFileSize(MAX_FILE_SIZE); //设置最大产生的文件个数 logConfigurator.setMaxBackupSize(MAX_FILE_NUMBER); //设置所有消息是否被立刻输出,默认为true,false不输出 logConfigurator.setImmediateFlush(true); //是否本地控制台打印输出,默认为true,false不输出 logConfigurator.setUseLogCatAppender(true); //设置是否启用文件附加,默认为true,false为覆盖文件 logConfigurator.setUseFileAppender(true); //设置是否重置配置文件,默认为true logConfigurator.setResetConfiguration(true); //是否显示内部初始化日志,默认为false logConfigurator.setInternalDebugging(false); logConfigurator.configure(); } public static void configure(Context context) { curContext = context; String processName = getAppProcessName(); if (TextUtils.isEmpty(processName)) { configure(DEFAULT_LOG_FILE_NAME); } else { configure(processName + ".log"); } } public static void configure() { configure("other.log"); } /** * 获取当前应用程序的包名 */ private static String getAppProcessName() { //当前应用pid int pid = android.os.Process.myPid(); //任务管理类 ActivityManager manager = (ActivityManager) curContext.getSystemService(Context.ACTIVITY_SERVICE); //遍历所有应用 if (manager != null) { List<ActivityManager.RunningAppProcessInfo> infos = manager.getRunningAppProcesses(); for (ActivityManager.RunningAppProcessInfo info : infos) { if (info.pid == pid)//得到当前应用 return info.processName;//返回包名 } } return ""; } }
318c5576586e3f2f438f685afdfc864e3868fe62
d976e7245f0d5c84f7b1d280b5493b8a1194b2b1
/src/main/java/com/niit/collaboration/controller/EventController.java
5da00c52f704eb996377ba58bf5b0f2c5a899b74
[]
no_license
SUPRIGA/Collaboration
a1e0f85b1c01ca69e113145ef38c4c7db81e4066
9c722b22db640fcb7b103a37d8c74ca5c0c80195
refs/heads/master
2020-06-10T17:28:23.581194
2017-01-17T06:14:09
2017-01-17T06:14:09
75,921,722
0
0
null
null
null
null
UTF-8
Java
false
false
3,129
java
package com.niit.collaboration.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.util.UriComponentsBuilder; import com.niit.collaboration.model.Blog; import com.niit.collaboration.model.Event; import com.niit.collaboration.service.EventDAO; @Controller public class EventController { @Autowired private EventDAO eventDAO; public EventDAO getEventDAO() { return eventDAO; } public void setEventDAO(EventDAO eventDAO) { this.eventDAO = eventDAO; } @RequestMapping(value="event",method=RequestMethod.GET) public ResponseEntity<List<Event>> getAllEvent(){ System.out.println(eventDAO.getAllEvent()); List<Event> event=eventDAO.getAllEvent(); if(event.isEmpty()) return new ResponseEntity<List<Event>>(HttpStatus.NO_CONTENT); return new ResponseEntity<List<Event>>(event,HttpStatus.OK); } //http://localhost:8080/crudusingrest/person/2 @RequestMapping(value="event/{id}",method=RequestMethod.GET) public ResponseEntity<Event> getEventById(@PathVariable(value="id") int id){ Event event=eventDAO.getEvent(id); if(event==null) return new ResponseEntity<Event>(HttpStatus.NOT_FOUND); return new ResponseEntity<Event>(event,HttpStatus.OK); } @RequestMapping(value="event",method=RequestMethod.POST) //RequestBody - to convert JSON data to java object //ResponseBody -> servet to client //RequestBody -> client to server public ResponseEntity<Void> createEvent(@RequestBody Event event, UriComponentsBuilder build){ //personDAO.savePerson(blog); HttpHeaders headers=new HttpHeaders(); //http://localhost:8080/appname/person/210 java.net.URI urilocation= build.path("event/") .path(String.valueOf(event.getEvent_id())) .build() .toUri(); headers.setLocation(urilocation); return new ResponseEntity<Void>(headers,HttpStatus.CREATED); } @RequestMapping(value="event/{id}",method=RequestMethod.PUT) public ResponseEntity<Event> updateEvent( @PathVariable int id,@RequestBody Event event){ Event updatedEvent=eventDAO.updateEvent(id, event); if(event==null) return new ResponseEntity<Event>(HttpStatus.NOT_FOUND); return new ResponseEntity<Event>(updatedEvent,HttpStatus.OK); } @RequestMapping(value="event/{id}",method=RequestMethod.DELETE) public ResponseEntity<Void> deleteEvent(@PathVariable int id){ Event event=eventDAO.getEvent(id); if(event==null) return new ResponseEntity<Void>(HttpStatus.NOT_FOUND); eventDAO.deleteEvent(id); return new ResponseEntity<Void>(HttpStatus.OK); } }
1d0ab552e667e8c59ab1db0777bdf667c811239a
eb136573f42657cd48d234ba104d227f5bf6cb81
/src/Vista/Productos/CategoriaProducto.java
c2bc58dd9b014c454946673579295980477c6d68
[]
no_license
william-monroy/SisVentas---JAVA
86b6a19ef8d6a065342da1a491038b9e04a64653
4d401b418375fbd1a4b08b77b17310b6fafa2c47
refs/heads/master
2022-12-29T06:29:50.177815
2020-10-10T16:05:41
2020-10-10T16:05:41
302,938,996
0
0
null
null
null
null
UTF-8
Java
false
false
25,875
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Vista.Productos; import Conexion.connSQL; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; /** * * @author William */ public class CategoriaProducto extends javax.swing.JInternalFrame { connSQL cc = new connSQL(); Connection con = cc.conexion(); public CategoriaProducto() { initComponents(); Limpiar(); mostrarDatos(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); txtNombre = new javax.swing.JTextField(); jSeparator1 = new javax.swing.JSeparator(); txtUnidad = new javax.swing.JTextField(); jSeparator2 = new javax.swing.JSeparator(); txtBus = new javax.swing.JTextField(); jSeparator4 = new javax.swing.JSeparator(); jScrollPane1 = new javax.swing.JScrollPane(); tabla = new javax.swing.JTable(); btnNuevo = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); btnEditar = new javax.swing.JPanel(); jLabel7 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); btnEliminar = new javax.swing.JPanel(); jLabel11 = new javax.swing.JLabel(); btnLimpiar = new javax.swing.JPanel(); jLabel12 = new javax.swing.JLabel(); jPanel1.setBackground(new java.awt.Color(27, 38, 44)); jPanel2.setBackground(new java.awt.Color(15, 76, 117)); jLabel1.setFont(new java.awt.Font("DeVinne Txt BT", 1, 36)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Categoría de Productos"); jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Resources/category.png"))); // NOI18N javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(66, 66, 66) .addComponent(jLabel8) .addGap(28, 28, 28) .addComponent(jLabel1) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(30, 30, 30) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel8) .addComponent(jLabel1)) .addContainerGap(33, Short.MAX_VALUE)) ); jLabel2.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N jLabel2.setForeground(new java.awt.Color(204, 204, 204)); jLabel2.setText("Nombre:"); jLabel3.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N jLabel3.setForeground(new java.awt.Color(204, 204, 204)); jLabel3.setText("Unidad:"); jLabel5.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N jLabel5.setForeground(new java.awt.Color(204, 204, 204)); jLabel5.setText("Búsqueda por Nombre:"); txtNombre.setBackground(new java.awt.Color(27, 38, 44)); txtNombre.setForeground(new java.awt.Color(204, 204, 204)); txtNombre.setText("jTextField1"); txtNombre.setBorder(null); jSeparator1.setForeground(new java.awt.Color(204, 204, 204)); txtUnidad.setBackground(new java.awt.Color(27, 38, 44)); txtUnidad.setForeground(new java.awt.Color(204, 204, 204)); txtUnidad.setText("jTextField1"); txtUnidad.setBorder(null); jSeparator2.setForeground(new java.awt.Color(204, 204, 204)); txtBus.setBackground(new java.awt.Color(27, 38, 44)); txtBus.setForeground(new java.awt.Color(204, 204, 204)); txtBus.setText("jTextField1"); txtBus.setBorder(null); txtBus.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { txtBusKeyReleased(evt); } }); jSeparator4.setForeground(new java.awt.Color(204, 204, 204)); tabla.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {"1", "Administrador"}, {"2", "Vendedor"}, {"3", "Caja"}, {"4", "Almacen"} }, new String [] { "Cod_Permiso", "Puesto" } )); tabla.setSelectionBackground(new java.awt.Color(15, 76, 117)); tabla.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { tablaMouseClicked(evt); } }); jScrollPane1.setViewportView(tabla); btnNuevo.setBackground(new java.awt.Color(32, 64, 81)); btnNuevo.setFocusCycleRoot(true); btnNuevo.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnNuevoMouseClicked(evt); } }); jLabel6.setForeground(new java.awt.Color(204, 204, 204)); jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Resources/add.png"))); // NOI18N jLabel6.setText("Nueva Categoría"); javax.swing.GroupLayout btnNuevoLayout = new javax.swing.GroupLayout(btnNuevo); btnNuevo.setLayout(btnNuevoLayout); btnNuevoLayout.setHorizontalGroup( btnNuevoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(btnNuevoLayout.createSequentialGroup() .addGap(85, 85, 85) .addComponent(jLabel6) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); btnNuevoLayout.setVerticalGroup( btnNuevoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, btnNuevoLayout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel6) .addContainerGap()) ); btnEditar.setBackground(new java.awt.Color(32, 64, 81)); btnEditar.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnEditarMouseClicked(evt); } }); jLabel7.setForeground(new java.awt.Color(204, 204, 204)); jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Resources/edit1.png"))); // NOI18N jLabel7.setText("Editar Categoría"); javax.swing.GroupLayout btnEditarLayout = new javax.swing.GroupLayout(btnEditar); btnEditar.setLayout(btnEditarLayout); btnEditarLayout.setHorizontalGroup( btnEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(btnEditarLayout.createSequentialGroup() .addGap(83, 83, 83) .addComponent(jLabel7) .addContainerGap(97, Short.MAX_VALUE)) ); btnEditarLayout.setVerticalGroup( btnEditarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(btnEditarLayout.createSequentialGroup() .addContainerGap() .addComponent(jLabel7) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Resources/search.png"))); // NOI18N btnEliminar.setBackground(new java.awt.Color(32, 64, 81)); btnEliminar.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnEliminarMouseClicked(evt); } }); jLabel11.setForeground(new java.awt.Color(204, 204, 204)); jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Resources/remove.png"))); // NOI18N jLabel11.setText("Eliminar Categoría"); javax.swing.GroupLayout btnEliminarLayout = new javax.swing.GroupLayout(btnEliminar); btnEliminar.setLayout(btnEliminarLayout); btnEliminarLayout.setHorizontalGroup( btnEliminarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(btnEliminarLayout.createSequentialGroup() .addGap(83, 83, 83) .addComponent(jLabel11) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); btnEliminarLayout.setVerticalGroup( btnEliminarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(btnEliminarLayout.createSequentialGroup() .addContainerGap() .addComponent(jLabel11) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); btnLimpiar.setBackground(new java.awt.Color(32, 64, 81)); btnLimpiar.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnLimpiarMouseClicked(evt); } }); jLabel12.setForeground(new java.awt.Color(204, 204, 204)); jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Resources/limpiar.png"))); // NOI18N jLabel12.setText("Limpiar Campos"); javax.swing.GroupLayout btnLimpiarLayout = new javax.swing.GroupLayout(btnLimpiar); btnLimpiar.setLayout(btnLimpiarLayout); btnLimpiarLayout.setHorizontalGroup( btnLimpiarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(btnLimpiarLayout.createSequentialGroup() .addGap(83, 83, 83) .addComponent(jLabel12) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); btnLimpiarLayout.setVerticalGroup( btnLimpiarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(btnLimpiarLayout.createSequentialGroup() .addContainerGap() .addComponent(jLabel12) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(72, 72, 72) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel2) .addComponent(jLabel3) .addComponent(txtNombre, javax.swing.GroupLayout.DEFAULT_SIZE, 312, Short.MAX_VALUE) .addComponent(jSeparator1) .addComponent(jSeparator2) .addComponent(txtUnidad, javax.swing.GroupLayout.DEFAULT_SIZE, 312, Short.MAX_VALUE) .addComponent(btnNuevo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnEditar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnEliminar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnLimpiar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 99, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 525, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(15, 15, 15) .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel5) .addComponent(txtBus) .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 265, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel9))) .addGap(39, 39, 39)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(41, 41, 41) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel9) .addGap(18, 18, 18)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtBus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(7, 7, 7) .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(11, 11, 11)))) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txtUnidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btnNuevo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btnEditar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btnEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btnLimpiar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) .addContainerGap(34, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btnNuevoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnNuevoMouseClicked agregarCategoria(); Limpiar(); }//GEN-LAST:event_btnNuevoMouseClicked private void btnEditarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnEditarMouseClicked actualizarCategoria(); Limpiar(); }//GEN-LAST:event_btnEditarMouseClicked private void btnEliminarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnEliminarMouseClicked eliminarCategoria(); Limpiar(); }//GEN-LAST:event_btnEliminarMouseClicked private void btnLimpiarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnLimpiarMouseClicked Limpiar(); }//GEN-LAST:event_btnLimpiarMouseClicked private void tablaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablaMouseClicked int filaSeleccionada = tabla.rowAtPoint(evt.getPoint()); txtNombre.setText(tabla.getValueAt(filaSeleccionada, 1).toString()); txtUnidad.setText(tabla.getValueAt(filaSeleccionada, 2).toString()); }//GEN-LAST:event_tablaMouseClicked private void txtBusKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtBusKeyReleased filtrarDatos(txtBus.getText()); }//GEN-LAST:event_txtBusKeyReleased public void mostrarDatos() { String[] titulos = {"Codigo", "Nombre", "Unidad"}; String[] registros = new String[3]; DefaultTableModel modelo = new DefaultTableModel(null, titulos); String SQL = "select * from categoria"; try { Statement st = con.createStatement(); ResultSet rs = st.executeQuery(SQL); while (rs.next()) { registros[0] = rs.getString("cod_categoria"); registros[1] = rs.getString("nombre"); registros[2] = rs.getString("unidad"); modelo.addRow(registros); } tabla.setModel(modelo); rs.close(); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error al Mostrar Datos: " + e.toString()); } } public void filtrarDatos(String valor) { String[] titulos = {"Codigo", "Nombre", "Unidad"}; String[] registros = new String[3]; DefaultTableModel modelo = new DefaultTableModel(null, titulos); String SQL = "select * from categoria where nombre like '%" + valor + "%'"; try { Statement st = con.createStatement(); ResultSet rs = st.executeQuery(SQL); while (rs.next()) { registros[0] = rs.getString("cod_categoria"); registros[1] = rs.getString("nombre"); registros[2] = rs.getString("unidad"); modelo.addRow(registros); } tabla.setModel(modelo); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error al Mostrar Datos: " + e.toString()); } } public void actualizarCategoria() { try { String SQL = "update categoria set nombre=?,unidad=? where cod_categoria=?"; int filaSeleccionada = tabla.getSelectedRow(); String txtfilaSeleccionada = (String) tabla.getValueAt(filaSeleccionada, 0); PreparedStatement pst = con.prepareStatement(SQL); pst.setString(1, txtNombre.getText()); pst.setString(2, txtUnidad.getText()); pst.setString(3, txtfilaSeleccionada);//inidice de busqueda pst.execute(); JOptionPane.showMessageDialog(null, "Registro Editado Exitosamente"); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error en Edicion de Registro: " + e.getMessage()); } } public void eliminarCategoria() { int filaSeleccionada = tabla.getSelectedRow(); try { String SQL = "delete from categoria where cod_categoria=" + tabla.getValueAt(filaSeleccionada, 0); Statement st = con.createStatement(); int n = st.executeUpdate(SQL); if (n >= 0) { JOptionPane.showMessageDialog(null, "Usuario Eliminado"); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error al Eliminar Producto: " + e.getMessage()); } } public void agregarCategoria(){ String sql = "insert into categoria (nombre,unidad) values (?,?)"; try{ PreparedStatement pst = con.prepareStatement(sql); pst.setString(1, txtNombre.getText()); pst.setString(2, txtUnidad.getText()); pst.execute(); JOptionPane.showMessageDialog(null, "Categoria Agregado Exitosamente"); }catch(Exception e){ JOptionPane.showMessageDialog(null, "Error: " + e.getMessage()); } } public void Limpiar(){ txtBus.setText(""); txtNombre.setText(""); txtUnidad.setText(""); txtBus.requestFocus(); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel btnEditar; private javax.swing.JPanel btnEliminar; private javax.swing.JPanel btnLimpiar; private javax.swing.JPanel btnNuevo; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSeparator jSeparator1; private javax.swing.JSeparator jSeparator2; private javax.swing.JSeparator jSeparator4; private javax.swing.JTable tabla; private javax.swing.JTextField txtBus; private javax.swing.JTextField txtNombre; private javax.swing.JTextField txtUnidad; // End of variables declaration//GEN-END:variables }
ad9233c97ac1892896c251fea90f90b44df546f2
5714e7075baaa2ed98fe9cc10dfa0e5110a98d5e
/support/cas-server-support-generic-remote-webflow/src/test/java/org/apereo/cas/adaptors/generic/remote/RemoteAddressCredentialTests.java
0ae0e2f33363a73df08806f10b6a8f51ce62315b
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
hunybei/cas
5646d3a2e7496b400c2d89f6a970a8e841e3067a
6553eace018407336b14c6c016783525d1a7e5eb
refs/heads/master
2020-03-27T20:21:27.270060
2018-09-01T09:41:58
2018-09-01T09:41:58
147,062,720
2
0
Apache-2.0
2018-09-02T07:03:25
2018-09-02T07:03:25
null
UTF-8
Java
false
false
934
java
package org.apereo.cas.adaptors.generic.remote; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.val; import org.apache.commons.io.FileUtils; import org.junit.Test; import java.io.File; import java.io.IOException; import static org.junit.Assert.*; /** * @author Misagh Moayyed * @since 5.0.0 */ public class RemoteAddressCredentialTests { private static final File JSON_FILE = new File(FileUtils.getTempDirectoryPath(), "remoteAddressCredential.json"); private static final ObjectMapper MAPPER = new ObjectMapper(); @Test public void verifySerializeARemoteAddressCredentialToJson() throws IOException { val credentialWritten = new RemoteAddressCredential("80.123.456.78"); MAPPER.writeValue(JSON_FILE, credentialWritten); val credentialRead = MAPPER.readValue(JSON_FILE, RemoteAddressCredential.class); assertEquals(credentialWritten, credentialRead); } }
69c969c530dfb5f13440736491f51932b4079917
6248ddc83816230d2895fe2c9e946a1817f3c306
/app/src/main/java/com/blossom/workrecd/Liugetu/Qianbao/MingxiActivity.java
8a02286b3895a56d14740377eb17f0674c827bd3
[]
no_license
bolssom/shengjianbao
978bcc04749e8fc822839955e8273ad54ca5ed5c
27a1bb111c4c6ae6117e40bb67c8bb0f0b300ab4
refs/heads/master
2016-08-11T20:37:28.241182
2016-01-31T05:28:40
2016-01-31T05:28:40
49,241,021
0
0
null
null
null
null
UTF-8
Java
false
false
780
java
package com.blossom.workrecd.Liugetu.Qianbao; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.Window; import com.blossom.workrecd.R; import com.lidroid.xutils.ViewUtils; import com.lidroid.xutils.view.annotation.event.OnClick; public class MingxiActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_mingxi); ViewUtils.inject(this); } @OnClick({R.id.left_btn}) public void myClick(View v){ switch (v.getId()){ case R.id.left_btn: finish(); break; } } }
d8a0bb6375530fe3d73fc4654117f32bd9559420
61e98b0302a43ab685be4c255b4ecf2979db55b6
/sdks/java/io/hdfs/src/test/java/org/apache/beam/sdk/io/hdfs/HadoopFileSystemOptionsTest.java
634528b8f33f84c26eef29b62b636237e3613c4a
[ "BSD-3-Clause", "EPL-2.0", "CDDL-1.0", "Apache-2.0", "WTFPL", "GPL-2.0-only", "BSD-2-Clause", "MIT", "LicenseRef-scancode-unknown-license-reference", "CDDL-1.1", "Classpath-exception-2.0" ]
permissive
dzenyu/kafka
5631c05a6de6e288baeb8955bdddf2ff60ec2a0e
d69a24bce8d108f43376271f89ecc3b81c7b6622
refs/heads/master
2021-07-16T12:31:09.623509
2021-06-28T18:22:16
2021-06-28T18:22:16
198,724,535
0
0
Apache-2.0
2019-07-24T23:51:47
2019-07-24T23:51:46
null
UTF-8
Java
false
false
1,938
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License 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 org.apache.beam.sdk.io.hdfs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import java.util.AbstractMap; import java.util.Map; import org.apache.beam.sdk.options.PipelineOptionsFactory; import org.hamcrest.Matchers; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** * Tests for {@link HadoopFileSystemOptions}. */ @RunWith(JUnit4.class) public class HadoopFileSystemOptionsTest { @Test public void testParsingHdfsConfiguration() { HadoopFileSystemOptions options = PipelineOptionsFactory.fromArgs( "--hdfsConfiguration=[" + "{\"propertyA\": \"A\"}," + "{\"propertyB\": \"B\"}]").as(HadoopFileSystemOptions.class); assertEquals(2, options.getHdfsConfiguration().size()); assertThat(options.getHdfsConfiguration().get(0), Matchers.<Map.Entry<String, String>>contains( new AbstractMap.SimpleEntry("propertyA", "A"))); assertThat(options.getHdfsConfiguration().get(1), Matchers.<Map.Entry<String, String>>contains( new AbstractMap.SimpleEntry("propertyB", "B"))); } }
724812272e944fe4af8d91d52205d937a0c5dafc
77de960bf45a999a980e43efe1937921b70795f2
/SummerHoliday_java/src/day52_Interface/InterfaceIntro.java
fb54044fa60958c010a9aa9e29cb768b92be3ae6
[]
no_license
serdarselcuk/JavaStudy
923c2ba9e39008b90d398f591b0bb7a711976ad9
189b59f44a884fd151268dcc3c72bfde2349f9c5
refs/heads/master
2022-12-28T23:53:49.751938
2020-01-17T22:52:51
2020-01-17T22:52:51
227,907,489
0
0
null
2020-10-13T18:12:43
2019-12-13T19:21:52
Java
UTF-8
Java
false
false
1,226
java
package day52_Interface; public interface InterfaceIntro { //public void name() { } no instance method //public InterfaceIntro() { } no constructor public abstract void methodA(); /* { } static { } */ // public InterfaceIntro() { } // public void methodB() { } public default void methodC() { } /// public abstract void methodA(); public static void mm() { } int a =100; // public static final public static final int b = 200; // public protected int num =100; public static void main(String[] args) { InterfaceIntro.mm(); System.out.println(a); // variables are static by default a = 200; // vairables are final by default } } interface Data{ } class Test implements InterfaceIntro, Data{ // subtype supertype, supertype @Override public void methodA() { } } // class B extends A, Test{ } a class can only extend one class class D{ static int a =200; static { a = 500; } }
aefd5aed6105c1eed6e7280a171d6d9dbd548f14
a546ef3ae90b194d832add3b41f4d2ae1f6b977b
/src/java/org/apache/cassandra/utils/BasicUtilities.java
46863213e6d8406041feafdb14dea7fe63f98240
[ "Apache-2.0" ]
permissive
osake/Cassandra
97da97e39943d0a56128a4e51360d9c985add2c5
6ccdeb38ca652c46813725f0c3917e5672ae536e
refs/heads/trunk
2020-12-25T22:19:13.197257
2009-09-03T02:26:38
2009-09-03T02:26:38
53,446,472
0
0
null
2016-03-08T21:28:46
2016-03-08T21:28:46
null
UTF-8
Java
false
false
2,022
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License 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 org.apache.cassandra.utils; import java.nio.ByteBuffer; public class BasicUtilities { public static byte[] longToByteArray(long arg) { byte[] retVal = new byte[8]; ByteBuffer.wrap(retVal).putLong(arg); return retVal; } public static long byteArrayToLong(byte[] arg) { return ByteBuffer.wrap(arg).getLong(); } public static byte[] intToByteArray(int arg) { byte[] retVal = new byte[4]; ByteBuffer.wrap(retVal).putInt(arg); return retVal; } public static int byteArrayToInt(byte[] arg) { return ByteBuffer.wrap(arg).getInt(); } public static byte[] shortToByteArray(short arg) { byte[] retVal = new byte[2]; ByteBuffer bb= ByteBuffer.wrap(retVal); bb.putShort(arg); return retVal; } public static short byteArrayToShort(byte[] arg) { return ByteBuffer.wrap(arg).getShort(); } public static byte[] booleanToByteArray(boolean b) { return b ? shortToByteArray((short)1) : shortToByteArray((short)0); } public static boolean byteArrayToBoolean(byte[] arg) { return (byteArrayToShort(arg) == (short) 1) ? true : false; } }
0dd892fff54a6468ba385da47704eeba35b955a4
4333f4b77b8ea45bddce903edce0c856bb495080
/docs/java进阶/day10-字符流, 缓冲流、转换流、序列化流,打印流,属性集/homework/day10_Homework/src/com/itheima/test/Test08.java
60de1643ef341da1e7532ca31063ae4a57f043b3
[]
no_license
codedawn/diary
cf4c749a40fc3553b0d2e2ad5f8f517afbe8865e
6fec696113dbce2f2a5ca15bedcece6eedf7c55e
refs/heads/master
2023-07-28T09:21:47.731900
2021-09-16T03:14:32
2021-09-16T03:14:32
359,477,622
0
0
null
null
null
null
UTF-8
Java
false
false
654
java
package com.itheima.test; import java.io.FileInputStream; import java.io.ObjectInputStream; /** * @author pkxing * @version 1.0 * @Package com.itheima.test * @date 2018/5/4 下午3:33 */ public class Test08 { public static void main(String[] args) throws Exception { // 创建字节输入流对象并关联文件 FileInputStream fis = new FileInputStream("stu.txt"); // 创建对象输入流对象 ObjectInputStream ois = new ObjectInputStream(fis); // 读取学生对象 Student s = (Student) ois.readObject(); System.out.println(s); // 关闭流 ois.close(); } }
08f49091aa116154fd000bcedd0a01888ea28e4d
1b0cc9ad4f01136883f3875c3ba2adaf1c21a7bb
/src/main/java/com/example/finalemucloud/configure/EmulatorConfigure.java
0ec1257d6a22ea151dfb4f8a84eb2405461a576f
[]
no_license
liambrandwein/EmuSync
fd298723a837c2c7795abffc731a739a5e1362c0
a3b62f4ba9c8b2b223a2e18178ef652b50428ca6
refs/heads/master
2021-01-14T04:14:29.297393
2020-04-09T19:37:11
2020-04-09T19:37:11
242,596,207
0
0
null
null
null
null
UTF-8
Java
false
false
679
java
package com.example.finalemucloud.configure; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.preference.PreferenceScreen; import com.example.finalemucloud.R; public class EmulatorConfigure extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getSupportFragmentManager() .beginTransaction() .replace(R.id.settings_container, new EmulatorConfigureFragment()) .commit(); setContentView(R.layout.settings_holder); } }
16a52730b368bc2fd83a92937b7420045a80c58a
5a89a4c247e03c07b2723d74066251d1cfa53b2e
/app/src/main/java/com/bitmesra/bitotsav/features/home/NotificationFeedItemAnimator.java
ea77cb8833ec6637c295ada06bb1d122b57d13a9
[ "Apache-2.0" ]
permissive
GauravChaddha1996/Bitotsav17
d26db0fb2a1a12ece948aa84e1ab8af1b1ef71bd
72862061a6afa9b5428bb81bf602ceff3fbe1222
refs/heads/develop
2021-06-24T05:32:40.107695
2017-08-29T11:40:12
2017-08-29T11:40:12
79,643,082
2
4
null
2017-08-29T11:40:13
2017-01-21T11:59:08
Java
UTF-8
Java
false
false
514
java
package com.bitmesra.bitotsav.features.home; import android.support.annotation.NonNull; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.RecyclerView; import java.util.List; /** * Created by Batdroid on 11/2/17 for Bitotsav. */ public class NotificationFeedItemAnimator extends DefaultItemAnimator { @Override public boolean canReuseUpdatedViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, @NonNull List<Object> payloads) { return true; } }
33e7b53398ed070d744b9c16e4cf3ca787332258
a7c59d36f213ef95ca7141117d206b9c23da3735
/CTCOffice/CTCSim/src/track_model/TLayout.java
c03ca6e4c232b12473b01bb5d71df48080ad0aee
[]
no_license
Software-Engineering-A-Team/DemTrains
ef4cd5ccdbbaaca5f684dd7b234b1cbf64b01c23
2844249b50edbd7545a9d2aff002744ad6bfcc6a
refs/heads/master
2021-01-13T02:26:50.699273
2015-04-23T21:18:33
2015-04-23T21:18:34
29,366,311
0
0
null
null
null
null
UTF-8
Java
false
false
4,829
java
package track_model; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import org.jgrapht.graph.DirectedMultigraph; import org.jgrapht.graph.DefaultEdge; import track_model.TrackSection; public class TLayout { public DirectedMultigraph<Integer, DefaultEdge> layout; public List<TrackSection> sections; public List<TrackBlock> blocks; public Map<Integer, Integer> switchToBlocks; public Map<String, Integer> trains; // maps from train ID to block ID /** * Creates a new instance of the TrackLayout class. */ public TLayout() { layout = new DirectedMultigraph<Integer, DefaultEdge>(DefaultEdge.class); sections = new ArrayList<TrackSection>(); blocks = new ArrayList<TrackBlock>(); switchToBlocks = new HashMap<Integer, Integer>(); trains = new HashMap<String, Integer>(); } /** * Retrieves the TrackBlock corresponding to a specific train and its total distance traveled. * @param trainID The unique identifier of the train requesting the TrackBlock. * @param totalDistance The total distance traveled by the train from the yard. * @return The TrackBlock on which the train with unique identifier trainID is located. */ public TrackBlock getCurrentBlock(String trainName, double totalDistance, TrackBlock previousBlock) { return null; } /** * Connects all of the blocks within each section together. */ public void connectBlocks() { // iterate over all of the TrackSections in the TrackLayout for (int i = 0; i < sections.size(); i++) { // retrieve the first TrackBlock in the current section TrackSection section = sections.get(i); // iterate over all of the TrackBlocks in this TrackSection for (int j = 0; j < section.blocks.size(); j++) { TrackBlock block = section.blocks.get(j); System.out.printf("Iterating over block #%d...\n", block.number); // if there is another block in this section... if (section.blocks.size() > j + 1) { TrackBlock nextBlock = section.blocks.get(j + 1); System.out.printf("And grabbing nextBlock #%d...\n", nextBlock.number); // add edges between consecutive blocks in this section if (section.leastToGreatest) { connectBlocks(block.number, nextBlock.number); } if (section.greatestToLeast) { connectBlocks(nextBlock.number, block.number); } } // if this is the first or last block in the section, we need to connect to the next/previous section if (block.connectsTo != null) { System.out.printf("Block #%d connects to another section...\n", block.number); // special case for single blocked sections which requires distinction between previous/next blocks if (section.blocks.size() == 1) { if (section.leastToGreatest) { connectBlocks(block.connectsTo[0], block.number); connectBlocks(block.number, block.connectsTo[1]); } if (section.greatestToLeast) { connectBlocks(block.connectsTo[1], block.number); connectBlocks(block.number, block.connectsTo[0]); } } else { for (int k = 0; k < block.connectsTo.length; k++) { System.out.printf("...block #%d.\n", block.connectsTo[k]); // add edges between the section-connecting TrackBlocks in this section // TODO: simplify this logic down (possible?) if (section.leastToGreatest) { if (j == 0) { connectBlocks(block.connectsTo[k], block.number); } else { connectBlocks(block.number, block.connectsTo[k]); } } if (section.greatestToLeast) { if (j == 0) { connectBlocks(block.number, block.connectsTo[k]); } else { connectBlocks(block.connectsTo[k], block.number); } } } } } } } } /** * Connects the two blocks with an edge from the source to the target. */ public void connectBlocks(int source, int target) { if (!layout.containsEdge(source, target)) { System.out.printf("Adding edge between block #%d --> block #%d.\n", source, target); layout.addEdge(source, target); } } }
4498f49c1fd50d31d3be291c318d143bf26700a2
0de2829723ee2778e4d1732602fc88d480c83e56
/Common/src/main/java/com/scj/common/util/EncodeDecodeUtil.java
881c79ab6cf2ddcef6d7fcf0c77cbbf01976a61c
[]
no_license
shengchaojie/Blog
352c40b71081552691a807a72b7c4d8959491280
211f929fa3833591b984afb47fb0ef3221959088
refs/heads/master
2020-04-12T06:43:11.028241
2017-03-21T12:24:10
2017-03-21T12:24:10
63,622,564
0
0
null
null
null
null
UTF-8
Java
false
false
2,406
java
package com.scj.common.util; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; import java.io.IOException; import java.security.MessageDigest; /** * Created by Administrator on 2016/7/11. */ public class EncodeDecodeUtil { /** * MD5加密 BASE64 */ public static String encodeWithMD5(String text) { final char[] chars = new char[]{'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; try { byte[] bytes =text.getBytes(); MessageDigest messageDigest =MessageDigest.getInstance("MD5"); messageDigest.update(bytes); byte[] encodeBytes =messageDigest.digest(); char[] resultChars =new char[encodeBytes.length*2]; int k =0; for(int i=0;i<encodeBytes.length;i++) { //0xf =1111 //第一句取高4位 第二句就是取第四位 resultChars[k++] =chars[encodeBytes[i]>>>4&0xf]; resultChars[k++] =chars[encodeBytes[i]&0xf]; } return new String(resultChars); }catch (Exception ex) { return text; } } /** * base64的原理是 3*8->4*(00+6) * 3个字节转换4个字节 8不足末尾补0 3不足 补= * @param text * @return */ public static String encodeWithBase64(String text) { byte[] source =text.getBytes(); BASE64Encoder encoder =new BASE64Encoder(); return encoder.encode(source); } public static String decodeWithBase64(String text) { BASE64Decoder decoder =new BASE64Decoder(); try { return new String(decoder.decodeBuffer(text)); } catch (IOException e) { e.printStackTrace(); return null; } } public static String EncodePassword(String password) { return encodeWithMD5(StringUtils.reverse(encodeWithMD5(password))); } /*public static void main(String[] args) { String text ="0123"; System.out.println(encodeWithMD5(text)); System.out.println(encodeWithMD5(text)); System.out.println(0xf ==15); String textEncodedByBase64 =encodeWithBase64(text); System.out.println(textEncodedByBase64); System.out.println(decodeWithBase64(textEncodedByBase64)); }*/ }
c3dbd1316fa7248a19b7edbc124633170dfb1d77
4bd11f6fe85bb1b59c78a4f6157270aa92db01ac
/src/main/java/com/sgaraba/store/config/SecurityConfiguration.java
39b7c3f24e63814c1119075f8e5120c0a1b405d8
[]
no_license
sgaraba/online-store
6d7d1774eaecb3229825d9cbfba76bcfdb3092f5
098b68e42d2f303d259944fd5241fd2c93d3cfb5
refs/heads/master
2022-12-21T08:29:19.882061
2020-01-25T15:46:11
2020-01-25T15:46:11
225,956,405
0
0
null
2019-12-04T21:04:02
2019-12-04T21:01:51
Java
UTF-8
Java
false
false
4,596
java
package com.sgaraba.store.config; import com.sgaraba.store.security.*; import com.sgaraba.store.security.jwt.*; import org.springframework.beans.factory.BeanInitializationException; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import org.springframework.http.HttpMethod; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.header.writers.ReferrerPolicyHeaderWriter; import org.springframework.web.filter.CorsFilter; import org.zalando.problem.spring.web.advice.security.SecurityProblemSupport; @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) @Import(SecurityProblemSupport.class) public class SecurityConfiguration extends WebSecurityConfigurerAdapter { private final TokenProvider tokenProvider; private final CorsFilter corsFilter; private final SecurityProblemSupport problemSupport; public SecurityConfiguration(TokenProvider tokenProvider, CorsFilter corsFilter, SecurityProblemSupport problemSupport) { this.tokenProvider = tokenProvider; this.corsFilter = corsFilter; this.problemSupport = problemSupport; } @Bean public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } @Override public void configure(WebSecurity web) { web.ignoring() .antMatchers(HttpMethod.OPTIONS, "/**") .antMatchers("/app/**/*.{js,html}") .antMatchers("/i18n/**") .antMatchers("/content/**") .antMatchers("/h2-console/**") .antMatchers("/swagger-ui/index.html") .antMatchers("/test/**"); } @Override public void configure(HttpSecurity http) throws Exception { // @formatter:off http .csrf() .disable() .addFilterBefore(corsFilter, UsernamePasswordAuthenticationFilter.class) .exceptionHandling() .authenticationEntryPoint(problemSupport) .accessDeniedHandler(problemSupport) .and() .headers() .contentSecurityPolicy("default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:") .and() .referrerPolicy(ReferrerPolicyHeaderWriter.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN) .and() .featurePolicy("geolocation 'none'; midi 'none'; sync-xhr 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; speaker 'none'; fullscreen 'self'; payment 'none'") .and() .frameOptions() .deny() .and() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .authorizeRequests() .antMatchers("/api/authenticate").permitAll() .antMatchers("/api/register").permitAll() .antMatchers("/api/activate").permitAll() .antMatchers("/api/account/reset-password/init").permitAll() .antMatchers("/api/account/reset-password/finish").permitAll() .antMatchers("/api/**").authenticated() .antMatchers("/management/health").permitAll() .antMatchers("/management/info").permitAll() .antMatchers("/management/prometheus").permitAll() .antMatchers("/management/**").hasAuthority(AuthoritiesConstants.ADMIN) .and() .httpBasic() .and() .apply(securityConfigurerAdapter()); // @formatter:on } private JWTConfigurer securityConfigurerAdapter() { return new JWTConfigurer(tokenProvider); } }
9ead42da06cfe61bb74b3a504614fc738c7d5ec2
7c934fc97c7cab466c585ac8551f4c2b3184c139
/Java/Labyrinth with GUI/src/vw/LabirintoIvedimas.java
cd228a4f89467a72f431175698400cbd5287b49d
[]
no_license
AntanasJurk/Projects
61ac77ae072b17d3cdf2e6dd868e7336b911699f
c331285266ac0dcffb55672b6ae3e62c98a93c40
refs/heads/master
2021-01-13T00:53:03.187982
2016-03-21T21:14:00
2016-03-21T21:14:00
54,414,864
0
0
null
null
null
null
UTF-8
Java
false
false
7,161
java
package vw; import java.awt.Color; public class LabirintoIvedimas extends javax.swing.JDialog { //klases kintamuju reikia tam, kad is kitu klasiu galeciau pasiekti public int auks = 4; public int plot = 8; public LabirintoIvedimas(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); m = new javax.swing.JButton(); a = new javax.swing.JTextField(); p = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Nurodykite labirinto matmenis"); jLabel1.setText("Aukstis:"); jLabel2.setText("Plotis:"); m.setText("Kurti"); m.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mActionPerformed(evt); } }); a.setText("4"); a.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { aKeyReleased(evt); } }); p.setText("8"); p.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { pKeyReleased(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(m, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(p, javax.swing.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE) .addComponent(a)))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(a, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(p, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(m) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void aKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_aKeyReleased //idekit ivedimo kontrole }//GEN-LAST:event_aKeyReleased private void pKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_pKeyReleased //ivedimo kontrole }//GEN-LAST:event_pKeyReleased private void mActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mActionPerformed try { auks = Integer.parseInt(a.getText()); plot = Integer.parseInt(p.getText()); this.setVisible(false); } catch (Exception e) { m.setBackground(Color.red); //Jei blogas foratas mygtuka nudazo raudonai } }//GEN-LAST:event_mActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(LabirintoIvedimas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(LabirintoIvedimas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(LabirintoIvedimas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(LabirintoIvedimas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the dialog */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { LabirintoIvedimas dialog = new LabirintoIvedimas(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField a; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JButton m; private javax.swing.JTextField p; // End of variables declaration//GEN-END:variables }
0ee3bfa30737b785c4de3d28b13d56b3aef30cfa
bdb127affae00652a549c8343c07122fefff307d
/app/src/main/java/com/example/sanju/stonepaperscissors/MainActivity.java
830839edbcc900d85677ef2819f61d849e7c19e1
[]
no_license
sanjana2610/RockPaperScissor
00bd632470a454edb16ee232bf08d327db04076a
52b637d61216e0042f54f89e9c3dfa91fcd90271
refs/heads/master
2020-04-01T06:21:44.627526
2018-10-20T05:03:00
2018-10-20T05:03:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,482
java
package com.example.sanju.stonepaperscissors; import android.content.Context; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import java.util.Random; import java.util.Scanner; public class MainActivity extends AppCompatActivity { Button rock,paper,scissor; TextView re,start; TextView points; int score=0; int computerscore=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); rock=findViewById(R.id.r); paper=findViewById(R.id.p); scissor=findViewById(R.id.s); start=(TextView) findViewById(R.id.text1); start.setText("Make a Move"); rock.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { start=(TextView) findViewById(R.id.text1); start.setText(""); Random random=new Random(); String personPlay; //User's play -- "R", "P", or "S" String computerPlay = ""; //Computer's play -- "R", "P", or "S" int computerInt; //Randomly generated number used to determine //computer's play //Generate computer's play (0,1,2) computerInt = random.nextInt(3)+1; //Translate computer's randomly generated play to //string using if //statements if (computerInt == 1) computerPlay = "R"; else if (computerInt == 2) computerPlay = "P"; else if (computerInt == 3) computerPlay = "S"; //Make player's play uppercase for ease of comparison personPlay = "R"; //See who won. Use nested ifs if (personPlay.equals(computerPlay)) { ImageView outp = (ImageView) findViewById(R.id.pcicon ); outp.setImageDrawable(getResources().getDrawable(R.drawable.computer)); ImageView outp3 = (ImageView) findViewById(R.id.usericon ); outp3.setImageDrawable(getResources().getDrawable(R.drawable.user2)); points=(TextView) findViewById(R.id.score); points.setText("PC score: "+Integer.toString(computerscore)+" "+"Your score: "+Integer.toString(score)+" "); ImageView outp1 = (ImageView) findViewById(R.id.pic1 ); outp1.setImageDrawable(getResources().getDrawable(R.drawable.stone)); ImageView outp2 = (ImageView) findViewById(R.id.pic2 ); outp2.setImageDrawable(getResources().getDrawable(R.drawable.stone)); re=(TextView) findViewById(R.id.result); re.setText("It's a tie");} else if (computerPlay.equals("S")){ ImageView outp = (ImageView) findViewById(R.id.pcicon ); outp.setImageDrawable(getResources().getDrawable(R.drawable.computer)); ImageView outp3 = (ImageView) findViewById(R.id.usericon ); outp3.setImageDrawable(getResources().getDrawable(R.drawable.user2)); score++; if (computerscore==10 && score<10){ Intent i = new Intent(MainActivity.this, Main2Activity.class); i.putExtra("PC", computerscore); i.putExtra("USER", score); startActivity(i); }else if(computerscore<10 && score==10){ Intent i = new Intent(MainActivity.this, Main2Activity.class); i.putExtra("PC", computerscore); i.putExtra("USER", score); startActivity(i); } points=(TextView) findViewById(R.id.score); points.setText("PC score: "+Integer.toString(computerscore)+" "+"Your score: "+Integer.toString(score)+" "); ImageView outp1 = (ImageView) findViewById(R.id.pic1); outp1.setImageDrawable(getResources().getDrawable(R.drawable.scissor)); ImageView outp2 = (ImageView) findViewById(R.id.pic2); outp2.setImageDrawable(getResources().getDrawable(R.drawable.stone)); re=(TextView) findViewById(R.id.result); re.setText("You win");} else if (computerPlay.equals("P")){ computerscore++; if (computerscore==10 && score<10){ Intent i = new Intent(MainActivity.this, Main2Activity.class); i.putExtra("PC", computerscore); i.putExtra("USER", score); startActivity(i); }else if(computerscore<10 && score==10){ Intent i = new Intent(MainActivity.this, Main2Activity.class); i.putExtra("PC", computerscore); i.putExtra("USER", score); startActivity(i); } ImageView outp = (ImageView) findViewById(R.id.pcicon ); outp.setImageDrawable(getResources().getDrawable(R.drawable.computer)); ImageView outp3 = (ImageView) findViewById(R.id.usericon ); outp3.setImageDrawable(getResources().getDrawable(R.drawable.user2)); points=(TextView) findViewById(R.id.score); points.setText("PC score: "+Integer.toString(computerscore)+" "+"Your score: "+Integer.toString(score)+" "); ImageView outp1 = (ImageView) findViewById(R.id.pic1); outp1.setImageDrawable(getResources().getDrawable(R.drawable.paper)); ImageView outp2 = (ImageView) findViewById(R.id.pic2); outp2.setImageDrawable(getResources().getDrawable(R.drawable.stone)); re=(TextView) findViewById(R.id.result); re.setText("You lose");} } }); paper.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { start=(TextView) findViewById(R.id.text1); start.setText(""); Random random=new Random(); String personPlay; //User's play -- "R", "P", or "S" String computerPlay = ""; //Computer's play -- "R", "P", or "S" int computerInt; //Randomly generated number used to determine //computer's play //Generate computer's play (0,1,2) computerInt = random.nextInt(3)+1; if (computerInt == 1) computerPlay = "R"; else if (computerInt == 2) computerPlay = "P"; else if (computerInt == 3) computerPlay = "S"; //Make player's play uppercase for ease of comparison personPlay = "P"; //See who won. Use nested ifs if (personPlay.equals(computerPlay)){ ImageView outp = (ImageView) findViewById(R.id.pcicon ); outp.setImageDrawable(getResources().getDrawable(R.drawable.computer)); ImageView outp3 = (ImageView) findViewById(R.id.usericon ); outp3.setImageDrawable(getResources().getDrawable(R.drawable.user2)); points=(TextView) findViewById(R.id.score); points.setText("PC score: "+Integer.toString(computerscore)+" "+"Your score: "+Integer.toString(score)+" "); ImageView outp1 = (ImageView) findViewById(R.id.pic1 ); outp1.setImageDrawable(getResources().getDrawable(R.drawable.paper)); ImageView outp2 = (ImageView) findViewById(R.id.pic2 ); outp2.setImageDrawable(getResources().getDrawable(R.drawable.paper)); re=(TextView) findViewById(R.id.result); re.setText("It's a tie");} else if (computerPlay.equals("S")){ computerscore++; if (computerscore==10 && score<10){ Intent i = new Intent(MainActivity.this, Main2Activity.class); i.putExtra("PC", computerscore); i.putExtra("USER", score); startActivity(i); }else if(computerscore<10 && score==10){ Intent i = new Intent(MainActivity.this, Main2Activity.class); i.putExtra("PC", computerscore); i.putExtra("USER", score); startActivity(i); } ImageView outp = (ImageView) findViewById(R.id.pcicon ); outp.setImageDrawable(getResources().getDrawable(R.drawable.computer)); ImageView outp3 = (ImageView) findViewById(R.id.usericon ); outp3.setImageDrawable(getResources().getDrawable(R.drawable.user2)); points=(TextView) findViewById(R.id.score); points.setText("PC score: "+Integer.toString(computerscore)+" "+"Your score: "+Integer.toString(score)+" "); ImageView outp1 = (ImageView) findViewById(R.id.pic1); outp1.setImageDrawable(getResources().getDrawable(R.drawable.scissor)); ImageView outp2 = (ImageView) findViewById(R.id.pic2); outp2.setImageDrawable(getResources().getDrawable(R.drawable.paper)); re=(TextView) findViewById(R.id.result); re.setText("You lose");} else if (computerPlay.equals("R")){ ImageView outp = (ImageView) findViewById(R.id.pcicon ); outp.setImageDrawable(getResources().getDrawable(R.drawable.computer)); ImageView outp3 = (ImageView) findViewById(R.id.usericon ); outp3.setImageDrawable(getResources().getDrawable(R.drawable.user2)); score++; if (computerscore==10 && score<10){ Intent i = new Intent(MainActivity.this, Main2Activity.class); i.putExtra("PC", computerscore); i.putExtra("USER", score); startActivity(i); }else if(computerscore<10 && score==10){ Intent i = new Intent(MainActivity.this, Main2Activity.class); i.putExtra("PC", computerscore); i.putExtra("USER", score); startActivity(i); } points=(TextView) findViewById(R.id.score); points.setText("PC score: "+Integer.toString(computerscore)+" "+"Your score: "+Integer.toString(score)+" "); ImageView outp1 = (ImageView) findViewById(R.id.pic1); outp1.setImageDrawable(getResources().getDrawable(R.drawable.stone)); ImageView outp2 = (ImageView) findViewById(R.id.pic2); outp2.setImageDrawable(getResources().getDrawable(R.drawable.paper)); re=(TextView) findViewById(R.id.result); re.setText("You win");} } }); scissor.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { start=(TextView) findViewById(R.id.text1); start.setText(""); Random random=new Random(); String personPlay; //User's play -- "R", "P", or "S" String computerPlay = ""; //Computer's play -- "R", "P", or "S" int computerInt; //Randomly generated number used to determine //computer's play //Generate computer's play (0,1,2) computerInt = random.nextInt(3)+1; if (computerInt == 1) //Translate computer's randomly generated play to //string using if //statements computerPlay = "R"; else if (computerInt == 2) computerPlay = "P"; else if (computerInt == 3) computerPlay = "S"; //Make player's play uppercase for ease of comparison personPlay = "S"; //See who won. Use nested ifs if (personPlay.equals(computerPlay)){ ImageView outp = (ImageView) findViewById(R.id.pcicon ); outp.setImageDrawable(getResources().getDrawable(R.drawable.computer)); ImageView outp3 = (ImageView) findViewById(R.id.usericon ); outp3.setImageDrawable(getResources().getDrawable(R.drawable.user2)); points=(TextView) findViewById(R.id.score); points.setText("PC score: "+Integer.toString(computerscore)+" "+"Your score: "+Integer.toString(score)+" "); ImageView outp1 = (ImageView) findViewById(R.id.pic1 ); outp1.setImageDrawable(getResources().getDrawable(R.drawable.scissor)); ImageView outp2 = (ImageView) findViewById(R.id.pic2 ); outp2.setImageDrawable(getResources().getDrawable(R.drawable.scissor)); re=(TextView) findViewById(R.id.result); re.setText("It's a tie");} else if (computerPlay.equals("P")){ ImageView outp = (ImageView) findViewById(R.id.pcicon ); outp.setImageDrawable(getResources().getDrawable(R.drawable.computer)); ImageView outp3 = (ImageView) findViewById(R.id.usericon ); outp3.setImageDrawable(getResources().getDrawable(R.drawable.user2)); score++; if (computerscore==10 && score<10){ Intent i = new Intent(MainActivity.this, Main2Activity.class); i.putExtra("PC", computerscore); i.putExtra("USER", score); startActivity(i); }else if(computerscore<10 && score==10){ Intent i = new Intent(MainActivity.this, Main2Activity.class); i.putExtra("PC", computerscore); i.putExtra("USER", score); startActivity(i); } points=(TextView) findViewById(R.id.score); points.setText("PC score: "+Integer.toString(computerscore)+" "+"Your score: "+Integer.toString(score)+" "); ImageView outp1 = (ImageView) findViewById(R.id.pic1); outp1.setImageDrawable(getResources().getDrawable(R.drawable.paper)); ImageView outp2 = (ImageView) findViewById(R.id.pic2); outp2.setImageDrawable(getResources().getDrawable(R.drawable.scissor)); re=(TextView) findViewById(R.id.result); re.setText("You win");} else if (computerPlay.equals("R")){ computerscore++; if (computerscore==10 && score<10){ Intent i = new Intent(MainActivity.this, Main2Activity.class); i.putExtra("PC", computerscore); i.putExtra("USER", score); startActivity(i); }else if(computerscore<10 && score==10){ Intent i = new Intent(MainActivity.this, Main2Activity.class); i.putExtra("PC", computerscore); i.putExtra("USER", score); startActivity(i); } ImageView outp = (ImageView) findViewById(R.id.pcicon ); outp.setImageDrawable(getResources().getDrawable(R.drawable.computer)); ImageView outp3 = (ImageView) findViewById(R.id.usericon ); outp3.setImageDrawable(getResources().getDrawable(R.drawable.user2)); points=(TextView) findViewById(R.id.score); points.setText("PC score: "+Integer.toString(computerscore)+" "+"Your score: "+Integer.toString(score)+" "); ImageView outp1 = (ImageView) findViewById(R.id.pic1); outp1.setImageDrawable(getResources().getDrawable(R.drawable.stone)); ImageView outp2 = (ImageView) findViewById(R.id.pic2); outp2.setImageDrawable(getResources().getDrawable(R.drawable.scissor)); re=(TextView) findViewById(R.id.result); re.setText("You lose");} } }); } }
093bc6ac2e71ece346ada8faf75ec7b049f24287
6296acd5f8a72da260c5dcf9a7f5d05efa9b8298
/java/com/szgentech/metro/model/MonitorIntervalDataPoint.java
b22d29b88ce69965380adee0a7e844a7ce5a81d0
[]
no_license
luogengbo/learngit
cf01fe5d45fe6463dbe15ad3e1297d850f273804
e18a70d079aa6fb734befa5f1ac0020e387ab87a
refs/heads/master
2021-03-13T01:27:14.936605
2018-07-10T16:10:09
2018-07-10T16:10:09
91,473,400
0
0
null
null
null
null
UTF-8
Java
false
false
1,258
java
package com.szgentech.metro.model; public class MonitorIntervalDataPoint implements java.io.Serializable { private static final long serialVersionUID = -7058279420262531201L; private String spName; //沉降点名称 private float thisVar; //本次变化量 private float sumVar; //累计变化量 private float originMileage; //初始里程 private String monitorDate; //监测日期 public String getSpName() { return spName; } public void setSpName(String spName) { this.spName = spName; } public float getThisVar() { return thisVar; } public void setThisVar(float thisVar) { this.thisVar = thisVar; } public float getSumVar() { return sumVar; } public void setSumVar(float sumVar) { this.sumVar = sumVar; } public float getOriginMileage() { return originMileage; } public void setOriginMileage(float originMileage) { this.originMileage = originMileage; } public String getMonitorDate() { return monitorDate; } public void setMonitorDate(String monitorDate) { this.monitorDate = monitorDate; } @Override public String toString() { return "MonitorIntervalDataPoint [thisVar=" + thisVar + ", sumVar=" + sumVar + ", originMileage=" + originMileage + ", monitorDate=" + monitorDate + "]"; } }
cf1d7b7d35f026cea57a0c71346a1a9bf8d5d3c8
21e4755ed4c11cc493ba5c5dd118141c776d9cd0
/app/build/generated/source/r/debug/android/support/v7/appcompat/R.java
a9523cddca09dba466fa55c0a08d88a5fdcb43f2
[]
no_license
notreniev/VoiceList-free
22d4efccce3d1c01add1b4029e7dd78aab24556c
5ea37270abf76fbe1712c517adcfc6bc9efad113
refs/heads/master
2022-04-03T22:34:49.369578
2019-11-24T17:12:52
2019-11-24T17:12:52
223,779,444
0
0
null
null
null
null
UTF-8
Java
false
false
65,641
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package android.support.v7.appcompat; public final class R { public static final class anim { public static final int abc_fade_in = 0x7f040000; public static final int abc_fade_out = 0x7f040001; public static final int abc_slide_in_bottom = 0x7f040002; public static final int abc_slide_in_top = 0x7f040003; public static final int abc_slide_out_bottom = 0x7f040004; public static final int abc_slide_out_top = 0x7f040005; } public static final class attr { public static final int actionBarDivider = 0x7f01006b; public static final int actionBarItemBackground = 0x7f01006c; public static final int actionBarPopupTheme = 0x7f010065; public static final int actionBarSize = 0x7f01006a; public static final int actionBarSplitStyle = 0x7f010067; public static final int actionBarStyle = 0x7f010066; public static final int actionBarTabBarStyle = 0x7f010061; public static final int actionBarTabStyle = 0x7f010060; public static final int actionBarTabTextStyle = 0x7f010062; public static final int actionBarTheme = 0x7f010068; public static final int actionBarWidgetTheme = 0x7f010069; public static final int actionButtonStyle = 0x7f010083; public static final int actionDropDownStyle = 0x7f01007e; public static final int actionLayout = 0x7f01003d; public static final int actionMenuTextAppearance = 0x7f01006d; public static final int actionMenuTextColor = 0x7f01006e; public static final int actionModeBackground = 0x7f010071; public static final int actionModeCloseButtonStyle = 0x7f010070; public static final int actionModeCloseDrawable = 0x7f010073; public static final int actionModeCopyDrawable = 0x7f010075; public static final int actionModeCutDrawable = 0x7f010074; public static final int actionModeFindDrawable = 0x7f010079; public static final int actionModePasteDrawable = 0x7f010076; public static final int actionModePopupWindowStyle = 0x7f01007b; public static final int actionModeSelectAllDrawable = 0x7f010077; public static final int actionModeShareDrawable = 0x7f010078; public static final int actionModeSplitBackground = 0x7f010072; public static final int actionModeStyle = 0x7f01006f; public static final int actionModeWebSearchDrawable = 0x7f01007a; public static final int actionOverflowButtonStyle = 0x7f010063; public static final int actionOverflowMenuStyle = 0x7f010064; public static final int actionProviderClass = 0x7f01003f; public static final int actionViewClass = 0x7f01003e; public static final int activityChooserViewStyle = 0x7f01008a; public static final int background = 0x7f01000c; public static final int backgroundSplit = 0x7f01000e; public static final int backgroundStacked = 0x7f01000d; public static final int barSize = 0x7f010029; public static final int buttonBarButtonStyle = 0x7f010085; public static final int buttonBarStyle = 0x7f010084; public static final int buttonGravity = 0x7f0100b4; public static final int closeIcon = 0x7f010046; public static final int closeItemLayout = 0x7f01001c; public static final int collapseIcon = 0x7f0100b5; public static final int color = 0x7f010023; public static final int colorAccent = 0x7f0100a5; public static final int colorButtonNormal = 0x7f0100a9; public static final int colorControlActivated = 0x7f0100a7; public static final int colorControlHighlight = 0x7f0100a8; public static final int colorControlNormal = 0x7f0100a6; public static final int colorPrimary = 0x7f0100a3; public static final int colorPrimaryDark = 0x7f0100a4; public static final int colorSwitchThumbNormal = 0x7f0100aa; public static final int commitIcon = 0x7f01004a; public static final int contentInsetEnd = 0x7f010017; public static final int contentInsetLeft = 0x7f010018; public static final int contentInsetRight = 0x7f010019; public static final int contentInsetStart = 0x7f010016; public static final int customNavigationLayout = 0x7f01000f; public static final int disableChildrenWhenDisabled = 0x7f010051; public static final int displayOptions = 0x7f010005; public static final int divider = 0x7f01000b; public static final int dividerHorizontal = 0x7f010089; public static final int dividerPadding = 0x7f01002d; public static final int dividerVertical = 0x7f010088; public static final int drawableSize = 0x7f010025; public static final int drawerArrowStyle = 0x7f010000; public static final int dropDownListViewStyle = 0x7f01009b; public static final int dropdownListPreferredItemHeight = 0x7f01007f; public static final int editTextBackground = 0x7f010090; public static final int editTextColor = 0x7f01008f; public static final int elevation = 0x7f01001a; public static final int expandActivityOverflowButtonDrawable = 0x7f01001e; public static final int gapBetweenBars = 0x7f010026; public static final int goIcon = 0x7f010047; public static final int height = 0x7f010001; public static final int hideOnContentScroll = 0x7f010015; public static final int homeAsUpIndicator = 0x7f010082; public static final int homeLayout = 0x7f010010; public static final int icon = 0x7f010009; public static final int iconifiedByDefault = 0x7f010044; public static final int indeterminateProgressStyle = 0x7f010012; public static final int initialActivityCount = 0x7f01001d; public static final int isLightTheme = 0x7f010002; public static final int itemPadding = 0x7f010014; public static final int layout = 0x7f010043; public static final int listChoiceBackgroundIndicator = 0x7f0100a2; public static final int listPopupWindowStyle = 0x7f01009c; public static final int listPreferredItemHeight = 0x7f010096; public static final int listPreferredItemHeightLarge = 0x7f010098; public static final int listPreferredItemHeightSmall = 0x7f010097; public static final int listPreferredItemPaddingLeft = 0x7f010099; public static final int listPreferredItemPaddingRight = 0x7f01009a; public static final int logo = 0x7f01000a; public static final int maxButtonHeight = 0x7f0100b2; public static final int measureWithLargestChild = 0x7f01002b; public static final int middleBarArrowSize = 0x7f010028; public static final int navigationContentDescription = 0x7f0100b7; public static final int navigationIcon = 0x7f0100b6; public static final int navigationMode = 0x7f010004; public static final int overlapAnchor = 0x7f010041; public static final int paddingEnd = 0x7f0100b9; public static final int paddingStart = 0x7f0100b8; public static final int panelBackground = 0x7f01009f; public static final int panelMenuListTheme = 0x7f0100a1; public static final int panelMenuListWidth = 0x7f0100a0; public static final int popupMenuStyle = 0x7f01008d; public static final int popupPromptView = 0x7f010050; public static final int popupTheme = 0x7f01001b; public static final int popupWindowStyle = 0x7f01008e; public static final int preserveIconSpacing = 0x7f010040; public static final int progressBarPadding = 0x7f010013; public static final int progressBarStyle = 0x7f010011; public static final int prompt = 0x7f01004e; public static final int queryBackground = 0x7f01004c; public static final int queryHint = 0x7f010045; public static final int searchIcon = 0x7f010048; public static final int searchViewStyle = 0x7f010095; public static final int selectableItemBackground = 0x7f010086; public static final int selectableItemBackgroundBorderless = 0x7f010087; public static final int showAsAction = 0x7f01003c; public static final int showDividers = 0x7f01002c; public static final int showText = 0x7f010058; public static final int spinBars = 0x7f010024; public static final int spinnerDropDownItemStyle = 0x7f010081; public static final int spinnerMode = 0x7f01004f; public static final int spinnerStyle = 0x7f010080; public static final int splitTrack = 0x7f010057; public static final int state_above_anchor = 0x7f010042; public static final int submitBackground = 0x7f01004d; public static final int subtitle = 0x7f010006; public static final int subtitleTextAppearance = 0x7f0100ac; public static final int subtitleTextStyle = 0x7f010008; public static final int suggestionRowLayout = 0x7f01004b; public static final int switchMinWidth = 0x7f010055; public static final int switchPadding = 0x7f010056; public static final int switchStyle = 0x7f010091; public static final int switchTextAppearance = 0x7f010054; public static final int textAllCaps = 0x7f010022; public static final int textAppearanceLargePopupMenu = 0x7f01007c; public static final int textAppearanceListItem = 0x7f01009d; public static final int textAppearanceListItemSmall = 0x7f01009e; public static final int textAppearanceSearchResultSubtitle = 0x7f010093; public static final int textAppearanceSearchResultTitle = 0x7f010092; public static final int textAppearanceSmallPopupMenu = 0x7f01007d; public static final int textColorSearchUrl = 0x7f010094; public static final int theme = 0x7f0100b3; public static final int thickness = 0x7f01002a; public static final int thumbTextPadding = 0x7f010053; public static final int title = 0x7f010003; public static final int titleMarginBottom = 0x7f0100b1; public static final int titleMarginEnd = 0x7f0100af; public static final int titleMarginStart = 0x7f0100ae; public static final int titleMarginTop = 0x7f0100b0; public static final int titleMargins = 0x7f0100ad; public static final int titleTextAppearance = 0x7f0100ab; public static final int titleTextStyle = 0x7f010007; public static final int toolbarNavigationButtonStyle = 0x7f01008c; public static final int toolbarStyle = 0x7f01008b; public static final int topBottomBarArrowSize = 0x7f010027; public static final int track = 0x7f010052; public static final int voiceIcon = 0x7f010049; public static final int windowActionBar = 0x7f010059; public static final int windowActionBarOverlay = 0x7f01005a; public static final int windowActionModeOverlay = 0x7f01005b; public static final int windowFixedHeightMajor = 0x7f01005f; public static final int windowFixedHeightMinor = 0x7f01005d; public static final int windowFixedWidthMajor = 0x7f01005c; public static final int windowFixedWidthMinor = 0x7f01005e; } public static final class bool { public static final int abc_action_bar_embed_tabs = 0x7f050000; public static final int abc_action_bar_embed_tabs_pre_jb = 0x7f050001; public static final int abc_action_bar_expanded_action_views_exclusive = 0x7f050002; public static final int abc_config_actionMenuItemAllCaps = 0x7f050003; public static final int abc_config_allowActionMenuItemTextWithIcon = 0x7f050004; public static final int abc_config_showMenuShortcutsWhenKeyboardPresent = 0x7f050005; } public static final class color { public static final int abc_background_cache_hint_selector_material_dark = 0x7f060052; public static final int abc_background_cache_hint_selector_material_light = 0x7f060053; public static final int abc_input_method_navigation_guard = 0x7f060000; public static final int abc_primary_text_disable_only_material_dark = 0x7f060054; public static final int abc_primary_text_disable_only_material_light = 0x7f060055; public static final int abc_primary_text_material_dark = 0x7f060056; public static final int abc_primary_text_material_light = 0x7f060057; public static final int abc_search_url_text = 0x7f060058; public static final int abc_search_url_text_normal = 0x7f060001; public static final int abc_search_url_text_pressed = 0x7f060002; public static final int abc_search_url_text_selected = 0x7f060003; public static final int abc_secondary_text_material_dark = 0x7f060059; public static final int abc_secondary_text_material_light = 0x7f06005a; public static final int accent_material_dark = 0x7f060004; public static final int accent_material_light = 0x7f060005; public static final int background_floating_material_dark = 0x7f060008; public static final int background_floating_material_light = 0x7f060009; public static final int background_material_dark = 0x7f06000a; public static final int background_material_light = 0x7f06000b; public static final int bright_foreground_disabled_material_dark = 0x7f06000c; public static final int bright_foreground_disabled_material_light = 0x7f06000d; public static final int bright_foreground_inverse_material_dark = 0x7f06000e; public static final int bright_foreground_inverse_material_light = 0x7f06000f; public static final int bright_foreground_material_dark = 0x7f060010; public static final int bright_foreground_material_light = 0x7f060011; public static final int button_material_dark = 0x7f060012; public static final int button_material_light = 0x7f060013; public static final int dim_foreground_disabled_material_dark = 0x7f060026; public static final int dim_foreground_disabled_material_light = 0x7f060027; public static final int dim_foreground_material_dark = 0x7f060028; public static final int dim_foreground_material_light = 0x7f060029; public static final int highlighted_text_material_dark = 0x7f06002a; public static final int highlighted_text_material_light = 0x7f06002b; public static final int hint_foreground_material_dark = 0x7f06002c; public static final int hint_foreground_material_light = 0x7f06002d; public static final int link_text_material_dark = 0x7f06002e; public static final int link_text_material_light = 0x7f06002f; public static final int material_blue_grey_800 = 0x7f060030; public static final int material_blue_grey_900 = 0x7f060031; public static final int material_blue_grey_950 = 0x7f060032; public static final int material_deep_teal_200 = 0x7f060033; public static final int material_deep_teal_500 = 0x7f060034; public static final int primary_dark_material_dark = 0x7f060035; public static final int primary_dark_material_light = 0x7f060036; public static final int primary_material_dark = 0x7f060037; public static final int primary_material_light = 0x7f060038; public static final int primary_text_default_material_dark = 0x7f060039; public static final int primary_text_default_material_light = 0x7f06003a; public static final int primary_text_disabled_material_dark = 0x7f06003b; public static final int primary_text_disabled_material_light = 0x7f06003c; public static final int ripple_material_dark = 0x7f06003d; public static final int ripple_material_light = 0x7f06003e; public static final int secondary_text_default_material_dark = 0x7f06003f; public static final int secondary_text_default_material_light = 0x7f060040; public static final int secondary_text_disabled_material_dark = 0x7f060041; public static final int secondary_text_disabled_material_light = 0x7f060042; public static final int switch_thumb_normal_material_dark = 0x7f060043; public static final int switch_thumb_normal_material_light = 0x7f060044; } public static final class dimen { public static final int abc_action_bar_default_height_material = 0x7f080000; public static final int abc_action_bar_default_padding_material = 0x7f080001; public static final int abc_action_bar_icon_vertical_padding_material = 0x7f080002; public static final int abc_action_bar_progress_bar_size = 0x7f080003; public static final int abc_action_bar_stacked_max_height = 0x7f080004; public static final int abc_action_bar_stacked_tab_max_width = 0x7f080005; public static final int abc_action_bar_subtitle_bottom_margin_material = 0x7f080006; public static final int abc_action_bar_subtitle_top_margin_material = 0x7f080007; public static final int abc_action_button_min_height_material = 0x7f080008; public static final int abc_action_button_min_width_material = 0x7f080009; public static final int abc_action_button_min_width_overflow_material = 0x7f08000a; public static final int abc_config_prefDialogWidth = 0x7f08000b; public static final int abc_control_inset_material = 0x7f08000c; public static final int abc_control_padding_material = 0x7f08000d; public static final int abc_dropdownitem_icon_width = 0x7f08000e; public static final int abc_dropdownitem_text_padding_left = 0x7f08000f; public static final int abc_dropdownitem_text_padding_right = 0x7f080010; public static final int abc_panel_menu_list_width = 0x7f080011; public static final int abc_search_view_preferred_width = 0x7f080012; public static final int abc_search_view_text_min_width = 0x7f080013; public static final int abc_text_size_body_1_material = 0x7f080014; public static final int abc_text_size_body_2_material = 0x7f080015; public static final int abc_text_size_button_material = 0x7f080016; public static final int abc_text_size_caption_material = 0x7f080017; public static final int abc_text_size_display_1_material = 0x7f080018; public static final int abc_text_size_display_2_material = 0x7f080019; public static final int abc_text_size_display_3_material = 0x7f08001a; public static final int abc_text_size_display_4_material = 0x7f08001b; public static final int abc_text_size_headline_material = 0x7f08001c; public static final int abc_text_size_large_material = 0x7f08001d; public static final int abc_text_size_medium_material = 0x7f08001e; public static final int abc_text_size_menu_material = 0x7f08001f; public static final int abc_text_size_small_material = 0x7f080020; public static final int abc_text_size_subhead_material = 0x7f080021; public static final int abc_text_size_subtitle_material_toolbar = 0x7f080022; public static final int abc_text_size_title_material = 0x7f080023; public static final int abc_text_size_title_material_toolbar = 0x7f080024; public static final int dialog_fixed_height_major = 0x7f080027; public static final int dialog_fixed_height_minor = 0x7f080028; public static final int dialog_fixed_width_major = 0x7f080029; public static final int dialog_fixed_width_minor = 0x7f08002a; public static final int disabled_alpha_material_dark = 0x7f08002b; public static final int disabled_alpha_material_light = 0x7f08002c; } public static final class drawable { public static final int abc_ab_share_pack_holo_dark = 0x7f020006; public static final int abc_ab_share_pack_holo_light = 0x7f020007; public static final int abc_btn_check_material = 0x7f020008; public static final int abc_btn_check_to_on_mtrl_000 = 0x7f020009; public static final int abc_btn_check_to_on_mtrl_015 = 0x7f02000a; public static final int abc_btn_radio_material = 0x7f02000b; public static final int abc_btn_radio_to_on_mtrl_000 = 0x7f02000c; public static final int abc_btn_radio_to_on_mtrl_015 = 0x7f02000d; public static final int abc_btn_switch_to_on_mtrl_00001 = 0x7f02000e; public static final int abc_btn_switch_to_on_mtrl_00012 = 0x7f02000f; public static final int abc_cab_background_internal_bg = 0x7f020010; public static final int abc_cab_background_top_material = 0x7f020011; public static final int abc_cab_background_top_mtrl_alpha = 0x7f020012; public static final int abc_edit_text_material = 0x7f020013; public static final int abc_ic_ab_back_mtrl_am_alpha = 0x7f020014; public static final int abc_ic_clear_mtrl_alpha = 0x7f020015; public static final int abc_ic_commit_search_api_mtrl_alpha = 0x7f020016; public static final int abc_ic_go_search_api_mtrl_alpha = 0x7f020017; public static final int abc_ic_menu_copy_mtrl_am_alpha = 0x7f020018; public static final int abc_ic_menu_cut_mtrl_alpha = 0x7f020019; public static final int abc_ic_menu_moreoverflow_mtrl_alpha = 0x7f02001a; public static final int abc_ic_menu_paste_mtrl_am_alpha = 0x7f02001b; public static final int abc_ic_menu_selectall_mtrl_alpha = 0x7f02001c; public static final int abc_ic_menu_share_mtrl_alpha = 0x7f02001d; public static final int abc_ic_search_api_mtrl_alpha = 0x7f02001e; public static final int abc_ic_voice_search_api_mtrl_alpha = 0x7f02001f; public static final int abc_item_background_holo_dark = 0x7f020020; public static final int abc_item_background_holo_light = 0x7f020021; public static final int abc_list_divider_mtrl_alpha = 0x7f020022; public static final int abc_list_focused_holo = 0x7f020023; public static final int abc_list_longpressed_holo = 0x7f020024; public static final int abc_list_pressed_holo_dark = 0x7f020025; public static final int abc_list_pressed_holo_light = 0x7f020026; public static final int abc_list_selector_background_transition_holo_dark = 0x7f020027; public static final int abc_list_selector_background_transition_holo_light = 0x7f020028; public static final int abc_list_selector_disabled_holo_dark = 0x7f020029; public static final int abc_list_selector_disabled_holo_light = 0x7f02002a; public static final int abc_list_selector_holo_dark = 0x7f02002b; public static final int abc_list_selector_holo_light = 0x7f02002c; public static final int abc_menu_hardkey_panel_mtrl_mult = 0x7f02002d; public static final int abc_popup_background_mtrl_mult = 0x7f02002e; public static final int abc_spinner_mtrl_am_alpha = 0x7f02002f; public static final int abc_switch_thumb_material = 0x7f020030; public static final int abc_switch_track_mtrl_alpha = 0x7f020031; public static final int abc_tab_indicator_material = 0x7f020032; public static final int abc_tab_indicator_mtrl_alpha = 0x7f020033; public static final int abc_textfield_activated_mtrl_alpha = 0x7f020034; public static final int abc_textfield_default_mtrl_alpha = 0x7f020035; public static final int abc_textfield_search_activated_mtrl_alpha = 0x7f020036; public static final int abc_textfield_search_default_mtrl_alpha = 0x7f020037; public static final int abc_textfield_search_material = 0x7f020038; } public static final class id { public static final int action_bar = 0x7f070044; public static final int action_bar_activity_content = 0x7f070028; public static final int action_bar_container = 0x7f070043; public static final int action_bar_root = 0x7f07003f; public static final int action_bar_spinner = 0x7f070029; public static final int action_bar_subtitle = 0x7f070032; public static final int action_bar_title = 0x7f070031; public static final int action_context_bar = 0x7f070045; public static final int action_menu_divider = 0x7f07002a; public static final int action_menu_presenter = 0x7f07002b; public static final int action_mode_bar = 0x7f070041; public static final int action_mode_bar_stub = 0x7f070040; public static final int action_mode_close_button = 0x7f070033; public static final int activity_chooser_view_content = 0x7f070034; public static final int always = 0x7f070012; public static final int beginning = 0x7f07000a; public static final int bottom = 0x7f070019; public static final int checkbox = 0x7f07003c; public static final int collapseActionView = 0x7f070014; public static final int decor_content_parent = 0x7f070042; public static final int default_activity_button = 0x7f070037; public static final int dialog = 0x7f070015; public static final int disableHome = 0x7f070009; public static final int dropdown = 0x7f070016; public static final int edit_query = 0x7f070046; public static final int end = 0x7f07000c; public static final int expand_activities_button = 0x7f070035; public static final int expanded_menu = 0x7f07003b; public static final int home = 0x7f07002c; public static final int homeAsUp = 0x7f070006; public static final int icon = 0x7f070039; public static final int ifRoom = 0x7f070011; public static final int image = 0x7f070036; public static final int listMode = 0x7f070001; public static final int list_item = 0x7f070038; public static final int middle = 0x7f07000b; public static final int never = 0x7f070010; public static final int none = 0x7f070003; public static final int normal = 0x7f070000; public static final int progress_circular = 0x7f07002d; public static final int progress_horizontal = 0x7f07002e; public static final int radio = 0x7f07003e; public static final int search_badge = 0x7f070048; public static final int search_bar = 0x7f070047; public static final int search_button = 0x7f070049; public static final int search_close_btn = 0x7f07004e; public static final int search_edit_frame = 0x7f07004a; public static final int search_go_btn = 0x7f070050; public static final int search_mag_icon = 0x7f07004b; public static final int search_plate = 0x7f07004c; public static final int search_src_text = 0x7f07004d; public static final int search_voice_btn = 0x7f070051; public static final int shortcut = 0x7f07003d; public static final int showCustom = 0x7f070008; public static final int showHome = 0x7f070005; public static final int showTitle = 0x7f070007; public static final int split_action_bar = 0x7f07002f; public static final int submit_area = 0x7f07004f; public static final int tabMode = 0x7f070002; public static final int title = 0x7f07003a; public static final int top = 0x7f070018; public static final int up = 0x7f070030; public static final int useLogo = 0x7f070004; public static final int withText = 0x7f070013; public static final int wrap_content = 0x7f070017; } public static final class integer { public static final int abc_max_action_buttons = 0x7f090000; } public static final class layout { public static final int abc_action_bar_title_item = 0x7f030000; public static final int abc_action_bar_up_container = 0x7f030001; public static final int abc_action_bar_view_list_nav_layout = 0x7f030002; public static final int abc_action_menu_item_layout = 0x7f030003; public static final int abc_action_menu_layout = 0x7f030004; public static final int abc_action_mode_bar = 0x7f030005; public static final int abc_action_mode_close_item_material = 0x7f030006; public static final int abc_activity_chooser_view = 0x7f030007; public static final int abc_activity_chooser_view_include = 0x7f030008; public static final int abc_activity_chooser_view_list_item = 0x7f030009; public static final int abc_expanded_menu_layout = 0x7f03000a; public static final int abc_list_menu_item_checkbox = 0x7f03000b; public static final int abc_list_menu_item_icon = 0x7f03000c; public static final int abc_list_menu_item_layout = 0x7f03000d; public static final int abc_list_menu_item_radio = 0x7f03000e; public static final int abc_popup_menu_item_layout = 0x7f03000f; public static final int abc_screen_content_include = 0x7f030010; public static final int abc_screen_simple = 0x7f030011; public static final int abc_screen_simple_overlay_action_mode = 0x7f030012; public static final int abc_screen_toolbar = 0x7f030013; public static final int abc_search_dropdown_item_icons_2line = 0x7f030014; public static final int abc_search_view = 0x7f030015; public static final int abc_simple_dropdown_hint = 0x7f030016; public static final int support_simple_spinner_dropdown_item = 0x7f030023; } public static final class string { public static final int abc_action_bar_home_description = 0x7f0a0000; public static final int abc_action_bar_home_description_format = 0x7f0a0001; public static final int abc_action_bar_home_subtitle_description_format = 0x7f0a0002; public static final int abc_action_bar_up_description = 0x7f0a0003; public static final int abc_action_menu_overflow_description = 0x7f0a0004; public static final int abc_action_mode_done = 0x7f0a0005; public static final int abc_activity_chooser_view_see_all = 0x7f0a0006; public static final int abc_activitychooserview_choose_application = 0x7f0a0007; public static final int abc_searchview_description_clear = 0x7f0a0008; public static final int abc_searchview_description_query = 0x7f0a0009; public static final int abc_searchview_description_search = 0x7f0a000a; public static final int abc_searchview_description_submit = 0x7f0a000b; public static final int abc_searchview_description_voice = 0x7f0a000c; public static final int abc_shareactionprovider_share_with = 0x7f0a000d; public static final int abc_shareactionprovider_share_with_application = 0x7f0a000e; } public static final class style { public static final int Base_TextAppearance_AppCompat = 0x7f0b0005; public static final int Base_TextAppearance_AppCompat_Body1 = 0x7f0b0006; public static final int Base_TextAppearance_AppCompat_Body2 = 0x7f0b0007; public static final int Base_TextAppearance_AppCompat_Button = 0x7f0b0008; public static final int Base_TextAppearance_AppCompat_Caption = 0x7f0b0009; public static final int Base_TextAppearance_AppCompat_Display1 = 0x7f0b000a; public static final int Base_TextAppearance_AppCompat_Display2 = 0x7f0b000b; public static final int Base_TextAppearance_AppCompat_Display3 = 0x7f0b000c; public static final int Base_TextAppearance_AppCompat_Display4 = 0x7f0b000d; public static final int Base_TextAppearance_AppCompat_Headline = 0x7f0b000e; public static final int Base_TextAppearance_AppCompat_Inverse = 0x7f0b000f; public static final int Base_TextAppearance_AppCompat_Large = 0x7f0b0010; public static final int Base_TextAppearance_AppCompat_Large_Inverse = 0x7f0b0011; public static final int Base_TextAppearance_AppCompat_Light_Widget_PopupMenu_Large = 0x7f0b0012; public static final int Base_TextAppearance_AppCompat_Light_Widget_PopupMenu_Small = 0x7f0b0013; public static final int Base_TextAppearance_AppCompat_Medium = 0x7f0b0014; public static final int Base_TextAppearance_AppCompat_Medium_Inverse = 0x7f0b0015; public static final int Base_TextAppearance_AppCompat_Menu = 0x7f0b0016; public static final int Base_TextAppearance_AppCompat_SearchResult = 0x7f0b0017; public static final int Base_TextAppearance_AppCompat_SearchResult_Subtitle = 0x7f0b0018; public static final int Base_TextAppearance_AppCompat_SearchResult_Title = 0x7f0b0019; public static final int Base_TextAppearance_AppCompat_Small = 0x7f0b001a; public static final int Base_TextAppearance_AppCompat_Small_Inverse = 0x7f0b001b; public static final int Base_TextAppearance_AppCompat_Subhead = 0x7f0b001c; public static final int Base_TextAppearance_AppCompat_Subhead_Inverse = 0x7f0b001d; public static final int Base_TextAppearance_AppCompat_Title = 0x7f0b001e; public static final int Base_TextAppearance_AppCompat_Title_Inverse = 0x7f0b001f; public static final int Base_TextAppearance_AppCompat_Widget_ActionBar_Menu = 0x7f0b0020; public static final int Base_TextAppearance_AppCompat_Widget_ActionBar_Subtitle = 0x7f0b0021; public static final int Base_TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse = 0x7f0b0022; public static final int Base_TextAppearance_AppCompat_Widget_ActionBar_Title = 0x7f0b0023; public static final int Base_TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse = 0x7f0b0024; public static final int Base_TextAppearance_AppCompat_Widget_ActionMode_Subtitle = 0x7f0b0025; public static final int Base_TextAppearance_AppCompat_Widget_ActionMode_Title = 0x7f0b0026; public static final int Base_TextAppearance_AppCompat_Widget_DropDownItem = 0x7f0b0027; public static final int Base_TextAppearance_AppCompat_Widget_PopupMenu_Large = 0x7f0b0028; public static final int Base_TextAppearance_AppCompat_Widget_PopupMenu_Small = 0x7f0b0029; public static final int Base_TextAppearance_AppCompat_Widget_Switch = 0x7f0b002a; public static final int Base_TextAppearance_Widget_AppCompat_ExpandedMenu_Item = 0x7f0b002b; public static final int Base_TextAppearance_Widget_AppCompat_Toolbar_Subtitle = 0x7f0b002c; public static final int Base_TextAppearance_Widget_AppCompat_Toolbar_Title = 0x7f0b002d; public static final int Base_ThemeOverlay_AppCompat = 0x7f0b0038; public static final int Base_ThemeOverlay_AppCompat_ActionBar = 0x7f0b0039; public static final int Base_ThemeOverlay_AppCompat_Dark = 0x7f0b003a; public static final int Base_ThemeOverlay_AppCompat_Dark_ActionBar = 0x7f0b003b; public static final int Base_ThemeOverlay_AppCompat_Light = 0x7f0b003c; public static final int Base_Theme_AppCompat = 0x7f0b002e; public static final int Base_Theme_AppCompat_CompactMenu = 0x7f0b002f; public static final int Base_Theme_AppCompat_Dialog = 0x7f0b0030; public static final int Base_Theme_AppCompat_DialogWhenLarge = 0x7f0b0032; public static final int Base_Theme_AppCompat_Dialog_FixedSize = 0x7f0b0031; public static final int Base_Theme_AppCompat_Light = 0x7f0b0033; public static final int Base_Theme_AppCompat_Light_DarkActionBar = 0x7f0b0034; public static final int Base_Theme_AppCompat_Light_Dialog = 0x7f0b0035; public static final int Base_Theme_AppCompat_Light_DialogWhenLarge = 0x7f0b0037; public static final int Base_Theme_AppCompat_Light_Dialog_FixedSize = 0x7f0b0036; public static final int Base_V11_Theme_AppCompat = 0x7f0b00f6; public static final int Base_V11_Theme_AppCompat_Dialog = 0x7f0b00f7; public static final int Base_V11_Theme_AppCompat_Light = 0x7f0b00f8; public static final int Base_V11_Theme_AppCompat_Light_Dialog = 0x7f0b00f9; public static final int Base_V14_Theme_AppCompat = 0x7f0b00fa; public static final int Base_V14_Theme_AppCompat_Dialog = 0x7f0b00fb; public static final int Base_V14_Theme_AppCompat_Light = 0x7f0b00fc; public static final int Base_V14_Theme_AppCompat_Light_Dialog = 0x7f0b00fd; public static final int Base_V21_Theme_AppCompat = 0x7f0b00fe; public static final int Base_V21_Theme_AppCompat_Dialog = 0x7f0b00ff; public static final int Base_V21_Theme_AppCompat_Light = 0x7f0b0100; public static final int Base_V21_Theme_AppCompat_Light_Dialog = 0x7f0b0101; public static final int Base_V7_Theme_AppCompat = 0x7f0b003d; public static final int Base_V7_Theme_AppCompat_Dialog = 0x7f0b003e; public static final int Base_V7_Theme_AppCompat_Light = 0x7f0b003f; public static final int Base_Widget_AppCompat_ActionBar = 0x7f0b0040; public static final int Base_Widget_AppCompat_ActionBar_Solid = 0x7f0b0041; public static final int Base_Widget_AppCompat_ActionBar_TabBar = 0x7f0b0042; public static final int Base_Widget_AppCompat_ActionBar_TabText = 0x7f0b0043; public static final int Base_Widget_AppCompat_ActionBar_TabView = 0x7f0b0044; public static final int Base_Widget_AppCompat_ActionButton = 0x7f0b0045; public static final int Base_Widget_AppCompat_ActionButton_CloseMode = 0x7f0b0046; public static final int Base_Widget_AppCompat_ActionButton_Overflow = 0x7f0b0047; public static final int Base_Widget_AppCompat_ActionMode = 0x7f0b0048; public static final int Base_Widget_AppCompat_ActivityChooserView = 0x7f0b0049; public static final int Base_Widget_AppCompat_AutoCompleteTextView = 0x7f0b004a; public static final int Base_Widget_AppCompat_CompoundButton_Switch = 0x7f0b004b; public static final int Base_Widget_AppCompat_DrawerArrowToggle = 0x7f0b004c; public static final int Base_Widget_AppCompat_DropDownItem_Spinner = 0x7f0b004d; public static final int Base_Widget_AppCompat_EditText = 0x7f0b004e; public static final int Base_Widget_AppCompat_Light_ActionBar = 0x7f0b004f; public static final int Base_Widget_AppCompat_Light_ActionBar_Solid = 0x7f0b0050; public static final int Base_Widget_AppCompat_Light_ActionBar_TabBar = 0x7f0b0051; public static final int Base_Widget_AppCompat_Light_ActionBar_TabText = 0x7f0b0052; public static final int Base_Widget_AppCompat_Light_ActionBar_TabText_Inverse = 0x7f0b0053; public static final int Base_Widget_AppCompat_Light_ActionBar_TabView = 0x7f0b0054; public static final int Base_Widget_AppCompat_Light_ActivityChooserView = 0x7f0b0055; public static final int Base_Widget_AppCompat_Light_AutoCompleteTextView = 0x7f0b0056; public static final int Base_Widget_AppCompat_Light_PopupMenu = 0x7f0b0057; public static final int Base_Widget_AppCompat_Light_PopupMenu_Overflow = 0x7f0b0058; public static final int Base_Widget_AppCompat_ListPopupWindow = 0x7f0b0059; public static final int Base_Widget_AppCompat_ListView_DropDown = 0x7f0b005a; public static final int Base_Widget_AppCompat_ListView_Menu = 0x7f0b005b; public static final int Base_Widget_AppCompat_PopupMenu = 0x7f0b005c; public static final int Base_Widget_AppCompat_PopupMenu_Overflow = 0x7f0b005d; public static final int Base_Widget_AppCompat_PopupWindow = 0x7f0b005e; public static final int Base_Widget_AppCompat_ProgressBar = 0x7f0b005f; public static final int Base_Widget_AppCompat_ProgressBar_Horizontal = 0x7f0b0060; public static final int Base_Widget_AppCompat_SearchView = 0x7f0b0061; public static final int Base_Widget_AppCompat_Spinner = 0x7f0b0062; public static final int Base_Widget_AppCompat_Spinner_DropDown_ActionBar = 0x7f0b0063; public static final int Base_Widget_AppCompat_Toolbar = 0x7f0b0064; public static final int Base_Widget_AppCompat_Toolbar_Button_Navigation = 0x7f0b0065; public static final int Platform_AppCompat = 0x7f0b006f; public static final int Platform_AppCompat_Dialog = 0x7f0b0070; public static final int Platform_AppCompat_Light = 0x7f0b0071; public static final int Platform_AppCompat_Light_Dialog = 0x7f0b0072; public static final int RtlOverlay_Widget_AppCompat_ActionBar_TitleItem = 0x7f0b0075; public static final int RtlOverlay_Widget_AppCompat_ActionButton_CloseMode = 0x7f0b0076; public static final int RtlOverlay_Widget_AppCompat_ActionButton_Overflow = 0x7f0b0077; public static final int RtlOverlay_Widget_AppCompat_PopupMenuItem = 0x7f0b0078; public static final int RtlOverlay_Widget_AppCompat_PopupMenuItem_InternalGroup = 0x7f0b0079; public static final int RtlOverlay_Widget_AppCompat_PopupMenuItem_Text = 0x7f0b007a; public static final int RtlOverlay_Widget_AppCompat_SearchView_MagIcon = 0x7f0b0080; public static final int RtlOverlay_Widget_AppCompat_Search_DropDown = 0x7f0b007b; public static final int RtlOverlay_Widget_AppCompat_Search_DropDown_Icon1 = 0x7f0b007c; public static final int RtlOverlay_Widget_AppCompat_Search_DropDown_Icon2 = 0x7f0b007d; public static final int RtlOverlay_Widget_AppCompat_Search_DropDown_Query = 0x7f0b007e; public static final int RtlOverlay_Widget_AppCompat_Search_DropDown_Text = 0x7f0b007f; public static final int TextAppearance_AppCompat = 0x7f0b0081; public static final int TextAppearance_AppCompat_Body1 = 0x7f0b0082; public static final int TextAppearance_AppCompat_Body2 = 0x7f0b0083; public static final int TextAppearance_AppCompat_Button = 0x7f0b0084; public static final int TextAppearance_AppCompat_Caption = 0x7f0b0085; public static final int TextAppearance_AppCompat_Display1 = 0x7f0b0086; public static final int TextAppearance_AppCompat_Display2 = 0x7f0b0087; public static final int TextAppearance_AppCompat_Display3 = 0x7f0b0088; public static final int TextAppearance_AppCompat_Display4 = 0x7f0b0089; public static final int TextAppearance_AppCompat_Headline = 0x7f0b008a; public static final int TextAppearance_AppCompat_Inverse = 0x7f0b008b; public static final int TextAppearance_AppCompat_Large = 0x7f0b008c; public static final int TextAppearance_AppCompat_Large_Inverse = 0x7f0b008d; public static final int TextAppearance_AppCompat_Light_SearchResult_Subtitle = 0x7f0b008e; public static final int TextAppearance_AppCompat_Light_SearchResult_Title = 0x7f0b008f; public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Large = 0x7f0b0090; public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Small = 0x7f0b0091; public static final int TextAppearance_AppCompat_Medium = 0x7f0b0092; public static final int TextAppearance_AppCompat_Medium_Inverse = 0x7f0b0093; public static final int TextAppearance_AppCompat_Menu = 0x7f0b0094; public static final int TextAppearance_AppCompat_SearchResult_Subtitle = 0x7f0b0095; public static final int TextAppearance_AppCompat_SearchResult_Title = 0x7f0b0096; public static final int TextAppearance_AppCompat_Small = 0x7f0b0097; public static final int TextAppearance_AppCompat_Small_Inverse = 0x7f0b0098; public static final int TextAppearance_AppCompat_Subhead = 0x7f0b0099; public static final int TextAppearance_AppCompat_Subhead_Inverse = 0x7f0b009a; public static final int TextAppearance_AppCompat_Title = 0x7f0b009b; public static final int TextAppearance_AppCompat_Title_Inverse = 0x7f0b009c; public static final int TextAppearance_AppCompat_Widget_ActionBar_Menu = 0x7f0b009d; public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle = 0x7f0b009e; public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse = 0x7f0b009f; public static final int TextAppearance_AppCompat_Widget_ActionBar_Title = 0x7f0b00a0; public static final int TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse = 0x7f0b00a1; public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle = 0x7f0b00a2; public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle_Inverse = 0x7f0b00a3; public static final int TextAppearance_AppCompat_Widget_ActionMode_Title = 0x7f0b00a4; public static final int TextAppearance_AppCompat_Widget_ActionMode_Title_Inverse = 0x7f0b00a5; public static final int TextAppearance_AppCompat_Widget_DropDownItem = 0x7f0b00a6; public static final int TextAppearance_AppCompat_Widget_PopupMenu_Large = 0x7f0b00a7; public static final int TextAppearance_AppCompat_Widget_PopupMenu_Small = 0x7f0b00a8; public static final int TextAppearance_AppCompat_Widget_Switch = 0x7f0b00a9; public static final int TextAppearance_Widget_AppCompat_ExpandedMenu_Item = 0x7f0b00aa; public static final int TextAppearance_Widget_AppCompat_Toolbar_Subtitle = 0x7f0b00ab; public static final int TextAppearance_Widget_AppCompat_Toolbar_Title = 0x7f0b00ac; public static final int ThemeOverlay_AppCompat = 0x7f0b00ba; public static final int ThemeOverlay_AppCompat_ActionBar = 0x7f0b00bb; public static final int ThemeOverlay_AppCompat_Dark = 0x7f0b00bc; public static final int ThemeOverlay_AppCompat_Dark_ActionBar = 0x7f0b00bd; public static final int ThemeOverlay_AppCompat_Light = 0x7f0b00be; public static final int Theme_AppCompat = 0x7f0b00ad; public static final int Theme_AppCompat_CompactMenu = 0x7f0b00ae; public static final int Theme_AppCompat_Dialog = 0x7f0b00af; public static final int Theme_AppCompat_DialogWhenLarge = 0x7f0b00b0; public static final int Theme_AppCompat_Light = 0x7f0b00b1; public static final int Theme_AppCompat_Light_DarkActionBar = 0x7f0b00b2; public static final int Theme_AppCompat_Light_Dialog = 0x7f0b00b3; public static final int Theme_AppCompat_Light_DialogWhenLarge = 0x7f0b00b4; public static final int Theme_AppCompat_Light_NoActionBar = 0x7f0b00b5; public static final int Theme_AppCompat_NoActionBar = 0x7f0b00b6; public static final int Widget_AppCompat_ActionBar = 0x7f0b00c3; public static final int Widget_AppCompat_ActionBar_Solid = 0x7f0b00c4; public static final int Widget_AppCompat_ActionBar_TabBar = 0x7f0b00c5; public static final int Widget_AppCompat_ActionBar_TabText = 0x7f0b00c6; public static final int Widget_AppCompat_ActionBar_TabView = 0x7f0b00c7; public static final int Widget_AppCompat_ActionButton = 0x7f0b00c8; public static final int Widget_AppCompat_ActionButton_CloseMode = 0x7f0b00c9; public static final int Widget_AppCompat_ActionButton_Overflow = 0x7f0b00ca; public static final int Widget_AppCompat_ActionMode = 0x7f0b00cb; public static final int Widget_AppCompat_ActivityChooserView = 0x7f0b00cc; public static final int Widget_AppCompat_AutoCompleteTextView = 0x7f0b00cd; public static final int Widget_AppCompat_CompoundButton_Switch = 0x7f0b00ce; public static final int Widget_AppCompat_DrawerArrowToggle = 0x7f0b00cf; public static final int Widget_AppCompat_DropDownItem_Spinner = 0x7f0b00d0; public static final int Widget_AppCompat_EditText = 0x7f0b00d1; public static final int Widget_AppCompat_Light_ActionBar = 0x7f0b00d2; public static final int Widget_AppCompat_Light_ActionBar_Solid = 0x7f0b00d3; public static final int Widget_AppCompat_Light_ActionBar_Solid_Inverse = 0x7f0b00d4; public static final int Widget_AppCompat_Light_ActionBar_TabBar = 0x7f0b00d5; public static final int Widget_AppCompat_Light_ActionBar_TabBar_Inverse = 0x7f0b00d6; public static final int Widget_AppCompat_Light_ActionBar_TabText = 0x7f0b00d7; public static final int Widget_AppCompat_Light_ActionBar_TabText_Inverse = 0x7f0b00d8; public static final int Widget_AppCompat_Light_ActionBar_TabView = 0x7f0b00d9; public static final int Widget_AppCompat_Light_ActionBar_TabView_Inverse = 0x7f0b00da; public static final int Widget_AppCompat_Light_ActionButton = 0x7f0b00db; public static final int Widget_AppCompat_Light_ActionButton_CloseMode = 0x7f0b00dc; public static final int Widget_AppCompat_Light_ActionButton_Overflow = 0x7f0b00dd; public static final int Widget_AppCompat_Light_ActionMode_Inverse = 0x7f0b00de; public static final int Widget_AppCompat_Light_ActivityChooserView = 0x7f0b00df; public static final int Widget_AppCompat_Light_AutoCompleteTextView = 0x7f0b00e0; public static final int Widget_AppCompat_Light_DropDownItem_Spinner = 0x7f0b00e1; public static final int Widget_AppCompat_Light_ListPopupWindow = 0x7f0b00e2; public static final int Widget_AppCompat_Light_ListView_DropDown = 0x7f0b00e3; public static final int Widget_AppCompat_Light_PopupMenu = 0x7f0b00e4; public static final int Widget_AppCompat_Light_PopupMenu_Overflow = 0x7f0b00e5; public static final int Widget_AppCompat_Light_SearchView = 0x7f0b00e6; public static final int Widget_AppCompat_Light_Spinner_DropDown_ActionBar = 0x7f0b00e7; public static final int Widget_AppCompat_ListPopupWindow = 0x7f0b00e8; public static final int Widget_AppCompat_ListView_DropDown = 0x7f0b00e9; public static final int Widget_AppCompat_ListView_Menu = 0x7f0b00ea; public static final int Widget_AppCompat_PopupMenu = 0x7f0b00eb; public static final int Widget_AppCompat_PopupMenu_Overflow = 0x7f0b00ec; public static final int Widget_AppCompat_PopupWindow = 0x7f0b00ed; public static final int Widget_AppCompat_ProgressBar = 0x7f0b00ee; public static final int Widget_AppCompat_ProgressBar_Horizontal = 0x7f0b00ef; public static final int Widget_AppCompat_SearchView = 0x7f0b00f0; public static final int Widget_AppCompat_Spinner = 0x7f0b00f1; public static final int Widget_AppCompat_Spinner_DropDown = 0x7f0b00f2; public static final int Widget_AppCompat_Spinner_DropDown_ActionBar = 0x7f0b00f3; public static final int Widget_AppCompat_Toolbar = 0x7f0b00f4; public static final int Widget_AppCompat_Toolbar_Button_Navigation = 0x7f0b00f5; } public static final class styleable { public static final int[] ActionBar = { 0x7f010001, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, 0x7f010010, 0x7f010011, 0x7f010012, 0x7f010013, 0x7f010014, 0x7f010015, 0x7f010016, 0x7f010017, 0x7f010018, 0x7f010019, 0x7f01001a, 0x7f01001b, 0x7f010082 }; public static final int[] ActionBarLayout = { 0x010100b3 }; public static final int ActionBarLayout_android_layout_gravity = 0; public static final int ActionBar_background = 10; public static final int ActionBar_backgroundSplit = 12; public static final int ActionBar_backgroundStacked = 11; public static final int ActionBar_contentInsetEnd = 21; public static final int ActionBar_contentInsetLeft = 22; public static final int ActionBar_contentInsetRight = 23; public static final int ActionBar_contentInsetStart = 20; public static final int ActionBar_customNavigationLayout = 13; public static final int ActionBar_displayOptions = 3; public static final int ActionBar_divider = 9; public static final int ActionBar_elevation = 24; public static final int ActionBar_height = 0; public static final int ActionBar_hideOnContentScroll = 19; public static final int ActionBar_homeAsUpIndicator = 26; public static final int ActionBar_homeLayout = 14; public static final int ActionBar_icon = 7; public static final int ActionBar_indeterminateProgressStyle = 16; public static final int ActionBar_itemPadding = 18; public static final int ActionBar_logo = 8; public static final int ActionBar_navigationMode = 2; public static final int ActionBar_popupTheme = 25; public static final int ActionBar_progressBarPadding = 17; public static final int ActionBar_progressBarStyle = 15; public static final int ActionBar_subtitle = 4; public static final int ActionBar_subtitleTextStyle = 6; public static final int ActionBar_title = 1; public static final int ActionBar_titleTextStyle = 5; public static final int[] ActionMenuItemView = { 0x0101013f }; public static final int ActionMenuItemView_android_minWidth = 0; public static final int[] ActionMenuView = { }; public static final int[] ActionMode = { 0x7f010001, 0x7f010007, 0x7f010008, 0x7f01000c, 0x7f01000e, 0x7f01001c }; public static final int ActionMode_background = 3; public static final int ActionMode_backgroundSplit = 4; public static final int ActionMode_closeItemLayout = 5; public static final int ActionMode_height = 0; public static final int ActionMode_subtitleTextStyle = 2; public static final int ActionMode_titleTextStyle = 1; public static final int[] ActivityChooserView = { 0x7f01001d, 0x7f01001e }; public static final int ActivityChooserView_expandActivityOverflowButtonDrawable = 1; public static final int ActivityChooserView_initialActivityCount = 0; public static final int[] CompatTextView = { 0x7f010022 }; public static final int CompatTextView_textAllCaps = 0; public static final int[] DrawerArrowToggle = { 0x7f010023, 0x7f010024, 0x7f010025, 0x7f010026, 0x7f010027, 0x7f010028, 0x7f010029, 0x7f01002a }; public static final int DrawerArrowToggle_barSize = 6; public static final int DrawerArrowToggle_color = 0; public static final int DrawerArrowToggle_drawableSize = 2; public static final int DrawerArrowToggle_gapBetweenBars = 3; public static final int DrawerArrowToggle_middleBarArrowSize = 5; public static final int DrawerArrowToggle_spinBars = 1; public static final int DrawerArrowToggle_thickness = 7; public static final int DrawerArrowToggle_topBottomBarArrowSize = 4; public static final int[] LinearLayoutCompat = { 0x010100af, 0x010100c4, 0x01010126, 0x01010127, 0x01010128, 0x7f01000b, 0x7f01002b, 0x7f01002c, 0x7f01002d }; public static final int[] LinearLayoutCompat_Layout = { 0x010100b3, 0x010100f4, 0x010100f5, 0x01010181 }; public static final int LinearLayoutCompat_Layout_android_layout_gravity = 0; public static final int LinearLayoutCompat_Layout_android_layout_height = 2; public static final int LinearLayoutCompat_Layout_android_layout_weight = 3; public static final int LinearLayoutCompat_Layout_android_layout_width = 1; public static final int LinearLayoutCompat_android_baselineAligned = 2; public static final int LinearLayoutCompat_android_baselineAlignedChildIndex = 3; public static final int LinearLayoutCompat_android_gravity = 0; public static final int LinearLayoutCompat_android_orientation = 1; public static final int LinearLayoutCompat_android_weightSum = 4; public static final int LinearLayoutCompat_divider = 5; public static final int LinearLayoutCompat_dividerPadding = 8; public static final int LinearLayoutCompat_measureWithLargestChild = 6; public static final int LinearLayoutCompat_showDividers = 7; public static final int[] ListPopupWindow = { 0x010102ac, 0x010102ad }; public static final int ListPopupWindow_android_dropDownHorizontalOffset = 0; public static final int ListPopupWindow_android_dropDownVerticalOffset = 1; public static final int[] MenuGroup = { 0x0101000e, 0x010100d0, 0x01010194, 0x010101de, 0x010101df, 0x010101e0 }; public static final int MenuGroup_android_checkableBehavior = 5; public static final int MenuGroup_android_enabled = 0; public static final int MenuGroup_android_id = 1; public static final int MenuGroup_android_menuCategory = 3; public static final int MenuGroup_android_orderInCategory = 4; public static final int MenuGroup_android_visible = 2; public static final int[] MenuItem = { 0x01010002, 0x0101000e, 0x010100d0, 0x01010106, 0x01010194, 0x010101de, 0x010101df, 0x010101e1, 0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5, 0x0101026f, 0x7f01003c, 0x7f01003d, 0x7f01003e, 0x7f01003f }; public static final int MenuItem_actionLayout = 14; public static final int MenuItem_actionProviderClass = 16; public static final int MenuItem_actionViewClass = 15; public static final int MenuItem_android_alphabeticShortcut = 9; public static final int MenuItem_android_checkable = 11; public static final int MenuItem_android_checked = 3; public static final int MenuItem_android_enabled = 1; public static final int MenuItem_android_icon = 0; public static final int MenuItem_android_id = 2; public static final int MenuItem_android_menuCategory = 5; public static final int MenuItem_android_numericShortcut = 10; public static final int MenuItem_android_onClick = 12; public static final int MenuItem_android_orderInCategory = 6; public static final int MenuItem_android_title = 7; public static final int MenuItem_android_titleCondensed = 8; public static final int MenuItem_android_visible = 4; public static final int MenuItem_showAsAction = 13; public static final int[] MenuView = { 0x010100ae, 0x0101012c, 0x0101012d, 0x0101012e, 0x0101012f, 0x01010130, 0x01010131, 0x7f010040 }; public static final int MenuView_android_headerBackground = 4; public static final int MenuView_android_horizontalDivider = 2; public static final int MenuView_android_itemBackground = 5; public static final int MenuView_android_itemIconDisabledAlpha = 6; public static final int MenuView_android_itemTextAppearance = 1; public static final int MenuView_android_verticalDivider = 3; public static final int MenuView_android_windowAnimationStyle = 0; public static final int MenuView_preserveIconSpacing = 7; public static final int[] PopupWindow = { 0x01010176, 0x7f010041 }; public static final int[] PopupWindowBackgroundState = { 0x7f010042 }; public static final int PopupWindowBackgroundState_state_above_anchor = 0; public static final int PopupWindow_android_popupBackground = 0; public static final int PopupWindow_overlapAnchor = 1; public static final int[] SearchView = { 0x010100da, 0x0101011f, 0x01010220, 0x01010264, 0x7f010043, 0x7f010044, 0x7f010045, 0x7f010046, 0x7f010047, 0x7f010048, 0x7f010049, 0x7f01004a, 0x7f01004b, 0x7f01004c, 0x7f01004d }; public static final int SearchView_android_focusable = 0; public static final int SearchView_android_imeOptions = 3; public static final int SearchView_android_inputType = 2; public static final int SearchView_android_maxWidth = 1; public static final int SearchView_closeIcon = 7; public static final int SearchView_commitIcon = 11; public static final int SearchView_goIcon = 8; public static final int SearchView_iconifiedByDefault = 5; public static final int SearchView_layout = 4; public static final int SearchView_queryBackground = 13; public static final int SearchView_queryHint = 6; public static final int SearchView_searchIcon = 9; public static final int SearchView_submitBackground = 14; public static final int SearchView_suggestionRowLayout = 12; public static final int SearchView_voiceIcon = 10; public static final int[] Spinner = { 0x010100af, 0x010100d4, 0x01010175, 0x01010176, 0x01010262, 0x010102ac, 0x010102ad, 0x7f01004e, 0x7f01004f, 0x7f010050, 0x7f010051 }; public static final int Spinner_android_background = 1; public static final int Spinner_android_dropDownHorizontalOffset = 5; public static final int Spinner_android_dropDownSelector = 2; public static final int Spinner_android_dropDownVerticalOffset = 6; public static final int Spinner_android_dropDownWidth = 4; public static final int Spinner_android_gravity = 0; public static final int Spinner_android_popupBackground = 3; public static final int Spinner_disableChildrenWhenDisabled = 10; public static final int Spinner_popupPromptView = 9; public static final int Spinner_prompt = 7; public static final int Spinner_spinnerMode = 8; public static final int[] SwitchCompat = { 0x01010124, 0x01010125, 0x01010142, 0x7f010052, 0x7f010053, 0x7f010054, 0x7f010055, 0x7f010056, 0x7f010057, 0x7f010058 }; public static final int SwitchCompat_android_textOff = 1; public static final int SwitchCompat_android_textOn = 0; public static final int SwitchCompat_android_thumb = 2; public static final int SwitchCompat_showText = 9; public static final int SwitchCompat_splitTrack = 8; public static final int SwitchCompat_switchMinWidth = 6; public static final int SwitchCompat_switchPadding = 7; public static final int SwitchCompat_switchTextAppearance = 5; public static final int SwitchCompat_thumbTextPadding = 4; public static final int SwitchCompat_track = 3; public static final int[] Theme = { 0x01010057, 0x7f010059, 0x7f01005a, 0x7f01005b, 0x7f01005c, 0x7f01005d, 0x7f01005e, 0x7f01005f, 0x7f010060, 0x7f010061, 0x7f010062, 0x7f010063, 0x7f010064, 0x7f010065, 0x7f010066, 0x7f010067, 0x7f010068, 0x7f010069, 0x7f01006a, 0x7f01006b, 0x7f01006c, 0x7f01006d, 0x7f01006e, 0x7f01006f, 0x7f010070, 0x7f010071, 0x7f010072, 0x7f010073, 0x7f010074, 0x7f010075, 0x7f010076, 0x7f010077, 0x7f010078, 0x7f010079, 0x7f01007a, 0x7f01007b, 0x7f01007c, 0x7f01007d, 0x7f01007e, 0x7f01007f, 0x7f010080, 0x7f010081, 0x7f010082, 0x7f010083, 0x7f010084, 0x7f010085, 0x7f010086, 0x7f010087, 0x7f010088, 0x7f010089, 0x7f01008a, 0x7f01008b, 0x7f01008c, 0x7f01008d, 0x7f01008e, 0x7f01008f, 0x7f010090, 0x7f010091, 0x7f010092, 0x7f010093, 0x7f010094, 0x7f010095, 0x7f010096, 0x7f010097, 0x7f010098, 0x7f010099, 0x7f01009a, 0x7f01009b, 0x7f01009c, 0x7f01009d, 0x7f01009e, 0x7f01009f, 0x7f0100a0, 0x7f0100a1, 0x7f0100a2, 0x7f0100a3, 0x7f0100a4, 0x7f0100a5, 0x7f0100a6, 0x7f0100a7, 0x7f0100a8, 0x7f0100a9, 0x7f0100aa }; public static final int Theme_actionBarDivider = 19; public static final int Theme_actionBarItemBackground = 20; public static final int Theme_actionBarPopupTheme = 13; public static final int Theme_actionBarSize = 18; public static final int Theme_actionBarSplitStyle = 15; public static final int Theme_actionBarStyle = 14; public static final int Theme_actionBarTabBarStyle = 9; public static final int Theme_actionBarTabStyle = 8; public static final int Theme_actionBarTabTextStyle = 10; public static final int Theme_actionBarTheme = 16; public static final int Theme_actionBarWidgetTheme = 17; public static final int Theme_actionButtonStyle = 43; public static final int Theme_actionDropDownStyle = 38; public static final int Theme_actionMenuTextAppearance = 21; public static final int Theme_actionMenuTextColor = 22; public static final int Theme_actionModeBackground = 25; public static final int Theme_actionModeCloseButtonStyle = 24; public static final int Theme_actionModeCloseDrawable = 27; public static final int Theme_actionModeCopyDrawable = 29; public static final int Theme_actionModeCutDrawable = 28; public static final int Theme_actionModeFindDrawable = 33; public static final int Theme_actionModePasteDrawable = 30; public static final int Theme_actionModePopupWindowStyle = 35; public static final int Theme_actionModeSelectAllDrawable = 31; public static final int Theme_actionModeShareDrawable = 32; public static final int Theme_actionModeSplitBackground = 26; public static final int Theme_actionModeStyle = 23; public static final int Theme_actionModeWebSearchDrawable = 34; public static final int Theme_actionOverflowButtonStyle = 11; public static final int Theme_actionOverflowMenuStyle = 12; public static final int Theme_activityChooserViewStyle = 50; public static final int Theme_android_windowIsFloating = 0; public static final int Theme_buttonBarButtonStyle = 45; public static final int Theme_buttonBarStyle = 44; public static final int Theme_colorAccent = 77; public static final int Theme_colorButtonNormal = 81; public static final int Theme_colorControlActivated = 79; public static final int Theme_colorControlHighlight = 80; public static final int Theme_colorControlNormal = 78; public static final int Theme_colorPrimary = 75; public static final int Theme_colorPrimaryDark = 76; public static final int Theme_colorSwitchThumbNormal = 82; public static final int Theme_dividerHorizontal = 49; public static final int Theme_dividerVertical = 48; public static final int Theme_dropDownListViewStyle = 67; public static final int Theme_dropdownListPreferredItemHeight = 39; public static final int Theme_editTextBackground = 56; public static final int Theme_editTextColor = 55; public static final int Theme_homeAsUpIndicator = 42; public static final int Theme_listChoiceBackgroundIndicator = 74; public static final int Theme_listPopupWindowStyle = 68; public static final int Theme_listPreferredItemHeight = 62; public static final int Theme_listPreferredItemHeightLarge = 64; public static final int Theme_listPreferredItemHeightSmall = 63; public static final int Theme_listPreferredItemPaddingLeft = 65; public static final int Theme_listPreferredItemPaddingRight = 66; public static final int Theme_panelBackground = 71; public static final int Theme_panelMenuListTheme = 73; public static final int Theme_panelMenuListWidth = 72; public static final int Theme_popupMenuStyle = 53; public static final int Theme_popupWindowStyle = 54; public static final int Theme_searchViewStyle = 61; public static final int Theme_selectableItemBackground = 46; public static final int Theme_selectableItemBackgroundBorderless = 47; public static final int Theme_spinnerDropDownItemStyle = 41; public static final int Theme_spinnerStyle = 40; public static final int Theme_switchStyle = 57; public static final int Theme_textAppearanceLargePopupMenu = 36; public static final int Theme_textAppearanceListItem = 69; public static final int Theme_textAppearanceListItemSmall = 70; public static final int Theme_textAppearanceSearchResultSubtitle = 59; public static final int Theme_textAppearanceSearchResultTitle = 58; public static final int Theme_textAppearanceSmallPopupMenu = 37; public static final int Theme_textColorSearchUrl = 60; public static final int Theme_toolbarNavigationButtonStyle = 52; public static final int Theme_toolbarStyle = 51; public static final int Theme_windowActionBar = 1; public static final int Theme_windowActionBarOverlay = 2; public static final int Theme_windowActionModeOverlay = 3; public static final int Theme_windowFixedHeightMajor = 7; public static final int Theme_windowFixedHeightMinor = 5; public static final int Theme_windowFixedWidthMajor = 4; public static final int Theme_windowFixedWidthMinor = 6; public static final int[] Toolbar = { 0x010100af, 0x01010140, 0x7f010003, 0x7f010006, 0x7f010016, 0x7f010017, 0x7f010018, 0x7f010019, 0x7f01001b, 0x7f0100ab, 0x7f0100ac, 0x7f0100ad, 0x7f0100ae, 0x7f0100af, 0x7f0100b0, 0x7f0100b1, 0x7f0100b2, 0x7f0100b3, 0x7f0100b4, 0x7f0100b5, 0x7f0100b6, 0x7f0100b7 }; public static final int Toolbar_android_gravity = 0; public static final int Toolbar_android_minHeight = 1; public static final int Toolbar_buttonGravity = 18; public static final int Toolbar_collapseIcon = 19; public static final int Toolbar_contentInsetEnd = 5; public static final int Toolbar_contentInsetLeft = 6; public static final int Toolbar_contentInsetRight = 7; public static final int Toolbar_contentInsetStart = 4; public static final int Toolbar_maxButtonHeight = 16; public static final int Toolbar_navigationContentDescription = 21; public static final int Toolbar_navigationIcon = 20; public static final int Toolbar_popupTheme = 8; public static final int Toolbar_subtitle = 3; public static final int Toolbar_subtitleTextAppearance = 10; public static final int Toolbar_theme = 17; public static final int Toolbar_title = 2; public static final int Toolbar_titleMarginBottom = 15; public static final int Toolbar_titleMarginEnd = 13; public static final int Toolbar_titleMarginStart = 12; public static final int Toolbar_titleMarginTop = 14; public static final int Toolbar_titleMargins = 11; public static final int Toolbar_titleTextAppearance = 9; public static final int[] View = { 0x010100da, 0x7f0100b8, 0x7f0100b9 }; public static final int[] ViewStubCompat = { 0x010100d0, 0x010100f2, 0x010100f3 }; public static final int ViewStubCompat_android_id = 0; public static final int ViewStubCompat_android_inflatedId = 2; public static final int ViewStubCompat_android_layout = 1; public static final int View_android_focusable = 0; public static final int View_paddingEnd = 2; public static final int View_paddingStart = 1; } }
bfd1c8a7b00093d5d48e2a2cc74d8d97d44be4d2
380d982252620906ec85dc3e39d46fc122efb02c
/app/src/main/java/com/app/phonecleaner/Fragment/FragmentBoost.java
17ab7ca1d251934da7b7de8c38b430a8a96c2538
[]
no_license
hawksky102/Malware-Detection-Android
ada61d4d645898b7c0e72f3b0a634583105f2c06
e4b1c85b199b5471878620859974fee1997c6905
refs/heads/master
2023-01-24T13:14:37.934646
2020-12-04T04:34:49
2020-12-04T04:34:49
318,401,354
1
0
null
null
null
null
UTF-8
Java
false
false
3,150
java
package com.app.phonecleaner.Fragment; import android.app.ActivityManager; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageButton; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import com.app.phonecleaner.R; import java.util.List; public class FragmentBoost extends Fragment { ImageButton imageButton; TextView textView; @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_boost,container,false); imageButton=v.findViewById(R.id.imageButton4); textView=v.findViewById(R.id.txtBoost); Animation slide= AnimationUtils.loadAnimation(getActivity().getApplicationContext(),R.anim.slide_in_up); Animation slide1=AnimationUtils.loadAnimation(getActivity().getApplicationContext(),R.anim.slide_out_up); slide1.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { imageButton.startAnimation(slide); } @Override public void onAnimationRepeat(Animation animation) { } }); slide.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { textView.setText("BOOSTED!"); textView.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { imageButton.startAnimation(slide1); apps(); } }); return v; } public void apps() { List<ApplicationInfo> packages; PackageManager pm; pm = getActivity().getPackageManager(); //get a list of installed apps. packages = pm.getInstalledApplications(0); ActivityManager mActivityManager = (ActivityManager)getContext().getSystemService(Context.ACTIVITY_SERVICE); for (ApplicationInfo packageInfo : packages) { if((packageInfo.flags & ApplicationInfo.FLAG_SYSTEM)==1)continue; if(packageInfo.packageName.equals("com.app.phonecleaner")) continue; mActivityManager.killBackgroundProcesses(packageInfo.packageName); } } }
2480501324806f76fe32d779d589d3292a6aace7
50a1e9815c8de810272d0110c3d7f3ba9561d345
/SwingFrontEnd/InitializeSimulator.java
b697f4783beff3ccdad07c1d9a4fae0ca8af8226
[ "MIT" ]
permissive
winsvold/Snake
223cb292ef1fe38170ca73ce84491e8e7d0dd993
2f961f9d28750d719111cde781fdf5ffce987cbf
refs/heads/master
2021-08-27T20:25:44.094803
2017-11-28T07:24:27
2017-11-28T07:24:27
112,112,967
0
0
null
null
null
null
UTF-8
Java
false
false
2,047
java
package Snake.SwingFrontEnd; import Snake.Logic.Apple; import Snake.Logic.TurnPlayer; import Snake.Logic.Worm; import Snake.SwingFrontEnd.Listener.KeyBoardListener; import javax.swing.*; import java.awt.*; import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; public class InitializeSimulator implements Runnable { private List<Apple> apples; private int height; private int width; private JFrame frame; private JPanel boardPainter; private Worm worm; private int pixelPerPoint; private double millisecondsPrRound; private ScheduledExecutorService updater; private TurnPlayer turnPlayer; public InitializeSimulator(Worm worm, List<Apple> apples, TurnPlayer turnPlayer, int pixelPerPoint, double hertz, int boardHeight, int boardWidth){ this.turnPlayer = turnPlayer; this.apples = apples; this.height = boardHeight; this.width = boardWidth; this.worm = worm; this.millisecondsPrRound = (int)(1000/hertz); this.pixelPerPoint = pixelPerPoint; this.boardPainter = new BoardPainter(worm,apples,pixelPerPoint,height,width); updater = Executors.newScheduledThreadPool(1); } private void setNextUpdate (){ updater.schedule(()->{ turnPlayer.playTurn(); if(!turnPlayer.isGameover()){ setNextUpdate(); } boardPainter.repaint(); },(int)millisecondsPrRound,TimeUnit.MILLISECONDS); } @Override public void run() { frame = new JFrame("Snake"); frame.setPreferredSize(new Dimension((int)((width)* pixelPerPoint + 27) ,(height) * pixelPerPoint + 50)); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.getContentPane().add(boardPainter); frame.addKeyListener(new KeyBoardListener(worm)); frame.pack(); frame.setVisible(true); setNextUpdate(); } }
3a596a2bec97ec8909dd6e288f65d37140c2f7e0
3306540f44fc0ec676310d4c8487ff517b05c2fa
/Java3-Aquarium/src/java3/aquarium/Java3Aquarium.java
0f14bd239b2ee6da4d5c18d8221f5be261d226b1
[]
no_license
VolanNnanpalle/Aquarium
0b8d5c12efbf627e6cc9b7f6ae17a32530666cb3
50ceaeca66a8e82dccefbc2da6d1d36ebcf4faf7
refs/heads/master
2021-01-19T04:22:37.126764
2017-06-01T03:34:16
2017-06-01T03:34:16
87,368,364
0
1
null
null
null
null
UTF-8
Java
false
false
2,930
java
package java3.aquarium; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.stage.Stage; /** * This class declares all the fishes and, fish thread, sets the background of * the window and start all thread enabling them to work simultaneously which * makes the fish to swim * * @author Volan Nnanpalle */ public class Java3Aquarium extends Application { @Override public void start(Stage primaryStage) { //create the pane StackPane root=new StackPane(); //create the fish Fish fish1=new Fish("file:imageedit_3_8691078998.gif", -350, -300); Fish fish2=new Fish("file:animated-shark-image-0027.gif", -350, -100); Fish fish3=new Fish("file:20096.gif", -350, 100); Fish fish4=new Fish("file:animated-salmon-fish.gif", -350, 200); Fish fish5=new Fish("file:animated-tropical-fish-5-2.gif", 350, 300); Fish fish6=new Fish("file:427841964601203090.jpg", 350, -10); Fish fish7=new Fish("file:imageedit_1_8734401747.gif", 350, -185); //create the fish thread FishThread t1=new FishThread(fish1); FishThread t2=new FishThread(fish2); FishThread t3=new FishThread(fish3); FishThread t4=new FishThread(fish4); FishThread t5=new FishThread(fish5); FishThread t6=new FishThread(fish6); FishThread t7=new FishThread(fish7); //closes the threads when the windown is closed t1.setDaemon(true); t2.setDaemon(true); t3.setDaemon(true); t4.setDaemon(true); t5.setDaemon(true); t6.setDaemon(true); t7.setDaemon(true); //start the fish thread t1.start(); t2.start(); t3.start(); t4.start(); t5.start(); t6.start(); t7.start(); //add the fish to the screen root.getChildren().add(fish1.makeFish()); root.getChildren().add(fish2.makeFish()); root.getChildren().add(fish3.makeFish()); root.getChildren().add(fish4.makeFish()); root.getChildren().add(fish5.makeFish()); root.getChildren().add(fish6.makeFish()); root.getChildren().add(fish7.makeFish()); //root.getChildren().add(iv); //declare a scene and set a pane on it Scene scene=new Scene(root, 800, 700); //set the background of the scene scene.getStylesheets().add(getClass().getResource("style.css"). toExternalForm()); //name the stage primaryStage.setTitle("Fish Tank"); primaryStage.setResizable(false); primaryStage.setScene(scene); primaryStage.show(); } /** * The main method to start the application * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }
c2ff7310177f4a5324b3305332c3c7abb23643cf
ac1768b715e9fe56be8b340bc1e4bc7f917c094a
/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dto/api/ChannelColor.java
ce01e320c95a9086a58130697c935834531f92f9
[ "Apache-2.0" ]
permissive
kykrueger/openbis
2c4d72cb4b150a2854df4edfef325f79ca429c94
1b589a9656d95e343a3747c86014fa6c9d299b8d
refs/heads/master
2023-05-11T23:03:57.567608
2021-05-21T11:54:58
2021-05-21T11:54:58
364,558,858
0
0
Apache-2.0
2021-06-04T10:08:32
2021-05-05T11:48:20
Java
UTF-8
Java
false
false
1,998
java
package ch.systemsx.cisd.openbis.dss.etl.dto.api; /** * Allowed colors in which channels can be presented. * * @author Tomasz Pylak */ public enum ChannelColor { BLUE(0), GREEN(1), RED(2), RED_GREEN(3), RED_BLUE(4), GREEN_BLUE(5); private static final int MAX_COLOR = calcMaxColorIndex(); // If no mapping between channels and colors has been provided then channels get consecutive // colors. This field determines the order in which colors are assigned. // It is important for backward compatibility as well. private final int orderIndex; private ChannelColor(int orderIndex) { this.orderIndex = orderIndex; } private static int calcMaxColorIndex() { int max = 0; for (ChannelColor color : values()) { max = Math.max(max, color.getColorOrderIndex()); } return max; } public int getColorOrderIndex() { return orderIndex; } public static ChannelColor createFromIndex(int colorIndex) { for (ChannelColor color : values()) { if (color.getColorOrderIndex() == colorIndex % (MAX_COLOR + 1)) { return color; } } throw new IllegalStateException("Invalid color index: " + colorIndex + "!"); } public ChannelColorRGB getRGB() { switch (this) { case RED: return new ChannelColorRGB(255, 0, 0); case GREEN: return new ChannelColorRGB(0, 255, 0); case BLUE: return new ChannelColorRGB(0, 0, 255); case RED_GREEN: return new ChannelColorRGB(255, 255, 0); case GREEN_BLUE: return new ChannelColorRGB(0, 255, 255); case RED_BLUE: return new ChannelColorRGB(255, 0, 255); default: throw new IllegalStateException("unhandled enum " + this); } } }
[ "jakubs" ]
jakubs
448d165893623d980f6a7f7b32143cd8ca600dac
a01eaed695583aad70bd7e1da1af0ec736c7bf22
/ncep/gov.noaa.nws.ncep.viz.overlays/src/gov/noaa/nws/ncep/viz/overlays/dialogs/ChangeScaleAttributesDialog.java
5d46227a8f3126f308133379a7b82cffb675d4f2
[]
no_license
SeanTheGuyThatAlwaysHasComputerTrouble/awips2
600d3e6f7ea1b488471e387c642d54cb6eebca1a
c8f8c20ca34e41ac23ad8e757130e91c77b558fe
refs/heads/master
2021-01-19T18:00:12.598133
2013-03-26T17:06:45
2013-03-26T17:06:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,461
java
package gov.noaa.nws.ncep.viz.overlays.dialogs; import java.util.EnumMap; import java.util.Map; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle; import gov.noaa.nws.ncep.ui.pgen.display.IText.FontStyle; import gov.noaa.nws.ncep.viz.common.ui.color.ColorMatrixSelector; import gov.noaa.nws.ncep.viz.overlays.IPointOverlayResourceData.MarkerTextSize; import gov.noaa.nws.ncep.viz.overlays.IScaleOverlayResourceData.ScaleIntervalMode; import gov.noaa.nws.ncep.viz.overlays.IScaleOverlayResourceData.ScaleLatMode; import gov.noaa.nws.ncep.viz.overlays.IScaleOverlayResourceData.ScalePosition; import gov.noaa.nws.ncep.viz.overlays.IScaleOverlayResourceData.ScaleTextFont; import gov.noaa.nws.ncep.viz.overlays.IScaleOverlayResourceData.ScaleTextSize; import gov.noaa.nws.ncep.viz.overlays.IScaleOverlayResourceData.ScaleTextStyle; import gov.noaa.nws.ncep.viz.overlays.IScaleOverlayResourceData.ScaleUnit; import gov.noaa.nws.ncep.viz.resources.INatlCntrsResourceData; import gov.noaa.nws.ncep.viz.resources.attributes.AbstractEditResourceAttrsDialog; import gov.noaa.nws.ncep.viz.resources.attributes.ResourceAttrSet.RscAttrValue; /* * * <pre> * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 07 Oct 2010 311 B. Hebbard Initial Creation (derived from ChangeLatLonAttributesDialog) * * @author bhebbard * @version 1 */ public class ChangeScaleAttributesDialog extends AbstractEditResourceAttrsDialog { private Label modelLabel; private Combo modelCombo = null; private Label positionLabel; private Combo positionCombo = null; private Label unitLabel; private Combo unitCombo = null; private Label valueLabel; private Combo valueCombo = null; private Text valueText = null; private Label latitudeLabel; private Combo latitudeCombo = null; private Text latitudeText = null; private Label sizeLabel; private Combo sizeCombo = null; private Label fontLabel; private Combo fontCombo = null; private Label styleLabel; private Combo styleCombo = null; private final static org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(ChangeScaleAttributesDialog.class); // Current attribute values. private RscAttrValue scaleModel = null; private RscAttrValue scalePosition = null; private RscAttrValue scaleUnit = null; private RscAttrValue scaleIntervalMode = null; private RscAttrValue scaleIntervalValue = null; private RscAttrValue scaleLatMode = null; private RscAttrValue scaleEffectiveLatitudeValue = null; private RscAttrValue scaleTextFont = null; private RscAttrValue scaleTextSize = null; private RscAttrValue scaleTextStyle = null; private RscAttrValue color = null; private ColorMatrixSelector colorMatrixSelector; /** * Constructor * * @param parentShell * @param dialogTitle */ public ChangeScaleAttributesDialog(Shell parentShell, INatlCntrsResourceData rd, Boolean apply ) { super(parentShell, rd, apply); } @Override public Composite createDialog(Composite composite) { final Display display = composite.getDisplay(); FormLayout layout0 = new FormLayout(); composite.setLayout(layout0); scaleModel = editedRscAttrSet.getRscAttr("scaleModel"); scalePosition = editedRscAttrSet.getRscAttr("scalePosition"); scaleUnit = editedRscAttrSet.getRscAttr("scaleUnit"); scaleIntervalMode = editedRscAttrSet.getRscAttr("scaleIntervalMode"); scaleIntervalValue = editedRscAttrSet.getRscAttr("scaleIntervalValue"); scaleLatMode = editedRscAttrSet.getRscAttr("scaleLatMode"); scaleEffectiveLatitudeValue = editedRscAttrSet.getRscAttr("scaleEffectiveLatitudeValue"); scaleTextFont = editedRscAttrSet.getRscAttr("scaleTextFont"); scaleTextSize = editedRscAttrSet.getRscAttr("scaleTextSize"); scaleTextStyle = editedRscAttrSet.getRscAttr("scaleTextStyle"); color = editedRscAttrSet.getRscAttr("color"); // confirm the classes of the attributes.. //if( scaleModel.getAttrClass() != ScaleModel.class ) { // System.out.println( "lineStyle is not of expected class? "+ scaleModel.getAttrClass().toString() ); //} else if( scalePosition.getAttrClass() != Integer.class ) { System.out.println( "scalePosition is not of expected class? "+ scalePosition.getAttrClass().toString() ); } else if( scaleUnit.getAttrClass() != Integer.class ) { System.out.println( "scaleUnit is not of expected class? "+ scaleUnit.getAttrClass().toString() ); } else if( scaleIntervalMode.getAttrClass() != Integer.class ) { System.out.println( "scaleIntervalMode is not of expected class? "+ scaleIntervalMode.getAttrClass().toString() ); } else if( scaleIntervalValue.getAttrClass() != Integer.class ) { System.out.println( "scaleIntervalValue is not of expected class? "+ scaleIntervalValue.getAttrClass().toString() ); } else if( scaleLatMode.getAttrClass() != Integer.class ) { System.out.println( "scaleLatMode is not of expected class? "+ scaleLatMode.getAttrClass().toString() ); } else if( scaleEffectiveLatitudeValue.getAttrClass() != Integer.class ) { System.out.println( "scaleEffectiveLatitudeValue is not of expected class? "+ scaleEffectiveLatitudeValue.getAttrClass().toString() ); } else if( scaleTextFont.getAttrClass() != Integer.class ) { System.out.println( "scaleTextFont is not of expected class? "+ scaleTextFont.getAttrClass().toString() ); } else if( scaleTextSize.getAttrClass() != Integer.class ) { System.out.println( "scaleTextSize is not of expected class? "+ scaleTextSize.getAttrClass().toString() ); } else if( scaleTextStyle.getAttrClass() != Integer.class ) { System.out.println( "scaleTextStyle is not of expected class? "+ scaleTextStyle.getAttrClass().toString() ); } else if( color.getAttrClass() != RGB.class ) { System.out.println( "color is not of expected class? "+ scaleTextStyle.getAttrClass().toString() ); } // Lay out the various groups within the dialog Group selectTextAttributesGroup = new Group ( composite, SWT.SHADOW_NONE ); selectTextAttributesGroup.setText("Text Attributes"); GridLayout textAttributesGridLayout = new GridLayout(); textAttributesGridLayout.numColumns = 4; textAttributesGridLayout.marginHeight = 18; textAttributesGridLayout.marginWidth = 18; textAttributesGridLayout.horizontalSpacing = 8; textAttributesGridLayout.verticalSpacing = 8; selectTextAttributesGroup.setLayout(textAttributesGridLayout); FormData formData1 = new FormData(); formData1.top = new FormAttachment(5, 100); formData1.left = new FormAttachment(2, 0); selectTextAttributesGroup.setLayoutData(formData1); Group selectColorGroup = new Group ( composite, SWT.SHADOW_NONE ); selectColorGroup.setText("Color"); FormData formData2 = new FormData(); formData2.top = new FormAttachment(selectTextAttributesGroup, 6); formData2.left = new FormAttachment(2, 0); formData2.right = new FormAttachment(98, 0); formData2.height = 170; selectColorGroup.setLayoutData(formData2); // Lay out individual components within the dialog and groups positionLabel = new Label(composite, SWT.LEFT); positionLabel.setText("Position:"); FormData formData3 = new FormData(); formData3.top = new FormAttachment(2, 8); formData3.left = new FormAttachment(4, 0); positionLabel.setLayoutData(formData3); positionCombo = new Combo( composite, SWT.DROP_DOWN | SWT.READ_ONLY ); FormData formData4 = new FormData(); formData4.top = new FormAttachment(positionLabel, 0, SWT.CENTER); formData4.left = new FormAttachment(positionLabel, 72, SWT.LEFT); positionCombo.setLayoutData(formData4); for ( ScalePosition sp : ScalePosition.values() ) { positionCombo.add( sp.getDisplayName() ); } positionCombo.select( (Integer) scalePosition.getAttrValue() ); positionCombo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scalePosition.setAttrValue( positionCombo.getSelectionIndex() ); } }); unitLabel = new Label(composite, SWT.LEFT); unitLabel.setText("Unit:"); FormData formData5 = new FormData(); formData5.top = new FormAttachment(2, 8); formData5.left = new FormAttachment(positionCombo, 18, SWT.RIGHT); unitLabel.setLayoutData(formData5); unitCombo = new Combo( composite, SWT.DROP_DOWN | SWT.READ_ONLY ); FormData formData6 = new FormData(); formData6.top = new FormAttachment(unitLabel, 0, SWT.CENTER); formData6.left = new FormAttachment(unitLabel, 6, SWT.RIGHT); formData6.right = new FormAttachment(100, -6); unitCombo.setLayoutData(formData6); for ( ScaleUnit su : ScaleUnit.values() ) { unitCombo.add( su.toString() ); } unitCombo.select( (Integer) scaleUnit.getAttrValue() ); unitCombo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scaleUnit.setAttrValue( unitCombo.getSelectionIndex() ); } }); valueLabel = new Label(composite, SWT.LEFT); valueLabel.setText("Interval:"); FormData formData7 = new FormData(); formData7.top = new FormAttachment(positionLabel, 20); formData7.left = new FormAttachment(4, 0); valueLabel.setLayoutData(formData7); valueCombo = new Combo( composite, SWT.DROP_DOWN | SWT.READ_ONLY ); FormData formData8 = new FormData(); formData8.top = new FormAttachment(valueLabel, 0, SWT.CENTER); formData8.left = new FormAttachment(valueLabel, 72, SWT.LEFT); valueCombo.setLayoutData(formData8); for ( ScaleIntervalMode sim : ScaleIntervalMode.values() ) { valueCombo.add( sim.getDisplayName() ); } valueCombo.select( (Integer) scaleIntervalMode.getAttrValue() ); valueCombo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scaleIntervalMode.setAttrValue( valueCombo.getSelectionIndex() ); valueText.setEnabled(valueCombo.getSelectionIndex() == 1); } }); valueText = new Text(composite, SWT.SINGLE); valueText.setText( String.valueOf( (Integer)scaleIntervalValue.getAttrValue() )); valueText.setEditable(true); valueText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { getValidInteger( valueText, scaleIntervalValue ); } }); valueText.setEnabled(valueCombo.getSelectionIndex() == 1); FormData formData9 = new FormData(); formData9.top = new FormAttachment(valueLabel, 0, SWT.CENTER); formData9.left = new FormAttachment(valueLabel, 220, SWT.LEFT); formData9.width = 60; valueText.setLayoutData(formData9); latitudeLabel = new Label(composite, SWT.LEFT); latitudeLabel.setText("Latitude:"); FormData formData10 = new FormData(); formData10.top = new FormAttachment(valueLabel, 20); formData10.left = new FormAttachment(4, 0); latitudeLabel.setLayoutData(formData10); latitudeCombo = new Combo( composite, SWT.DROP_DOWN | SWT.READ_ONLY ); FormData formData11 = new FormData(); formData11.top = new FormAttachment(latitudeLabel, 0, SWT.CENTER); formData11.left = new FormAttachment(latitudeLabel, 72, SWT.LEFT); latitudeCombo.setLayoutData(formData11); for ( ScaleLatMode slm : ScaleLatMode.values() ) { latitudeCombo.add( slm.getDisplayName() ); } latitudeCombo.select( (Integer) scaleLatMode.getAttrValue() ); latitudeCombo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scaleLatMode.setAttrValue( latitudeCombo.getSelectionIndex() ); latitudeText.setEnabled(latitudeCombo.getSelectionIndex() == 2); } }); latitudeText = new Text(composite, SWT.SINGLE); latitudeText.setText( String.valueOf( (Integer)scaleEffectiveLatitudeValue.getAttrValue() )); latitudeText.setEditable(true); latitudeText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { getValidInteger( latitudeText, scaleEffectiveLatitudeValue ); } }); latitudeText.setEnabled(latitudeCombo.getSelectionIndex() == 2); FormData formData12 = new FormData(); formData12.top = new FormAttachment(latitudeLabel, 0, SWT.CENTER); formData12.left = new FormAttachment(latitudeLabel, 220, SWT.LEFT); formData12.width = 60; latitudeText.setLayoutData(formData12); fontLabel = new Label(selectTextAttributesGroup, SWT.LEFT); fontLabel.setText("Font:"); fontCombo = new Combo( selectTextAttributesGroup, SWT.DROP_DOWN | SWT.READ_ONLY ); for ( ScaleTextFont stf : ScaleTextFont.values() ) { fontCombo.add( stf.getDisplayName() ); } fontCombo.select( (Integer) scaleTextFont.getAttrValue() ); fontCombo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scaleTextFont.setAttrValue( fontCombo.getSelectionIndex() ); } }); sizeLabel = new Label(selectTextAttributesGroup, SWT.LEFT); sizeLabel.setText("Size:"); sizeCombo = new Combo( selectTextAttributesGroup, SWT.DROP_DOWN | SWT.READ_ONLY ); for ( ScaleTextSize sts : ScaleTextSize.values() ) { sizeCombo.add( sts.getDisplayName() ); } sizeCombo.select( (Integer) scaleTextSize.getAttrValue() ); sizeCombo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scaleTextSize.setAttrValue( sizeCombo.getSelectionIndex() ); } }); styleLabel = new Label(selectTextAttributesGroup, SWT.LEFT); styleLabel.setText("Style:"); styleCombo = new Combo( selectTextAttributesGroup, SWT.DROP_DOWN | SWT.READ_ONLY ); for ( ScaleTextStyle sts : ScaleTextStyle.values() ) { styleCombo.add( sts.getDisplayName() ); } styleCombo.select( (Integer) scaleTextStyle.getAttrValue() ); styleCombo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scaleTextStyle.setAttrValue( styleCombo.getSelectionIndex() ); } }); // Scale Color colorMatrixSelector = new ColorMatrixSelector(selectColorGroup, false, true, 22, 88, 18, 22, 28, 86, 0, 4, 5); colorMatrixSelector.setColorValue( (RGB)color.getAttrValue()); colorMatrixSelector.addListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { color.setAttrValue( colorMatrixSelector.getColorValue() ); } }); return composite; } // if an int can be parsed from the widget then set the rscAttr // and if not then reset the widget with the current value of the RscAttrValue // public void getValidInteger( Text txtWid, RscAttrValue intAttr ) { String intStr = txtWid.getText(); if( intStr.isEmpty() ) { return; } try { int ival = Integer.parseInt( txtWid.getText() ); intAttr.setAttrValue( Integer.valueOf(ival) ); } catch( NumberFormatException exc ) { int ival = ((Integer)intAttr.getAttrValue()).intValue(); txtWid.setText( Integer.toString( ival ) ); } } @Override public void initWidgets() { // TODO Auto-generated method stub } }
[ "root@lightning.(none)" ]
root@lightning.(none)
132eded15dc15f112e335f3502d9fd300bc26d92
71edbefecd92593b09ca66d35da6f0da0ca0e815
/JAVA/src/yanrui/DataStructure/Collection/Set/Set.java
e8f02c9ec9b18faaf061709e06ab26443527c2db
[]
no_license
YanRuizly/Java_into_practice
e7cd557d36176724553f301cf175911ddb52b2e9
c4d768b1afe11fb6c58994086210ca4017b79d0b
refs/heads/master
2020-03-17T17:56:03.004370
2019-04-08T06:21:24
2019-04-08T06:21:24
133,808,241
0
0
null
null
null
null
UTF-8
Java
false
false
67
java
package yanrui.DataStructure.Collection.Set; public class Set { }
8d3c9db202b6f4d57f91931979edad6f966a892a
58cfddd62eeb694afa67f85ac8f8281ada2bf0f2
/mainWeb/src/main/java/ru/simplgroupp/data/Step5Data.java
141ee20bed7db25b78128db9dacb3de1dadc5cfc
[]
no_license
juhnowski/mb
b3016e3c26a1f0df6b7daf7ca8cc77ba5433d0b7
0d05227d79dcc6059a10162924dbc49d21f6e637
refs/heads/master
2020-06-22T05:10:23.191165
2016-11-25T11:48:40
2016-11-25T11:48:40
74,754,230
0
0
null
null
null
null
UTF-8
Java
false
false
3,351
java
package ru.simplgroupp.data; /** * Step3Data * Данные передаваемые на пятом шаге в json * * @author Andrey Unger aka Cobalt <[email protected]> http://www.servicepro-online.ru * @since 23.04.14. */ public class Step5Data { private String id, creditsumprev,creditcardlimit,creditdate, overdue; private Integer prevcredits,credittype,currencytype,creditisover, creditOrganization; private String credittypeTitle,currencytypeTitle,creditOrganizationTitle,overdueTitle; public Step5Data(){ creditOrganizationTitle = id = creditsumprev = creditcardlimit = creditdate = overdueTitle = credittypeTitle = currencytypeTitle = overdue = ""; prevcredits = credittype = currencytype = creditisover = creditOrganization = null; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getCreditsumprev() { return creditsumprev; } public void setCreditsumprev(String creditsumprev) { this.creditsumprev = creditsumprev; } public String getCreditcardlimit() { return creditcardlimit; } public void setCreditcardlimit(String creditcardlimit) { this.creditcardlimit = creditcardlimit; } public String getCreditdate() { return creditdate; } public void setCreditdate(String creditdate) { this.creditdate = creditdate; } public Integer getPrevcredits() { return prevcredits; } public void setPrevcredits(Integer prevcredits) { this.prevcredits = prevcredits; } public Integer getCreditOrganization() { return creditOrganization; } public void setCreditOrganization(Integer creditOrganization) { this.creditOrganization = creditOrganization; } public Integer getCredittype() { return credittype; } public void setCredittype(Integer credittype) { this.credittype = credittype; } public Integer getCurrencytype() { return currencytype; } public void setCurrencytype(Integer currencytype) { this.currencytype = currencytype; } public Integer getCreditisover() { return creditisover; } public void setCreditisover(Integer creditisover) { this.creditisover = creditisover; } public String getCredittypeTitle() { return credittypeTitle; } public void setCredittypeTitle(String credittypeTitle) { this.credittypeTitle = credittypeTitle; } public String getCurrencytypeTitle() { return currencytypeTitle; } public void setCurrencytypeTitle(String currencytypeTitle) { this.currencytypeTitle = currencytypeTitle; } public String getCreditOrganizationTitle() { return creditOrganizationTitle; } public void setCreditOrganizationTitle(String creditOrganizationTitle) { this.creditOrganizationTitle = creditOrganizationTitle; } public String getOverdue() { return overdue; } public void setOverdue(String overdue) { this.overdue = overdue; } public String getOverdueTitle() { return overdueTitle; } public void setOverdueTitle(String overdueTitle) { this.overdueTitle = overdueTitle; } }
b22b1dd1ad31ee873dd82a7ea06131c293cc2ae4
45099c4d1630130e0916a2cbb15c2cd6f2d133ff
/Football_Scores-master/app/src/main/java/barqsoft/footballscores/Utilies.java
fa84e108b2e70493baaad9bcbcba657dc3d217d2
[ "MIT" ]
permissive
asheshb/SuperDuo
837a6ebd09b31ca6929aa9af5949a1b2e85c460e
2ab61662ff9449b479a30e039af66ea4bc33e3a3
refs/heads/master
2021-01-10T14:02:24.910026
2016-03-08T20:04:20
2016-03-08T20:04:20
47,209,318
0
0
null
null
null
null
UTF-8
Java
false
false
5,351
java
package barqsoft.footballscores; import android.content.Context; /** * Created by yehya khaled on 3/3/2015. */ public class Utilies { public static final int BUNDESLIGA1 = 394; public static final int BUNDESLIGA2 = 395; public static final int LIGUE1 = 396; public static final int LIGUE2 = 397; public static final int PREMIER_LEAGUE = 398; public static final int PRIMERA_DIVISION = 399; public static final int SEGUNDA_DIVISION = 400; public static final int SERIE_A = 401; public static final int PRIMERA_LIGA = 402; public static final int Bundesliga3 = 403; public static final int EREDIVISIE = 404; public static final int CHAMPIONS_LEAGUE = 405; public static String getLeague(int league_num, Context context) { switch (league_num) { case BUNDESLIGA1 : return context.getString(R.string.bundesliga1); case BUNDESLIGA2 : return context.getString(R.string.bundesliga2); case LIGUE1 : return context.getString(R.string.ligue1); case LIGUE2 : return context.getString(R.string.ligue2); case PREMIER_LEAGUE : return context.getString(R.string.premier_league); case PRIMERA_DIVISION : return context.getString(R.string.primera_divison); case SEGUNDA_DIVISION : return context.getString(R.string.segunda_divison); case SERIE_A : return context.getString(R.string.serie_a); case PRIMERA_LIGA : return context.getString(R.string.primeira_liga); case Bundesliga3 : return context.getString(R.string.bundesliga3); case EREDIVISIE : return context.getString(R.string.eredivisie); case CHAMPIONS_LEAGUE : return context.getString(R.string.champions_league); default: return context.getString(R.string.league_unknown); } } public static String getMatchDay(int match_day,int league_num, Context context) { if(league_num == CHAMPIONS_LEAGUE) { if (match_day <= 6) { return context.getString(R.string.group_stage_text) + " " + context.getString(R.string.matchday_text) + " : 6"; } else if(match_day == 7 || match_day == 8) { return context.getString(R.string.first_knockout_round); } else if(match_day == 9 || match_day == 10) { return context.getString(R.string.quarter_final); } else if(match_day == 11 || match_day == 12) { return context.getString(R.string.semi_final); } else { return context.getString(R.string.final_text); } } else { return context.getString(R.string.matchday_text) + " : " + String.valueOf(match_day); } } public static String getScores(int home_goals,int awaygoals) { if(home_goals < 0 || awaygoals < 0) { return " - "; } else { return String.valueOf(home_goals) + " - " + String.valueOf(awaygoals); } } public static String getScoresDescription(int home_goals,int awaygoals, String home_team, String away_team, String prefix, String matchNoScore) { if(home_goals < 0 || awaygoals < 0) { return matchNoScore; } else { return prefix + " " + home_team + ": " + String.valueOf(home_goals) + " - " + away_team + ": " + String.valueOf(awaygoals); } } public static int getTeamCrestByTeamName (String teamname, Context context) { if (teamname==null){return R.drawable.no_icon;} if(context.getString(R.string.Arsenal_London_FC).equals(teamname) || context.getString(R.string.TESTING1).equals(teamname)){ return R.drawable.arsenal; } else if(context.getString(R.string.Manchester_United_FC).equals(teamname) || context.getString(R.string.TESTING2).equals(teamname)){ return R.drawable.manchester_united; } else if(context.getString(R.string.Swansea_City).equals(teamname) || context.getString(R.string.TESTING3).equals(teamname)){ return R.drawable.swansea_city_afc; } else if(context.getString(R.string.Leicester_City).equals(teamname) || context.getString(R.string.TESTING5).equals(teamname)){ return R.drawable.leicester_city_fc_hd_logo; } else if(context.getString(R.string.Everton_FC).equals(teamname)){ return R.drawable.everton_fc_logo1; } else if(context.getString(R.string.West_Ham_United_FC).equals(teamname)){ return R.drawable.west_ham; } else if(context.getString(R.string.Tottenham_Hotspur_FC).equals(teamname)){ return R.drawable.tottenham_hotspur; } else if(context.getString(R.string.West_Bromwich_Albion).equals(teamname)){ return R.drawable.west_bromwich_albion_hd_logo; } else if(context.getString(R.string.Sunderland_AFC).equals(teamname)){ return R.drawable.sunderland; } else if(context.getString(R.string.Stoke_City_FC).equals(teamname)){ return R.drawable.stoke_city; } else { return R.drawable.no_icon; } } }
f7df3e88033d5c82b20a1bf2b4683ad61a569cfa
7a5968dfed03c0caa4546918bf0935de10410a66
/ParserMain.java
ad914c8bed27174839fbe35435c3b6791f80ed23
[]
no_license
alon-c/Lexical-Analyzer
12ce46170711a2d5d082c2e13b9a8be6cae7bb45
96b559c9d3ed9c7135156414c6838beee320c371
refs/heads/master
2021-01-20T18:28:44.856263
2016-07-27T12:35:08
2016-07-27T12:35:08
64,306,229
0
0
null
null
null
null
UTF-8
Java
false
false
599
java
/* * Please read README.txt file for "how to run?" details. */ public class ParserMain { public static void main(String args[]) { if (args.length != 1) { System.out.println("Usage: ParserMain <file name>"); System.exit(-1); } String path = ""; if ((System.getProperty("os.name").equals("Linux")) || (System.getProperty("os.name").equals("Mac OS X"))) path = System.getProperty("user.dir") + "/" + args[0]; else path = System.getProperty("user.dir") + "\\" + args[0]; LexicalAnalyzer lex = new LexicalAnalyzer(path); lex.startAnalyze(); } }
02406a54cf74c87943fb19d5e046f66b3e8168e7
b111b77f2729c030ce78096ea2273691b9b63749
/db-example-large-multi-project/project62/src/test/java/org/gradle/test/performance/mediumjavamultiproject/project62/p313/Test6273.java
5004e0fe55ef0f7496de7ae5a5347b96a8909e13
[]
no_license
WeilerWebServices/Gradle
a1a55bdb0dd39240787adf9241289e52f593ccc1
6ab6192439f891256a10d9b60f3073cab110b2be
refs/heads/master
2023-01-19T16:48:09.415529
2020-11-28T13:28:40
2020-11-28T13:28:40
256,249,773
1
0
null
null
null
null
UTF-8
Java
false
false
2,619
java
package org.gradle.test.performance.mediumjavamultiproject.project62.p313; import org.junit.Test; import static org.junit.Assert.*; public class Test6273 { Production6273 objectUnderTest = new Production6273(); @Test public void testProperty0() throws Exception { Production6270 value = new Production6270(); objectUnderTest.setProperty0(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() throws Exception { Production6271 value = new Production6271(); objectUnderTest.setProperty1(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() throws Exception { Production6272 value = new Production6272(); objectUnderTest.setProperty2(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() throws Exception { String value = "value"; objectUnderTest.setProperty3(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() throws Exception { String value = "value"; objectUnderTest.setProperty4(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() throws Exception { String value = "value"; objectUnderTest.setProperty5(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() throws Exception { String value = "value"; objectUnderTest.setProperty6(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() throws Exception { String value = "value"; objectUnderTest.setProperty7(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() throws Exception { String value = "value"; objectUnderTest.setProperty8(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() throws Exception { String value = "value"; objectUnderTest.setProperty9(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty9()); } }
8d6a58d2489551d14a0022b97e4ab45efa16baa5
c601eab06042ff594aa27cb680eff96a3d75e7f6
/src/main/java/jhotel/DatabaseRoom.java
d87aa683db0d8b3350f80b08c0333479db355658
[]
no_license
fahmifirmanf/jhotel
2e9769b2804137a1006ddf99f1d7898fac3a9889
f08f23e22d3cf9da9f004b5abb28adc30a04a84a
refs/heads/master
2021-04-27T15:02:24.975281
2018-05-29T16:45:21
2018-05-29T16:45:21
122,459,330
0
0
null
null
null
null
UTF-8
Java
false
false
3,449
java
package jhotel; import java.util.ArrayList; /** * Class yang erisi database ruangan hotel * * @author Fahmi Firman F * @version 2018.05.20 */ public class DatabaseRoom { //private static String[] list_room; private static ArrayList<Room> ROOM_DATABASE = new ArrayList<Room>(); /** * Digunakan untukvmembuat arraylist berisi room * * @return ROOM_DATABASE */ public static ArrayList<Room> getRoomDatabase() { return ROOM_DATABASE; } /** * Digunakan untuk menambahkan database room * * @param baru berisi objek Room */ public static boolean addRoom(Room baru) throws RoomSudahAdaException{ for(Room cari : ROOM_DATABASE){ if(cari.getHotel().equals(baru.getHotel()) && cari.getNomorKamar().equals(baru.getNomorKamar())) { throw new RoomSudahAdaException(baru); } } ROOM_DATABASE.add(baru); return true; } /** * digunakan untuk mengambil database room berdasarkan hotel dan nomor kamar * * @param hotel berisi hotel * @param nomor_kamar berisi nomor kamar * @return tes */ public static Room getRoom(Hotel hotel, String nomor_kamar){ /* for (int i = 0; i < ROOM_DATABASE.size(); i++) { Room tes = ROOM_DATABASE.get(i); if (tes.getHotel().equals(hotel) && tes.getNomorKamar().equals(nomor_kamar)){ return tes; } } return null; } */ for(Room kamar : ROOM_DATABASE) { if(kamar.getHotel().equals(hotel) && kamar.getNomorKamar().equals(nomor_kamar)) { return kamar; } } return null; } /** * digunakan untuk mendapatkan arraylist room yang berasal dari hotel * * @param hotel berisi objek Hotel * @return tempRoom */ public static ArrayList<Room> getRoomsFromHotel(Hotel hotel) { ArrayList<Room> tempRoom = new ArrayList<Room>(); for(Room kamar : ROOM_DATABASE) { if(kamar.getHotel().equals(hotel)) { tempRoom.add(kamar); } } return tempRoom; } /** * digunakan untuk mengambil arraylist dari vacant room * * @return tempRoom */ public static ArrayList<Room> getVacantRooms() { ArrayList<Room> tempRoom = new ArrayList<Room>(); for(Room kamar : ROOM_DATABASE) { if(kamar.getStatusKamar().equals(StatusKamar.VACANT)) { tempRoom.add(kamar); } } return tempRoom; } /** * digunakan unruk menghapus room dari database * * @param hotel berisi objek Hotel * @param nomor_kamar berisi nomor kamar * @return true */ public static boolean removeRoom(Hotel hotel, String nomor_kamar) throws RoomTidakDitemukanException { for(Room kamar : ROOM_DATABASE) { if(kamar.getHotel().equals(hotel) && kamar.getNomorKamar().equals(nomor_kamar)) { Administrasi.pesananDibatalkan(kamar); if(ROOM_DATABASE.remove(kamar)) { return true; } } } throw new RoomTidakDitemukanException(hotel, nomor_kamar); } }
43bbfe9c0590d60aa9e8e5db05bf9bf2f893fd8b
0e66c7d2e67777997741a13334a11620fc1e7c33
/account/src/main/java/com/sbrf/dao/api/GenericDAO.java
9cf20b673968c03defabe1f30c42c02794076dac
[]
no_license
St1904/bank
be1bcb9d57969261db1e8788b4df303844a49aef
bfe923846818aef30b1b9be80181abc68cb0c9d3
refs/heads/master
2020-06-12T21:57:56.863722
2016-12-26T01:56:48
2016-12-26T01:56:48
75,502,815
0
0
null
null
null
null
UTF-8
Java
false
false
149
java
package com.sbrf.dao.api; public interface GenericDAO<T> { long create(T t); T read(long id); void update(T t); void delete(T t); }
a2b94cd550a0cfb8033f270be666e6b723e22f6b
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/alibaba--druid/29fbe65a77b27b8cc00ee3790dcc88514b639945/before/DesensitizationTest_createTable.java
964fcd76edf1ef4747c0e544707671820defaee3
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
1,178
java
package com.alibaba.druid.bvt.sql.oracle; import com.alibaba.druid.sql.SQLUtils; import com.alibaba.druid.util.JdbcConstants; import junit.framework.TestCase; /** * Created by wenshao on 19/06/2017. */ public class DesensitizationTest_createTable extends TestCase { public void test_for_desensitization() throws Exception { String sql = "CREATE TABLE customers\n" + "( customer_id number(10) NOT NULL,\n" + " customer_name varchar2(50) NOT NULL,\n" + " city varchar2(50)\n" + ");"; SQLUtils.FormatOption option = new SQLUtils.FormatOption(); option.setDesensitize(true); option.setParameterized(true); String desens_Sql = SQLUtils.format(sql, JdbcConstants.ORACLE, option); System.out.println(sql); System.out.println("-------------------"); System.out.println(desens_Sql); assertEquals("CREATE TABLE T_69BFC132C09344DE (\n" + "\tcustomer_id number(10) NOT NULL,\n" + "\tcustomer_name varchar2(50) NOT NULL,\n" + "\tcity varchar2(50)\n" + ");", desens_Sql); } }
e2ee12596f6240786a902780433554998e4b2c5b
7744b38ac4c00bed926137a30014fd92d7fc9214
/desktop/src/main/java/com/summer/view/calendar/CalendarFraUIOpe.java
4683f103a4e221ddfc7739648038b777db98b0e6
[]
no_license
canvaser/App
173b53638231d165e98316262d654ad246cb5af6
c8956766c16677bda1ae42691d958de155a2d0e3
refs/heads/master
2021-01-22T08:47:42.713548
2017-04-19T03:59:44
2017-04-19T03:59:44
81,914,207
1
0
null
null
null
null
UTF-8
Java
false
false
1,109
java
package com.summer.view.calendar; import android.content.Context; import android.os.Bundle; import android.view.View; import com.summer.app.R; import com.summer.base.ui.ope.BaseUIOpe; import com.summer.view.calendar.interf.OnDaySelectListener; import butterknife.BindView; /** * Created by ${viwmox} on 2016-09-12. */ public class CalendarFraUIOpe extends BaseUIOpe { @BindView(R.id.calendar) CalendarMonthView calendarMonthView; OnDaySelectListener onDaySelectListener; public CalendarFraUIOpe(Context context, View convertView) { super(context, convertView); } public CalendarMonthView getCalendarMonthView() { return calendarMonthView; } public void refresh(Bundle bundle) { if (bundle == null) { return; } calendarMonthView.refreshDate(bundle.getInt("year"), bundle.getInt("month")); } public void setOnDaySelectListener(OnDaySelectListener onDaySelectListener) { this.onDaySelectListener = onDaySelectListener; calendarMonthView.setOnDaySelectListener(onDaySelectListener); } }
0b0c17d12bf0eeac77dcefb6831ca8596fdff292
45bcde459a3f0453108727a66e19e831aea17fb1
/HomeWork/src/Abstract/Abstraction3.java
968b14b658d500dcc36d1018c4381496d3783199
[]
no_license
kranthikumar07/PracticeRepo
2f0635bfe962b56e9aa0c45095e28f394eff3bac
68244353f91b65ae76c36506df2d62ec53dcc6dc
refs/heads/main
2023-05-01T22:26:13.609677
2021-05-19T20:57:15
2021-05-19T20:57:15
368,985,196
0
0
null
2021-05-19T20:57:16
2021-05-19T19:50:49
null
UTF-8
Java
false
false
142
java
package Abstract; class Abstraction3 extends Abstraction2{ public void message(){ System.out.println("Messaging works"); } }
3b58f2b15afde92b3c0f074ef07c634a5f4e4198
e0cf94903a1a11058e4252871104059e2a1c048a
/src/test/java/com/github/gobars/l2cache/core/config/CacheConfig.java
797172a00e78dc3cb608f647929b63e1e8d72b6e
[ "MIT" ]
permissive
gobars/l2cache
f16abb3fee9ac65a9634f32d8410dd2fe7c780f4
895209bbfd1b72f2547c99879328cad3d966916c
refs/heads/master
2022-12-11T07:02:25.878232
2020-09-07T06:38:40
2020-09-07T06:38:40
292,721,427
0
0
null
null
null
null
UTF-8
Java
false
false
692
java
package com.github.gobars.l2cache.core.config; import com.github.gobars.l2cache.core.manager.CacheManager; import com.github.gobars.l2cache.core.manager.L2Manager; import com.github.gobars.l2cache.core.redis.client.RedisClient; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration @Import({RedisConfig.class}) public class CacheConfig { @Bean public CacheManager l2CacheManager(RedisClient l2CacheRedisClient) { L2Manager l2Manager = new L2Manager(l2CacheRedisClient); // 开启统计功能 l2Manager.setStats(true); return l2Manager; } }
61d1e69465159233fd2557a5ff8631671f8260e6
4ffee0bf98b0a0d6c8bbbe4e90a70ce32d249b54
/rewrite-java/src/main/java/org/openrewrite/java/JavaTypeMapping.java
5701fe4e59e31874d52e38c730940c8d10cd3171
[ "Apache-2.0" ]
permissive
sullis/rewrite
79289764836094fef43928ea77f5a819a16d6cf6
f50358bd729f1a0b7a18e7aec87c6b68e3ff186e
refs/heads/main
2023-08-09T21:50:56.680155
2023-08-04T15:07:15
2023-08-04T15:07:15
410,321,671
1
0
Apache-2.0
2021-09-25T16:20:14
2021-09-25T16:20:13
null
UTF-8
Java
false
false
820
java
/* * Copyright 2021 the original author or authors. * <p> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * <p> * https://www.apache.org/licenses/LICENSE-2.0 * <p> * 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 org.openrewrite.java; import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.tree.JavaType; public interface JavaTypeMapping<T> { JavaType type(@Nullable T t); }
1caf937c06ebb61c5bcb3de9fa8328cb92231acb
5bff05e844f7c3286a84e9a8eb3f5c880ab3ab2a
/app/src/main/java/TEAM79b/m4/model/LocationContainer.java
1ffafab3750f9777109a5b5da71e838180f255b0
[]
no_license
yjeon43/M4
cff92f4c238ca04e088a9e9a57e69172dc5e223d
8dc743c46d40be45ac330d41de9c9f9ae7ff1d91
refs/heads/master
2020-04-05T12:28:21.435006
2018-11-09T06:10:02
2018-11-09T06:10:02
156,871,612
0
0
null
null
null
null
UTF-8
Java
false
false
782
java
package TEAM79b.m4.model; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class LocationContainer { private HashMap<Location, List<Item>> locationMap; private static final LocationContainer _instance = new LocationContainer(); public static LocationContainer getInstance() { return _instance; } public HashMap<Location, List<Item>> getLocationMap() { return locationMap; } private LocationContainer() { locationMap = new HashMap<>(); } public void addLocation(Location location, List<Item> data) { locationMap.put(location, data); } //the method you made for getting the map // public Map<String, List<String>> locationMap() { return locationMap; } }
4a514c8dd5dd32d5e00497218a4f3287daad1c93
cd1d792fa7caad7b14755fb53063323ee2097f59
/src/io/renren/entity/SysUserRoleEntity.java
88c258b328af0819f796716fb035898743c96dea
[]
no_license
zhouqing0428/CAHGAdmin
383fe179f11b090b066596654c41ee8271e69920
f08df7a18a65bb352396ba01e644c62c5f7de507
refs/heads/master
2020-09-09T08:21:43.783274
2019-12-19T09:31:08
2019-12-19T09:31:08
221,397,758
0
0
null
null
null
null
UTF-8
Java
false
false
973
java
package io.renren.entity; import java.io.Serializable; /** * 用户与角色对应关系 * * @author * @email * @date */ public class SysUserRoleEntity implements Serializable { private static final long serialVersionUID = 1L; private Long id; /** * 用户ID */ private Long userId; /** * 角色ID */ private Long roleId; /** * 设置: * @param id */ public void setId(Long id) { this.id = id; } /** * 获取: * @return Long */ public Long getId() { return id; } /** * 设置:用户ID * @param userId 用户ID */ public void setUserId(Long userId) { this.userId = userId; } /** * 获取:用户ID * @return Long */ public Long getUserId() { return userId; } /** * 设置:角色ID * @param roleId 角色ID */ public void setRoleId(Long roleId) { this.roleId = roleId; } /** * 获取:角色ID * @return Long */ public Long getRoleId() { return roleId; } }
3c44de8cb3feb4ac7f378c2ed8d5a85478d58f3b
1f1c5f0f2e4498f6f4ab5f4e022ce5eb58f8c1fc
/Lesson42(EqualsAndStringPool)/src/com/caseih/Test.java
e1f53bf878fce2979c6f98066a38bd0527272463
[]
no_license
SergeyOger/JavaLessons
6d2b042e264abf44adff175e1c5d556d57a6f785
07093f22906533bee92dcf50e37dba6682ce02c8
refs/heads/master
2020-05-01T23:35:41.308644
2019-04-09T18:48:11
2019-04-09T18:48:11
177,666,695
0
0
null
null
null
null
UTF-8
Java
false
false
1,930
java
package com.caseih; public class Test { public static void main(String[] args) { // == only for primitive type int x = 1; int y = 1; System.out.println(x == y); /* * при сравнивании двух структурных объектов, метод "==" не сработает, так как * он сравнивает ссылки на объекты, а не сами объекты */ // Создание объектов для сравнения их в перееопределённом методе equals Animal animal = new Animal(1); Animal animal2 = new Animal(2); System.out.println(animal.equals(animal2)); String string = "Hello"; // при таком методе создания строки, сравнение "==" сработает, string pool String string2 = "Hello"; System.out.println(string.equals(string2)); // use string pool Автоматический поиск одинаковых значений строки при её // создании System.out.println(string == string2); // stringpool не сработает в случае: String a = "hello"; String b = "hello123".substring(0, 5); System.out.println(a == b); } } class Animal { int id; public Animal(int id) { this.id = id; } @Override public boolean equals(Object obj) { /* * для сравнивания объектов, нужно переопределить метод по умолчанию в классе * Object Условие: Объекты равны, если поля id равны По умолчанию мы обязаны * принимать на вход объекты класса Object.но мы на вход принимаем объекты * класса Animal. Поэтому нужно применить Downcasting */ Animal otherAnimal = (Animal) obj; return this.id == otherAnimal.id; } }
bd07347e5ade04ea96c0e7080ef0d5a90f071d1f
801530194d9c4b5ed8446256f4d70ce8196b4860
/src/main/java/info/loenwind/mvesrf/rfhandler/RfEnergyStack.java
13da7fd2b517ba53dd58c3da65020749338abcd7
[ "CC0-1.0" ]
permissive
HenryLoenwind/mvesrf
92a4d14887c27452f99a7648f99ba2ce15abfbc5
002b2c2af778a6b4dd68684b7919829221e89403
refs/heads/master
2016-08-12T21:33:40.436144
2016-02-15T23:51:28
2016-02-15T23:51:28
51,758,703
0
0
null
null
null
null
UTF-8
Java
false
false
793
java
package info.loenwind.mvesrf.rfhandler; import info.loenwind.mves.api.IEnergyStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import cofh.api.energy.IEnergyProvider; public class RfEnergyStack<TE extends TileEntity & IEnergyProvider> implements IEnergyStack { private final TE te; private final EnumFacing facing; public RfEnergyStack(TE te, EnumFacing facing) { this.te = te; this.facing = facing; } @Override public int getStackSize() { return te.getEnergyStored(facing); } @Override public int extractEnergy(int amount) { return te.extractEnergy(facing, amount, false); } @Override public Object getSource() { return te; } @Override public boolean isStoredEnergy() { return false; } }